diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:42:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:42:52 +0000 |
commit | da0f8427204ad57aad08059906df0ea10a7ccf31 (patch) | |
tree | ccda92692e296a50dac104945f62b4402d5e4447 /library/Cube/ProvidedHook/Cube/IcingaDbActions.php | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-cube-da0f8427204ad57aad08059906df0ea10a7ccf31.tar.xz icingaweb2-module-cube-da0f8427204ad57aad08059906df0ea10a7ccf31.zip |
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Cube/ProvidedHook/Cube/IcingaDbActions.php')
-rw-r--r-- | library/Cube/ProvidedHook/Cube/IcingaDbActions.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/library/Cube/ProvidedHook/Cube/IcingaDbActions.php b/library/Cube/ProvidedHook/Cube/IcingaDbActions.php new file mode 100644 index 0000000..c670ab4 --- /dev/null +++ b/library/Cube/ProvidedHook/Cube/IcingaDbActions.php @@ -0,0 +1,41 @@ +<?php + +namespace Icinga\Module\Cube\ProvidedHook\Cube; + +use Icinga\Module\Cube\Hook\IcingaDbActionsHook; +use Icinga\Module\Cube\IcingaDb\IcingaDbCube; +use Icinga\Module\Cube\Icingadb\IcingadbServiceStatusCube; + +class IcingaDbActions extends IcingaDbActionsHook +{ + public function createActionLinks(IcingaDbCube $cube) + { + $type = 'host'; + if ($cube instanceof IcingadbServiceStatusCube) { + $type = 'service'; + } + + $url = 'icingadb/' . $type . 's'; + + $paramsWithPrefix = []; + foreach ($cube->getSlices() as $dimension => $slice) { + $paramsWithPrefix[$type . '.vars.' . $dimension] = $slice; + } + + if ($type === 'host') { + $this->addActionLink( + $this->makeUrl($url, $paramsWithPrefix), + t('Show hosts status'), + t('This shows all matching hosts and their current state in Icinga DB Web'), + 'server' + ); + } else { + $this->addActionLink( + $this->makeUrl($url, $paramsWithPrefix), + t('Show services status'), + t('This shows all matching hosts and their current state in Icinga DB Web'), + 'cog' + ); + } + } +} |