mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
changing insights cred lookup to not use hard coded cred type
and rather, do a comparison against the credential_type endpoint
This commit is contained in:
parent
c57d39dcd9
commit
8980e70918
@ -72,9 +72,6 @@ function(i18n, InventoryCompletedJobsList) {
|
|||||||
basePath: 'credentials',
|
basePath: 'credentials',
|
||||||
sourceModel: 'insights_credential',
|
sourceModel: 'insights_credential',
|
||||||
sourceField: 'name',
|
sourceField: 'name',
|
||||||
search: {
|
|
||||||
credential_type: '13' //insights
|
|
||||||
},
|
|
||||||
ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd) || !canEditOrg',
|
ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd) || !canEditOrg',
|
||||||
},
|
},
|
||||||
instance_groups: {
|
instance_groups: {
|
||||||
|
@ -722,7 +722,8 @@ function($injector, $stateExtender, $log, i18n) {
|
|||||||
function buildFieldDefinition(field) {
|
function buildFieldDefinition(field) {
|
||||||
|
|
||||||
// Some lookup modals require some additional default params,
|
// Some lookup modals require some additional default params,
|
||||||
// namely organization and inventory_script. If these params
|
// namely organization and inventory_script, and insights
|
||||||
|
// credentials. If these params
|
||||||
// aren't set as default params out of the gate, then smart
|
// aren't set as default params out of the gate, then smart
|
||||||
// search will think they need to be set as search tags.
|
// search will think they need to be set as search tags.
|
||||||
var params;
|
var params;
|
||||||
@ -739,6 +740,12 @@ function($injector, $stateExtender, $log, i18n) {
|
|||||||
organization: null
|
organization: null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if(field.sourceModel === "insights_credential"){
|
||||||
|
params = {
|
||||||
|
page_size: '5',
|
||||||
|
credential_type: null
|
||||||
|
};
|
||||||
|
}
|
||||||
else if(field.sourceModel === 'host') {
|
else if(field.sourceModel === 'host') {
|
||||||
params = {
|
params = {
|
||||||
page_size: '5'
|
page_size: '5'
|
||||||
@ -805,8 +812,24 @@ function($injector, $stateExtender, $log, i18n) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope', '$state', 'OrganizationId',
|
InsightsCredTypePK: ['ListDefinition', 'Rest', 'GetBasePath', 'ProcessErrors',
|
||||||
(list, qs, $stateParams, GetBasePath, $interpolate, $rootScope, $state, OrganizationId) => {
|
function(list, Rest, GetBasePath,ProcessErrors) {
|
||||||
|
if(list.iterator === 'insights_credential'){
|
||||||
|
Rest.setUrl(GetBasePath('credential_types') + '?name=Insights');
|
||||||
|
return Rest.get()
|
||||||
|
.then(({data}) => {
|
||||||
|
return data.results[0].id;
|
||||||
|
})
|
||||||
|
.catch(({data, status}) => {
|
||||||
|
ProcessErrors(null, data, status, null, {
|
||||||
|
hdr: 'Error!',
|
||||||
|
msg: 'Failed to get credential type data: ' + status
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope', '$state', 'OrganizationId', 'InsightsCredTypePK',
|
||||||
|
(list, qs, $stateParams, GetBasePath, $interpolate, $rootScope, $state, OrganizationId, InsightsCredTypePK) => {
|
||||||
// allow lookup field definitions to use interpolated $stateParams / $rootScope in basePath field
|
// allow lookup field definitions to use interpolated $stateParams / $rootScope in basePath field
|
||||||
// the basePath on a form's lookup field will take precedence over the general model list's basepath
|
// the basePath on a form's lookup field will take precedence over the general model list's basepath
|
||||||
let path, interpolator;
|
let path, interpolator;
|
||||||
@ -830,6 +853,10 @@ function($injector, $stateExtender, $log, i18n) {
|
|||||||
$stateParams[`${list.iterator}_search`].role_level = "admin_role";
|
$stateParams[`${list.iterator}_search`].role_level = "admin_role";
|
||||||
$stateParams[`${list.iterator}_search`].organization = OrganizationId;
|
$stateParams[`${list.iterator}_search`].organization = OrganizationId;
|
||||||
}
|
}
|
||||||
|
if(list.iterator === "insights_credential"){
|
||||||
|
$stateParams[`${list.iterator}_search`].credential_type = InsightsCredTypePK.toString() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return qs.search(path, $stateParams[`${list.iterator}_search`]);
|
return qs.search(path, $stateParams[`${list.iterator}_search`]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user