Improve multi-view tabs

Display the current object count next to the tab title, to clarify that those views display a summary of multiple items. Only display the current tab for hosts or services, to avoid confusion.

refs #8565
This commit is contained in:
Matthias Jentsch 2015-05-18 15:22:10 +02:00
parent 342a8a39d1
commit c3129890aa
3 changed files with 7 additions and 33 deletions

View File

@ -15,7 +15,6 @@ use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm;
use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandForm;
use Icinga\Module\Monitoring\Object\HostList; use Icinga\Module\Monitoring\Object\HostList;
use Icinga\Web\Url; use Icinga\Web\Url;
use Icinga\Web\Widget\Chart\InlinePie;
use Icinga\Web\Widget\Tabextension\DashboardAction; use Icinga\Web\Widget\Tabextension\DashboardAction;
class Monitoring_HostsController extends Controller class Monitoring_HostsController extends Controller
@ -42,24 +41,12 @@ class Monitoring_HostsController extends Controller
$this->translate('Show summarized information for %u hosts'), $this->translate('Show summarized information for %u hosts'),
count($this->hostList) count($this->hostList)
), ),
'label' => $this->translate('Hosts'), 'label' => sprintf($this->translate('Hosts (%d)'), count($this->hostList)),
'url' => Url::fromRequest(), 'url' => Url::fromRequest(),
'icon' => 'host' 'icon' => 'host'
) )
)->extend(new DashboardAction()); )->extend(new DashboardAction())->activate('show');
$this->getTabs()->add(
'services',
array(
'title' => sprintf(
$this->translate('Show summarized information for related services')
),
'label' => $this->translate('Services'),
'url' => Url::fromPath('monitoring/services/show')->setParams(Url::fromRequest()->getParams()),
'icon' => 'services'
)
)->activate('show');
$this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/hosts')->setQueryString($filterString); $this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/hosts')->setQueryString($filterString);
} }

View File

@ -15,7 +15,6 @@ use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandForm;
use Icinga\Module\Monitoring\Object\ServiceList; use Icinga\Module\Monitoring\Object\ServiceList;
use Icinga\Web\Url; use Icinga\Web\Url;
use Icinga\Web\Widget\Chart\InlinePie;
use Icinga\Web\Widget\Tabextension\DashboardAction; use Icinga\Web\Widget\Tabextension\DashboardAction;
class Monitoring_ServicesController extends Controller class Monitoring_ServicesController extends Controller
@ -34,18 +33,6 @@ class Monitoring_ServicesController extends Controller
$this->serviceList = $serviceList; $this->serviceList = $serviceList;
$this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/services'); $this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/services');
$this->getTabs()->add(
'hosts',
array(
'title' => sprintf(
$this->translate('Show summarized information for hosts')
),
'label' => $this->translate('Hosts'),
'url' => Url::fromPath('monitoring/hosts/show')->setParams(Url::fromRequest()->getParams()),
'icon' => 'host'
)
)->extend(new DashboardAction());
$this->getTabs()->add( $this->getTabs()->add(
'show', 'show',
array( array(
@ -53,11 +40,11 @@ class Monitoring_ServicesController extends Controller
$this->translate('Show summarized information for %u services'), $this->translate('Show summarized information for %u services'),
count($this->serviceList) count($this->serviceList)
), ),
'label' => $this->translate('Services'), 'label' => sprintf($this->translate('Services (%d)'), count($this->serviceList)),
'url' => Url::fromRequest(), 'url' => Url::fromRequest(),
'icon' => 'services' 'icon' => 'services'
) )
)->activate('show'); )->extend(new DashboardAction())->activate('show');
} }
protected function handleCommandForm(ObjectsCommandForm $form) protected function handleCommandForm(ObjectsCommandForm $form)

View File

@ -76,7 +76,7 @@ class HostList extends ObjectList
/** /**
* Returns a Filter that matches all hosts in this list * Returns a Filter that matches all hosts in this list
* *
* @return array An * @return Filter
*/ */
public function objectsFilter($columns = array('host' => 'host')) public function objectsFilter($columns = array('host' => 'host'))
{ {