From 65b2a25fd61d6750ac6c545635115dfe4eab1e7f Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 5 Sep 2014 17:41:53 +0200 Subject: [PATCH] list/components/servicesummary: show state summary refs #6993 --- .../list/components/servicesummary.phtml | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 modules/monitoring/application/views/scripts/list/components/servicesummary.phtml diff --git a/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml b/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml new file mode 100644 index 000000000..aa67cdeae --- /dev/null +++ b/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml @@ -0,0 +1,80 @@ +getRelativeUrl(); + +?>

compact ? ' data-base-target="col1"' : '' ?>> +qlink(sprintf($this->translate('%s services:'), $this->stats->services_total), $selfUrl) ?> + qlink( + $this->stats->services_ok, + $selfUrl, + array('service_state' => 0), + array('title' => sprintf($this->translate('Services with state %s'), strtoupper($this->translate('ok')))) +) ?> + 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $state) { + $pre = 'services_' . $state; + if ($this->stats->$pre) { + $handled = $pre . '_handled'; + $unhandled = $pre . '_unhandled'; + $paramsHandled = array('service_state' => $stateId, 'service_handled' => 1); + $paramsUnhandled = array('service_state' => $stateId, 'service_handled' => 0); + if ($this->stats->$unhandled) { + $compareUrl = Url::fromPath($selfUrl, $paramsUnhandled)->getRelativeUrl(); + } else { + $compareUrl = Url::fromPath($selfUrl, $paramsHandled)->getRelativeUrl(); + } + + if ($compareUrl === $currentUrl) { + $active = ' active'; + } else { + $active = ''; + } + + echo ''; + if ($this->stats->$unhandled) { + + echo $this->qlink( + $this->stats->$unhandled, + $selfUrl, + $paramsUnhandled, + array('title' => sprintf($this->translate('Unandled services with state %s'), strtoupper($this->translate($state)))) + ); + } + if ($this->stats->$handled) { + + if (Url::fromPath($selfUrl, $paramsHandled)->getRelativeUrl() === $currentUrl) { + $active = ' active'; + } else { + $active = ''; + } + if ($this->stats->$unhandled) { + echo ''; + } + echo $this->qlink( + $this->stats->$handled, + $selfUrl, + $paramsHandled, + array('title' => sprintf($this->translate('Handled services with state %s'), strtoupper($this->translate($state)))) + ); + if ($this->stats->$unhandled) { + echo "\n"; + } + } + echo "\n"; + } +} + +?> +stats->services_pending): ?> + qlink( + $this->stats->services_pending, + $selfUrl, + array('service_state' => 99), + array('title' => sprintf($this->translate('Services with state %s'), strtoupper($this->translate('pending')))) +) ?> + +

+