mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-06-09 00:32:05 -04:00
Allow to show technical host details
This commit is contained in:
parent
c37fdffaba
commit
f24ebd50da
3 changed files with 38 additions and 4 deletions
|
|
@ -5,6 +5,8 @@
|
|||
namespace Icinga\Module\Icingadb\Controllers;
|
||||
|
||||
use Icinga\Exception\NotFoundError;
|
||||
use Icinga\Module\Icingadb\Command\Object\GetObjectCommand;
|
||||
use Icinga\Module\Icingadb\Command\Transport\CommandTransport;
|
||||
use Icinga\Module\Icingadb\Common\CommandActions;
|
||||
use Icinga\Module\Icingadb\Common\HostLinks;
|
||||
use Icinga\Module\Icingadb\Common\Links;
|
||||
|
|
@ -14,6 +16,7 @@ use Icinga\Module\Icingadb\Model\Service;
|
|||
use Icinga\Module\Icingadb\Model\ServicestateSummary;
|
||||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\Detail\HostDetail;
|
||||
use Icinga\Module\Icingadb\Widget\Detail\HostInspectionDetail;
|
||||
use Icinga\Module\Icingadb\Widget\Detail\QuickActions;
|
||||
use Icinga\Module\Icingadb\Widget\DowntimeList;
|
||||
use Icinga\Module\Icingadb\Widget\HostList;
|
||||
|
|
@ -73,6 +76,24 @@ class HostController extends Controller
|
|||
$this->setAutorefreshInterval(10);
|
||||
}
|
||||
|
||||
public function sourceAction()
|
||||
{
|
||||
$this->assertPermission('icingadb/object/show-source');
|
||||
$apiResult = (new CommandTransport())->send((new GetObjectCommand())->setObject($this->host));
|
||||
|
||||
if ($this->host->state->is_overdue) {
|
||||
$this->controls->addAttributes(['class' => 'overdue']);
|
||||
}
|
||||
|
||||
$this->addControl((new HostList([$this->host]))
|
||||
->setDetailActionsDisabled()
|
||||
->setNoSubjectLink());
|
||||
$this->addContent(new HostInspectionDetail(
|
||||
$this->host,
|
||||
reset($apiResult)
|
||||
));
|
||||
}
|
||||
|
||||
public function commentsAction()
|
||||
{
|
||||
$this->setTitle(t('Comments'));
|
||||
|
|
@ -231,8 +252,7 @@ class HostController extends Controller
|
|||
|
||||
protected function createTabs()
|
||||
{
|
||||
return $this
|
||||
->getTabs()
|
||||
$tabs = $this->getTabs()
|
||||
->add('index', [
|
||||
'label' => t('Host'),
|
||||
'url' => Links::host($this->host)
|
||||
|
|
@ -245,6 +265,15 @@ class HostController extends Controller
|
|||
'label' => t('History'),
|
||||
'url' => HostLinks::history($this->host)
|
||||
]);
|
||||
|
||||
if ($this->hasPermission('icingadb/object/show-source')) {
|
||||
$tabs->add('source', [
|
||||
'label' => t('Source'),
|
||||
'url' => Links::hostSource($this->host)
|
||||
]);
|
||||
}
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
protected function setTitleTab($name)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ namespace Icinga\Module\Icingadb\Common;
|
|||
use Icinga\Module\Icingadb\Model\Comment;
|
||||
use Icinga\Module\Icingadb\Model\Downtime;
|
||||
use Icinga\Module\Icingadb\Model\Host;
|
||||
use Icinga\Module\Icingadb\Model\Hostgroup;
|
||||
use Icinga\Module\Icingadb\Model\Service;
|
||||
use Icinga\Module\Icingadb\Model\Servicegroup;
|
||||
use Icinga\Module\Icingadb\Model\User;
|
||||
|
|
@ -61,6 +60,11 @@ abstract class Links
|
|||
return Url::fromPath('icingadb/host', ['name' => $host->name]);
|
||||
}
|
||||
|
||||
public static function hostSource(Host $host)
|
||||
{
|
||||
return Url::fromPath('icingadb/host/source', ['name' => $host->name]);
|
||||
}
|
||||
|
||||
public static function hostsDetails()
|
||||
{
|
||||
return Url::fromPath('icingadb/hosts/details');
|
||||
|
|
|
|||
|
|
@ -167,7 +167,8 @@ div.show-more {
|
|||
.content > h2:first-child,
|
||||
.host-detail > h2:first-child,
|
||||
.comment-detail > h2:first-child,
|
||||
.downtime-detail > h2:first-child {
|
||||
.downtime-detail > h2:first-child,
|
||||
.inspection-detail > h2:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue