Commit beca72cc by Torkel Ödegaard

filterSrv refactoring cleanup and testing

parent 5ea07d0f
......@@ -2,7 +2,7 @@
<div class='filtering-container'>
<div ng-repeat="filter in filter.list" class="small filter-panel-filter">
<div ng-repeat="filter in filter.templateParameters" class="small filter-panel-filter">
<div>
<i class="filter-action pointer icon-remove" bs-tooltip="'Remove'" ng-click="remove(filter)"></i>
<i class="filter-action pointer icon-edit" ng-hide="filter.editing" bs-tooltip="'Edit'" ng-click="filter.editing = true"></i>
......
......@@ -16,7 +16,7 @@ define([
};
var result = {
_updateTemplateData : function( initial ) {
_updateTemplateData : function(initial) {
var _templateData = {};
_.each(this.templateParameters, function( templateParameter ) {
if (initial) {
......@@ -29,7 +29,7 @@ define([
return;
}
_templateData[ templateParameter.name ] = templateParameter.current.value;
_templateData[templateParameter.name] = templateParameter.current.value;
});
this._templateData = _templateData;
},
......@@ -92,17 +92,19 @@ define([
this.templateParameters = _.without( this.templateParameters, templateParameter );
},
init : function( dashboard ) {
init: function(dashboard) {
_.defaults(this, _d);
this.dashboard = dashboard;
this.templateSettings = { interpolate : /\[\[([\s\S]+?)\]\]/g };
if( dashboard && dashboard.services && dashboard.services.filter ) {
// compatiblity hack
if(dashboard.services && dashboard.services.filter) {
this.time = dashboard.services.filter.time;
this.templateParameters = dashboard.services.filter.list || [];
this._updateTemplateData(true);
}
}
};
};
return result;
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment