Skip to content

Commit

Permalink
Improve multi-view tabs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
majentsch committed May 18, 2015
1 parent 342a8a3 commit c312989
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 33 deletions.
19 changes: 3 additions & 16 deletions modules/monitoring/application/controllers/HostsController.php
Expand Up @@ -15,7 +15,6 @@
use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandForm;
use Icinga\Module\Monitoring\Object\HostList;
use Icinga\Web\Url;
use Icinga\Web\Widget\Chart\InlinePie;
use Icinga\Web\Widget\Tabextension\DashboardAction;

class Monitoring_HostsController extends Controller
Expand All @@ -42,24 +41,12 @@ public function init()
$this->translate('Show summarized information for %u hosts'),
count($this->hostList)
),
'label' => $this->translate('Hosts'),
'label' => sprintf($this->translate('Hosts (%d)'), count($this->hostList)),
'url' => Url::fromRequest(),
'icon' => 'host'
)
)->extend(new DashboardAction());

$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');

)->extend(new DashboardAction())->activate('show');

$this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/hosts')->setQueryString($filterString);
}

Expand Down
19 changes: 3 additions & 16 deletions modules/monitoring/application/controllers/ServicesController.php
Expand Up @@ -15,7 +15,6 @@
use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandForm;
use Icinga\Module\Monitoring\Object\ServiceList;
use Icinga\Web\Url;
use Icinga\Web\Widget\Chart\InlinePie;
use Icinga\Web\Widget\Tabextension\DashboardAction;

class Monitoring_ServicesController extends Controller
Expand All @@ -34,30 +33,18 @@ public function init()
$this->serviceList = $serviceList;
$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(
'show',
array(
'title' => sprintf(
$this->translate('Show summarized information for %u services'),
count($this->serviceList)
),
'label' => $this->translate('Services'),
'label' => sprintf($this->translate('Services (%d)'), count($this->serviceList)),
'url' => Url::fromRequest(),
'icon' => 'services'
'icon' => 'services'
)
)->activate('show');
)->extend(new DashboardAction())->activate('show');
}

protected function handleCommandForm(ObjectsCommandForm $form)
Expand Down
2 changes: 1 addition & 1 deletion modules/monitoring/library/Monitoring/Object/HostList.php
Expand Up @@ -76,7 +76,7 @@ public static function getHostStatesSummaryEmpty()
/**
* Returns a Filter that matches all hosts in this list
*
* @return array An
* @return Filter
*/
public function objectsFilter($columns = array('host' => 'host'))
{
Expand Down

0 comments on commit c312989

Please sign in to comment.