diff --git a/rd_ui/app/scripts/app.js b/rd_ui/app/scripts/app.js index 9ed52fba..fd0e4ab9 100644 --- a/rd_ui/app/scripts/app.js +++ b/rd_ui/app/scripts/app.js @@ -17,16 +17,9 @@ angular.module('redash', [ ]).config(['$routeProvider', '$locationProvider', '$compileProvider', 'growlProvider', function($routeProvider, $locationProvider, $compileProvider, growlProvider) { - function getQuery(Query, $q, $route) { - var defer = $q.defer(); - - Query.get({ - 'id': $route.current.params.queryId - }, function(query) { - defer.resolve(query); - }); - - return defer.promise; + function getQuery(Query, $route) { + var query = Query.get({'id': $route.current.params.queryId }); + return query.$promise; }; $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|http|data):/); @@ -57,7 +50,7 @@ angular.module('redash', [ controller: 'QueryViewCtrl', reloadOnSearch: false, resolve: { - 'query': ['Query', '$q', '$route', getQuery] + 'query': ['Query', '$route', getQuery] } }); $routeProvider.when('/queries/:queryId/source', { @@ -65,7 +58,7 @@ angular.module('redash', [ controller: 'QueryEditCtrl', reloadOnSearch: false, resolve: { - 'query': ['Query', '$q', '$route', getQuery] + 'query': ['Query', '$route', getQuery] } }); $routeProvider.when('/admin/status', { diff --git a/rd_ui/app/scripts/directives/dashboard_directives.js b/rd_ui/app/scripts/directives/dashboard_directives.js index 44b3ccc5..6142271c 100644 --- a/rd_ui/app/scripts/directives/dashboard_directives.js +++ b/rd_ui/app/scripts/directives/dashboard_directives.js @@ -161,7 +161,7 @@ 'width': $scope.widgetSize }); - widget.$save(function success(response) { + widget.$save().then(function(response) { // update dashboard layout $scope.dashboard.layout = response['layout']; if (response['new_row']) { @@ -173,9 +173,10 @@ // close the dialog $('#add_query_dialog').modal('hide'); reset(); - }, function error(httpResponse) { - $scope.saveInProgress = false; + }).catch(function() { growl.addErrorMessage("Widget can not be added"); + }).finally(function() { + $scope.saveInProgress = false; }); } diff --git a/rd_ui/bower.json b/rd_ui/bower.json index a6954a8a..d8bb06a0 100644 --- a/rd_ui/bower.json +++ b/rd_ui/bower.json @@ -13,7 +13,7 @@ "angular-ui-codemirror": "0.0.5", "highcharts": "3.0.1", "underscore": "1.5.1", - "angular-resource": "1.2.7", + "angular-resource": "1.2.15", "angular-growl": "0.3.1", "angular-route": "1.2.7", "pivottable": "https://github.com/arikfr/pivottable.git", @@ -26,6 +26,6 @@ "angular-scenario": "~1.0.7" }, "resolutions": { - "angular": "~1.2.7" + "angular": "1.2.7" } }