Minor enhancement to silence form

This commit is contained in:
Fabian Reinartz 2015-11-02 18:51:54 +01:00
parent f4a31855cc
commit a1a9840656
3 changed files with 28 additions and 24 deletions

View File

@ -40,6 +40,8 @@ header #logo {
#silence-create {
background: #fff;
width: 100%;
min-width: 400px;
}
.silence-matchers {

View File

@ -206,9 +206,7 @@ angular.module('am.controllers').controller('AlertsCtrl',
$scope.refresh = function() {
Route.query({},
function(data) {
console.log(data);
$scope.route = data.data;
console.log($scope.route)
},
function(data) {
@ -231,17 +229,17 @@ angular.module('am.controllers').controller('SilencesCtrl',
$scope.silences = data.data || [];
},
function(data) {
$scope.error = data.data;
}
);
}
};
$scope.delete = function(sil) {
Silence.delete({
id: sil.id
})
$scope.refresh()
}
};
$scope.refresh();
}
@ -263,12 +261,12 @@ angular.module('am.controllers').controller('SilenceCreateCtrl',
$scope.error = null;
$scope.newMatcher = function() {
$scope.addMatcher = function() {
$scope.silence.matchers.push({});
}
};
$scope.delMatcher = function(i) {
$scope.silence.matchers.splice(i, 1);
}
};
$scope.reset = function() {
var now = new Date();
var end = new Date();
@ -285,10 +283,13 @@ angular.module('am.controllers').controller('SilenceCreateCtrl',
$scope.silence.startsAt = now;
$scope.silence.endsAt = end;
$scope.silence.comment = "";
$scope.silence.createdBy = "";
if (!$scope.silence.matchers) {
$scope.silence.matchers = [{}];
$scope.silence.matchers = [{}, {}];
}
}
};
$scope.reset();
}

View File

@ -17,23 +17,24 @@
</span>
</div>
<div class="container-right group">
<div>
Details: <input class="collapse" ng-class="{open:collapse}" type="checkbox" ng-model="collapse"></input>
</div>
<div class="left" ng-show="collapse">
<table class="table-flat">
<tbody>
<tr ng-repeat="(name, val) in a.annotations | orderBy:name">
<td style="padding-right: 3em"><em>{{ name }}</em></td>
<td style="white-space: pre-line;">{{ val }}</td>
</tr>
</tbody>
</table>
</div>
<div class="right">
<button type="secondary" ng-click="toggleSilenceForm()" small>Silence</button>
</div>
<div class="left">
<silence-form ng-show="showSilenceForm" silence="silence"></silence-form>
Details: <input class="collapse" ng-class="{open:collapse}" type="checkbox" ng-model="collapse"></input>
<div class="left" ng-show="collapse">
<table class="table-flat">
<tbody>
<tr ng-repeat="(name, val) in a.annotations | orderBy:name">
<td style="padding-right: 3em"><em>{{ name }}</em></td>
<td style="white-space: pre-line;">{{ val }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>