mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 15:58:45 -03:30
incorporating organization into the custom inv script option selection for a group
This commit is contained in:
@@ -520,7 +520,6 @@ function(ConfigurationUtils, i18n, $rootScope) {
|
|||||||
query = '?role_level=admin_role';
|
query = '?role_level=admin_role';
|
||||||
break;
|
break;
|
||||||
case 'inventory_script':
|
case 'inventory_script':
|
||||||
console.log("Can we see what organization? ", scope);
|
|
||||||
query = '?role_level=admin_role&organization=' + scope.$resolve.inventoryData.summary_fields.organization.id;
|
query = '?role_level=admin_role&organization=' + scope.$resolve.inventoryData.summary_fields.organization.id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -616,7 +615,7 @@ function(ConfigurationUtils, i18n, $rootScope) {
|
|||||||
query += '&role_level=admin_role';
|
query += '&role_level=admin_role';
|
||||||
break;
|
break;
|
||||||
case 'inventory_script':
|
case 'inventory_script':
|
||||||
query += '&role_level=admin_role';
|
query += '&role_level=admin_role&organization=' + scope.$resolve.inventoryData.summary_fields.organization.id;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
query += '&role_level=use_role';
|
query += '&role_level=use_role';
|
||||||
|
|||||||
@@ -685,8 +685,25 @@ export default ['$injector', '$stateExtender', '$log', 'i18n', function($injecto
|
|||||||
list.iterator = field.sourceModel;
|
list.iterator = field.sourceModel;
|
||||||
return list;
|
return list;
|
||||||
}],
|
}],
|
||||||
Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope', '$state',
|
OrganizationId: ['ListDefinition', 'InventoryManageService', '$stateParams', '$rootScope',
|
||||||
(list, qs, $stateParams, GetBasePath, $interpolate, $rootScope, $state) => {
|
function(list, InventoryManageService, $stateParams, $rootScope){
|
||||||
|
if(list.iterator === 'inventory_script'){
|
||||||
|
if($rootScope.$$childTail &&
|
||||||
|
$rootScope.$$childTail.$resolve &&
|
||||||
|
$rootScope.$$childTail.$resolve.hasOwnProperty('inventoryData')){
|
||||||
|
return $rootScope.$$childTail.$resolve.inventoryData.summary_fields.organization.id;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return InventoryManageService.getInventory($stateParams.inventory_id).then(res => res.data.summary_fields.organization.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope', '$state', 'OrganizationId',
|
||||||
|
(list, qs, $stateParams, GetBasePath, $interpolate, $rootScope, $state, OrganizationId) => {
|
||||||
// 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;
|
||||||
@@ -703,9 +720,14 @@ export default ['$injector', '$stateExtender', '$log', 'i18n', function($injecto
|
|||||||
}
|
}
|
||||||
// Need to change the role_level here b/c organizations and inventory scripts
|
// Need to change the role_level here b/c organizations and inventory scripts
|
||||||
// don't have a "use_role", only "admin_role" and "read_role"
|
// don't have a "use_role", only "admin_role" and "read_role"
|
||||||
if(list.iterator === "organization" || list.iterator === "inventory_script"){
|
if(list.iterator === "organization"){
|
||||||
$stateParams[`${list.iterator}_search`].role_level = "admin_role";
|
$stateParams[`${list.iterator}_search`].role_level = "admin_role";
|
||||||
}
|
}
|
||||||
|
if(list.iterator === "inventory_script"){
|
||||||
|
$stateParams[`${list.iterator}_search`].role_level = "admin_role";
|
||||||
|
$stateParams[`${list.iterator}_search`].organization = OrganizationId;
|
||||||
|
}
|
||||||
|
|
||||||
return qs.search(path, $stateParams[`${list.iterator}_search`]);
|
return qs.search(path, $stateParams[`${list.iterator}_search`]);
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user