Skip to content

Commit

Permalink
Added show on map button to service view
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolai Buchwitz committed Feb 21, 2018
1 parent 216eba4 commit 539791f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions library/Map/ProvidedHook/Monitoring/ServiceActions.php
@@ -0,0 +1,23 @@
<?php

namespace Icinga\Module\Map\ProvidedHook\Monitoring;

use Icinga\Module\Monitoring\Hook\ServiceActionsHook;
use Icinga\Module\Monitoring\Object\Service;
use Icinga\Web\Url;

class ServiceActions extends ServiceActionsHook
{
public function getActionsForService(Service $service)
{
$actions = [];

$service->fetchCustomvars();
if (array_key_exists("geolocation", $service->customvars)) {
$actions[t("Show on map")] = Url::fromPath('map/',
array('showHost' => $service->host_name . "!" . $service->getName()));
}

return $actions;
}
}
1 change: 1 addition & 0 deletions run.php
@@ -1,4 +1,5 @@
<?php

$this->provideHook('monitoring/HostActions');
$this->provideHook('monitoring/ServiceActions');
$this->provideHook('cube/Actions', 'CubeLinks');

0 comments on commit 539791f

Please sign in to comment.