From 705432b5fbe8e21586d540be5da9b88d09db83e7 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Sun, 27 Sep 2015 15:43:17 +0200 Subject: [PATCH] monitoring/lib: Change StateBadges::add() signature refs #5543 --- .../views/scripts/list/hostgroups.phtml | 30 +++++++++---------- .../Monitoring/Web/Widget/StateBadges.php | 6 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/hostgroups.phtml b/modules/monitoring/application/views/scripts/list/hostgroups.phtml index da7dcb40b..a9d2e2e8a 100644 --- a/modules/monitoring/application/views/scripts/list/hostgroups.phtml +++ b/modules/monitoring/application/views/scripts/list/hostgroups.phtml @@ -1,6 +1,6 @@ compact): ?>
tabs ?> @@ -58,18 +58,19 @@ 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, @@ -77,26 +78,26 @@ if (! $this->compact): ?> '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, @@ -104,32 +105,31 @@ if (! $this->compact): ?> '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) @@ -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, @@ -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, @@ -203,20 +204,19 @@ 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) @@ -224,6 +224,7 @@ if (! $this->compact): ?> ) ->add( StateBadges::STATE_WARNING, + $hostgroup->services_warning_unhandled, array( 'service_state' => 1, 'service_acknowledged' => 0, @@ -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) diff --git a/modules/monitoring/library/Monitoring/Web/Widget/StateBadges.php b/modules/monitoring/library/Monitoring/Web/Widget/StateBadges.php index a82862210..26d388732 100644 --- a/modules/monitoring/library/Monitoring/Web/Widget/StateBadges.php +++ b/modules/monitoring/library/Monitoring/Web/Widget/StateBadges.php @@ -160,8 +160,8 @@ class StateBadges extends AbstractWidget * 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 @@ -169,7 +169,7 @@ class StateBadges extends AbstractWidget * @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, @@ -218,7 +218,7 @@ class StateBadges extends AbstractWidget $groupItem = new NavigationItem( uniqid(), array( - 'name' => '', + 'label' => '', 'priority' => $this->priority++ ) );