Skip to content

Commit

Permalink
Reset and hide form after silence creation
Browse files Browse the repository at this point in the history
  • Loading branch information
grobie committed Aug 31, 2016
1 parent 4e8bcfb commit 94c8320
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ui/app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ angular.module('am.controllers').controller('SilencesCtrl', function($scope, $lo
};

$scope.$on('silence-created', function(evt) {
$scope.toggleForm();
$scope.refresh();
});
$scope.$on('silence-deleted', function(evt) {
Expand Down Expand Up @@ -402,6 +403,11 @@ angular.module('am.controllers').controller('SilenceCreateCtrl', function($scope

$scope.reset();

$scope.$on('silence-created', function(evt) {
$scope.form.$setUntouched();
$scope.reset();
});

$scope.addMatcher = function() {
$scope.silence.matchers.push({});
};
Expand All @@ -414,7 +420,6 @@ angular.module('am.controllers').controller('SilenceCreateCtrl', function($scope
var now = new Date;
// Go through conditions that go against immutability of historic silences.
var createNew = !angular.equals(origSilence.matchers, $scope.silence.matchers);
console.log(origSilence, $scope.silence);
createNew = createNew || $scope.silence.elapsed;
createNew = createNew || ($scope.silence.active && (origSilence.startsAt == $scope.silence.startsAt || origSilence.endsAt == $scope.silence.endsAt));

Expand Down

0 comments on commit 94c8320

Please sign in to comment.