mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 07:26:03 -03:30
update credential type usage to kind instead of name
This commit is contained in:
@@ -135,7 +135,7 @@ angular.module('inventory', [
|
|||||||
if(_.has(resourceData, 'data.summary_fields.insights_credential')){
|
if(_.has(resourceData, 'data.summary_fields.insights_credential')){
|
||||||
return credentialTypesLookup()
|
return credentialTypesLookup()
|
||||||
.then(kinds => {
|
.then(kinds => {
|
||||||
let insightsKind = kinds.Insights;
|
let insightsKind = kinds.insights;
|
||||||
let path = `${GetBasePath('projects')}?credential__credential_type=${insightsKind}&role_level=use_role`;
|
let path = `${GetBasePath('projects')}?credential__credential_type=${insightsKind}&role_level=use_role`;
|
||||||
Rest.setUrl(path);
|
Rest.setUrl(path);
|
||||||
return Rest.get().then(({data}) => {
|
return Rest.get().then(({data}) => {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default
|
|||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
credentialTypesLookup()
|
credentialTypesLookup()
|
||||||
.then(kinds => {
|
.then(kinds => {
|
||||||
if(data.credential_type === kinds.Machine && data.inputs){
|
if(data.credential_type === kinds.ssh && data.inputs){
|
||||||
if(data.inputs.password === "ASK" ){
|
if(data.inputs.password === "ASK" ){
|
||||||
passwords.push("ssh_password");
|
passwords.push("ssh_password");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', 'ParseT
|
|||||||
credentialTypesLookup()
|
credentialTypesLookup()
|
||||||
.then(kinds => {
|
.then(kinds => {
|
||||||
if(scope.ask_credential_on_launch) {
|
if(scope.ask_credential_on_launch) {
|
||||||
scope.credentialKind = "" + kinds.Machine;
|
scope.credentialKind = "" + kinds.ssh;
|
||||||
scope.includeCredentialList = true;
|
scope.includeCredentialList = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ export default
|
|||||||
|
|
||||||
$scope.$watchCollection('selectedCredentials.extra', () => {
|
$scope.$watchCollection('selectedCredentials.extra', () => {
|
||||||
if($scope.credentials && $scope.credentials.length > 0) {
|
if($scope.credentials && $scope.credentials.length > 0) {
|
||||||
if($scope.selectedCredentials.extra && $scope.selectedCredentials.extra.length > 0 && parseInt($scope.credentialKind) !== credentialKinds.Machine) {
|
if($scope.selectedCredentials.extra && $scope.selectedCredentials.extra.length > 0 && parseInt($scope.credentialKind) !== credentialKinds.ssh) {
|
||||||
updateExtraCredentialsList();
|
updateExtraCredentialsList();
|
||||||
} else if (parseInt($scope.credentialKind) !== credentialKinds.Machine) {
|
} else if (parseInt($scope.credentialKind) !== credentialKinds.ssh) {
|
||||||
uncheckAllCredentials();
|
uncheckAllCredentials();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ export default
|
|||||||
|
|
||||||
$scope.$watch('selectedCredentials.machine', () => {
|
$scope.$watch('selectedCredentials.machine', () => {
|
||||||
if($scope.credentials && $scope.credentials.length > 0) {
|
if($scope.credentials && $scope.credentials.length > 0) {
|
||||||
if($scope.selectedCredentials.machine && parseInt($scope.credentialKind) === credentialKinds.Machine) {
|
if($scope.selectedCredentials.machine && parseInt($scope.credentialKind) === credentialKinds.ssh) {
|
||||||
updateMachineCredentialList();
|
updateMachineCredentialList();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -92,10 +92,10 @@ export default
|
|||||||
|
|
||||||
$scope.$watchGroup(['credentials', 'selectedCredentials.machine'], () => {
|
$scope.$watchGroup(['credentials', 'selectedCredentials.machine'], () => {
|
||||||
if($scope.credentials && $scope.credentials.length > 0) {
|
if($scope.credentials && $scope.credentials.length > 0) {
|
||||||
if($scope.selectedCredentials.machine && parseInt($scope.credentialKind) === credentialKinds.Machine) {
|
if($scope.selectedCredentials.machine && parseInt($scope.credentialKind) === credentialKinds.ssh) {
|
||||||
updateMachineCredentialList();
|
updateMachineCredentialList();
|
||||||
}
|
}
|
||||||
else if($scope.selectedCredentials.extra && $scope.selectedCredentials.extra.length > 0 && parseInt($scope.credentialKind) !== credentialKinds.Machine) {
|
else if($scope.selectedCredentials.extra && $scope.selectedCredentials.extra.length > 0 && parseInt($scope.credentialKind) !== credentialKinds.ssh) {
|
||||||
updateExtraCredentialsList();
|
updateExtraCredentialsList();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -106,7 +106,7 @@ export default
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.toggle_row = function(selectedRow) {
|
$scope.toggle_row = function(selectedRow) {
|
||||||
if(parseInt($scope.credentialKind) === credentialKinds.Machine) {
|
if(parseInt($scope.credentialKind) === credentialKinds.ssh) {
|
||||||
$scope.selectedCredentials.machine = _.cloneDeep(selectedRow);
|
$scope.selectedCredentials.machine = _.cloneDeep(selectedRow);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ function(Rest, GetBasePath, ProcessErrors) {
|
|||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
var val = {};
|
var val = {};
|
||||||
data.results.forEach(type => {
|
data.results.forEach(type => {
|
||||||
val[type.name] = type.id;
|
val[type.kind] = type.id;
|
||||||
});
|
});
|
||||||
return val;
|
return val;
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ function multiCredentialModalController(GetBasePath, qs, MultiCredentialService)
|
|||||||
scope = _scope_;
|
scope = _scope_;
|
||||||
scope.modalSelectedCredentials = _.cloneDeep(scope.selectedCredentials);
|
scope.modalSelectedCredentials = _.cloneDeep(scope.selectedCredentials);
|
||||||
|
|
||||||
scope.credentialTypes.forEach(({ name, id }) => types[name] = id);
|
scope.credentialTypes.forEach(({ kind, id }) => types[kind] = id);
|
||||||
|
|
||||||
scope.toggle_row = vm.toggle_row;
|
scope.toggle_row = vm.toggle_row;
|
||||||
scope.toggle_credential = vm.toggle_credential;
|
scope.toggle_credential = vm.toggle_credential;
|
||||||
@@ -152,13 +152,13 @@ function multiCredentialModalController(GetBasePath, qs, MultiCredentialService)
|
|||||||
|
|
||||||
function getInitialCredentialType () {
|
function getInitialCredentialType () {
|
||||||
const selectedMachineCredential = scope.modalSelectedCredentials
|
const selectedMachineCredential = scope.modalSelectedCredentials
|
||||||
.find(c => c.id === types.Machine);
|
.find(c => c.id === types.ssh);
|
||||||
|
|
||||||
if (selectedMachineCredential) {
|
if (selectedMachineCredential) {
|
||||||
return `${types.Vault}`;
|
return `${types.vault}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${types.Machine}`;
|
return `${types.ssh}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchCredentials (credentialType) {
|
function fetchCredentials (credentialType) {
|
||||||
@@ -175,7 +175,7 @@ function multiCredentialModalController(GetBasePath, qs, MultiCredentialService)
|
|||||||
|
|
||||||
scope.destroyList();
|
scope.destroyList();
|
||||||
|
|
||||||
if (credentialType === types.Vault) {
|
if (credentialType === types.vault) {
|
||||||
scope.createVaultList();
|
scope.createVaultList();
|
||||||
} else {
|
} else {
|
||||||
scope.createList();
|
scope.createList();
|
||||||
@@ -215,11 +215,11 @@ function multiCredentialModalController(GetBasePath, qs, MultiCredentialService)
|
|||||||
|
|
||||||
const credentialTypeId = credential.credential_type || credential.credential_type_id;
|
const credentialTypeId = credential.credential_type || credential.credential_type_id;
|
||||||
|
|
||||||
if (credentialTypeId === types.Vault) {
|
if (credentialTypeId === types.vault) {
|
||||||
const vaultId = _.get(credential, 'inputs.vault_id');
|
const vaultId = _.get(credential, 'inputs.vault_id');
|
||||||
|
|
||||||
scope.modalSelectedCredentials = scope.modalSelectedCredentials
|
scope.modalSelectedCredentials = scope.modalSelectedCredentials
|
||||||
.filter(c => (c.credential_type !== types.Vault) || (c.inputs.vault_id !== vaultId))
|
.filter(c => (c.credential_type !== types.vault) || (c.inputs.vault_id !== vaultId))
|
||||||
.concat([credential]);
|
.concat([credential]);
|
||||||
} else {
|
} else {
|
||||||
scope.modalSelectedCredentials = scope.modalSelectedCredentials
|
scope.modalSelectedCredentials = scope.modalSelectedCredentials
|
||||||
|
|||||||
Reference in New Issue
Block a user