Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
Clear all filterpresets when displaying the filter window
Browse files Browse the repository at this point in the history
 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
  • Loading branch information
Jannis Moßhammer committed Apr 11, 2013
1 parent 8cf1556 commit 1b4ec0e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/modules/Cronks/lib/js/Icinga/Cronks/util/FilterEditor.js 100644 → 100755
Expand Up @@ -61,26 +61,32 @@ 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) {
continue;
}
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;
}
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 1b4ec0e

Please sign in to comment.