[icinga-checkins] icinga.org: icinga-web/next: Clear all filterpresets when displaying the filter window

git at icinga.org git at icinga.org
Thu Apr 11 13:08:01 CEST 2013


Module: icinga-web
Branch: next
Commit: 1b4ec0e7ad2933f9c540e1599745213c0c44bd9f
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=1b4ec0e7ad2933f9c540e1599745213c0c44bd9f

Author: Jannis Moßhammer <jannis.mosshammer at netways.de>
Date:   Thu Apr 11 13:07:55 2013 +0200

Clear all filterpresets when displaying the filter window

 The possiblefilter property in FilterEditor wasn't correctly cleared
 when switching cronks. As the FilterEditor is only constructed once,
 this caused all filters that showed up for different cronks to be summarized. Therefore it was possible to filter for properties that weren't available.

 fixes #3935

---

 .../lib/js/Icinga/Cronks/util/FilterEditor.js      |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/app/modules/Cronks/lib/js/Icinga/Cronks/util/FilterEditor.js b/app/modules/Cronks/lib/js/Icinga/Cronks/util/FilterEditor.js
old mode 100644
new mode 100755
index 6dbf230..c030d96
--- a/app/modules/Cronks/lib/js/Icinga/Cronks/util/FilterEditor.js
+++ b/app/modules/Cronks/lib/js/Icinga/Cronks/util/FilterEditor.js
@@ -61,18 +61,24 @@ Ext.ns("Icinga.Cronks.util").FilterEditor = Ext.extend(Ext.tree.TreePanel, {
         if(typeof cfg !== "object")
             cfg = {};
         this.filterCfg = cfg.filterCfg;
-        this.grid = cfg.grid,
+        this.grid = cfg.grid;
         this.presets = cfg.presets;
         this.registerFilters();
         
         Ext.tree.TreePanel.prototype.constructor.apply(this,arguments);
         this.addEvents({
             "filterchanged": true
+
         });
     },
 
     registerFilters: function() {
         var known = {};
+        this.possibleFilters = [
+            ['AND','group'],
+            ['OR','group'],
+            ['NOT','group']
+        ];
         for(var i=0;i<this.filterCfg.length;i++) {
             var filter = this.filterCfg[i];
             if (filter.enabled !== true) {
@@ -80,7 +86,7 @@ Ext.ns("Icinga.Cronks.util").FilterEditor = Ext.extend(Ext.tree.TreePanel, {
             }
             if(known[filter.label])
                 continue;
-            this.possibleFilters.push([filter.label,'filter',filter])
+            this.possibleFilters.push([filter.label,'filter',filter]);
             this.labelFilterMap[filter.label] = filter;
             known[filter.label] = true;
         }
@@ -277,6 +283,7 @@ Ext.ns("Icinga.Cronks.util").FilterEditor = Ext.extend(Ext.tree.TreePanel, {
         Ext.tree.TreePanel.prototype.initEvents.apply(this,arguments);
         this.on({
             afterlayout: function() {
+                this.registerFilters();
                 if(this.currentState)
                     this.setRootNode(this.nodeFromFilterObject(this.currentState));
 
@@ -391,7 +398,7 @@ Ext.ns("Icinga.Cronks.util").FilterEditor = Ext.extend(Ext.tree.TreePanel, {
             layout:'fit',
             items: this.form
         });
-        this.addctx.setPosition(Ext.EventObject.getXY())
+        this.addctx.setPosition(Ext.EventObject.getXY());
         
         this.addctx.show();
 





More information about the icinga-checkins mailing list