From 333704237b0f2517532b2e4f0eddb131ce72d20f Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Mon, 29 Jul 2013 15:29:11 -0700 Subject: [PATCH] added the ability to edit filters, added field filter and modified table to use it --- js/services.js | 2 ++ panels/filtering/module.html | 29 ++++++++++++++++++++++------- panels/filtering/module.js | 9 +++++++++ panels/table/module.js | 8 ++++---- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/js/services.js b/js/services.js index 1173e0e846423..e27e255dbc5e0 100644 --- a/js/services.js +++ b/js/services.js @@ -352,6 +352,8 @@ angular.module('kibana.services', []) .to(filter.to); case 'querystring': return ejs.QueryFilter(ejs.QueryStringQuery(filter.query)).cache(true); + case 'field': + return ejs.QueryFilter(ejs.FieldQuery(filter.field,filter.query)).cache(true); case 'terms': return ejs.TermsFilter(filter.field,filter.value); case 'exists': diff --git a/panels/filtering/module.html b/panels/filtering/module.html index 47a56525401ff..c117f34d4409a 100644 --- a/panels/filtering/module.html +++ b/panels/filtering/module.html @@ -7,7 +7,7 @@ display:inline-block; vertical-align: top; margin-left: 10px; - width: 200px; + width: 220px; padding: 5px 5px 0px 5px; border: #555 1px solid; margin: 0px 5px 5px 0px; @@ -36,7 +36,10 @@ text-decoration: underline; cursor: pointer; } - + .filter-apply { + float:right; + margin-bottom: 5px; + }
@@ -47,17 +50,29 @@ {{filterSrv.list[id].mandate}} - - + +
- + +
+ +
+
+ +
+
+ + +
\ No newline at end of file diff --git a/panels/filtering/module.js b/panels/filtering/module.js index f06037316aee9..5b450f53c5f79 100644 --- a/panels/filtering/module.js +++ b/panels/filtering/module.js @@ -48,4 +48,13 @@ angular.module('kibana.filtering', []) return !_.contains(['type','id','alias','mandate','active','editing'],key); }; + $scope.isEditable = function(filter) { + var uneditable = ['time']; + if(_.contains(uneditable,filter.type)) { + return false; + } else { + return true; + } + }; + }); \ No newline at end of file diff --git a/panels/table/module.js b/panels/table/module.js index 4bd4d12715271..e70aa38703907 100644 --- a/panels/table/module.js +++ b/panels/table/module.js @@ -108,14 +108,14 @@ angular.module('kibana.table', []) }; $scope.build_search = function(field,value,negate) { - var query = field+":"; + var query; // This needs to be abstracted somewhere if(_.isArray(value)) { - query = query+"(" + _.map(value,function(v){return angular.toJson(v);}).join(" AND ") + ")"; + query = "(" + _.map(value,function(v){return angular.toJson(v);}).join(" AND ") + ")"; } else { - query = query+angular.toJson(value); + query = angular.toJson(value); } - filterSrv.set({type:'querystring',query:query,mandate:(negate ? 'mustNot':'must')}); + filterSrv.set({type:'field',field:field,query:query,mandate:(negate ? 'mustNot':'must')}); $scope.panel.offset = 0; dashboard.refresh(); };