mirror of
https://github.com/ansible/awx.git
synced 2026-02-14 01:34:45 -03:30
Add method to remove input data on credential type change
This commit is contained in:
@@ -35,6 +35,7 @@ function EditCredentialsController (models, $state) {
|
|||||||
|
|
||||||
vm.form.save = data => {
|
vm.form.save = data => {
|
||||||
data.user = me.getSelf().id;
|
data.user = me.getSelf().id;
|
||||||
|
credential.clearTypeInputs();
|
||||||
|
|
||||||
return credential.request('put', data);
|
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';
|
scope.buttonText = 'REPLACE';
|
||||||
} else {
|
} else {
|
||||||
scope.state._hint = scope.state._hint || DEFAULT_HINT;
|
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();
|
vm.updateModel();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -33,11 +33,16 @@ function assignInputGroupValues (inputs) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearTypeInputs () {
|
||||||
|
delete this.model.GET.inputs;
|
||||||
|
}
|
||||||
|
|
||||||
function CredentialModel (method, resource) {
|
function CredentialModel (method, resource) {
|
||||||
BaseModel.call(this, 'credentials');
|
BaseModel.call(this, 'credentials');
|
||||||
|
|
||||||
this.createFormSchema = createFormSchema.bind(this);
|
this.createFormSchema = createFormSchema.bind(this);
|
||||||
this.assignInputGroupValues = assignInputGroupValues.bind(this);
|
this.assignInputGroupValues = assignInputGroupValues.bind(this);
|
||||||
|
this.clearTypeInputs = clearTypeInputs.bind(this);
|
||||||
|
|
||||||
return this.request(method, resource)
|
return this.request(method, resource)
|
||||||
.then(() => this);
|
.then(() => this);
|
||||||
|
|||||||
Reference in New Issue
Block a user