Skip to content

Commit

Permalink
Merge pull request #369 from EverythingMe/fix/dashboard_filters
Browse files Browse the repository at this point in the history
Fix: filters got linked when they shouldn't have.
  • Loading branch information
arikfr committed Feb 1, 2015
2 parents b76906b + e113642 commit c131dab
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions rd_ui/app/scripts/controllers/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,19 @@
var filters = {};
_.each(queryResults, function(queryResult) {
var queryFilters = queryResult.getFilters();
_.each(queryFilters, function (filter) {
if (!_.has(filters, filter.name)) {
// TODO: first object should be a copy, otherwise one of the chart filters behaves different than the others.
_.each(queryFilters, function (queryFilter) {
var hasQueryStringValue = _.has($location.search(), queryFilter.name);

if (!(hasQueryStringValue || dashboard.dashboard_filters_enabled)) {
// If dashboard filters not enabled, or no query string value given, skip filters linking.
return;
}

if (!_.has(filters, queryFilter.name)) {
var filter = _.extend({}, queryFilter);
filters[filter.name] = filter;
filters[filter.name].originFilters = [];
if (_.has($location.search(), filter.name)) {
if (hasQueryStringValue) {
filter.current = $location.search()[filter.name];
}

Expand All @@ -44,7 +51,7 @@
}

// TODO: merge values.
filters[filter.name].originFilters.push(filter);
filters[queryFilter.name].originFilters.push(queryFilter);
});
});

Expand Down

0 comments on commit c131dab

Please sign in to comment.