Do not display hosts without any services in the servicematrix

refs #4180
This commit is contained in:
Johannes Meyer 2014-03-12 16:48:24 +01:00
parent 5dc7d0dd56
commit 13b509bf4b
2 changed files with 9 additions and 19 deletions

View File

@ -4,7 +4,6 @@
namespace Icinga\Data;
use \stdClass;
use Icinga\Data\BaseQuery;
class PivotTable
@ -142,26 +141,17 @@ class PivotTable
$yAxis = $this->fetchYAxis();
$this->query->where($this->xAxisColumn, $xAxis)->where($this->yAxisColumn, $yAxis);
if (!$this->query->hasOrder()) {
$this->query->order($this->xAxisColumn)->order($this->yAxisColumn);
}
$emptyrow = new stdClass();
foreach ($this->query->getColumns() as $col) {
$emptyrow->{$col} = null;
}
$pivot = array();
foreach ($xAxis as $x) {
foreach ($yAxis as $y) {
$row = clone($emptyrow);
$row->{$this->xAxisColumn} = $x;
$row->{$this->yAxisColumn} = $y;
$pivot[$y][$x] = $row;
}
}
foreach ($this->query->fetchAll() as $row) {
if (!array_key_exists($row->{$this->yAxisColumn}, $pivot)) {
$defaults = array();
foreach ($xAxis as $label) {
$defaults[$label] = null;
}
$pivot[$row->{$this->yAxisColumn}] = $defaults;
}
$pivot[$row->{$this->yAxisColumn}][$row->{$this->xAxisColumn}] = $row;
}

View File

@ -29,7 +29,7 @@
</a>
</th>
<?php foreach (array_values($serviceStates) as $service): ?>
<?php if ($service->service_state !== null): ?>
<?php if ($service !== null): ?>
<td class="state_<?= $this->monitoringState($service, 'service'); ?> <?= $service->service_handled ? 'handled' : ''; ?>">
<a href="<?= $this->href(
'monitoring/show/service',