1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Merge pull request #4103 from AlexSCorey/79-NotifyOnJobStart

Adds notify on start toggle

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-06-21 16:51:52 +00:00 committed by GitHub
commit b369609f07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 5 deletions

View File

@ -35,6 +35,18 @@ export default ['i18n', 'templateUrl', function(i18n, templateUrl){
excludeModal: true,
columnClass: 'd-none d-sm-flex col-md-4 col-sm-3'
},
notification_templates_started: {
label: i18n._("Start"),
flag: 'notification_templates_started',
type: "toggle",
ngClick: "toggleNotification($event, notification.id, \"notification_templates_started\")",
ngDisabled: "!sufficientRoleForNotifToggle",
awToolTip: "{{ schedule.play_tip }}",
dataTipWatch: "schedule.play_tip",
dataPlacement: "right",
nosort: true,
columnClass: 'd-none d-md-flex justify-content-start col-md-1'
},
notification_templates_success: {
label: i18n._('Success'),
flag: 'notification_templates_success',
@ -45,11 +57,11 @@ export default ['i18n', 'templateUrl', function(i18n, templateUrl){
dataTipWatch: "schedule.play_tip",
dataPlacement: "right",
nosort: true,
columnClass: 'd-none d-md-flex justify-content-start col-md-2'
columnClass: 'd-none d-md-flex justify-content-start col-md-1'
},
notification_templates_error: {
label: i18n._('Failure'),
columnClass: 'd-none d-md-flex justify-content-start col-md-2 NotifierList-lastColumn',
columnClass: 'd-none d-md-flex justify-content-start col-md-1 NotifierList-lastColumn',
flag: 'notification_templates_error',
type: "toggle",
ngClick: "toggleNotification($event, notification.id, \"notification_templates_error\")",

View File

@ -49,7 +49,7 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
scope.relatednotificationsRemove();
}
scope.relatednotificationsRemove = scope.$on('relatednotifications', function () {
var columns = ['/notification_templates_success/', '/notification_templates_error/'];
var columns = ['/notification_templates_started/', '/notification_templates_success/', '/notification_templates_error/'];
GetChoices({
scope: scope,
@ -64,7 +64,10 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
Rest.setUrl(notifier_url);
Rest.get()
.then(function(response) {
var type = (response.config.url.indexOf('success')>0) ? "notification_templates_success" : "notification_templates_error";
let checkForSuccessOrError = response.config.url.indexOf('success') > 0 ? "notification_templates_success" : "notification_templates_error";
let type = response.config.url.indexOf('started') > 0 ? "notification_templates_started" : checkForSuccessOrError;
if (response.data.results) {
_.forEach(response.data.results, function(result){
_.forEach(scope.notifications, function(notification){

View File

@ -21,7 +21,7 @@ export default ['Wait', 'ProcessErrors', 'Rest',
notifier = params.notifier,
notifier_id = params.notifier.id,
callback = params.callback,
column = params.column, // notification_template_success/notification_template__error
column = params.column, // notification_template_success/notification_template__error/notification_template_started
url = params.url + "/" + column + '/';
if(!notifier[column]){