mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
Add method to remove input data on credential type change
This commit is contained in:
parent
09ac71518e
commit
2b01c24dce
@ -35,6 +35,7 @@ function EditCredentialsController (models, $state) {
|
||||
|
||||
vm.form.save = data => {
|
||||
data.user = me.getSelf().id;
|
||||
credential.clearTypeInputs();
|
||||
|
||||
return credential.request('put', data);
|
||||
};
|
||||
|
||||
44
awx/ui/client/lib/components/input/checkbox.directive.js
Normal file
44
awx/ui/client/lib/components/input/checkbox.directive.js
Normal file
@ -0,0 +1,44 @@
|
||||
function atInputCheckboxLink (scope, element, attrs, controllers) {
|
||||
let formController = controllers[0];
|
||||
let inputController = controllers[1];
|
||||
|
||||
if (scope.tab === '1') {
|
||||
element.find('input')[0].focus();
|
||||
}
|
||||
|
||||
inputController.init(scope, element, formController);
|
||||
}
|
||||
|
||||
function AtInputCheckboxController (baseInputController) {
|
||||
let vm = this || {};
|
||||
|
||||
vm.init = (scope, element, form) => {
|
||||
baseInputController.call(vm, 'input', scope, element, form);
|
||||
|
||||
vm.check();
|
||||
};
|
||||
}
|
||||
|
||||
AtInputCheckboxController.$inject = ['BaseInputController'];
|
||||
|
||||
function atInputCheckbox (pathService) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
replace: true,
|
||||
require: ['^^atForm', 'atInputCheckbox'],
|
||||
templateUrl: pathService.getPartialPath('components/input/checkbox'),
|
||||
controller: AtInputCheckboxController,
|
||||
controllerAs: 'vm',
|
||||
link: atInputCheckboxLink,
|
||||
scope: {
|
||||
state: '=',
|
||||
col: '@',
|
||||
tab: '@'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
atInputCheckbox.$inject = ['PathService'];
|
||||
|
||||
export default atInputCheckbox;
|
||||
@ -37,9 +37,11 @@ function AtInputTextareaSecretController (baseInputController, eventService) {
|
||||
scope.buttonText = 'REPLACE';
|
||||
} else {
|
||||
scope.state._hint = scope.state._hint || DEFAULT_HINT;
|
||||
vm.listeners = vm.setFileListeners(textarea, input);
|
||||
}
|
||||
|
||||
if (scope.state.format === 'ssh_private_key') {
|
||||
vm.listeners = vm.setFileListeners(textarea, input);
|
||||
}
|
||||
}
|
||||
|
||||
vm.updateModel();
|
||||
};
|
||||
|
||||
@ -33,11 +33,16 @@ function assignInputGroupValues (inputs) {
|
||||
});
|
||||
}
|
||||
|
||||
function clearTypeInputs () {
|
||||
delete this.model.GET.inputs;
|
||||
}
|
||||
|
||||
function CredentialModel (method, resource) {
|
||||
BaseModel.call(this, 'credentials');
|
||||
|
||||
|
||||
this.createFormSchema = createFormSchema.bind(this);
|
||||
this.assignInputGroupValues = assignInputGroupValues.bind(this);
|
||||
this.clearTypeInputs = clearTypeInputs.bind(this);
|
||||
|
||||
return this.request(method, resource)
|
||||
.then(() => this);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user