UI silencing on alert items fixed

This commit is contained in:
Fabian Reinartz 2015-11-06 17:35:37 +01:00
parent a3dc8fb36e
commit 7be65952e3
3 changed files with 16 additions and 9 deletions

View File

@ -44,10 +44,10 @@ header #logo {
min-width: 400px; min-width: 400px;
} }
.silence .delete-button { .silence .delete-button, .alert-item .silence-button {
opacity: 0.2; opacity: 0.2;
} }
.silence:hover .delete-button { .silence:hover .delete-button, .alert-item:hover .silence-button {
opacity: 1.0; opacity: 1.0;
} }
@ -76,6 +76,10 @@ header #logo {
margin-bottom: 24px; margin-bottom: 24px;
} }
.alert-item .silence-alert {
padding: 1em 2em;
}
.list-item { .list-item {
background: #fff; background: #fff;
margin-bottom: 1px; margin-bottom: 1px;

View File

@ -207,6 +207,9 @@ angular.module('am.controllers').controller('AlertCtrl',
}); });
}, $scope.silence.matchers); }, $scope.silence.matchers);
$scope.$on('silence-created', function(evt) {
$scope.toggleSilenceForm();
});
} }
); );
@ -231,12 +234,12 @@ angular.module('am.controllers').controller('AlertsCtrl',
); );
angular.module('am.controllers').controller('SilenceCtrl', angular.module('am.controllers').controller('SilenceCtrl',
function($scope, $rootScope, Silence) { function($scope, Silence) {
$scope.delete = function(sil) { $scope.delete = function(sil) {
Silence.delete({id: sil.id}, Silence.delete({id: sil.id},
function(data) { function(data) {
$rootScope.$broadcast('silence-deleted'); $scope.$emit('silence-deleted');
}, },
function(data) { function(data) {
$scope.error = data.data; $scope.error = data.data;
@ -279,7 +282,7 @@ angular.module('am.controllers').controller('SilencesCtrl',
); );
angular.module('am.controllers').controller('SilenceCreateCtrl', angular.module('am.controllers').controller('SilenceCreateCtrl',
function($scope, $rootScope, Silence) { function($scope, Silence) {
$scope.error = null; $scope.error = null;
$scope.silence = $scope.silence || {}; $scope.silence = $scope.silence || {};
@ -320,7 +323,7 @@ angular.module('am.controllers').controller('SilenceCreateCtrl',
$scope.create = function() { $scope.create = function() {
Silence.create($scope.silence, Silence.create($scope.silence,
function(data) { function(data) {
$rootScope.$broadcast('silence-created'); $scope.$emit('silence-created');
$scope.reset(); $scope.reset();
}, },
function(data) { function(data) {

View File

@ -7,12 +7,12 @@
</span> </span>
<div class="right"> <div class="right">
<button type="secondary" ng-click="toggleSilenceForm()" small>Silence</button> <button class="silence-button" type="secondary" ng-click="toggleSilenceForm()" small upper>Silence</button>
</div> </div>
</div> </div>
<div> <div class="silence-alert" ng-show="showSilenceForm">
<silence-form ng-show="showSilenceForm" silence="silence"></silence-form> <silence-form silence="silence"></silence-form>
</div> </div>
<div class="detail group"> <div class="detail group">