diff --git a/awx/ui/client/lib/components/syntax-highlight/syntax-highlight.directive.js b/awx/ui/client/lib/components/syntax-highlight/syntax-highlight.directive.js index 23c78fb5cf..8ef0be94e0 100644 --- a/awx/ui/client/lib/components/syntax-highlight/syntax-highlight.directive.js +++ b/awx/ui/client/lib/components/syntax-highlight/syntax-highlight.directive.js @@ -16,6 +16,11 @@ function atSyntaxHighlightController ($scope, AngularCodeMirror) { $scope.$watch(varName, () => { $scope.value = $scope[varName]; + if ($scope.oneLine && $scope.value && $scope.value.includes('\n')) { + $scope.hasNewlineError = true; + } else { + $scope.hasNewlineError = false; + } }); } @@ -84,6 +89,7 @@ function atCodeMirrorTextarea () { init: '=', default: '@', rows: '@', + oneLine: '@', mode: '@', } }; diff --git a/awx/ui/client/lib/components/syntax-highlight/syntax-highlight.partial.html b/awx/ui/client/lib/components/syntax-highlight/syntax-highlight.partial.html index 0efa81b061..595021035a 100644 --- a/awx/ui/client/lib/components/syntax-highlight/syntax-highlight.partial.html +++ b/awx/ui/client/lib/components/syntax-highlight/syntax-highlight.partial.html @@ -29,4 +29,5 @@ class="form-control Form-textArea" id="{{ vm.name }}_codemirror"> +
New lines are not supported in this field
diff --git a/awx/ui/client/src/notifications/notificationTemplates.form.js b/awx/ui/client/src/notifications/notificationTemplates.form.js index bb02c7f43c..cfed7fc3d7 100644 --- a/awx/ui/client/src/notifications/notificationTemplates.form.js +++ b/awx/ui/client/src/notifications/notificationTemplates.form.js @@ -610,6 +610,7 @@ export default ['i18n', function(i18n) { default: '', ngShow: "customize_messages && notification_type.value != 'webhook'", rows: 2, + oneLine: 'true', ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', }, started_body: { @@ -632,6 +633,7 @@ export default ['i18n', function(i18n) { default: '', ngShow: "customize_messages && notification_type.value != 'webhook'", rows: 2, + oneLine: 'true', ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', }, success_body: { @@ -654,6 +656,7 @@ export default ['i18n', function(i18n) { default: '', ngShow: "customize_messages && notification_type.value != 'webhook'", rows: 2, + oneLine: 'true', ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', }, error_body: { diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index c8eed8ebea..5f0330b4b2 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -1369,6 +1369,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat html += `value="${fld}" `; html += `default="${field.default || ''}" `; html += `rows="${field.rows || 6}" `; + html += `one-line="${field.oneLine || ''}"`; html += `mode="${field.mode}" `; html += `ng-disabled="${field.ngDisabled}" `; html += '>';