mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
update existing relatedSearchKey requests to new convention and fix UJT searchKeys
This commit is contained in:
parent
9c13c07169
commit
dd68b6ed73
@ -38,7 +38,7 @@ function JobList({ i18n, defaultParams, showTypeColumn = false }) {
|
||||
const [selected, setSelected] = useState([]);
|
||||
const location = useLocation();
|
||||
const {
|
||||
result: { results, count, actions, relatedSearchFields },
|
||||
result: { results, count, relatedSearchableKeys, searchableKeys },
|
||||
error: contentError,
|
||||
isLoading,
|
||||
request: fetchJobs,
|
||||
@ -53,10 +53,12 @@ function JobList({ i18n, defaultParams, showTypeColumn = false }) {
|
||||
return {
|
||||
results: response.data.results,
|
||||
count: response.data.count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
},
|
||||
[location] // eslint-disable-line react-hooks/exhaustive-deps
|
||||
@ -64,8 +66,8 @@ function JobList({ i18n, defaultParams, showTypeColumn = false }) {
|
||||
{
|
||||
results: [],
|
||||
count: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
useEffect(() => {
|
||||
@ -138,11 +140,6 @@ function JobList({ i18n, defaultParams, showTypeColumn = false }) {
|
||||
}
|
||||
};
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card>
|
||||
|
||||
@ -52,7 +52,7 @@ function CredentialsStep({ i18n }) {
|
||||
}, [fetchTypes]);
|
||||
|
||||
const {
|
||||
result: { credentials, count, actions, relatedSearchFields },
|
||||
result: { credentials, count, relatedSearchableKeys, searchableKeys },
|
||||
error: credentialsError,
|
||||
isLoading: isCredentialsLoading,
|
||||
request: fetchCredentials,
|
||||
@ -72,13 +72,15 @@ function CredentialsStep({ i18n }) {
|
||||
return {
|
||||
credentials: data.results,
|
||||
count: data.count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [selectedType, history.location.search]),
|
||||
{ credentials: [], count: 0, actions: {}, relatedSearchFields: [] }
|
||||
{ credentials: [], count: 0, relatedSearchableKeys: [], searchableKeys: [] }
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@ -104,11 +106,6 @@ function CredentialsStep({ i18n }) {
|
||||
/>
|
||||
);
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{types && types.length > 0 && (
|
||||
|
||||
@ -27,7 +27,7 @@ function InventoryStep({ i18n }) {
|
||||
const {
|
||||
isLoading,
|
||||
error,
|
||||
result: { inventories, count, actions, relatedSearchFields },
|
||||
result: { inventories, count, relatedSearchableKeys, searchableKeys },
|
||||
request: fetchInventories,
|
||||
} = useRequest(
|
||||
useCallback(async () => {
|
||||
@ -39,17 +39,19 @@ function InventoryStep({ i18n }) {
|
||||
return {
|
||||
inventories: data.results,
|
||||
count: data.count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [history.location]),
|
||||
{
|
||||
count: 0,
|
||||
inventories: [],
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -57,11 +59,6 @@ function InventoryStep({ i18n }) {
|
||||
fetchInventories();
|
||||
}, [fetchInventories]);
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
if (isLoading) {
|
||||
return <ContentLoading />;
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ function ApplicationLookup({ i18n, onChange, value, label }) {
|
||||
const location = useLocation();
|
||||
const {
|
||||
error,
|
||||
result: { applications, itemCount, actions, relatedSearchFields },
|
||||
result: { applications, itemCount, relatedSearchableKeys, searchableKeys },
|
||||
request: fetchApplications,
|
||||
} = useRequest(
|
||||
useCallback(async () => {
|
||||
@ -40,23 +40,24 @@ function ApplicationLookup({ i18n, onChange, value, label }) {
|
||||
return {
|
||||
applications: results,
|
||||
itemCount: count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [location]),
|
||||
{ applications: [], itemCount: 0, actions: {}, relatedSearchFields: [] }
|
||||
{
|
||||
applications: [],
|
||||
itemCount: 0,
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
useEffect(() => {
|
||||
fetchApplications();
|
||||
}, [fetchApplications]);
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<FormGroup fieldId="application" label={label}>
|
||||
<Lookup
|
||||
|
||||
@ -35,7 +35,7 @@ function CredentialLookup({
|
||||
tooltip,
|
||||
}) {
|
||||
const {
|
||||
result: { count, credentials, actions, relatedSearchFields },
|
||||
result: { count, credentials, relatedSearchableKeys, searchableKeys },
|
||||
error,
|
||||
request: fetchCredentials,
|
||||
} = useRequest(
|
||||
@ -64,10 +64,12 @@ function CredentialLookup({
|
||||
return {
|
||||
count: data.count,
|
||||
credentials: data.results,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [
|
||||
credentialTypeId,
|
||||
@ -78,8 +80,8 @@ function CredentialLookup({
|
||||
{
|
||||
count: 0,
|
||||
credentials: [],
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -87,11 +89,6 @@ function CredentialLookup({
|
||||
fetchCredentials();
|
||||
}, [fetchCredentials]);
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
// TODO: replace credential type search with REST-based grabbing of cred types
|
||||
|
||||
return (
|
||||
|
||||
@ -30,7 +30,7 @@ function InstanceGroupsLookup(props) {
|
||||
} = props;
|
||||
|
||||
const {
|
||||
result: { instanceGroups, count, actions, relatedSearchFields },
|
||||
result: { instanceGroups, count, relatedSearchableKeys, searchableKeys },
|
||||
request: fetchInstanceGroups,
|
||||
error,
|
||||
isLoading,
|
||||
@ -44,24 +44,26 @@ function InstanceGroupsLookup(props) {
|
||||
return {
|
||||
instanceGroups: data.results,
|
||||
count: data.count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [history.location]),
|
||||
{ instanceGroups: [], count: 0, actions: {}, relatedSearchFields: [] }
|
||||
{
|
||||
instanceGroups: [],
|
||||
count: 0,
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
fetchInstanceGroups();
|
||||
}, [fetchInstanceGroups]);
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<FormGroup
|
||||
className={className}
|
||||
|
||||
@ -19,7 +19,7 @@ const QS_CONFIG = getQSConfig('inventory', {
|
||||
|
||||
function InventoryLookup({ value, onChange, onBlur, required, i18n, history }) {
|
||||
const {
|
||||
result: { inventories, count, actions, relatedSearchFields },
|
||||
result: { inventories, count, relatedSearchableKeys, searchableKeys },
|
||||
request: fetchInventories,
|
||||
error,
|
||||
isLoading,
|
||||
@ -33,24 +33,21 @@ function InventoryLookup({ value, onChange, onBlur, required, i18n, history }) {
|
||||
return {
|
||||
inventories: data.results,
|
||||
count: data.count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [history.location]),
|
||||
{ inventories: [], count: 0, actions: {}, relatedSearchFields: [] }
|
||||
{ inventories: [], count: 0, relatedSearchableKeys: [], searchableKeys: [] }
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
fetchInventories();
|
||||
}, [fetchInventories]);
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Lookup
|
||||
|
||||
@ -49,7 +49,12 @@ function MultiCredentialsLookup(props) {
|
||||
}, [fetchTypes]);
|
||||
|
||||
const {
|
||||
result: { credentials, credentialsCount, actions, relatedSearchFields },
|
||||
result: {
|
||||
credentials,
|
||||
credentialsCount,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
request: fetchCredentials,
|
||||
error: credentialsError,
|
||||
isLoading: isCredentialsLoading,
|
||||
@ -69,17 +74,19 @@ function MultiCredentialsLookup(props) {
|
||||
return {
|
||||
credentials: results,
|
||||
credentialsCount: count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [selectedType, history.location]),
|
||||
{
|
||||
credentials: [],
|
||||
credentialsCount: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -104,11 +111,6 @@ function MultiCredentialsLookup(props) {
|
||||
|
||||
const isVault = selectedType?.kind === 'vault';
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<Lookup
|
||||
id="multiCredential"
|
||||
|
||||
@ -32,7 +32,7 @@ function ProjectLookup({
|
||||
history,
|
||||
}) {
|
||||
const {
|
||||
result: { projects, count, actions, relatedSearchFields },
|
||||
result: { projects, count, relatedSearchableKeys, searchableKeys },
|
||||
request: fetchProjects,
|
||||
error,
|
||||
isLoading,
|
||||
@ -49,17 +49,19 @@ function ProjectLookup({
|
||||
return {
|
||||
count: data.count,
|
||||
projects: data.results,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [history.location.search, autocomplete]),
|
||||
{
|
||||
count: 0,
|
||||
projects: [],
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -67,11 +69,6 @@ function ProjectLookup({
|
||||
fetchProjects();
|
||||
}, [fetchProjects]);
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<FormGroup
|
||||
fieldId="project"
|
||||
|
||||
@ -32,7 +32,13 @@ function ScheduleList({
|
||||
const location = useLocation();
|
||||
|
||||
const {
|
||||
result: { schedules, itemCount, actions, relatedSearchFields },
|
||||
result: {
|
||||
schedules,
|
||||
itemCount,
|
||||
actions,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
error: contentError,
|
||||
isLoading,
|
||||
request: fetchSchedules,
|
||||
@ -49,16 +55,20 @@ function ScheduleList({
|
||||
schedules: results,
|
||||
itemCount: count,
|
||||
actions: scheduleActions.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
scheduleActions?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
scheduleActions.data.actions?.GET || {}
|
||||
).filter(key => scheduleActions.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [location, loadSchedules, loadScheduleOptions]),
|
||||
{
|
||||
schedules: [],
|
||||
itemCount: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -106,10 +116,6 @@ function ScheduleList({
|
||||
actions &&
|
||||
Object.prototype.hasOwnProperty.call(actions, 'POST') &&
|
||||
!hideAddButton;
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@ -26,7 +26,7 @@ function ApplicationTokenList({ i18n }) {
|
||||
const {
|
||||
error,
|
||||
isLoading,
|
||||
result: { tokens, itemCount, actions, relatedSearchFields },
|
||||
result: { tokens, itemCount, relatedSearchableKeys, searchableKeys },
|
||||
request: fetchTokens,
|
||||
} = useRequest(
|
||||
useCallback(async () => {
|
||||
@ -52,13 +52,15 @@ function ApplicationTokenList({ i18n }) {
|
||||
return {
|
||||
tokens: modifiedResults,
|
||||
itemCount: count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [id, location.search]),
|
||||
{ tokens: [], itemCount: 0, actions: {}, relatedSearchFields: [] }
|
||||
{ tokens: [], itemCount: 0, relatedSearchableKeys: [], searchableKeys: [] }
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@ -91,11 +93,6 @@ function ApplicationTokenList({ i18n }) {
|
||||
setSelected([]);
|
||||
};
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<PaginatedDataList
|
||||
|
||||
@ -32,7 +32,13 @@ function ApplicationsList({ i18n }) {
|
||||
isLoading,
|
||||
error,
|
||||
request: fetchApplications,
|
||||
result: { applications, itemCount, actions, relatedSearchFields },
|
||||
result: {
|
||||
applications,
|
||||
itemCount,
|
||||
actions,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
} = useRequest(
|
||||
useCallback(async () => {
|
||||
const params = parseQueryString(QS_CONFIG, location.search);
|
||||
@ -46,16 +52,20 @@ function ApplicationsList({ i18n }) {
|
||||
applications: response.data.results,
|
||||
itemCount: response.data.count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [location]),
|
||||
{
|
||||
applications: [],
|
||||
itemCount: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -89,10 +99,6 @@ function ApplicationsList({ i18n }) {
|
||||
};
|
||||
|
||||
const canAdd = actions && actions.POST;
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@ -25,7 +25,7 @@ function CredentialsStep({ i18n }) {
|
||||
const history = useHistory();
|
||||
|
||||
const {
|
||||
result: { credentials, count, actions, relatedSearchFields },
|
||||
result: { credentials, count, relatedSearchableKeys, searchableKeys },
|
||||
error: credentialsError,
|
||||
isLoading: isCredentialsLoading,
|
||||
request: fetchCredentials,
|
||||
@ -39,24 +39,21 @@ function CredentialsStep({ i18n }) {
|
||||
return {
|
||||
credentials: data.results,
|
||||
count: data.count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [history.location.search]),
|
||||
{ credentials: [], count: 0, actions: {}, relatedSearchFields: [] }
|
||||
{ credentials: [], count: 0, relatedSearchableKeys: [], searchableKeys: [] }
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
fetchCredentials();
|
||||
}, [fetchCredentials]);
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
if (credentialsError) {
|
||||
return <ContentError error={credentialsError} />;
|
||||
}
|
||||
|
||||
@ -33,7 +33,13 @@ function HostGroupsList({ i18n, host }) {
|
||||
const invId = host.summary_fields.inventory.id;
|
||||
|
||||
const {
|
||||
result: { groups, itemCount, actions, relatedSearchFields },
|
||||
result: {
|
||||
groups,
|
||||
itemCount,
|
||||
actions,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
error: contentError,
|
||||
isLoading,
|
||||
request: fetchGroups,
|
||||
@ -55,16 +61,20 @@ function HostGroupsList({ i18n, host }) {
|
||||
groups: results,
|
||||
itemCount: count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [hostId, search]),
|
||||
{
|
||||
groups: [],
|
||||
itemCount: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -128,10 +138,6 @@ function HostGroupsList({ i18n, host }) {
|
||||
|
||||
const canAdd =
|
||||
actions && Object.prototype.hasOwnProperty.call(actions, 'POST');
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@ -29,7 +29,7 @@ function HostList({ i18n }) {
|
||||
const [selected, setSelected] = useState([]);
|
||||
|
||||
const {
|
||||
result: { hosts, count, actions, relatedSearchFields },
|
||||
result: { hosts, count, actions, relatedSearchableKeys, searchableKeys },
|
||||
error: contentError,
|
||||
isLoading,
|
||||
request: fetchHosts,
|
||||
@ -44,16 +44,20 @@ function HostList({ i18n }) {
|
||||
hosts: results[0].data.results,
|
||||
count: results[0].data.count,
|
||||
actions: results[1].data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
results[1]?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(results[1].data.actions?.GET || {}).filter(
|
||||
key => results[1].data.actions?.GET[key].filterable
|
||||
),
|
||||
};
|
||||
}, [location]),
|
||||
{
|
||||
hosts: [],
|
||||
count: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -97,10 +101,6 @@ function HostList({ i18n }) {
|
||||
|
||||
const canAdd =
|
||||
actions && Object.prototype.hasOwnProperty.call(actions, 'POST');
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<PageSection>
|
||||
|
||||
@ -32,7 +32,13 @@ function InventoryGroupHostList({ i18n }) {
|
||||
const history = useHistory();
|
||||
|
||||
const {
|
||||
result: { hosts, hostCount, actions, relatedSearchFields },
|
||||
result: {
|
||||
hosts,
|
||||
hostCount,
|
||||
actions,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
error: contentError,
|
||||
isLoading,
|
||||
request: fetchHosts,
|
||||
@ -48,16 +54,20 @@ function InventoryGroupHostList({ i18n }) {
|
||||
hosts: response.data.results,
|
||||
hostCount: response.data.count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [groupId, inventoryId, location.search]),
|
||||
{
|
||||
hosts: [],
|
||||
hostCount: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -127,10 +137,6 @@ function InventoryGroupHostList({ i18n }) {
|
||||
const canAdd =
|
||||
actions && Object.prototype.hasOwnProperty.call(actions, 'POST');
|
||||
const addFormUrl = `/inventories/inventory/${inventoryId}/groups/${groupId}/nested_hosts/add`;
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@ -31,7 +31,13 @@ function InventoryHostGroupsList({ i18n }) {
|
||||
const { search } = useLocation();
|
||||
|
||||
const {
|
||||
result: { groups, itemCount, actions, relatedSearchFields },
|
||||
result: {
|
||||
groups,
|
||||
itemCount,
|
||||
actions,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
error: contentError,
|
||||
isLoading,
|
||||
request: fetchGroups,
|
||||
@ -53,16 +59,20 @@ function InventoryHostGroupsList({ i18n }) {
|
||||
groups: results,
|
||||
itemCount: count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [hostId, search]), // eslint-disable-line react-hooks/exhaustive-deps
|
||||
{
|
||||
groups: [],
|
||||
itemCount: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -126,10 +136,6 @@ function InventoryHostGroupsList({ i18n }) {
|
||||
|
||||
const canAdd =
|
||||
actions && Object.prototype.hasOwnProperty.call(actions, 'POST');
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@ -29,7 +29,13 @@ function InventoryList({ i18n }) {
|
||||
const [selected, setSelected] = useState([]);
|
||||
|
||||
const {
|
||||
result: { results, itemCount, actions, relatedSearchFields },
|
||||
result: {
|
||||
results,
|
||||
itemCount,
|
||||
actions,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
error: contentError,
|
||||
isLoading,
|
||||
request: fetchInventories,
|
||||
@ -44,16 +50,20 @@ function InventoryList({ i18n }) {
|
||||
results: response.data.results,
|
||||
itemCount: response.data.count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [location]),
|
||||
{
|
||||
results: [],
|
||||
itemCount: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -97,10 +107,6 @@ function InventoryList({ i18n }) {
|
||||
|
||||
const hasContentLoading = isDeleteLoading || isLoading;
|
||||
const canAdd = actions && actions.POST;
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
const handleSelectAll = isSelected => {
|
||||
setSelected(isSelected ? [...inventories] : []);
|
||||
|
||||
@ -31,7 +31,13 @@ function OrganizationsList({ i18n }) {
|
||||
const addUrl = `${match.url}/add`;
|
||||
|
||||
const {
|
||||
result: { organizations, organizationCount, actions, relatedSearchFields },
|
||||
result: {
|
||||
organizations,
|
||||
organizationCount,
|
||||
actions,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
error: contentError,
|
||||
isLoading: isOrgsLoading,
|
||||
request: fetchOrganizations,
|
||||
@ -46,16 +52,20 @@ function OrganizationsList({ i18n }) {
|
||||
organizations: orgs.data.results,
|
||||
organizationCount: orgs.data.count,
|
||||
actions: orgActions.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
orgActions?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(orgActions.data.actions?.GET || {}).filter(
|
||||
key => orgActions.data.actions?.GET[key].filterable
|
||||
),
|
||||
};
|
||||
}, [location]),
|
||||
{
|
||||
organizations: [],
|
||||
organizationCount: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -90,10 +100,6 @@ function OrganizationsList({ i18n }) {
|
||||
|
||||
const hasContentLoading = isDeleteLoading || isOrgsLoading;
|
||||
const canAdd = actions && actions.POST;
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
const handleSelectAll = isSelected => {
|
||||
setSelected(isSelected ? [...organizations] : []);
|
||||
|
||||
@ -30,7 +30,13 @@ function ProjectList({ i18n }) {
|
||||
const [selected, setSelected] = useState([]);
|
||||
|
||||
const {
|
||||
result: { results, itemCount, actions, relatedSearchFields },
|
||||
result: {
|
||||
results,
|
||||
itemCount,
|
||||
actions,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
error: contentError,
|
||||
isLoading,
|
||||
request: fetchProjects,
|
||||
@ -45,16 +51,20 @@ function ProjectList({ i18n }) {
|
||||
results: response.data.results,
|
||||
itemCount: response.data.count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [location]),
|
||||
{
|
||||
results: [],
|
||||
itemCount: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -89,10 +99,6 @@ function ProjectList({ i18n }) {
|
||||
|
||||
const hasContentLoading = isDeleteLoading || isLoading;
|
||||
const canAdd = actions && actions.POST;
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
const handleSelectAll = isSelected => {
|
||||
setSelected(isSelected ? [...projects] : []);
|
||||
|
||||
@ -29,7 +29,13 @@ function TeamList({ i18n }) {
|
||||
const [selected, setSelected] = useState([]);
|
||||
|
||||
const {
|
||||
result: { teams, itemCount, actions, relatedSearchFields },
|
||||
result: {
|
||||
teams,
|
||||
itemCount,
|
||||
actions,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
error: contentError,
|
||||
isLoading,
|
||||
request: fetchTeams,
|
||||
@ -44,16 +50,20 @@ function TeamList({ i18n }) {
|
||||
teams: response.data.results,
|
||||
itemCount: response.data.count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [location]),
|
||||
{
|
||||
teams: [],
|
||||
itemCount: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -85,10 +95,6 @@ function TeamList({ i18n }) {
|
||||
|
||||
const hasContentLoading = isDeleteLoading || isLoading;
|
||||
const canAdd = actions && actions.POST;
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
const handleSelectAll = isSelected => {
|
||||
setSelected(isSelected ? [...teams] : []);
|
||||
|
||||
@ -37,7 +37,13 @@ function TeamRolesList({ i18n, me, team }) {
|
||||
isLoading,
|
||||
request: fetchRoles,
|
||||
contentError,
|
||||
result: { roleCount, roles, isAdminOfOrg, actions, relatedSearchFields },
|
||||
result: {
|
||||
roleCount,
|
||||
roles,
|
||||
isAdminOfOrg,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
} = useRequest(
|
||||
useCallback(async () => {
|
||||
const params = parseQueryString(QS_CONFIG, search);
|
||||
@ -58,18 +64,20 @@ function TeamRolesList({ i18n, me, team }) {
|
||||
roleCount: count,
|
||||
roles: results,
|
||||
isAdminOfOrg: orgAdminCount > 0,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [me.id, team.id, team.organization, search]),
|
||||
{
|
||||
roles: [],
|
||||
roleCount: 0,
|
||||
isAdminOfOrg: false,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -98,11 +106,6 @@ function TeamRolesList({ i18n, me, team }) {
|
||||
);
|
||||
|
||||
const canAdd = team?.summary_fields?.user_capabilities?.edit || isAdminOfOrg;
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
const detailUrl = role => {
|
||||
const { resource_id, resource_type } = role.summary_fields;
|
||||
|
||||
|
||||
@ -36,7 +36,14 @@ function TemplateList({ i18n }) {
|
||||
const [selected, setSelected] = useState([]);
|
||||
|
||||
const {
|
||||
result: { results, count, jtActions, wfjtActions, relatedSearchFields },
|
||||
result: {
|
||||
results,
|
||||
count,
|
||||
jtActions,
|
||||
wfjtActions,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
error: contentError,
|
||||
isLoading,
|
||||
request: fetchTemplates,
|
||||
@ -47,20 +54,19 @@ function TemplateList({ i18n }) {
|
||||
UnifiedJobTemplatesAPI.read(params),
|
||||
JobTemplatesAPI.readOptions(),
|
||||
WorkflowJobTemplatesAPI.readOptions(),
|
||||
UnifiedJobTemplatesAPI.readOptions(),
|
||||
]);
|
||||
return {
|
||||
results: responses[0].data.results,
|
||||
count: responses[0].data.count,
|
||||
jtActions: responses[1].data.actions,
|
||||
wfjtActions: responses[2].data.actions,
|
||||
relatedSearchFields: [
|
||||
...(responses[1]?.data?.related_search_fields || []).map(val =>
|
||||
val.slice(0, -8)
|
||||
),
|
||||
...(responses[2]?.data?.related_search_fields || []).map(val =>
|
||||
val.slice(0, -8)
|
||||
),
|
||||
],
|
||||
relatedSearchableKeys: (
|
||||
responses[3]?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
responses[3].data.actions?.GET || {}
|
||||
).filter(key => responses[3].data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [location]),
|
||||
{
|
||||
@ -68,7 +74,8 @@ function TemplateList({ i18n }) {
|
||||
count: 0,
|
||||
jtActions: {},
|
||||
wfjtActions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -128,17 +135,6 @@ function TemplateList({ i18n }) {
|
||||
const canAddWFJT =
|
||||
wfjtActions && Object.prototype.hasOwnProperty.call(wfjtActions, 'POST');
|
||||
// spreading Set() returns only unique keys
|
||||
const relatedSearchableKeys = [...new Set(relatedSearchFields)] || [];
|
||||
const searchableKeys = [
|
||||
...new Set([
|
||||
...Object.keys(jtActions?.GET || {}).filter(
|
||||
key => jtActions.GET[key].filterable
|
||||
),
|
||||
...Object.keys(wfjtActions?.GET || {}).filter(
|
||||
key => wfjtActions.GET[key].filterable
|
||||
),
|
||||
]),
|
||||
];
|
||||
const addButtonOptions = [];
|
||||
|
||||
if (canAddJT) {
|
||||
|
||||
@ -38,7 +38,13 @@ function UserAccessList({ i18n, user }) {
|
||||
isLoading,
|
||||
request: fetchRoles,
|
||||
error,
|
||||
result: { roleCount, roles, actions, relatedSearchFields },
|
||||
result: {
|
||||
roleCount,
|
||||
roles,
|
||||
actions,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
} = useRequest(
|
||||
useCallback(async () => {
|
||||
const params = parseQueryString(QS_CONFIG, search);
|
||||
@ -55,16 +61,20 @@ function UserAccessList({ i18n, user }) {
|
||||
roleCount: count,
|
||||
roles: results,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [user.id, search]),
|
||||
{
|
||||
roles: [],
|
||||
roleCount: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -92,11 +102,6 @@ function UserAccessList({ i18n, user }) {
|
||||
user?.summary_fields?.user_capabilities?.edit ||
|
||||
(actions && Object.prototype.hasOwnProperty.call(actions, 'POST'));
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
const saveRoles = () => {
|
||||
setIsWizardOpen(false);
|
||||
fetchRoles();
|
||||
|
||||
@ -20,7 +20,7 @@ function UserTeamList({ i18n }) {
|
||||
const { id: userId } = useParams();
|
||||
|
||||
const {
|
||||
result: { teams, count, actions, relatedSearchFields },
|
||||
result: { teams, count, relatedSearchableKeys, searchableKeys },
|
||||
error: contentError,
|
||||
isLoading,
|
||||
request: fetchOrgs,
|
||||
@ -39,17 +39,19 @@ function UserTeamList({ i18n }) {
|
||||
return {
|
||||
teams: results,
|
||||
count: teamCount,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [userId, location.search]),
|
||||
{
|
||||
teams: [],
|
||||
count: 0,
|
||||
actions: {},
|
||||
relatedSearchFields: [],
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
@ -57,11 +59,6 @@ function UserTeamList({ i18n }) {
|
||||
fetchOrgs();
|
||||
}, [fetchOrgs]);
|
||||
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<PaginatedDataList
|
||||
items={teams}
|
||||
|
||||
@ -28,7 +28,7 @@ function UserTokenList({ i18n }) {
|
||||
error,
|
||||
isLoading,
|
||||
request: fetchTokens,
|
||||
result: { tokens, itemCount, actions, relatedSearchFields },
|
||||
result: { tokens, itemCount, relatedSearchableKeys, searchableKeys },
|
||||
} = useRequest(
|
||||
useCallback(async () => {
|
||||
const params = parseQueryString(QS_CONFIG, location.search);
|
||||
@ -53,13 +53,15 @@ function UserTokenList({ i18n }) {
|
||||
return {
|
||||
tokens: modifiedResults,
|
||||
itemCount: count,
|
||||
actions: actionsResponse.data.actions,
|
||||
relatedSearchFields: (
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [id, location.search]),
|
||||
{ tokens: [], itemCount: 0, actions: {}, relatedSearchFields: [] }
|
||||
{ tokens: [], itemCount: 0, relatedSearchableKeys: [], searchableKeys: [] }
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@ -93,10 +95,7 @@ function UserTokenList({ i18n }) {
|
||||
};
|
||||
|
||||
const canAdd = true;
|
||||
const relatedSearchableKeys = relatedSearchFields || [];
|
||||
const searchableKeys = Object.keys(actions?.GET || {}).filter(
|
||||
key => actions.GET[key].filterable
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<PaginatedDataList
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user