mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +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: {
|
||||
credential_search: {
|
||||
value: {
|
||||
page_size: '5'
|
||||
page_size: '5',
|
||||
credential_type: null
|
||||
},
|
||||
squash: true,
|
||||
dynamic: true
|
||||
|
@ -12,7 +12,7 @@
|
||||
function adhocController($q, $scope, $stateParams,
|
||||
$state, CheckPasswords, PromptForPasswords, CreateLaunchDialog, CreateSelect2, adhocForm,
|
||||
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
|
||||
// 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',
|
||||
'$state', 'CheckPasswords', 'PromptForPasswords', 'CreateLaunchDialog', 'CreateSelect2',
|
||||
'adhocForm', 'GenerateForm', 'Rest', 'ProcessErrors', 'GetBasePath',
|
||||
'GetChoices', 'KindChange', 'Wait', 'ParseTypeChange',
|
||||
'GetChoices', 'KindChange', 'Wait', 'ParseTypeChange', 'credentialTypes',
|
||||
adhocController];
|
||||
|
@ -64,6 +64,7 @@ export default ['i18n', function(i18n) {
|
||||
sourceModel: 'credential',
|
||||
sourceField: 'name',
|
||||
class: 'squeeze',
|
||||
ngClick: 'lookupCredential()',
|
||||
awPopOver: '<p>Select the credential you want to use when ' +
|
||||
'accessing the remote hosts to run the command. ' +
|
||||
'Choose the credential containing ' +
|
||||
|
@ -26,5 +26,14 @@ export default {
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
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