1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

Let disassociate jt cred requests finish before attempting to associate any new ones

This commit is contained in:
mabashian 2018-07-18 17:38:11 -04:00
parent bc3f06c725
commit 0104228541

View File

@ -38,14 +38,11 @@ function MultiCredentialService (Rest, ProcessErrors, $q, GetBasePath) {
.filter(id => selected.indexOf(id) < 0)
.map(id => disassociate({ related }, id));
const associationPromises = selected
.filter(id => currentlyAssociated.indexOf(id) < 0)
.map(id => associate({ related }, id));
const promises = disassociationPromises
.concat(associationPromises);
return $q.all(promises);
return $q.all(disassociationPromises).then(() => {
_.each(selected.filter(id => currentlyAssociated.indexOf(id) < 0), (id) => {
associate({related}, id);
});
});
});
};