diff --git a/src/app/panels/filtering/module.html b/src/app/panels/filtering/module.html
index a0a0a677a94..06728b9f6b8 100644
--- a/src/app/panels/filtering/module.html
+++ b/src/app/panels/filtering/module.html
@@ -47,35 +47,30 @@
No filters available
-
+
- {{filterSrv.list[id].type}}
-
- {{filterSrv.list[id].mandate}}
-
-
- {{filterSrv.list[id].mandate}}
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/app/panels/filtering/module.js b/src/app/panels/filtering/module.js
index 4fc31ccd6df..9c162dc1ce1 100644
--- a/src/app/panels/filtering/module.js
+++ b/src/app/panels/filtering/module.js
@@ -14,7 +14,7 @@ function (angular, app, _) {
var module = angular.module('kibana.panels.filtering', []);
app.useModule(module);
- module.controller('filtering', function($scope, filterSrv, $rootScope, dashboard) {
+ module.controller('filtering', function($scope, filterSrv, graphiteSrv, $rootScope, dashboard) {
$scope.panelMeta = {
status : "Stable",
@@ -45,15 +45,19 @@ function (angular, app, _) {
};
$scope.add = function(query) {
- query = query || '*';
filterSrv.set({
editing : true,
- type : 'querystring',
- query : query,
- mandate : 'must'
+ type : 'filter',
+ name : 'filter name',
+ value : '*',
+ query : 'metric.path.query.*',
},undefined,true);
};
+ $scope.getMetricFilterOptions = function(filter) {
+ return graphiteSrv.metricFindQuery(filter.query);
+ };
+
$scope.refresh = function() {
dashboard.refresh();
};
@@ -62,8 +66,12 @@ function (angular, app, _) {
$rootScope.$broadcast('render');
};
+ $scope.edit_key = function(key) {
+ return !_.contains(['type','id','active','editing', 'value'],key);
+ };
+
$scope.show_key = function(key) {
- return !_.contains(['type','id','alias','mandate','active','editing'],key);
+ return !_.contains(['type','id','active','editing', 'name', 'query', 'value'],key);
};
$scope.isEditable = function(filter) {
diff --git a/src/app/services/filterSrv.js b/src/app/services/filterSrv.js
index d0aa3890e60..5767c619838 100644
--- a/src/app/services/filterSrv.js
+++ b/src/app/services/filterSrv.js
@@ -53,10 +53,16 @@ define([
var _r;
_.defaults(filter,{
- mandate:'must',
active: true
});
+ if (!id && filter.type === 'time') {
+ var _existing = _.findWhere(self.list, {type: 'time'});
+ if (_existing) {
+ id = _existing.id;
+ }
+ }
+
if(!_.isUndefined(id)) {
if(!_.isUndefined(self.list[id])) {
_.extend(self.list[id],filter);
@@ -70,9 +76,7 @@ define([
} else {
var _id = nextId();
var _filter = {
- alias: '',
id: _id,
- mandate: 'must'
};
_.defaults(filter,_filter);
self.list[_id] = filter;
diff --git a/src/app/services/graphite/graphiteSrv.js b/src/app/services/graphite/graphiteSrv.js
index 554f12a7b9e..4df440734ce 100644
--- a/src/app/services/graphite/graphiteSrv.js
+++ b/src/app/services/graphite/graphiteSrv.js
@@ -46,6 +46,20 @@ function (angular, _, $, config) {
return found;
};
+ this.metricFindQuery = function(query) {
+ var url = config.graphiteUrl + '/metrics/find/?query=' + query;
+ return $http.get(url)
+ .then(function(results) {
+ return _.map(results.data, function(metric) {
+ return {
+ text: metric.text,
+ expandable: metric.expandable ? true : false
+ };
+ });
+ });
+ }
+
+
function buildGraphitePostParams(options) {
var clean_options = [];
var graphite_options = ['target', 'targets', 'from', 'until', 'rawData', 'format', 'maxDataPoints'];