Assemble object details in concrete classes for hosts/services

This commit is contained in:
Johannes Meyer 2020-02-06 15:23:45 +01:00
parent 81a9fd490e
commit e32323e1d1
5 changed files with 52 additions and 26 deletions

View file

@ -10,7 +10,7 @@ use Icinga\Module\Icingadb\Model\History;
use Icinga\Module\Icingadb\Model\Host;
use Icinga\Module\Icingadb\Model\Service;
use Icinga\Module\Icingadb\Web\Controller;
use Icinga\Module\Icingadb\Widget\Detail\ObjectDetail;
use Icinga\Module\Icingadb\Widget\Detail\HostDetail;
use Icinga\Module\Icingadb\Widget\Detail\QuickActions;
use Icinga\Module\Icingadb\Widget\DowntimeList;
use Icinga\Module\Icingadb\Widget\HostList;
@ -18,7 +18,6 @@ use Icinga\Module\Icingadb\Widget\ItemList\CommentList;
use Icinga\Module\Icingadb\Widget\ItemList\HistoryList;
use Icinga\Module\Icingadb\Widget\ServiceList;
use Icinga\Module\Icingadb\Widget\ShowMore;
use ipl\Web\Url;
class HostController extends Controller
{
@ -57,7 +56,7 @@ class HostController extends Controller
$this->addControl((new HostList([$this->host]))->setViewMode('minimal'));
$this->addControl(new QuickActions($this->host));
$this->addContent(new ObjectDetail($this->host));
$this->addContent(new HostDetail($this->host));
$this->setAutorefreshInterval(10);
}

View file

@ -9,15 +9,14 @@ use Icinga\Module\Icingadb\Common\ServiceLinks;
use Icinga\Module\Icingadb\Model\History;
use Icinga\Module\Icingadb\Model\Service;
use Icinga\Module\Icingadb\Web\Controller;
use Icinga\Module\Icingadb\Widget\Detail\ObjectDetail;
use Icinga\Module\Icingadb\Widget\Detail\QuickActions;
use Icinga\Module\Icingadb\Widget\Detail\ServiceDetail;
use Icinga\Module\Icingadb\Widget\DowntimeList;
use Icinga\Module\Icingadb\Widget\ItemList\CommentList;
use Icinga\Module\Icingadb\Widget\ItemList\HistoryList;
use Icinga\Module\Icingadb\Widget\ServiceList;
use Icinga\Module\Icingadb\Widget\ShowMore;
use ipl\Sql\Sql;
use ipl\Web\Url;
class ServiceController extends Controller
{
@ -61,7 +60,7 @@ class ServiceController extends Controller
$this->addControl((new ServiceList([$this->service]))->setViewMode('minimal'));
$this->addControl(new QuickActions($this->service));
$this->addContent(new ObjectDetail($this->service));
$this->addContent(new ServiceDetail($this->service));
$this->setAutorefreshInterval(10);
}

View file

@ -0,0 +1,24 @@
<?php
namespace Icinga\Module\Icingadb\Widget\Detail;
class HostDetail extends ObjectDetail
{
protected function assemble()
{
$this->add([
$this->createPluginOutput(),
$this->createEvents(),
$this->createActions(),
$this->createNotes(),
$this->createGroups(),
$this->createComments(),
$this->createDowntimes(),
$this->createNotifications(),
$this->createCheckStatistics(),
$this->createPerformanceData(),
$this->createCustomVars(),
$this->createFeatureToggles()
]);
}
}

View file

@ -6,11 +6,9 @@ use Icinga\Application\Config;
use Icinga\Application\Icinga;
use Icinga\Module\Icingadb\Common\Auth;
use Icinga\Module\Icingadb\Common\HostLinks;
use Icinga\Module\Icingadb\Common\HostStates;
use Icinga\Module\Icingadb\Common\Icons;
use Icinga\Module\Icingadb\Common\Links;
use Icinga\Module\Icingadb\Common\ServiceLinks;
use Icinga\Module\Icingadb\Common\ServiceStates;
use Icinga\Module\Icingadb\Compat\CompatBackend;
use Icinga\Module\Icingadb\Compat\CompatHost;
use Icinga\Module\Icingadb\Compat\CompatObject;
@ -357,22 +355,4 @@ class ObjectDetail extends BaseHtmlElement
return [$users, $usergroups];
}
protected function assemble()
{
$this->add([
$this->createPluginOutput(),
$this->createEvents(),
$this->createActions(),
$this->createNotes(),
$this->createGroups(),
$this->createComments(),
$this->createDowntimes(),
$this->createNotifications(),
$this->createCheckStatistics(),
$this->createPerformanceData(),
$this->createCustomVars(),
$this->createFeatureToggles()
]);
}
}

View file

@ -0,0 +1,24 @@
<?php
namespace Icinga\Module\Icingadb\Widget\Detail;
class ServiceDetail extends ObjectDetail
{
protected function assemble()
{
$this->add([
$this->createPluginOutput(),
$this->createEvents(),
$this->createActions(),
$this->createNotes(),
$this->createGroups(),
$this->createComments(),
$this->createDowntimes(),
$this->createNotifications(),
$this->createCheckStatistics(),
$this->createPerformanceData(),
$this->createCustomVars(),
$this->createFeatureToggles()
]);
}
}