mirror of
https://github.com/ansible/awx.git
synced 2026-05-09 02:17:37 -02:30
show error for disallowed new lines in code mirror
This commit is contained in:
@@ -16,6 +16,11 @@ function atSyntaxHighlightController ($scope, AngularCodeMirror) {
|
|||||||
|
|
||||||
$scope.$watch(varName, () => {
|
$scope.$watch(varName, () => {
|
||||||
$scope.value = $scope[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: '=',
|
init: '=',
|
||||||
default: '@',
|
default: '@',
|
||||||
rows: '@',
|
rows: '@',
|
||||||
|
oneLine: '@',
|
||||||
mode: '@',
|
mode: '@',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,4 +29,5 @@
|
|||||||
class="form-control Form-textArea"
|
class="form-control Form-textArea"
|
||||||
id="{{ vm.name }}_codemirror">
|
id="{{ vm.name }}_codemirror">
|
||||||
</textarea>
|
</textarea>
|
||||||
|
<div class="error" ng-show="hasNewlineError">New lines are not supported in this field</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -610,6 +610,7 @@ export default ['i18n', function(i18n) {
|
|||||||
default: '',
|
default: '',
|
||||||
ngShow: "customize_messages && notification_type.value != 'webhook'",
|
ngShow: "customize_messages && notification_type.value != 'webhook'",
|
||||||
rows: 2,
|
rows: 2,
|
||||||
|
oneLine: 'true',
|
||||||
ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)',
|
ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)',
|
||||||
},
|
},
|
||||||
started_body: {
|
started_body: {
|
||||||
@@ -632,6 +633,7 @@ export default ['i18n', function(i18n) {
|
|||||||
default: '',
|
default: '',
|
||||||
ngShow: "customize_messages && notification_type.value != 'webhook'",
|
ngShow: "customize_messages && notification_type.value != 'webhook'",
|
||||||
rows: 2,
|
rows: 2,
|
||||||
|
oneLine: 'true',
|
||||||
ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)',
|
ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)',
|
||||||
},
|
},
|
||||||
success_body: {
|
success_body: {
|
||||||
@@ -654,6 +656,7 @@ export default ['i18n', function(i18n) {
|
|||||||
default: '',
|
default: '',
|
||||||
ngShow: "customize_messages && notification_type.value != 'webhook'",
|
ngShow: "customize_messages && notification_type.value != 'webhook'",
|
||||||
rows: 2,
|
rows: 2,
|
||||||
|
oneLine: 'true',
|
||||||
ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)',
|
ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)',
|
||||||
},
|
},
|
||||||
error_body: {
|
error_body: {
|
||||||
|
|||||||
@@ -1369,6 +1369,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += `value="${fld}" `;
|
html += `value="${fld}" `;
|
||||||
html += `default="${field.default || ''}" `;
|
html += `default="${field.default || ''}" `;
|
||||||
html += `rows="${field.rows || 6}" `;
|
html += `rows="${field.rows || 6}" `;
|
||||||
|
html += `one-line="${field.oneLine || ''}"`;
|
||||||
html += `mode="${field.mode}" `;
|
html += `mode="${field.mode}" `;
|
||||||
html += `ng-disabled="${field.ngDisabled}" `;
|
html += `ng-disabled="${field.ngDisabled}" `;
|
||||||
html += '></at-syntax-highlight>';
|
html += '></at-syntax-highlight>';
|
||||||
|
|||||||
Reference in New Issue
Block a user