From 149e0835f8fb43e8e88542a04491f8c260ac4db8 Mon Sep 17 00:00:00 2001 From: Iftach Bar Date: Mon, 12 Jan 2015 09:22:53 +0200 Subject: [PATCH 1/3] fixed jshint stuff - semicolon in different places --- rd_ui/app/scripts/controllers/dashboard.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rd_ui/app/scripts/controllers/dashboard.js b/rd_ui/app/scripts/controllers/dashboard.js index 338d27bdb7..10322b78d9 100644 --- a/rd_ui/app/scripts/controllers/dashboard.js +++ b/rd_ui/app/scripts/controllers/dashboard.js @@ -38,7 +38,7 @@ originFilter.current = value; }); }); - }; + } // TODO: merge values. filters[filter.name].originFilters.push(filter); @@ -83,8 +83,8 @@ }); }, $scope.refreshRate); - }; - } + } + }; $scope.triggerRefresh = function() { $scope.refreshEnabled = !$scope.refreshEnabled; From b2bab33baa94f911f731569cf9aceda517805d81 Mon Sep 17 00:00:00 2001 From: Iftach Bar Date: Mon, 12 Jan 2015 09:23:27 +0200 Subject: [PATCH 2/3] added support for deep links to dashboards with saved filters --- rd_ui/app/scripts/controllers/dashboard.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rd_ui/app/scripts/controllers/dashboard.js b/rd_ui/app/scripts/controllers/dashboard.js index 10322b78d9..2c775beeaf 100644 --- a/rd_ui/app/scripts/controllers/dashboard.js +++ b/rd_ui/app/scripts/controllers/dashboard.js @@ -1,5 +1,5 @@ (function() { - var DashboardCtrl = function($scope, Events, Widget, $routeParams, $http, $timeout, $q, Dashboard) { + var DashboardCtrl = function($scope, Events, Widget, $routeParams, $location, $http, $timeout, $q, Dashboard) { $scope.refreshEnabled = false; $scope.refreshRate = 60; @@ -15,7 +15,7 @@ return _.map(row, function (widget) { var w = new Widget(widget); - if (w.visualization && dashboard.dashboard_filters_enabled) { + if (w.visualization) { promises.push(w.getQuery().getQueryResultPromise()); } @@ -32,6 +32,9 @@ // TODO: first object should be a copy, otherwise one of the chart filters behaves different than the others. filters[filter.name] = filter; filters[filter.name].originFilters = []; + if (_.has($location.search(), filter.friendlyName)) { + filter.current = $location.search()[filter.friendlyName]; + } $scope.$watch(function () { return filter.current }, function (value) { _.each(filter.originFilters, function (originFilter) { @@ -45,9 +48,7 @@ }); }); - if (dashboard.dashboard_filters_enabled) { - $scope.filters = _.values(filters); - } + $scope.filters = _.values(filters); }); @@ -137,7 +138,7 @@ }; angular.module('redash.controllers') - .controller('DashboardCtrl', ['$scope', 'Events', 'Widget', '$routeParams', '$http', '$timeout', '$q', 'Dashboard', DashboardCtrl]) + .controller('DashboardCtrl', ['$scope', 'Events', 'Widget', '$routeParams', '$location', '$http', '$timeout', '$q', 'Dashboard', DashboardCtrl]) .controller('WidgetCtrl', ['$scope', 'Events', 'Query', WidgetCtrl]) -})(); \ No newline at end of file +})(); From 02c81632653a54017d202d3bd3b1327fdabf832e Mon Sep 17 00:00:00 2001 From: barnash Date: Mon, 12 Jan 2015 18:56:44 +0200 Subject: [PATCH 3/3] Changed the query param to something more url friendly --- rd_ui/app/scripts/controllers/dashboard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rd_ui/app/scripts/controllers/dashboard.js b/rd_ui/app/scripts/controllers/dashboard.js index 2c775beeaf..ecff1fd8f6 100644 --- a/rd_ui/app/scripts/controllers/dashboard.js +++ b/rd_ui/app/scripts/controllers/dashboard.js @@ -32,8 +32,8 @@ // TODO: first object should be a copy, otherwise one of the chart filters behaves different than the others. filters[filter.name] = filter; filters[filter.name].originFilters = []; - if (_.has($location.search(), filter.friendlyName)) { - filter.current = $location.search()[filter.friendlyName]; + if (_.has($location.search(), filter.name)) { + filter.current = $location.search()[filter.name]; } $scope.$watch(function () { return filter.current }, function (value) {