mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 11:20:39 -03:30
Adds notify on start toggle
This commit is contained in:
parent
e269634afc
commit
a7c787af02
@ -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\")",
|
||||
|
||||
@ -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,
|
||||
@ -59,12 +59,15 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
|
||||
callback: 'choicesReadyNotifierList'
|
||||
});
|
||||
|
||||
_.map(columns, function(column){
|
||||
var notifier_url = url + id + column;
|
||||
_.map(columns, function(column){
|
||||
var notifier_url = url + id + column;
|
||||
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){
|
||||
|
||||
@ -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]){
|
||||
@ -45,7 +45,7 @@ export default ['Wait', 'ProcessErrors', 'Rest',
|
||||
notifier[column] = !notifier[column];
|
||||
}
|
||||
// Hide the working spinner
|
||||
Wait('stop');
|
||||
Wait('stop');
|
||||
})
|
||||
.catch(({data, status}) => {
|
||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user