mirror of
https://github.com/ansible/awx.git
synced 2026-03-23 11:55:04 -02:30
changing logic for Remediate Inventory button
to only check for any insights projects, instead of insights projects with specifically the same credential as the insights inventory
This commit is contained in:
@@ -130,13 +130,15 @@ angular.module('inventory', [
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}],
|
}],
|
||||||
checkProjectPermission: ['resourceData', '$stateParams', 'Rest', 'GetBasePath',
|
checkProjectPermission: ['resourceData', '$stateParams', 'Rest', 'GetBasePath', 'credentialTypesLookup',
|
||||||
function(resourceData, $stateParams, Rest, GetBasePath){
|
function(resourceData, $stateParams, Rest, GetBasePath, credentialTypesLookup){
|
||||||
if(_.has(resourceData, 'data.summary_fields.insights_credential')){
|
if(_.has(resourceData, 'data.summary_fields.insights_credential')){
|
||||||
let credential_id = resourceData.data.summary_fields.insights_credential.id,
|
return credentialTypesLookup()
|
||||||
path = `${GetBasePath('projects')}?credential__id=${credential_id}&role_level=use_role`;
|
.then(kinds => {
|
||||||
Rest.setUrl(path);
|
let insightsKind = kinds.Insights;
|
||||||
return Rest.get().then(({data}) => {
|
let path = `${GetBasePath('projects')}?credential__credential_type=${insightsKind}&role_level=use_role`;
|
||||||
|
Rest.setUrl(path);
|
||||||
|
return Rest.get().then(({data}) => {
|
||||||
if (data.results.length > 0){
|
if (data.results.length > 0){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -146,6 +148,7 @@ angular.module('inventory', [
|
|||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user