mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 11:20:39 -03:30
add validation for required values and metadata fields
This commit is contained in:
parent
47f31b41fb
commit
736bd2ed67
@ -2,11 +2,18 @@
|
||||
<at-form state="vm.form" autocomplete="off" id="external_test_form">
|
||||
<at-input-group col="12" tab="20" state="vm.form.inputs" form-id="external_test"></at-input-group>
|
||||
<at-action-group col="12" pos="right">
|
||||
<at-action-button variant="tertiary" ng-click="vm.onClose()">
|
||||
{{::vm.strings.get('CLOSE')}}
|
||||
<at-action-button
|
||||
variant="tertiary"
|
||||
ng-click="vm.onClose()"
|
||||
>
|
||||
{{::vm.strings.get('CLOSE')}}
|
||||
</at-action-button>
|
||||
<at-action-button variant="primary" ng-click="vm.onSubmit()">
|
||||
{{::vm.strings.get('RUN')}}
|
||||
<at-action-button
|
||||
variant="primary"
|
||||
ng-click="vm.onSubmit()"
|
||||
ng-disabled="!vm.form.isValid || vm.form.disabled"
|
||||
>
|
||||
{{::vm.strings.get('RUN')}}
|
||||
</at-action-button>
|
||||
</at-action-group>
|
||||
</at-form>
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
<at-action-button
|
||||
variant="secondary"
|
||||
ng-click="vm.onTest()"
|
||||
ng-disabled="!vm.form.isValid || vm.form.disabled"
|
||||
ng-show="vm.tabs.metadata._active"
|
||||
>
|
||||
{{::vm.strings.get('TEST')}}
|
||||
@ -50,6 +51,7 @@
|
||||
<at-action-button
|
||||
variant="primary"
|
||||
ng-click="vm.onNext()"
|
||||
ng-disabled="!vm.selectedId"
|
||||
ng-show="vm.tabs.credential._active"
|
||||
>
|
||||
{{::vm.strings.get('NEXT')}}
|
||||
@ -57,6 +59,7 @@
|
||||
<at-action-button
|
||||
variant="primary"
|
||||
ng-click="vm.onSelect()"
|
||||
ng-disabled="!vm.form.isValid || vm.form.disabled"
|
||||
ng-show="vm.tabs.metadata._active"
|
||||
>
|
||||
{{::vm.strings.get('OK')}}
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
const templateUrl = require('~components/action/action-button.partial.html');
|
||||
|
||||
function ActionButtonController () {
|
||||
const vm = this || {};
|
||||
vm.$onInit = () => {
|
||||
const { variant } = vm;
|
||||
|
||||
if (variant === 'primary') {
|
||||
vm.color = 'success';
|
||||
vm.fill = '';
|
||||
}
|
||||
|
||||
if (variant === 'secondary') {
|
||||
vm.color = 'info';
|
||||
vm.fill = '';
|
||||
}
|
||||
|
||||
if (variant === 'tertiary') {
|
||||
vm.color = 'default';
|
||||
vm.fill = 'Hollow';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
templateUrl,
|
||||
controller: ActionButtonController,
|
||||
controllerAs: 'vm',
|
||||
transclude: true,
|
||||
bindings: {
|
||||
variant: '@',
|
||||
},
|
||||
};
|
||||
@ -0,0 +1,48 @@
|
||||
const templateUrl = require('~components/action/action-button.partial.html');
|
||||
|
||||
function link (scope, element, attrs, controllers) {
|
||||
const [actionButtonController] = controllers;
|
||||
|
||||
actionButtonController.init(scope);
|
||||
}
|
||||
|
||||
function ActionButtonController () {
|
||||
const vm = this || {};
|
||||
|
||||
vm.init = (scope) => {
|
||||
const { variant } = scope;
|
||||
|
||||
if (variant === 'primary') {
|
||||
vm.color = 'success';
|
||||
vm.fill = '';
|
||||
}
|
||||
|
||||
if (variant === 'secondary') {
|
||||
vm.color = 'info';
|
||||
vm.fill = '';
|
||||
}
|
||||
|
||||
if (variant === 'tertiary') {
|
||||
vm.color = 'default';
|
||||
vm.fill = 'Hollow';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function atActionButton () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
replace: true,
|
||||
templateUrl,
|
||||
require: ['atActionButton'],
|
||||
controller: ActionButtonController,
|
||||
controllerAs: 'vm',
|
||||
link,
|
||||
scope: {
|
||||
variant: '@',
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default atActionButton;
|
||||
@ -202,7 +202,10 @@ function AtFormController (eventService, strings) {
|
||||
|
||||
if (isValid !== vm.state.isValid) {
|
||||
vm.state.isValid = isValid;
|
||||
scope.state.isValid = vm.state.isValid;
|
||||
}
|
||||
|
||||
if (isValid !== scope.state.isValid) {
|
||||
scope.state.isValid = isValid;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import atLibServices from '~services';
|
||||
|
||||
import actionGroup from '~components/action/action-group.directive';
|
||||
import actionButton from '~components/action/action-button.component';
|
||||
import actionButton from '~components/action/action-button.directive';
|
||||
import divider from '~components/utility/divider.directive';
|
||||
import dynamicSelect from '~components/input/dynamic-select.directive';
|
||||
import easyModal from '~components/easy-modal/easy-modal.component';
|
||||
@ -56,7 +56,7 @@ angular
|
||||
atCodeMirror
|
||||
])
|
||||
.directive('atActionGroup', actionGroup)
|
||||
.component('atActionButton', actionButton)
|
||||
.directive('atActionButton', actionButton)
|
||||
.directive('atDivider', divider)
|
||||
.directive('atDynamicSelect', dynamicSelect)
|
||||
.component('atEasyModal', easyModal)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user