ServiceActions: Show inspect link on all services
Not only services of hosts managed by Director. This aligns behavior with HostActions itself.
This commit is contained in:
parent
41e379b008
commit
63a98c05a9
|
@ -5,7 +5,6 @@ namespace Icinga\Module\Director\ProvidedHook\Monitoring;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Icinga\Application\Config;
|
use Icinga\Application\Config;
|
||||||
use Icinga\Module\Director\Db;
|
use Icinga\Module\Director\Db;
|
||||||
use Icinga\Module\Director\Objects\IcingaHost;
|
|
||||||
use Icinga\Module\Director\Util;
|
use Icinga\Module\Director\Util;
|
||||||
use Icinga\Module\Monitoring\Hook\ServiceActionsHook;
|
use Icinga\Module\Monitoring\Hook\ServiceActionsHook;
|
||||||
use Icinga\Module\Monitoring\Object\Service;
|
use Icinga\Module\Monitoring\Object\Service;
|
||||||
|
@ -24,33 +23,28 @@ class ServiceActions extends ServiceActionsHook
|
||||||
|
|
||||||
protected function getThem(Service $service)
|
protected function getThem(Service $service)
|
||||||
{
|
{
|
||||||
if (! Util::hasPermission('director/inspect')) {
|
$actions = array();
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
$db = $this->db();
|
$db = $this->db();
|
||||||
if (! $db) {
|
if (! $db) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IcingaHost::exists($service->host_name, $db)) {
|
if (Util::hasPermission('director/inspect')) {
|
||||||
return array(
|
$actions['Inspect'] = Url::fromPath(
|
||||||
'Inspect' => Url::fromPath(
|
'director/inspect/object',
|
||||||
'director/inspect/object',
|
array(
|
||||||
array(
|
'type' => 'service',
|
||||||
'type' => 'service',
|
'plural' => 'services',
|
||||||
'plural' => 'services',
|
'name' => sprintf(
|
||||||
'name' => sprintf(
|
'%s!%s',
|
||||||
'%s!%s',
|
$service->host_name,
|
||||||
$service->host_name,
|
$service->service_description
|
||||||
$service->service_description
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
return array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function db()
|
protected function db()
|
||||||
|
|
Loading…
Reference in New Issue