diff options
Diffstat (limited to 'modules/monitoring/application/views/scripts/list/components')
3 files changed, 225 insertions, 0 deletions
diff --git a/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml b/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml new file mode 100644 index 0000000..4b9f1cd --- /dev/null +++ b/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml @@ -0,0 +1,92 @@ +<?php +use Icinga\Module\Monitoring\Web\Widget\StateBadges; +use Icinga\Web\Url; + +// Don't fetch rows until they are actually needed to improve dashlet performance +if (! $stats instanceof stdClass) { + $stats = $stats->fetchRow(); +} +?> +<div class="hosts-summary dont-print"> + <span class="hosts-link"><?= $this->qlink( + sprintf($this->translatePlural('%u Host', '%u Hosts', $stats->hosts_total), $stats->hosts_total), + // @TODO(el): Fix that + Url::fromPath('monitoring/list/hosts')->setParams(isset($baseFilter) ? $baseFilter->getUrlParams() : array()), + null, + array('title' => sprintf( + $this->translatePlural('List %u host', 'List all %u hosts', $stats->hosts_total), + $stats->hosts_total + )) + ) ?>:</span> +<?php +$stateBadges = new StateBadges(); +$stateBadges + ->setBaseFilter(isset($baseFilter) ? $baseFilter : null) + ->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)', + 'List %u hosts which are currently in state UNREACHABLE (Acknowledged)', + array($stats->hosts_unreachable_handled) + ) + ->add( + StateBadges::STATE_PENDING, + $stats->hosts_pending, + array( + 'host_state' => 99 + ), + 'List %u host that is currently in state PENDING', + 'List %u hosts which are currently in state PENDING', + array($stats->hosts_pending) + ); +echo $stateBadges->render(); +?> +</div> diff --git a/modules/monitoring/application/views/scripts/list/components/selectioninfo.phtml b/modules/monitoring/application/views/scripts/list/components/selectioninfo.phtml new file mode 100644 index 0000000..ec0fb85 --- /dev/null +++ b/modules/monitoring/application/views/scripts/list/components/selectioninfo.phtml @@ -0,0 +1,15 @@ +<?php +$helpMessage = $this->translate( + 'Press and hold the Ctrl key while clicking on rows to select multiple rows or press and hold the Shift key to' + .' select a range of rows', + 'Multi-selection help' +); +?> +<div class="selection-info" title="<?= $this->escape($helpMessage) ?>"> + <?= sprintf( + /// TRANSLATORS: Please leave %s as it is because the selection counter is wrapped in a span tag for updating + /// the counter via JavaScript + $this->translate('%s row(s) selected', 'Multi-selection count'), + '<span class="selection-info-count">0</span>' + ) ?> +</div> 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 0000000..73a3b57 --- /dev/null +++ b/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml @@ -0,0 +1,118 @@ +<?php +use Icinga\Module\Monitoring\Web\Widget\StateBadges; +use Icinga\Web\Url; + +// Don't fetch rows until they are actually needed, to improve dashlet performance +if (! $stats instanceof stdClass) { + $stats = $stats->fetchRow(); +} +?> +<div class="services-summary dont-print"> + <span class="services-link"><?= $this->qlink( + sprintf($this->translatePlural( + '%u Service', '%u Services', $stats->services_total), + $stats->services_total + ), + // @TODO(el): Fix that + Url::fromPath('monitoring/list/services')->setParams(isset($baseFilter) ? $baseFilter->getUrlParams() : array()), + null, + array('title' => sprintf( + $this->translatePlural('List %u service', 'List all %u services', $stats->services_total), + $stats->services_total + )) + ) ?>:</span> +<?php +$stateBadges = new StateBadges(); +$stateBadges + ->setBaseFilter(isset($baseFilter) ? $baseFilter : null) + ->setUrl('monitoring/list/services') + ->add( + StateBadges::STATE_OK, + $stats->services_ok, + array( + 'service_state' => 0 + ), + 'List %u service that is currently in state OK', + 'List %u services which are currently in state OK', + array($stats->services_ok) + ) + ->add( + StateBadges::STATE_CRITICAL, + $stats->services_critical_unhandled, + array( + 'service_state' => 2, + 'service_handled' => 0 + ), + 'List %u service that is currently in state CRITICAL', + 'List %u services which are currently in state CRITICAL', + array($stats->services_critical_unhandled) + ) + ->add( + StateBadges::STATE_CRITICAL_HANDLED, + $stats->services_critical_handled, + array( + 'service_state' => 2, + 'service_handled' => 1 + ), + 'List %u handled service that is currently in state CRITICAL', + 'List %u handled services which are currently in state CRITICAL', + array($stats->services_critical_handled) + ) + ->add( + StateBadges::STATE_UNKNOWN, + $stats->services_unknown_unhandled, + array( + 'service_state' => 3, + 'service_handled' => 0 + ), + 'List %u service that is currently in state UNKNOWN', + 'List %u services which are currently in state UNKNOWN', + array($stats->services_unknown_unhandled) + ) + ->add( + StateBadges::STATE_UNKNOWN_HANDLED, + $stats->services_unknown_handled, + array( + 'service_state' => 3, + 'service_handled' => 1 + ), + 'List %u handled service that is currently in state UNKNOWN', + 'List %u handled services which are currently in state UNKNOWN', + array($stats->services_unknown_handled) + + ) + ->add( + StateBadges::STATE_WARNING, + $stats->services_warning_unhandled, + array( + 'service_state' => 1, + 'service_handled' => 0 + ), + 'List %u service that is currently in state WARNING', + 'List %u services which are currently in state WARNING', + array($stats->services_warning_unhandled) + ) + ->add( + StateBadges::STATE_WARNING_HANDLED, + $stats->services_warning_handled, + array( + 'service_state' => 1, + 'service_handled' => 1 + ), + 'List %u handled service that is currently in state WARNING', + 'List %u handled services which are currently in state WARNING', + array($stats->services_warning_handled) + ) + ->add( + StateBadges::STATE_PENDING, + $stats->services_pending, + array( + 'service_state' => 99 + ), + 'List %u handled service that is currently in state PENDING', + 'List %u handled services which are currently in state PENDING', + array($stats->services_pending) + ); +echo $stateBadges->render(); +?> +</div> |