mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
Adding default params for some lookup modals
the organization and inventory-script lookup modals require some additional default params set to properly present the user w/ options they have permission to see. If these default params aren't set, they'll show up as search tags, which we don't want.
This commit is contained in:
parent
32622add2c
commit
57883e37bf
@ -646,6 +646,32 @@ export default ['$injector', '$stateExtender', '$log', 'i18n', function($injecto
|
||||
generateLookupNodes: function(form, formStateDefinition) {
|
||||
|
||||
function buildFieldDefinition(field) {
|
||||
|
||||
// Some lookup modals require some additional default params,
|
||||
// namely organization and inventory_script. If these params
|
||||
// aren't set as default params out of the gate, then smart
|
||||
// search will think they need to be set as search tags.
|
||||
var params;
|
||||
if(field.sourceModel === "organization"){
|
||||
params = {
|
||||
page_size: '5',
|
||||
role_level: 'admin_role'
|
||||
};
|
||||
}
|
||||
else if(field.sourceModel === "inventory_script"){
|
||||
params = {
|
||||
page_size: '5',
|
||||
role_level: 'admin_role',
|
||||
organization: null
|
||||
};
|
||||
}
|
||||
else {
|
||||
params = {
|
||||
page_size: '5',
|
||||
role_level: 'use_role'
|
||||
};
|
||||
}
|
||||
|
||||
let state = $stateExtender.buildDefinition({
|
||||
searchPrefix: field.sourceModel,
|
||||
//squashSearchUrl: true, @issue enable
|
||||
@ -658,10 +684,7 @@ export default ['$injector', '$stateExtender', '$log', 'i18n', function($injecto
|
||||
},
|
||||
params: {
|
||||
[field.sourceModel + '_search']: {
|
||||
value: {
|
||||
page_size: '5',
|
||||
role_level: 'use_role'
|
||||
}
|
||||
value: params
|
||||
}
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user