diff --git a/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml b/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml index 3fe11bcca..058620dc4 100644 --- a/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml +++ b/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml @@ -1,164 +1,89 @@ baseFilter = isset($this->baseFilter) ? $this->baseFilter : null; - -// don't fetch rows until they are actually needed to improve dashlet performance -if (!$stats instanceof stdClass) { +// Don't fetch rows until they are actually needed to improve dashlet performance +if (! $stats instanceof stdClass) { $stats = $stats->fetchRow(); } - -$selfUrl = 'monitoring/list/hosts'; -$currentUrl = Url::fromRequest()->getRelativeUrl(); ?> - qlink( - sprintf($this->translatePlural('%u Host', '%u Hosts', $stats->hosts_total), $stats->hosts_total), - $selfUrl, - null, - array('title' => sprintf( - $this->translatePlural('List %u host', 'List all %u hosts', $stats->hosts_total), - $stats->hosts_total - )) - ) ?>: - - hosts_up): ?> - - qlink( - $stats->hosts_up, - Url::urlAddFilterOptional( - $selfUrl, - Filter::where('host_state', 0), - $this->baseFilter - ), - null, - array('title' => sprintf( - $this->translatePlural( - 'List %u host that is currently in state UP', - 'List %u hosts which are currently in state UP', - $stats->hosts_up - ), - $stats->hosts_up - ) - ) - ); ?> - - - - hosts_down_unhandled): ?> - - qlink( - $stats->hosts_down_unhandled, - Url::urlAddFilterOptional( - $selfUrl, - Filter::matchAll(Filter::where('host_state', 1), Filter::where('host_unhandled', 1)), - $this->baseFilter - ), - null, - array('title' => sprintf( - $this->translatePlural( - 'List %u host that is currently in state DOWN', - 'List %u hosts which are currently in state DOWN', - $stats->hosts_down_unhandled - ), - $stats->hosts_down_unhandled - )) - ); ?> - - - hosts_down_handled): ?> - - qlink( - $stats->hosts_down_handled, - Url::urlAddFilterOptional( - $selfUrl, - Filter::matchAll(Filter::where('host_state', 1), Filter::where('host_unhandled', 0)), - $this->baseFilter - ), - null, - array('title' => sprintf( - $this->translatePlural( - 'List %u host that is currently in state DOWN (Acknowledged)', - 'List %u hosts which are currently in state DOWN (Acknowledged)', - $stats->hosts_down_handled - ), - $stats->hosts_down_handled - )) - ); ?> - - - - hosts_down): ?> - - - - hosts_unreachable_unhandled): ?> - - qlink( - $stats->hosts_unreachable_unhandled, - Url::urlAddFilterOptional( - $selfUrl, - Filter::matchAll(Filter::where('host_state', 2), Filter::where('host_unhandled', 1)), - $this->baseFilter - ), - null, - array('title' => sprintf( - $this->translatePlural( - 'List %u host that is currently in state UNREACHABLE', - 'List %u hosts which are currently in state UNREACHABLE', - $stats->hosts_unreachable_unhandled - ), - $stats->hosts_unreachable_unhandled - )) - ); ?> - - - hosts_unreachable_handled > 0): ?> - - qlink( - $stats->hosts_unreachable_handled, - Url::urlAddFilterOptional( - $selfUrl, - Filter::matchAll(Filter::where('host_state', 2), Filter::where('host_unhandled', 0)), - $this->baseFilter - ), - null, - array('title' => sprintf( - $this->translatePlural( - 'List %u host that is currently in state UNREACHABLE (Acknowledged)', - 'List %u hosts which are currently in state UNREACHABLE (Acknowledged)', - $stats->hosts_unreachable_handled - ), - $stats->hosts_unreachable_handled - )) - ); ?> - - - - hosts_unreachable): ?> - - - - hosts_pending): ?> - - qlink( - $stats->hosts_pending, - Url::urlAddFilterOptional( - $selfUrl, - Filter::where('host_state', 99), - $this->baseFilter - ), - null, - array('title' => sprintf( - $this->translatePlural( - 'List %u host that is currently in state PENDING', - 'List %u hosts which are currently in state PENDING', - $stats->hosts_pending - ), - $stats->hosts_pending - )) - ); ?> - - - +
+qlink( + sprintf($this->translatePlural('%u Host', '%u Hosts', $stats->hosts_total), $stats->hosts_total), + 'monitoring/list/hosts', + null, + array('title' => sprintf( + $this->translatePlural('List %u host', 'List all %u hosts', $stats->hosts_total), + $stats->hosts_total + )) +) ?>: +setUrl('monitoring/list/hosts') + ->add( + StateBadges::STATE_UP, + $stats->hosts_up, + array( + 'host_state' => 0 + ), + 'List %u host that is currently in state UP', + 'List %u hosts which are currently in state UP', + array($stats->hosts_up) + ) + ->add( + StateBadges::STATE_DOWN, + $stats->hosts_down_unhandled, + array( + 'host_state' => 1, + 'host_handled' => 0 + ), + 'List %u host that is currently in state DOWN', + 'List %u hosts which are currently in state DOWN', + array($stats->hosts_down_unhandled) + ) + ->add( + StateBadges::STATE_DOWN_HANDLED, + $stats->hosts_down_handled, + array( + 'host_state' => 1, + 'host_handled' => 1 + ), + 'List %u host that is currently in state DOWN (Acknowledged)', + 'List %u hosts which are currently in state DOWN (Acknowledged)', + array($stats->hosts_down_handled) + ) + ->add( + StateBadges::STATE_UNREACHABLE, + $stats->hosts_unreachable_unhandled, + array( + 'host_state' => 2, + 'host_handled' => 0 + ), + 'List %u host that is currently in state UNREACHABLE', + 'List %u hosts which are currently in state UNREACHABLE', + array($stats->hosts_unreachable_unhandled) + ) + ->add( + StateBadges::STATE_UNREACHABLE_HANDLED, + $stats->hosts_unreachable_handled, + array( + 'host_state' => 2, + 'host_handled' => 1 + ), + '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($stats->hosts_unreachable_handled) + ) + ->add( + StateBadges::STATE_PENDING, + $stats->hosts_pending, + array( + 'host_state' => 99 + ), + 'List %u host that is currently in state UNREACHABLE (Acknowledged)', + 'List %u hosts which are currently in state UNREACHABLE (Acknowledged)', + array($stats->hosts_pending) + ); +echo $stateBadges->render(); +?> +
diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 428ea7f58..246d41344 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -6,9 +6,7 @@ if (! $this->compact): ?> tabs ?>
render('list/components/selectioninfo.phtml') ?> -

compact ? ' data-base-target="col1"' : '' ?>> - render('list/components/hostssummary.phtml') ?> -

+ render('list/components/hostssummary.phtml') ?>
sortBox ?> limiter ?>