mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-06 16:32:01 -05:00
Use credential_type to fetch associated types in list view
This commit is contained in:
committed by
Matthew Jones
parent
64c5e3994e
commit
766a088749
@@ -5,10 +5,13 @@
|
||||
*************************************************/
|
||||
|
||||
export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', 'GetBasePath',
|
||||
'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', 'credentialType', 'i18n',
|
||||
'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', 'CredentialTypeModel',
|
||||
'i18n',
|
||||
function($scope, Rest, CredentialList, Prompt,
|
||||
ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset,
|
||||
credentialType, i18n) {
|
||||
CredentialType, i18n) {
|
||||
|
||||
const credentialType = new CredentialType();
|
||||
|
||||
var list = CredentialList,
|
||||
defaultUrl = GetBasePath('credentials');
|
||||
@@ -45,9 +48,25 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', '
|
||||
return;
|
||||
}
|
||||
|
||||
$scope[list.name].forEach(credential => {
|
||||
credential.kind = credentialType.match('id', credential.credential_type).name;
|
||||
});
|
||||
const params = $scope[list.name]
|
||||
.reduce((accumulator, credential) => {
|
||||
accumulator.push(credential.credential_type);
|
||||
|
||||
return accumulator;
|
||||
}, [])
|
||||
.filter((id, i, array) => array.indexOf(id) === i)
|
||||
.map(id => `or__id=${id}`);
|
||||
|
||||
credentialType.search(params)
|
||||
.then(found => {
|
||||
if (!found) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope[list.name].forEach(credential => {
|
||||
credential.kind = credentialType.match('id', credential.credential_type).name;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// iterate over the list and add fields like type label, after the
|
||||
|
||||
Reference in New Issue
Block a user