mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
Limit adhoc credential lookup to only machine credentials
This commit is contained in:
parent
150467a1cb
commit
6e2133aa52
@ -7,7 +7,8 @@ export default {
|
|||||||
params: {
|
params: {
|
||||||
credential_search: {
|
credential_search: {
|
||||||
value: {
|
value: {
|
||||||
page_size: '5'
|
page_size: '5',
|
||||||
|
credential_type: null
|
||||||
},
|
},
|
||||||
squash: true,
|
squash: true,
|
||||||
dynamic: true
|
dynamic: true
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
function adhocController($q, $scope, $stateParams,
|
function adhocController($q, $scope, $stateParams,
|
||||||
$state, CheckPasswords, PromptForPasswords, CreateLaunchDialog, CreateSelect2, adhocForm,
|
$state, CheckPasswords, PromptForPasswords, CreateLaunchDialog, CreateSelect2, adhocForm,
|
||||||
GenerateForm, Rest, ProcessErrors, GetBasePath, GetChoices,
|
GenerateForm, Rest, ProcessErrors, GetBasePath, GetChoices,
|
||||||
KindChange, Wait, ParseTypeChange) {
|
KindChange, Wait, ParseTypeChange, credentialTypes) {
|
||||||
|
|
||||||
// this is done so that we can access private functions for testing, but
|
// this is done so that we can access private functions for testing, but
|
||||||
// we don't want to populate the "public" scope with these internal
|
// we don't want to populate the "public" scope with these internal
|
||||||
@ -301,11 +301,23 @@ function adhocController($q, $scope, $stateParams,
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.lookupCredential = function(){
|
||||||
|
let credType = _.filter(credentialTypes, function(credType){
|
||||||
|
return credType.kind === "ssh";
|
||||||
|
});
|
||||||
|
$state.go('.credential', {
|
||||||
|
credential_search: {
|
||||||
|
credential_type: credType[0].id,
|
||||||
|
page_size: '5',
|
||||||
|
page: '1'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ['$q', '$scope', '$stateParams',
|
export default ['$q', '$scope', '$stateParams',
|
||||||
'$state', 'CheckPasswords', 'PromptForPasswords', 'CreateLaunchDialog', 'CreateSelect2',
|
'$state', 'CheckPasswords', 'PromptForPasswords', 'CreateLaunchDialog', 'CreateSelect2',
|
||||||
'adhocForm', 'GenerateForm', 'Rest', 'ProcessErrors', 'GetBasePath',
|
'adhocForm', 'GenerateForm', 'Rest', 'ProcessErrors', 'GetBasePath',
|
||||||
'GetChoices', 'KindChange', 'Wait', 'ParseTypeChange',
|
'GetChoices', 'KindChange', 'Wait', 'ParseTypeChange', 'credentialTypes',
|
||||||
adhocController];
|
adhocController];
|
||||||
|
@ -64,6 +64,7 @@ export default ['i18n', function(i18n) {
|
|||||||
sourceModel: 'credential',
|
sourceModel: 'credential',
|
||||||
sourceField: 'name',
|
sourceField: 'name',
|
||||||
class: 'squeeze',
|
class: 'squeeze',
|
||||||
|
ngClick: 'lookupCredential()',
|
||||||
awPopOver: '<p>Select the credential you want to use when ' +
|
awPopOver: '<p>Select the credential you want to use when ' +
|
||||||
'accessing the remote hosts to run the command. ' +
|
'accessing the remote hosts to run the command. ' +
|
||||||
'Choose the credential containing ' +
|
'Choose the credential containing ' +
|
||||||
|
@ -26,5 +26,14 @@ export default {
|
|||||||
},
|
},
|
||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
label: N_("RUN COMMAND")
|
label: N_("RUN COMMAND")
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
credentialTypes: ['CredentialTypeModel', (CredentialType) =>
|
||||||
|
new CredentialType('get')
|
||||||
|
.then((model) => {
|
||||||
|
const credentialTypeRes = model.get();
|
||||||
|
return credentialTypeRes.results;
|
||||||
|
})
|
||||||
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user