Skip to content

Commit

Permalink
monitoring/lib: Change StateBadges::add() signature
Browse files Browse the repository at this point in the history
refs #5543
  • Loading branch information
lippserd committed Sep 27, 2015
1 parent 63e0549 commit 705432b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
30 changes: 15 additions & 15 deletions modules/monitoring/application/views/scripts/list/hostgroups.phtml
@@ -1,6 +1,6 @@
<?php
use Icinga\Module\Monitoring\Web\Widget\StateBadges;

/** @var \Icinga\Module\Monitoring\DataView\Hostgroup $hostgroups */
if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
Expand Down Expand Up @@ -58,78 +58,78 @@ if (! $this->compact): ?>
->setUrl('monitoring/list/hosts')
->add(
StateBadges::STATE_UP,
$hostgroup->hosts_up,
array(
'host_state' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_up,
'List %u host that is currently in state UP in the host group "%s"',
'List %u hosts which are currently in state UP in the host group "%s"',
array($hostgroup->hosts_up, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_DOWN,
$hostgroup->hosts_down_unhandled,
array(
'host_state' => 1,
'host_acknowledged' => 0,
'host_in_downtime' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_down_unhandled,
'List %u host that is currently in state DOWN in the host group "%s"',
'List %u hosts which are currently in state DOWN in the host group "%s"',
array($hostgroup->hosts_down_unhandled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_DOWN_HANDLED,
$hostgroup->hosts_down_handled,
array(
'host_state' => 1,
'host_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_down_handled,
'List %u host that is currently in state DOWN (Acknowledged) in the host group "%s"',
'List %u hosts which are currently in state DOWN (Acknowledged) in the host group "%s"',
array($hostgroup->hosts_down_handled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_UNREACHABLE,
$hostgroup->hosts_unreachable_unhandled,
array(
'host_state' => 2,
'host_acknowledged' => 0,
'host_in_downtime' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_unreachable_unhandled,
'List %u host that is currently in state UNREACHABLE in the host group "%s"',
'List %u hosts which are currently in state UNREACHABLE in the host group "%s"',
array($hostgroup->hosts_unreachable_unhandled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_UNREACHABLE_HANDLED,
$hostgroup->hosts_unreachable_handled,
array(
'host_state' => 2,
'host_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_unreachable_handled,
'List %u host that is currently in state UNREACHABLE (Acknowledged) in the host group "%s"',
'List %u hosts which are currently in state UNREACHABLE (Acknowledged) in the host group "%s"',
array($hostgroup->hosts_unreachable_handled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_PENDING,
$hostgroup->hosts_pending,
array(
'host_state' => 99,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_pending,
'List %u host that is currently in state PENDING in the host group "%s"',
'List %u hosts which are currently in state PENDING in the host group "%s"',
array($hostgroup->hosts_pending, $hostgroup->hostgroup_alias)
Expand All @@ -155,18 +155,19 @@ if (! $this->compact): ?>
->setUrl('monitoring/list/services')
->add(
StateBadges::STATE_OK,
$hostgroup->services_ok,
array(
'service_state' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_ok,
'List %u service that is currently in state OK on hosts in the host group "%s"',
'List %u services which are currently in state OK on hosts in the host group "%s"',
array($hostgroup->services_ok, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_CRITICAL,
$hostgroup->services_critical_unhandled,
array(
'service_state' => 2,
'service_acknowledged' => 0,
Expand All @@ -175,26 +176,26 @@ if (! $this->compact): ?>
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_critical_unhandled,
'List %u service that is currently in state CRITICAL on hosts in the host group "%s"',
'List %u services which are currently in state CRITICAL on hosts in the host group "%s"',
array($hostgroup->services_critical_unhandled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_CRITICAL_HANDLED,
$hostgroup->services_critical_handled,
array(
'service_state' => 2,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_critical_handled,
'List %u service that is currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"',
'List %u services which are currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"',
array($hostgroup->services_critical_unhandled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_UNKNOWN,
$hostgroup->services_unknown_unhandled,
array(
'service_state' => 3,
'service_acknowledged' => 0,
Expand All @@ -203,27 +204,27 @@ if (! $this->compact): ?>
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_unknown_unhandled,
'List %u service that is currently in state UNKNOWN on hosts in the host group "%s"',
'List %u services which are currently in state UNKNOWN on hosts in the host group "%s"',
array($hostgroup->services_unknown_unhandled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_UNKNOWN_HANDLED,
$hostgroup->services_unknown_handled,
array(
'service_state' => 3,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_unknown_handled,
'List %u service that is currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"',
'List %u services which are currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"',
array($hostgroup->services_unknown_handled, $hostgroup->hostgroup_alias)

)
->add(
StateBadges::STATE_WARNING,
$hostgroup->services_warning_unhandled,
array(
'service_state' => 1,
'service_acknowledged' => 0,
Expand All @@ -232,32 +233,31 @@ if (! $this->compact): ?>
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_warning_unhandled,
'List %u service that is currently in state WARNING on hosts in the host group "%s"',
'List %u services which are currently in state WARNING on hosts in the host group "%s"',
array($hostgroup->services_warning_unhandled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_WARNING_HANDLED,
$hostgroup->services_warning_handled,
array(
'service_state' => 1,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_warning_handled,
'List %u service that is currently in state WARNING (Acknowledged) on hosts in the host group "%s"',
'List %u services which are currently in state WARNING (Acknowledged) on hosts in the host group "%s"',
array($hostgroup->services_warning_handled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_PENDING,
$hostgroup->services_pending,
array(
'service_state' => 99,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_pending,
'List %u service that is currently in state PENDING on hosts in the host group "%s"',
'List %u services which are currently in state PENDING on hosts in the host group "%s"',
array($hostgroup->services_pending, $hostgroup->hostgroup_alias)
Expand Down
Expand Up @@ -160,16 +160,16 @@ public function setUrl($url)
* Add a state badge
*
* @param string $state
* @param array $filter
* @param int $count
* @param array $filter
* @param string $translateSingular
* @param string $translatePlural
* @param array $translateArgs
*
* @return $this
*/
public function add(
$state, array $filter, $count, $translateSingular, $translatePlural, array $translateArgs = array()
$state, $count, array $filter, $translateSingular, $translatePlural, array $translateArgs = array()
) {
$this->badges[$state] = (object) array(
'count' => (int) $count,
Expand Down Expand Up @@ -218,7 +218,7 @@ public function createBadgeGroup(array $states, Navigation $badges)
$groupItem = new NavigationItem(
uniqid(),
array(
'name' => '',
'label' => '',
'priority' => $this->priority++
)
);
Expand Down

0 comments on commit 705432b

Please sign in to comment.