Add proper titles to the hostsummary component view

refs #8458
This commit is contained in:
Johannes Meyer 2015-02-23 17:22:52 +01:00
parent 96c7b22c16
commit abcac2917c

View File

@ -4,38 +4,65 @@ use Icinga\Web\Url;
$selfUrl = 'monitoring/list/hosts'; $selfUrl = 'monitoring/list/hosts';
$currentUrl = Url::fromRequest()->getRelativeUrl(); $currentUrl = Url::fromRequest()->getRelativeUrl();
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : '' ?>> ?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
<?= $this->qlink(sprintf($this->translate('%s hosts:'), $this->stats->hosts_total), $selfUrl); ?> <?= sprintf($this->translate('%s hosts:'), $this->stats->hosts_total); ?>
<span class="badges"> <span class="badges">
<?php if($this->stats->hosts_up): ?> <?php if ($this->stats->hosts_up): ?>
<span class="state ok<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 0))->getRelativeUrl() ? ' active' : '' ?>"> <span class="state ok<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 0))->getRelativeUrl() ? ' active' : ''; ?>">
<?= $this->qlink( <?= $this->qlink(
$this->stats->hosts_up, $this->stats->hosts_up,
$selfUrl, $selfUrl,
array('host_state' => 0), array('host_state' => 0),
array('title' => $this->translate('Hosts with state UP')) array('title' => sprintf(
) ?> $this->translatePlural(
'List %u host that is currently in state UP',
'List %u hosts which are currently in state UP',
$this->stats->hosts_up
),
$this->stats->hosts_up
))
); ?>
</span> </span>
<?php endif; ?> <?php endif; ?>
<?php if($this->stats->hosts_down_unhandled): ?> <?php if ($this->stats->hosts_down_unhandled): ?>
<span class="state critical<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 1, 'host_unhandled' => 1))->getRelativeUrl() ? ' active' : '' ?>"> <span class="state critical<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 1, 'host_unhandled' => 1))->getRelativeUrl() ? ' active' : ''; ?>">
<?= $this->qlink( <?= $this->qlink(
$this->stats->hosts_down_unhandled, $this->stats->hosts_down_unhandled,
$selfUrl, $selfUrl,
array('host_state' => 1, 'host_unhandled' => 1), array(
array('title' => $this->translate('Unhandled hosts with state DOWN')) 'host_state' => 1,
) ?> 'host_unhandled' => 1
),
array('title' => sprintf(
$this->translatePlural(
'List %u host that is currently in state DOWN',
'List %u hosts which are currently in state DOWN',
$this->stats->hosts_down_unhandled
),
$this->stats->hosts_down_unhandled
))
); ?>
<?php endif; ?> <?php endif; ?>
<?php if($this->stats->hosts_down_handled > 0): ?> <?php if ($this->stats->hosts_down_handled): ?>
<span class="state handled critical<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 1, 'host_unhandled' =>0))->getRelativeUrl() ? ' active' : '' ?>"> <span class="state handled critical<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 1, 'host_unhandled' =>0))->getRelativeUrl() ? ' active' : ''; ?>">
<?= $this->qlink( <?= $this->qlink(
$this->stats->hosts_down_handled, $this->stats->hosts_down_handled,
$selfUrl, $selfUrl,
array('host_state' => 1, 'host_unhandled' => 0), array(
array('title' => $this->translate('Handled hosts with state DOWN')) 'host_state' => 1,
) ?> 'host_unhandled' => 0
),
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)',
$this->stats->hosts_down_handled
),
$this->stats->hosts_down_handled
))
); ?>
</span> </span>
<?php endif; ?> <?php endif; ?>
@ -44,13 +71,23 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
<?php endif; ?> <?php endif; ?>
<?php if($this->stats->hosts_unreachable_unhandled): ?> <?php if($this->stats->hosts_unreachable_unhandled): ?>
<span class="state unknown<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 2, 'host_unhandled' => 1))->getRelativeUrl() ? ' active' : '' ?>"> <span class="state unknown<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 2, 'host_unhandled' => 1))->getRelativeUrl() ? ' active' : ''; ?>">
<?= $this->qlink( <?= $this->qlink(
$this->stats->hosts_unreachable_unhandled, $this->stats->hosts_unreachable_unhandled,
$selfUrl, $selfUrl,
array('host_state' => 2, 'host_unhandled' => 1), array(
array('title' => $this->translate('Unhandled hosts with state UNREACHABLE')) 'host_state' => 2,
) ?> 'host_unhandled' => 1
),
array('title' => sprintf(
$this->translatePlural(
'List %u host that is currently in state UNREACHABLE',
'List %u hosts which are currently in state UNREACHABLE',
$this->stats->hosts_unreachable_unhandled
),
$this->stats->hosts_unreachable_unhandled
))
); ?>
<?php endif; ?> <?php endif; ?>
<?php if($this->stats->hosts_unreachable_handled > 0): ?> <?php if($this->stats->hosts_unreachable_handled > 0): ?>
@ -58,9 +95,19 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
<?= $this->qlink( <?= $this->qlink(
$this->stats->hosts_unreachable_handled, $this->stats->hosts_unreachable_handled,
$selfUrl, $selfUrl,
array('host_state' => 2, 'host_unhandled' => 0), array(
array('title' => $this->translate('Handled hosts with state UNREACHABLE')) 'host_state' => 2,
) ?> 'host_unhandled' => 0
),
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)',
$this->stats->hosts_unreachable_handled
),
$this->stats->hosts_unreachable_handled
))
); ?>
</span> </span>
<?php endif; ?> <?php endif; ?>
@ -69,13 +116,20 @@ $currentUrl = Url::fromRequest()->getRelativeUrl();
<?php endif; ?> <?php endif; ?>
<?php if($this->stats->hosts_pending): ?> <?php if($this->stats->hosts_pending): ?>
<span class="state pending<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 99))->getRelativeUrl() ? ' active' : '' ?>"> <span class="state pending<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 99))->getRelativeUrl() ? ' active' : ''; ?>">
<?= $this->qlink( <?= $this->qlink(
$this->stats->hosts_pending, $this->stats->hosts_pending,
$selfUrl, $selfUrl,
array('host_state' => 99), array('host_state' => 99),
array('title' => $this->translate('Hosts with state PENDING')) array('title' => sprintf(
) ?> $this->translatePlural(
'List %u host that is currently in state PENDING',
'List %u hosts which are currently in state PENDING',
$this->stats->hosts_pending
),
$this->stats->hosts_pending
))
); ?>
</span> </span>
<?php endif; ?> <?php endif; ?>
</span> </span>