diff options
Diffstat (limited to '')
-rw-r--r-- | application/controllers/HostsController.php | 45 | ||||
-rw-r--r-- | application/controllers/IdoHostsController.php | 24 | ||||
-rw-r--r-- | application/controllers/IdoServicesController.php | 24 | ||||
-rw-r--r-- | application/controllers/IndexController.php | 15 | ||||
-rw-r--r-- | application/controllers/ServicesController.php | 45 |
5 files changed, 153 insertions, 0 deletions
diff --git a/application/controllers/HostsController.php b/application/controllers/HostsController.php new file mode 100644 index 0000000..c41d846 --- /dev/null +++ b/application/controllers/HostsController.php @@ -0,0 +1,45 @@ +<?php + +// Icinga Web 2 Cube Module | (c) 2019 Icinga GmbH | GPLv2 + +namespace Icinga\Module\Cube\Controllers; + +use Icinga\Module\Cube\IcingaDb\IcingaDbCube; +use Icinga\Module\Cube\IcingaDb\IcingaDbHostStatusCube; +use Icinga\Module\Cube\Web\Controller; +use Icinga\Module\Icingadb\Model\Host; +use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions; + +class HostsController extends Controller +{ + public function indexAction(): void + { + $this->createTabs()->activate('cube/hosts'); + + $this->renderCube(); + } + + protected function getCube(): IcingaDbCube + { + return new IcingaDbHostStatusCube(); + } + + public function completeAction(): void + { + $suggestions = new ObjectSuggestions(); + $suggestions->setModel(Host::class); + $suggestions->forRequest($this->getServerRequest()); + $this->getDocument()->add($suggestions); + } + + public function searchEditorAction(): void + { + $editor = $this->createSearchEditor( + Host::on($this->getDb()), + $this->preserveParams + ); + + $this->getDocument()->add($editor); + $this->setTitle($this->translate('Adjust Filter')); + } +} diff --git a/application/controllers/IdoHostsController.php b/application/controllers/IdoHostsController.php new file mode 100644 index 0000000..8648823 --- /dev/null +++ b/application/controllers/IdoHostsController.php @@ -0,0 +1,24 @@ +<?php + +// Icinga Cube Module | (c) 2022 Icinga GmbH | GPLv2 + +namespace Icinga\Module\Cube\Controllers; + +use Icinga\Module\Cube\Ido\IdoCube; +use Icinga\Module\Cube\Ido\IdoHostStatusCube; +use Icinga\Module\Cube\Web\IdoController; + +class IdoHostsController extends IdoController +{ + public function indexAction(): void + { + $this->createTabs()->activate('cube/hosts'); + + $this->renderCube(); + } + + protected function getCube(): IdoCube + { + return new IdoHostStatusCube(); + } +} diff --git a/application/controllers/IdoServicesController.php b/application/controllers/IdoServicesController.php new file mode 100644 index 0000000..f55e1d7 --- /dev/null +++ b/application/controllers/IdoServicesController.php @@ -0,0 +1,24 @@ +<?php + +// Icinga Cube Module | (c) 2022 Icinga GmbH | GPLv2 + +namespace Icinga\Module\Cube\Controllers; + +use Icinga\Module\Cube\Ido\IdoCube; +use Icinga\Module\Cube\Ido\IdoServiceStatusCube; +use Icinga\Module\Cube\Web\IdoController; + +class IdoServicesController extends IdoController +{ + public function indexAction(): void + { + $this->createTabs()->activate('cube/services'); + + $this->renderCube(); + } + + protected function getCube(): IdoCube + { + return new IdoServiceStatusCube(); + } +} 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..0914aa2 --- /dev/null +++ b/application/controllers/ServicesController.php @@ -0,0 +1,45 @@ +<?php + +// Icinga Web 2 Cube Module | (c) 2019 Icinga GmbH | GPLv2 + +namespace Icinga\Module\Cube\Controllers; + +use Icinga\Module\Cube\IcingaDb\IcingaDbCube; +use Icinga\Module\Cube\IcingaDb\IcingaDbServiceStatusCube; +use Icinga\Module\Cube\Web\Controller; +use Icinga\Module\Icingadb\Model\Service; +use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions; + +class ServicesController extends Controller +{ + public function indexAction(): void + { + $this->createTabs()->activate('cube/services'); + + $this->renderCube(); + } + + protected function getCube(): IcingaDbCube + { + return new IcingaDbServiceStatusCube(); + } + + public function completeAction(): void + { + $suggestions = new ObjectSuggestions(); + $suggestions->setModel(Service::class); + $suggestions->forRequest($this->getServerRequest()); + $this->getDocument()->add($suggestions); + } + + public function searchEditorAction(): void + { + $editor = $this->createSearchEditor( + Service::on($this->getDb()), + $this->preserveParams + ); + + $this->getDocument()->add($editor); + $this->setTitle($this->translate('Adjust Filter')); + } +} |