diff --git a/ui/app/js/app.js b/ui/app/js/app.js index 69bfb4ad..7aef686c 100644 --- a/ui/app/js/app.js +++ b/ui/app/js/app.js @@ -24,8 +24,10 @@ angular.module('am.controllers').controller('SilencesCtrl', $scope.refresh = function() { Silence.query({}, function(data) { - console.log(data); $scope.silences = data.data || []; + }, + function(data) { + } ); } @@ -54,13 +56,29 @@ angular.module('am.controllers').controller('SilenceCreateCtrl', $scope.silence = { startsAt: now, endsAt: end, - matchers: [] + matchers: [{}] } $scope.create = function() { - Silence.create($scope.silence); - $scope.$parent.refresh(); + Silence.create($scope.silence, + function(data) { + $scope.refresh(); + }, + function(data) { + $scope.error = data.data; + } + ); } + + $scope.error = null; + + $scope.newMatcher = function() { + $scope.silence.matchers.push({}); + } + $scope.delMatcher = function(i) { + $scope.silence.matchers.splice(i, 1); + } + } ); diff --git a/ui/app/partials/silences.html b/ui/app/partials/silences.html index c3a9898d..0a6fba7e 100644 --- a/ui/app/partials/silences.html +++ b/ui/app/partials/silences.html @@ -1,11 +1,17 @@
-
+ Start: End: - - - regex: +
+ + + regex: + + +
+ +
Error: {{ error }}