From bf717654f0565347f629d4c8888726fee5d59b4c Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 20 Mar 2014 11:30:42 +0100 Subject: [PATCH] Add more consistency to the servicematrix when switching pages --- library/Icinga/Data/PivotTable.php | 14 ++++++-------- .../application/controllers/ListController.php | 1 + .../views/scripts/list/servicematrix.phtml | 2 -- public/css/icinga/monitoring-colors.less | 4 ++-- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/library/Icinga/Data/PivotTable.php b/library/Icinga/Data/PivotTable.php index 98c165206..4d4b8fbd7 100644 --- a/library/Icinga/Data/PivotTable.php +++ b/library/Icinga/Data/PivotTable.php @@ -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; } } diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index f735e482c..7fc2f3cce 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -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'; diff --git a/modules/monitoring/application/views/scripts/list/servicematrix.phtml b/modules/monitoring/application/views/scripts/list/servicematrix.phtml index 8fc360a0d..0aa0c324c 100644 --- a/modules/monitoring/application/views/scripts/list/servicematrix.phtml +++ b/modules/monitoring/application/views/scripts/list/servicematrix.phtml @@ -50,7 +50,6 @@ $hostFilter = implode(',', array_keys($pivotData)); - @@ -74,7 +73,6 @@ $hostFilter = implode(',', array_keys($pivotData)); - diff --git a/public/css/icinga/monitoring-colors.less b/public/css/icinga/monitoring-colors.less index f97b569a7..ac186fc4f 100644 --- a/public/css/icinga/monitoring-colors.less +++ b/public/css/icinga/monitoring-colors.less @@ -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 {