summaryrefslogtreecommitdiffstats
path: root/library/Director/Web/Controller/ActionController.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/Director/Web/Controller/ActionController.php')
-rw-r--r--library/Director/Web/Controller/ActionController.php26
1 files changed, 17 insertions, 9 deletions
diff --git a/library/Director/Web/Controller/ActionController.php b/library/Director/Web/Controller/ActionController.php
index 6282a16..e851d82 100644
--- a/library/Director/Web/Controller/ActionController.php
+++ b/library/Director/Web/Controller/ActionController.php
@@ -4,10 +4,14 @@ namespace Icinga\Module\Director\Web\Controller;
use gipfl\Translation\StaticTranslator;
use Icinga\Application\Benchmark;
+use Icinga\Application\Modules\Module;
use Icinga\Data\Paginatable;
use Icinga\Exception\NotFoundError;
use Icinga\Exception\ProgrammingError;
-use Icinga\Module\Director\Monitoring;
+use Icinga\Module\Director\Integration\Icingadb\IcingadbBackend;
+use Icinga\Module\Director\Integration\BackendInterface;
+use Icinga\Module\Director\Integration\MonitoringModule\Monitoring;
+use Icinga\Module\Director\ProvidedHook\Icingadb\IcingadbSupport;
use Icinga\Module\Director\Web\Controller\Extension\CoreApi;
use Icinga\Module\Director\Web\Controller\Extension\DirectorDb;
use Icinga\Module\Director\Web\Controller\Extension\RestApi;
@@ -36,8 +40,8 @@ abstract class ActionController extends Controller implements ControlsAndContent
/** @var UrlParams Hint for IDE, somehow does not work in web */
protected $params;
- /** @var Monitoring */
- private $monitoring;
+ /** @var BackendInterface */
+ private $backend;
/**
* @throws SecurityException
@@ -219,7 +223,7 @@ abstract class ActionController extends Controller implements ControlsAndContent
// Hint -> $this->view->compact is the only way since v2.8.0
if ($this->view->compact || $this->getOriginalUrl()->getParam('view') === 'compact') {
if ($this->view->controls) {
- $this->controls()->getAttributes()->add('style', 'display: none;');
+ $this->controls()->getAttributes()->add('class', 'compact');
}
}
} else {
@@ -240,14 +244,18 @@ abstract class ActionController extends Controller implements ControlsAndContent
}
/**
- * @return Monitoring
+ * @return BackendInterface
*/
- protected function monitoring()
+ protected function backend(): BackendInterface
{
- if ($this->monitoring === null) {
- $this->monitoring = new Monitoring;
+ if ($this->backend === null) {
+ if (Module::exists('icingadb') && IcingadbSupport::useIcingaDbAsBackend()) {
+ $this->backend = new IcingadbBackend();
+ } else {
+ $this->backend = new Monitoring($this->getAuth());
+ }
}
- return $this->monitoring;
+ return $this->backend;
}
}