diff --git a/src/app/panels/filtering/module.js b/src/app/panels/filtering/module.js
index 9fc84471085..6c1e6b47962 100644
--- a/src/app/panels/filtering/module.js
+++ b/src/app/panels/filtering/module.js
@@ -27,15 +27,33 @@ function (angular, app, _) {
_.defaults($scope.panel,_d);
$scope.init = function() {
- $scope.filterSrv = filterSrv;
+ $scope.filterList = filterSrv.list;
};
$scope.remove = function(filter) {
filterSrv.remove(filter);
};
+ $scope.filterOptionSelected = function(filter, option) {
+ filterSrv.filterOptionSelected(filter, option);
+ $scope.applyFilterToOtherFilters(filter);
+ };
+
+ $scope.applyFilterToOtherFilters = function(updatedFilter) {
+ _.each($scope.filterList, function(filter) {
+ if (filter === updatedFilter) {
+ return;
+ }
+ if (filter.query.indexOf(updatedFilter.name) !== -1) {
+ $scope.applyFilter(filter);
+ }
+ });
+ };
+
$scope.applyFilter = function(filter) {
- datasourceSrv.default.metricFindQuery(filter.query)
+ var query = filterSrv.applyFilterToTarget(filter.query);
+
+ datasourceSrv.default.metricFindQuery(query)
.then(function (results) {
filter.editing=undefined;
filter.options = _.map(results, function(node) {
diff --git a/src/app/services/all.js b/src/app/services/all.js
index b4f17ad3491..2f2ecfb3543 100644
--- a/src/app/services/all.js
+++ b/src/app/services/all.js
@@ -1,10 +1,10 @@
define([
'./alertSrv',
'./dashboard',
+ './datasourceSrv',
'./filterSrv',
'./timer',
'./panelMove',
- './datasourceSrv',
'./keyboardManager',
'./annotationsSrv',
'./playlistSrv',