From 3917620c24b179c937d47f8e5fce7f04009d3efd Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Tue, 13 Oct 2015 16:59:37 +0200 Subject: [PATCH] Implement multiple matchers in Silence creation --- ui/app/js/app.js | 26 ++++++++++++++++++++++---- ui/app/partials/silences.html | 14 ++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) 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 }}