Adds notify on start toggle

This commit is contained in:
Alex Corey
2019-06-05 11:00:36 -04:00
parent e269634afc
commit a7c787af02
3 changed files with 23 additions and 8 deletions

View File

@@ -35,6 +35,18 @@ export default ['i18n', 'templateUrl', function(i18n, templateUrl){
excludeModal: true, excludeModal: true,
columnClass: 'd-none d-sm-flex col-md-4 col-sm-3' 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: { notification_templates_success: {
label: i18n._('Success'), label: i18n._('Success'),
flag: 'notification_templates_success', flag: 'notification_templates_success',
@@ -45,11 +57,11 @@ export default ['i18n', 'templateUrl', function(i18n, templateUrl){
dataTipWatch: "schedule.play_tip", dataTipWatch: "schedule.play_tip",
dataPlacement: "right", dataPlacement: "right",
nosort: true, 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: { notification_templates_error: {
label: i18n._('Failure'), 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', flag: 'notification_templates_error',
type: "toggle", type: "toggle",
ngClick: "toggleNotification($event, notification.id, \"notification_templates_error\")", 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.relatednotificationsRemove = scope.$on('relatednotifications', function () { 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({ GetChoices({
scope: scope, scope: scope,
@@ -59,12 +59,15 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
callback: 'choicesReadyNotifierList' callback: 'choicesReadyNotifierList'
}); });
_.map(columns, function(column){ _.map(columns, function(column){
var notifier_url = url + id + column; var notifier_url = url + id + column;
Rest.setUrl(notifier_url); Rest.setUrl(notifier_url);
Rest.get() Rest.get()
.then(function(response) { .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) { if (response.data.results) {
_.forEach(response.data.results, function(result){ _.forEach(response.data.results, function(result){
_.forEach(scope.notifications, function(notification){ _.forEach(scope.notifications, function(notification){

View File

@@ -21,7 +21,7 @@ export default ['Wait', 'ProcessErrors', 'Rest',
notifier = params.notifier, notifier = params.notifier,
notifier_id = params.notifier.id, notifier_id = params.notifier.id,
callback = params.callback, 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 + '/'; url = params.url + "/" + column + '/';
if(!notifier[column]){ if(!notifier[column]){
@@ -45,7 +45,7 @@ export default ['Wait', 'ProcessErrors', 'Rest',
notifier[column] = !notifier[column]; notifier[column] = !notifier[column];
} }
// Hide the working spinner // Hide the working spinner
Wait('stop'); Wait('stop');
}) })
.catch(({data, status}) => { .catch(({data, status}) => {
ProcessErrors(scope, data, status, null, { hdr: 'Error!', ProcessErrors(scope, data, status, null, { hdr: 'Error!',