diff --git a/application/controllers/HostsController.php b/application/controllers/HostsController.php index 67781557..af6aaf9c 100644 --- a/application/controllers/HostsController.php +++ b/application/controllers/HostsController.php @@ -164,7 +164,7 @@ class HostsController extends Controller ); $this->addContent( - (new ObjectsDetail('host', $summary)) + (new ObjectsDetail('host', $summary, $hosts)) ->setBaseFilter($this->getFilter()) ); } diff --git a/application/controllers/ServicesController.php b/application/controllers/ServicesController.php index eb3a1b97..02a2b53c 100644 --- a/application/controllers/ServicesController.php +++ b/application/controllers/ServicesController.php @@ -175,7 +175,7 @@ class ServicesController extends Controller ); $this->addContent( - (new ObjectsDetail('service', $summary)) + (new ObjectsDetail('service', $summary, $services)) ->setBaseFilter($this->getFilter()) ); } diff --git a/library/Icingadb/Widget/Detail/ObjectsDetail.php b/library/Icingadb/Widget/Detail/ObjectsDetail.php index 968f157f..6edb51d5 100644 --- a/library/Icingadb/Widget/Detail/ObjectsDetail.php +++ b/library/Icingadb/Widget/Detail/ObjectsDetail.php @@ -8,6 +8,7 @@ use Icinga\Chart\Donut; use Icinga\Module\Icingadb\Common\BaseFilter; use Icinga\Module\Icingadb\Common\Links; use Icinga\Module\Icingadb\Forms\Command\Object\ToggleObjectFeaturesForm; +use Icinga\Module\Icingadb\Hook\ExtensionHook\ObjectsDetailExtensionHook; use Icinga\Module\Icingadb\Util\FeatureStatus; use Icinga\Module\Icingadb\Widget\EmptyState; use Icinga\Module\Icingadb\Widget\HostStateBadges; @@ -25,15 +26,18 @@ class ObjectsDetail extends BaseHtmlElement protected $summary; + protected $query; + protected $type; protected $defaultAttributes = ['class' => 'objects-detail']; protected $tag = 'div'; - public function __construct($type, $summary) + public function __construct($type, $summary, $query) { $this->summary = $summary; + $this->query = $query; $this->type = $type; } @@ -148,6 +152,15 @@ class ObjectsDetail extends BaseHtmlElement ]; } + protected function createExtensions() + { + return ObjectsDetailExtensionHook::loadExtensions( + $this->type, + $this->query, + $this->getBaseFilter() + ); + } + protected function createSummary() { return [ @@ -158,11 +171,11 @@ class ObjectsDetail extends BaseHtmlElement protected function assemble() { - $this->add([ - $this->createSummary(), - $this->createComments(), - $this->createDowntimes(), - $this->createFeatureToggles() - ]); + $this->add(ObjectsDetailExtensionHook::injectExtensions([ + 190 => $this->createSummary(), + 400 => $this->createComments(), + 401 => $this->createDowntimes(), + 701 => $this->createFeatureToggles() + ], $this->createExtensions())); } }