update angular-resource (adds .$promise support)

This commit is contained in:
Amir Nissim 2014-03-26 17:27:18 +02:00
parent 1bb12b87ac
commit 72c74101da
3 changed files with 11 additions and 17 deletions

View File

@ -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', {

View File

@ -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;
});
}

View File

@ -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"
}
}