diff --git a/awx/ui/client/lib/components/syntax-highlight/index.js b/awx/ui/client/lib/components/syntax-highlight/index.js index a87b69923f..4936e5ff81 100644 --- a/awx/ui/client/lib/components/syntax-highlight/index.js +++ b/awx/ui/client/lib/components/syntax-highlight/index.js @@ -1,6 +1,4 @@ -// import 'codemirror/mode/jinja2/jinja2'; import syntaxHighlight from './syntax-highlight.directive'; -// import strings from './syntax-highlight.strings'; const MODULE_NAME = 'at.syntax.highlight'; diff --git a/awx/ui/client/src/notifications/edit/edit.controller.js b/awx/ui/client/src/notifications/edit/edit.controller.js index 43e48a8fdf..053c89ad37 100644 --- a/awx/ui/client/src/notifications/edit/edit.controller.js +++ b/awx/ui/client/src/notifications/edit/edit.controller.js @@ -10,7 +10,7 @@ export default ['Rest', 'Wait', 'notification_template', '$scope', '$state', 'GetChoices', 'CreateSelect2', 'Empty', 'NotificationsTypeChange', 'ParseTypeChange', 'i18n', - 'MessageUtils', 'Alert', + 'MessageUtils', function( Rest, Wait, NotificationsFormObject, ProcessErrors, GetBasePath, @@ -18,7 +18,7 @@ export default ['Rest', 'Wait', notification_template, $scope, $state, GetChoices, CreateSelect2, Empty, NotificationsTypeChange, ParseTypeChange, i18n, - MessageUtils, Alert + MessageUtils ) { var generator = GenerateForm, id = notification_template.id, @@ -41,11 +41,19 @@ export default ['Rest', 'Wait', Rest.setUrl(GetBasePath('notification_templates')); Rest.options() .then(({data}) => { - if (!data.actions.POST) { - $state.go("^"); - Alert('Permission Error', 'You do not have permission to add a notification template.', 'alert-info'); + if (data.actions.POST) { + defaultMessages = data.actions.POST.messages.default; + } else { + const defaults = { + message: '', + body: '', + }; + defaultMessages = { + started: defaults, + success: defaults, + error: defaults, + }; } - defaultMessages = data.actions.POST.messages.default; }); GetChoices({ diff --git a/awx/ui/client/src/notifications/notificationTemplates.form.js b/awx/ui/client/src/notifications/notificationTemplates.form.js index bb586424a0..49a7062d2c 100644 --- a/awx/ui/client/src/notifications/notificationTemplates.form.js +++ b/awx/ui/client/src/notifications/notificationTemplates.form.js @@ -587,6 +587,7 @@ export default ['i18n', function(i18n) { type: 'checkbox', class: 'Form-formGroup--fullWidth', default: false, + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', }, started_message: { label: i18n._('Start Message'), @@ -596,6 +597,7 @@ export default ['i18n', function(i18n) { default: '', ngShow: "customize_messages", rows: 2, + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', }, started_body: { label: i18n._('Start Expanded Message'), @@ -604,6 +606,7 @@ export default ['i18n', function(i18n) { mode: 'jinja2', default: '', ngShow: "customize_messages && notification_type.value == 'email'", + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', }, success_message: { label: i18n._('Success Message'), @@ -613,6 +616,7 @@ export default ['i18n', function(i18n) { default: '', ngShow: "customize_messages", rows: 2, + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', }, success_body: { label: i18n._('Success Expanded Message'), @@ -621,6 +625,7 @@ export default ['i18n', function(i18n) { mode: 'jinja2', default: '', ngShow: "customize_messages && notification_type.value == 'email'", + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', }, error_message: { label: i18n._('Error Message'), @@ -630,6 +635,7 @@ export default ['i18n', function(i18n) { default: '', ngShow: "customize_messages", rows: 2, + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', }, error_body: { label: i18n._('Error Expanded Message'), @@ -638,6 +644,7 @@ export default ['i18n', function(i18n) { mode: 'jinja2', default: '', ngShow: "customize_messages && notification_type.value == 'email'", + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', }, },