[icinga-checkins] icinga.org: icinga-web/r1.7: Fixes filter for host_status in openproblems view

git at icinga.org git at icinga.org
Thu Aug 23 11:40:40 CEST 2012


Module: icinga-web
Branch: r1.7
Commit: 82e4379f9c2bfc46b41bcf8f9026451866c2380a
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=82e4379f9c2bfc46b41bcf8f9026451866c2380a

Author: Marius Hein <marius.hein at netways.de>
Date:   Thu Aug 23 11:35:31 2012 +0200

Fixes filter for host_status in openproblems view

Added filter parameter 'field' to override API defined alias fields

fixes #2973

---

 .../xml/grid/icinga-open-problems-template.xml     |    3 +++
 .../DQLCronkTemplateWorker.class.php               |   12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/app/modules/Cronks/data/xml/grid/icinga-open-problems-template.xml b/app/modules/Cronks/data/xml/grid/icinga-open-problems-template.xml
index 64a6dc7..144f836 100644
--- a/app/modules/Cronks/data/xml/grid/icinga-open-problems-template.xml
+++ b/app/modules/Cronks/data/xml/grid/icinga-open-problems-template.xml
@@ -462,6 +462,9 @@
                 <parameter name="subtype">appkit.ext.filter.hoststatus</parameter>
 
                 <parameter name="no_operator">false</parameter>
+                
+                <!-- Override the default field -->
+                <parameter name="field">COALESCE(hs.current_state,shs.current_state)</parameter>
             </filter>
 
             <order>
diff --git a/app/modules/Cronks/lib/template/TemplateWorker/DQLCronkTemplateWorker.class.php b/app/modules/Cronks/lib/template/TemplateWorker/DQLCronkTemplateWorker.class.php
index 4e16b2b..211a671 100644
--- a/app/modules/Cronks/lib/template/TemplateWorker/DQLCronkTemplateWorker.class.php
+++ b/app/modules/Cronks/lib/template/TemplateWorker/DQLCronkTemplateWorker.class.php
@@ -202,7 +202,17 @@ class DQLCronkTemplateWorker extends CronkGridTemplateWorker {
             }
         }
         
-        $field = $this->aliasToColumn($field);
+        /*
+         * Use override field if some special has done in the view we
+         * can not filter on it
+         */
+        $filter = $this->template->getFieldByName($field, 'filter');
+        if ($filter->hasParameter('field')) {
+            $field = $filter->getParameter('field');
+        } else {
+            $field = $this->aliasToColumn($field);
+        }
+        
         $val = str_replace("'","'",$val);
         $this->parser->addWhere($field, $operator,$val);
         





More information about the icinga-checkins mailing list