mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 20:51:21 -03:30
show error for disallowed new lines in code mirror
This commit is contained in:
parent
a10ad58c75
commit
901d41e261
@ -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: '@',
|
||||
}
|
||||
};
|
||||
|
||||
@ -29,4 +29,5 @@
|
||||
class="form-control Form-textArea"
|
||||
id="{{ vm.name }}_codemirror">
|
||||
</textarea>
|
||||
<div class="error" ng-show="hasNewlineError">New lines are not supported in this field</div>
|
||||
</div>
|
||||
|
||||
@ -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: {
|
||||
|
||||
@ -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 += '></at-syntax-highlight>';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user