diff options
Diffstat (limited to 'application/controllers')
-rw-r--r-- | application/controllers/HostsController.php | 30 | ||||
-rw-r--r-- | application/controllers/IndexController.php | 15 | ||||
-rw-r--r-- | application/controllers/ServicesController.php | 30 |
3 files changed, 75 insertions, 0 deletions
diff --git a/application/controllers/HostsController.php b/application/controllers/HostsController.php new file mode 100644 index 0000000..c3e5374 --- /dev/null +++ b/application/controllers/HostsController.php @@ -0,0 +1,30 @@ +<?php + +// Icinga Web 2 Cube Module | (c) 2019 Icinga GmbH | GPLv2 + +namespace Icinga\Module\Cube\Controllers; + +use Icinga\Application\Modules\Module; +use Icinga\Module\Cube\IcingaDb\IcingaDbHostStatusCube; +use Icinga\Module\Cube\Ido\IdoHostStatusCube; +use Icinga\Module\Cube\ProvidedHook\Icingadb\IcingadbSupport; +use Icinga\Module\Cube\Web\IdoController; + +class HostsController extends IdoController +{ + public function indexAction() + { + $this->createTabs()->activate('cube/hosts'); + + $this->renderCube(); + } + + protected function getCube() + { + if (Module::exists('icingadb') && IcingadbSupport::useIcingaDbAsBackend()) { + return new IcingaDbHostStatusCube(); + } + + return new IdoHostStatusCube(); + } +} diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php new file mode 100644 index 0000000..082fda3 --- /dev/null +++ b/application/controllers/IndexController.php @@ -0,0 +1,15 @@ +<?php + +// Icinga Web 2 Cube Module | (c) 2016 Icinga GmbH | GPLv2 + +namespace Icinga\Module\Cube\Controllers; + +use Icinga\Web\Controller; + +class IndexController extends Controller +{ + public function indexAction() + { + $this->redirectNow('cube/hosts' . ($this->params->toString() === '' ? '' : '?' . $this->params->toString())); + } +} diff --git a/application/controllers/ServicesController.php b/application/controllers/ServicesController.php new file mode 100644 index 0000000..ec08bbb --- /dev/null +++ b/application/controllers/ServicesController.php @@ -0,0 +1,30 @@ +<?php + +// Icinga Web 2 Cube Module | (c) 2019 Icinga GmbH | GPLv2 + +namespace Icinga\Module\Cube\Controllers; + +use Icinga\Application\Modules\Module; +use Icinga\Module\Cube\IcingaDb\IcingaDbServiceStatusCube; +use Icinga\Module\Cube\Ido\IdoServiceStatusCube; +use Icinga\Module\Cube\ProvidedHook\Icingadb\IcingadbSupport; +use Icinga\Module\Cube\Web\IdoController; + +class ServicesController extends IdoController +{ + public function indexAction() + { + $this->createTabs()->activate('cube/services'); + + $this->renderCube(); + } + + protected function getCube() + { + if (Module::exists('icingadb') && IcingadbSupport::useIcingaDbAsBackend()) { + return new IcingaDbServiceStatusCube(); + } + + return new IdoServiceStatusCube(); + } +} |