Skip to content

Commit

Permalink
Merge pull request #505 from EverythingMe/small_fixes
Browse files Browse the repository at this point in the history
Fix: Update URL after creating an alert
  • Loading branch information
arikfr committed Jul 22, 2015
2 parents bff4d31 + 02582ca commit da56dc8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions rd_ui/app/scripts/controllers/alerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
];
};

var AlertCtrl = function($scope, $routeParams, growl, Query, Events, Alert) {
var AlertCtrl = function($scope, $routeParams, $location, growl, Query, Events, Alert) {
$scope.$parent.pageTitle = "Alerts";

$scope.alertId = $routeParams.alertId;
Expand Down Expand Up @@ -97,8 +97,11 @@
$scope.alert.name = $scope.getDefaultName();
}

$scope.alert.$save(function() {
$scope.alert.$save(function(alert) {
growl.addSuccessMessage("Saved.");
if ($scope.alertId === "new") {
$location.path('/alerts/' + alert.id).replace();
}
}, function() {
growl.addErrorMessage("Failed saving alert.");
});
Expand Down Expand Up @@ -166,6 +169,6 @@

angular.module('redash.controllers')
.controller('AlertsCtrl', ['$scope', 'Events', 'Alert', AlertsCtrl])
.controller('AlertCtrl', ['$scope', '$routeParams', 'growl', 'Query', 'Events', 'Alert', AlertCtrl])
.controller('AlertCtrl', ['$scope', '$routeParams', '$location', 'growl', 'Query', 'Events', 'Alert', AlertCtrl])

})();

0 comments on commit da56dc8

Please sign in to comment.