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
1 changed files with 93 additions and 39 deletions

View File

@ -4,79 +4,133 @@ use Icinga\Web\Url;
$selfUrl = 'monitoring/list/hosts';
$currentUrl = Url::fromRequest()->getRelativeUrl();
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : '' ?>>
<?= $this->qlink(sprintf($this->translate('%s hosts:'), $this->stats->hosts_total), $selfUrl); ?>
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
<?= sprintf($this->translate('%s hosts:'), $this->stats->hosts_total); ?>
<span class="badges">
<?php if($this->stats->hosts_up): ?>
<span class="state ok<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 0))->getRelativeUrl() ? ' active' : '' ?>">
<?php if ($this->stats->hosts_up): ?>
<span class="state ok<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 0))->getRelativeUrl() ? ' active' : ''; ?>">
<?= $this->qlink(
$this->stats->hosts_up,
$selfUrl,
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>
<?php endif; ?>
<?php if($this->stats->hosts_down_unhandled): ?>
<span class="state critical<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 1, 'host_unhandled' => 1))->getRelativeUrl() ? ' active' : '' ?>">
<?php if ($this->stats->hosts_down_unhandled): ?>
<span class="state critical<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 1, 'host_unhandled' => 1))->getRelativeUrl() ? ' active' : ''; ?>">
<?= $this->qlink(
$this->stats->hosts_down_unhandled,
$selfUrl,
array('host_state' => 1, 'host_unhandled' => 1),
array('title' => $this->translate('Unhandled hosts with state DOWN'))
) ?>
array(
'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 if($this->stats->hosts_down_handled > 0): ?>
<span class="state handled critical<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 1, 'host_unhandled' =>0))->getRelativeUrl() ? ' active' : '' ?>">
<?= $this->qlink(
$this->stats->hosts_down_handled,
$selfUrl,
array('host_state' => 1, 'host_unhandled' => 0),
array('title' => $this->translate('Handled hosts with state DOWN'))
) ?>
</span>
<?php endif; ?>
<?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' : ''; ?>">
<?= $this->qlink(
$this->stats->hosts_down_handled,
$selfUrl,
array(
'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>
<?php endif; ?>
<?php if($this->stats->hosts_down): ?>
</span>
<?php endif; ?>
<?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->stats->hosts_unreachable_unhandled,
$selfUrl,
array('host_state' => 2, 'host_unhandled' => 1),
array('title' => $this->translate('Unhandled hosts with state UNREACHABLE'))
) ?>
array(
'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 if($this->stats->hosts_unreachable_handled > 0): ?>
<span class="state handled unknown<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 2, 'host_unhandled' => 0))->getRelativeUrl() ? ' active' : '' ?>">
<?= $this->qlink(
$this->stats->hosts_unreachable_handled,
$selfUrl,
array('host_state' => 2, 'host_unhandled' => 0),
array('title' => $this->translate('Handled hosts with state UNREACHABLE'))
) ?>
</span>
<?php endif; ?>
<?php if($this->stats->hosts_unreachable_handled > 0): ?>
<span class="state handled unknown<?= $currentUrl === Url::fromPath($selfUrl, array('host_state' => 2, 'host_unhandled' => 0))->getRelativeUrl() ? ' active' : '' ?>">
<?= $this->qlink(
$this->stats->hosts_unreachable_handled,
$selfUrl,
array(
'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>
<?php endif; ?>
<?php if($this->stats->hosts_unreachable): ?>
</span>
<?php endif; ?>
<?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->stats->hosts_pending,
$selfUrl,
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>
<?php endif; ?>
</span>
</div>
</div>