Add more consistency to the servicematrix when switching pages

This commit is contained in:
Johannes Meyer 2014-03-20 11:30:42 +01:00
parent 9561096f4a
commit bf717654f0
4 changed files with 9 additions and 12 deletions

View File

@ -163,22 +163,20 @@ class PivotTable
*/
public function toArray()
{
$pivot = array();
$xAxis = $this->xAxisQuery->fetchColumn();
$yAxis = $this->yAxisQuery->fetchColumn();
$pivot = array();
if (!empty($xAxis) && !empty($yAxis)) {
$this->baseQuery->where($this->xAxisColumn, $xAxis)->where($this->yAxisColumn, $yAxis);
foreach ($this->baseQuery->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;
foreach ($yAxis as $yLabel) {
foreach ($xAxis as $xLabel) {
$pivot[$yLabel][$xLabel] = null;
}
}
foreach ($this->baseQuery->fetchAll() as $row) {
$pivot[$row->{$this->yAxisColumn}][$row->{$this->xAxisColumn}] = $row;
}
}

View File

@ -458,6 +458,7 @@ class Monitoring_ListController extends Controller
$this->view->history = $query->paginate();
}
// TODO: Should be able to identify hosts that have not a single service (without compromising the pagination)
public function servicematrixAction()
{
$this->view->title = 'Servicematrix';

View File

@ -50,7 +50,6 @@ $hostFilter = implode(',', array_keys($pivotData));
<tbody>
<?php $hasHeader = true; ?>
<?php endif ?>
<?php if (count(array_filter(array_values($serviceStates)))): ?>
<tr>
<th>
<a href="<?= $this->href('monitoring/show/host', array('host' => $host_name)); ?>">
@ -74,7 +73,6 @@ $hostFilter = implode(',', array_keys($pivotData));
</td>
<?php endforeach ?>
</tr>
<?php endif ?>
<?php endforeach ?>
</tbody>
</table>

View File

@ -591,9 +591,9 @@ table.pivot {
}
td {
min-width: 1.5em;
min-height: 1.5em;
padding: 2px;
min-width: 1.5em;
line-height: 1.5em;
text-align: center;
a {