Make "hosts" and "services" views responsive

This commit is contained in:
Matthias Jentsch 2014-10-01 09:24:52 +02:00
parent bbee06b57f
commit f188bf6b9c
5 changed files with 78 additions and 57 deletions

View File

@ -43,6 +43,13 @@ class Monitoring_HostsController extends Controller
public function showAction()
{
$this->getTabs()->add(
'show',
array(
'title' => t('Hosts'),
'url' => Url::fromRequest()
)
)->activate('show');
$this->setAutorefreshInterval(15);
$checkNowForm = new CheckNowCommandForm();
$checkNowForm

View File

@ -43,6 +43,13 @@ class Monitoring_ServicesController extends Controller
public function showAction()
{
$this->getTabs()->add(
'show',
array(
'title' => t('Services'),
'url' => Url::fromRequest()
)
)->activate('show');
$this->setAutorefreshInterval(15);
$checkNowForm = new CheckNowCommandForm();
$checkNowForm

View File

@ -5,26 +5,23 @@
<?php if (count($objects) === 0): ?>
<?= $this->translate('No hosts matching the filter') ?>
<?php else: ?>
<h1><?= sprintf($this->translate('Summary For %u Hosts'), count($objects)) ?></h1>
<table style="width: 100%; font-size: 0.8em;">
<tr>
<th colspan="2"><?= sprintf($this->translate('%u Hosts'), array_sum(array_values($hostStates))) ?></th>
</tr>
<tr>
<td align="center">
<?= $this->hostStatesPieChart ?>
</td>
<td>
<?php
<div class="hbox-item">
<b><?= sprintf($this->translate('Hosts (%u)'), array_sum(array_values($hostStates))) ?></b>
</div>
<div class="hbox-item">
<?= $this->hostStatesPieChart ?>
</div>
<div class="hbox-item" style="font-size: 14px">
<?php foreach (array_filter($hostStates) as $text => $count) {
echo sprintf('%s: %u <br>', strtoupper($text), $count);
} ?>
</div>
foreach (array_filter($hostStates) as $text => $count) {
echo sprintf('%s: %u<br>', strtoupper($text), $count);
}
?>
</td>
</tr>
</table>
<h3>
<?= sprintf($this->translate('%u Hosts'),
count($objects))
?>
</h3>
<div>
<a href="<?= $listAllLink ?>" title="<?= $this->translate('List all') ?>">
@ -32,8 +29,6 @@
</a>
</div>
<hr>
<div>
<?= $checkNowForm ?>
</div>
@ -53,7 +48,7 @@
</div>
<?php if (! empty($unhandledObjects)): ?>
<h2>
<h3>
<?= sprintf(
$this->translatePlural(
'%u Unhandled Host Problem',
@ -62,7 +57,7 @@
),
count($unhandledObjects)
) ?>
</h2>
</h3>
<div>
<a href="<?= $downtimeUnhandledLink ?>"
title="<?= $this->translate('Schedule downtimes for unhandled problem hosts') ?>">

View File

@ -5,39 +5,34 @@
<?php if (count($objects) === 0): ?>
<?= $this->translate('No services matching the filter') ?>
<?php else: ?>
<h1><?= sprintf($this->translate('Summary For %u Services'), count($objects)) ?></h1>
<table style="width: 100%; font-size: 0.8em;">
<tr>
<th colspan="2"><?= sprintf($this->translate('%u Services'), array_sum(array_values($serviceStates))) ?></th>
<th colspan="2"><?= sprintf($this->translate('%u Hosts'), array_sum(array_values($hostStates))) ?></th>
</tr>
<tr>
<td align="center">
<?= $this->serviceStatesPieChart ?>
</td>
<td>
<?php
foreach (array_filter($serviceStates) as $text => $count) {
echo sprintf('%s: %u<br>', strtoupper($text), $count);
}
<div class="hbox">
<div class="hbox-item" style="width: 6em;">
<b><?= sprintf($this->translate('Services (%u)'), array_sum(array_values($serviceStates))) ?></b>
</div>
<div class="hbox-item">
<?= $this->serviceStatesPieChart ?>
</div>
<div class="hbox-item" style="font-size: 14px">
<?php foreach (array_filter($serviceStates) as $text => $count) {
echo sprintf(' %s: %u <br>', strtoupper($text), $count);
} ?>
</div>
</div>
?>
</td>
<td align="center">
<?= $this->hostStatesPieChart ?>
</td>
<td>
<?php
foreach (array_filter($hostStates) as $text => $count) {
echo sprintf('%s: %u<br>', strtoupper($text), $count);
}
?>
</td>
</tr>
</table>
<div class="hbox">
<div class="hbox-item" style="width: 6em;">
<b><?= sprintf($this->translate('Hosts (%u)'), array_sum(array_values($hostStates))) ?></b>
</div>
<div class="hbox-item">
<?= $this->hostStatesPieChart ?>
</div>
<div class="hbox-item" style="font-size: 14px">
<?php foreach (array_filter($hostStates) as $text => $count) {
echo sprintf('%s: %u <br>', strtoupper($text), $count);
} ?>
</div>
</div>
<div>
<a href="<?= $listAllLink ?>" title="<?= $this->translate('List all') ?>">
@ -45,7 +40,6 @@
</a>
</div>
<hr>
<div>
<?= $checkNowForm ?>
@ -66,7 +60,7 @@
</div>
<?php if (! empty($unhandledObjects)): ?>
<h2>
<h3>
<?= sprintf(
$this->translatePlural(
'%u Unhandled Service Problem',
@ -75,7 +69,7 @@
),
count($unhandledObjects)
) ?>
</h2>
</h3>
<div>
<a href="<?= $downtimeUnhandledLink ?>"
title="<?= $this->translate('Schedule downtimes for unhandled problem services') ?>">

View File

@ -331,3 +331,21 @@ html {
font-weight: bold;
color: white;
}
.hbox {
display: inline-block;
}
.hbox-item {
display: inline-block;
vertical-align: top;
margin-bottom: 0.25em;
margin-left: 1em;
margin-right: 1em;
}
.hbox-spacer {
display: inline-block;
vertical-align: top;
width: 2em;
}