Merge pull request #2652 from charltonaustin/failing_repository_notifications_to_be_disabled_after_n_failures_in_a_row_144646649

Failing repository notifications to be disabled after n failures in a row 144646649
This commit is contained in:
Charlton Austin 2017-05-22 09:30:53 -04:00 committed by GitHub
commit a71f60a9c1
14 changed files with 156 additions and 33 deletions

View file

@ -236,6 +236,11 @@ angular.module('quay').directive('logsView', function () {
return 'Delete notification of event "' + eventData['title'] + '" for repository {namespace}/{repo}';
},
'reset_repo_notification': function(metadata) {
var eventData = ExternalNotificationData.getEventInfo(metadata.event);
return 'Re-enable notification of event "' + eventData['title'] + '" for repository {namespace}/{repo}';
},
'regenerate_robot_token': 'Regenerated token for robot {robot}',
'service_key_create': function(metadata) {
@ -313,6 +318,7 @@ angular.module('quay').directive('logsView', function () {
'reset_application_client_secret': 'Reset Client Secret',
'add_repo_notification': 'Add repository notification',
'delete_repo_notification': 'Delete repository notification',
'reset_repo_notification': 'Re-enable repository notification',
'regenerate_robot_token': 'Regenerate Robot Token',
'service_key_create': 'Create Service Key',
'service_key_approve': 'Approve Service Key',

View file

@ -93,6 +93,20 @@ angular.module('quay').directive('repositoryEventsTable', function () {
}, ApiService.errorDisplay('Cannot delete notification'));
};
$scope.reenableNotification = function(notification) {
var params = {
'repository': $scope.repository.namespace + '/' + $scope.repository.name,
'uuid': notification.uuid
};
ApiService.resetRepositoryNotificationFailures(null, params).then(function() {
var index = $.inArray(notification, $scope.notifications);
if (index < 0) { return; }
$scope.notifications[index].number_of_failures = 0
}, ApiService.errorDisplay('Cannot re-enable notification'));
};
$scope.showNotifyInfo = function(notification, field) {
var dom = document.createElement('input');
dom.setAttribute('type', 'text');