Monitoring ShowController changed:

* removed tab classes, added icons
* ugly temp-fix for broken tab activation
This commit is contained in:
Thomas Gelf 2014-02-18 19:04:54 +00:00
parent dc529fb0ba
commit 158b137cdb

View File

@ -28,23 +28,23 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
use \Icinga\Module\Monitoring\Backend; use Icinga\Application\Benchmark;
use Icinga\Module\Monitoring\Controller as MonitoringController; use Icinga\Web\Hook;
use \Icinga\Web\Hook; use Icinga\Web\Widget\Tabs;
use \Icinga\Module\Monitoring\Object\Host; use Icinga\Web\Widget\Tabextension\OutputFormat;
use \Icinga\Module\Monitoring\Object\Service;
use \Icinga\Application\Benchmark;
use \Icinga\Web\Widget\Tabextension\OutputFormat;
use Icinga\Web\Widget\Tabextension\DashboardAction; use Icinga\Web\Widget\Tabextension\DashboardAction;
use Icinga\Module\Monitoring\Backend;
use Icinga\Module\Monitoring\Controller;
use Icinga\Module\Monitoring\Object\AbstractObject; use Icinga\Module\Monitoring\Object\AbstractObject;
use \Icinga\Web\Widget\Tabs; use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;
/** /**
* Class Monitoring_ShowController * Class Monitoring_ShowController
* *
* Actions for show context * Actions for show context
*/ */
class Monitoring_ShowController extends MonitoringController class Monitoring_ShowController extends Controller
{ {
/** /**
* @var Backend * @var Backend
@ -62,6 +62,7 @@ class Monitoring_ShowController extends MonitoringController
|| $this->getRequest()->getActionName() === 'services' ) { || $this->getRequest()->getActionName() === 'services' ) {
$this->view->object = new Service($this->getRequest()); $this->view->object = new Service($this->getRequest());
} else { } else {
// TODO: Well... this could be done better
$this->view->object = AbstractObject::fromRequest($this->getRequest()); $this->view->object = AbstractObject::fromRequest($this->getRequest());
} }
@ -73,6 +74,7 @@ class Monitoring_ShowController extends MonitoringController
*/ */
public function serviceAction() public function serviceAction()
{ {
$this->getTabs()->activate('service');
$this->view->object->populate(); $this->view->object->populate();
} }
@ -81,15 +83,16 @@ class Monitoring_ShowController extends MonitoringController
*/ */
public function hostAction() public function hostAction()
{ {
$this->getTabs()->activate('host');
$this->view->object->populate(); $this->view->object->populate();
} }
public function historyAction() public function historyAction()
{ {
$this->getTabs()->activate('history');
$this->view->object->populate(); $this->view->object->populate();
$this->view->object->fetchEventHistory(); $this->view->object->fetchEventHistory();
$this->view->history = $this->view->object->eventhistory->limit(10)->paginate(); $this->view->history = $this->view->object->eventhistory->limit(10)->paginate();
} }
public function servicesAction() public function servicesAction()
@ -153,12 +156,9 @@ class Monitoring_ShowController extends MonitoringController
'service', 'service',
array( array(
'title' => 'Service', 'title' => 'Service',
'iconCls' => 'icinga-icon-service', 'icon' => 'img/icons/service.png',
'url' => 'monitoring/show/service', 'url' => 'monitoring/show/service',
'urlParams' => $params, 'urlParams' => $params,
'tagParams' => array(
'data-icinga-target' => 'detail'
)
) )
); );
} }
@ -166,36 +166,27 @@ class Monitoring_ShowController extends MonitoringController
'host', 'host',
array( array(
'title' => 'Host', 'title' => 'Host',
'iconCls' => 'icinga-icon-host', 'icon' => 'img/icons/host.png',
'url' => 'monitoring/show/host', 'url' => 'monitoring/show/host',
'urlParams' => $params, 'urlParams' => $params,
'tagParams' => array(
'data-icinga-target' => 'detail'
)
) )
); );
$tabs->add( $tabs->add(
'services', 'services',
array( array(
'title' => 'Services', 'title' => 'Services',
'iconCls' => 'icinga-icon-service', 'icon' => 'img/icons/service.png',
'url' => 'monitoring/show/services', 'url' => 'monitoring/show/services',
'urlParams' => $params, 'urlParams' => $params,
'tagParams' => array(
'data-icinga-target' => 'detail'
)
) )
); );
$tabs->add( $tabs->add(
'history', 'history',
array( array(
'title' => 'History', 'title' => 'History',
'iconCls' => 'icinga-icon-history', 'icon' => 'img/icons/history.png',
'url' => 'monitoring/show/history', 'url' => 'monitoring/show/history',
'urlParams' => $params, 'urlParams' => $params,
'tagParams' => array(
'data-icinga-target' => 'detail'
)
) )
); );
$tabs->extend(new OutputFormat()) $tabs->extend(new OutputFormat())