summaryrefslogtreecommitdiffstats
path: root/library/Map/ProvidedHook/Monitoring/HostActions.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:45:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:45:13 +0000
commita4a4a84d79e95d34f80346c423b4e84f7af3f03d (patch)
tree91608c01e82676102457ffff2219f321ec474657 /library/Map/ProvidedHook/Monitoring/HostActions.php
parentInitial commit. (diff)
downloadicingaweb2-module-map-upstream/1.1.0.tar.xz
icingaweb2-module-map-upstream/1.1.0.zip
Adding upstream version 1.1.0.upstream/1.1.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Map/ProvidedHook/Monitoring/HostActions.php')
-rw-r--r--library/Map/ProvidedHook/Monitoring/HostActions.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/library/Map/ProvidedHook/Monitoring/HostActions.php b/library/Map/ProvidedHook/Monitoring/HostActions.php
new file mode 100644
index 0000000..d64f743
--- /dev/null
+++ b/library/Map/ProvidedHook/Monitoring/HostActions.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Icinga\Module\Map\ProvidedHook\Monitoring;
+
+use Icinga\Module\Monitoring\DataView\Customvar;
+use Icinga\Web\Controller\ModuleActionController;
+use Icinga\Module\Monitoring\Hook\HostActionsHook;
+use Icinga\Module\Monitoring\Object\Host;
+use Icinga\Web\Navigation\Navigation;
+use Icinga\Web\Navigation\NavigationItem;
+use Icinga\Web\Url;
+
+class HostActions extends HostActionsHook
+{
+ public function getActionsForHost(Host $host)
+ {
+ $nav = new Navigation();
+
+ $host->fetchCustomvars();
+ if (array_key_exists("geolocation", $host->customvars)) {
+ $nav->addItem(new NavigationItem(t('Show on map'), array(
+ 'url' => Url::fromPath('map/', array('showHost' => $host->getName())),
+ 'target' => '_next',
+ 'icon' => 'globe',
+ )));
+ }
+
+ return $nav;
+ }
+}