From ad5857e06b4707948007db220ef7a665816ca6ef Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Mon, 21 Oct 2019 10:41:39 -0700 Subject: [PATCH] Add notification custom message fields for workflow pause/approval --- .../notificationTemplates.form.js | 92 ++++++++++++ .../shared/message-utils.service.js | 136 ++++++++++++++---- 2 files changed, 204 insertions(+), 24 deletions(-) diff --git a/awx/ui/client/src/notifications/notificationTemplates.form.js b/awx/ui/client/src/notifications/notificationTemplates.form.js index cfed7fc3d7..92ad403101 100644 --- a/awx/ui/client/src/notifications/notificationTemplates.form.js +++ b/awx/ui/client/src/notifications/notificationTemplates.form.js @@ -671,6 +671,98 @@ export default ['i18n', function(i18n) { "|| notification_type.value == 'webhook')", ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', }, + approved_message: { + label: i18n._('Workflow Approved Message'), + class: 'Form-formGroup--fullWidth', + type: 'syntax_highlight', + mode: 'jinja2', + default: '', + ngShow: "customize_messages && notification_type.value != 'webhook'", + rows: 2, + oneLine: 'true', + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', + }, + approved_body: { + label: i18n._('Workflow Approved Message Body'), + class: 'Form-formGroup--fullWidth', + type: 'syntax_highlight', + mode: 'jinja2', + default: '', + ngShow: "customize_messages && " + + "(notification_type.value == 'email' " + + "|| notification_type.value == 'pagerduty' " + + "|| notification_type.value == 'webhook')", + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', + }, + denied_message: { + label: i18n._('Workflow Denied Message'), + class: 'Form-formGroup--fullWidth', + type: 'syntax_highlight', + mode: 'jinja2', + default: '', + ngShow: "customize_messages && notification_type.value != 'webhook'", + rows: 2, + oneLine: 'true', + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', + }, + denied_body: { + label: i18n._('Workflow Denied Message Body'), + class: 'Form-formGroup--fullWidth', + type: 'syntax_highlight', + mode: 'jinja2', + default: '', + ngShow: "customize_messages && " + + "(notification_type.value == 'email' " + + "|| notification_type.value == 'pagerduty' " + + "|| notification_type.value == 'webhook')", + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', + }, + running_message: { + label: i18n._('Workflow Running Message'), + class: 'Form-formGroup--fullWidth', + type: 'syntax_highlight', + mode: 'jinja2', + default: '', + ngShow: "customize_messages && notification_type.value != 'webhook'", + rows: 2, + oneLine: 'true', + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', + }, + running_body: { + label: i18n._('Workflow Running Message Body'), + class: 'Form-formGroup--fullWidth', + type: 'syntax_highlight', + mode: 'jinja2', + default: '', + ngShow: "customize_messages && " + + "(notification_type.value == 'email' " + + "|| notification_type.value == 'pagerduty' " + + "|| notification_type.value == 'webhook')", + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', + }, + timed_out_message: { + label: i18n._('Workflow Timed Out Message'), + class: 'Form-formGroup--fullWidth', + type: 'syntax_highlight', + mode: 'jinja2', + default: '', + ngShow: "customize_messages && notification_type.value != 'webhook'", + rows: 2, + oneLine: 'true', + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', + }, + timed_out_body: { + label: i18n._('Workflow Timed Out Message Body'), + class: 'Form-formGroup--fullWidth', + type: 'syntax_highlight', + mode: 'jinja2', + default: '', + ngShow: "customize_messages && " + + "(notification_type.value == 'email' " + + "|| notification_type.value == 'pagerduty' " + + "|| notification_type.value == 'webhook')", + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', + }, }, buttons: { //for now always generates