update all lists to use getSearchableKeys helper

This commit is contained in:
Keith J. Grant 2021-07-30 14:20:47 -07:00
parent 977164b920
commit 262a2b70e2
49 changed files with 124 additions and 150 deletions

View File

@ -8,7 +8,11 @@ import { getQSConfig, parseQueryString } from 'util/qs';
import DataListToolbar from '../DataListToolbar';
import CheckboxListItem from '../CheckboxListItem';
import { SelectedList } from '../SelectedList';
import PaginatedTable, { HeaderCell, HeaderRow } from '../PaginatedTable';
import PaginatedTable, {
HeaderCell,
HeaderRow,
getSearchableKeys,
} from '../PaginatedTable';
const QS_Config = (sortColumns) =>
getQSConfig('resource', {
@ -56,9 +60,7 @@ function SelectResourceStep({
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location, fetchItems, fetchOptions, sortColumns]),
{

View File

@ -20,6 +20,7 @@ import PaginatedTable, {
HeaderRow,
HeaderCell,
ToolbarDeleteButton,
getSearchableKeys,
} from '../PaginatedTable';
import JobListItem from './JobListItem';
import JobListCancelButton from './JobListCancelButton';
@ -59,9 +60,7 @@ function JobList({ defaultParams, showTypeColumn = false }) {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
},
[location] // eslint-disable-line react-hooks/exhaustive-deps

View File

@ -21,7 +21,11 @@ import ChipGroup from '../ChipGroup';
import Popover from '../Popover';
import DataListToolbar from '../DataListToolbar';
import LookupErrorMessage from './shared/LookupErrorMessage';
import PaginatedTable, { HeaderCell, HeaderRow } from '../PaginatedTable';
import PaginatedTable, {
HeaderCell,
HeaderRow,
getSearchableKeys,
} from '../PaginatedTable';
import HostListItem from './HostListItem';
import {
removeDefaultParams,
@ -157,9 +161,7 @@ function HostFilterLookup({
relatedSearchableKeys: (actions?.related_search_fields || []).map(
parseRelatedSearchFields
),
searchableKeys: Object.keys(actions?.actions.GET || {}).filter(
(key) => actions.actions?.GET[key].filterable
),
searchableKeys: getSearchableKeys(actions?.actions.GET),
};
},
[location.search]

View File

@ -74,14 +74,17 @@ function InventoryLookup({
relatedSearchableKeys: (
actionsResponse?.data?.related_search_fields || []
).map((val) => val.slice(0, -8)),
searchableKeys: Object.keys(
actionsResponse.data.actions?.GET || {}
).filter((key) => {
if (['kind', 'host_filter'].includes(key) && hideSmartInventories) {
return false;
}
return actionsResponse.data.actions?.GET[key].filterable;
}),
searchableKeys: Object.keys(actionsResponse.data.actions?.GET || {})
.filter((key) => {
if (['kind', 'host_filter'].includes(key) && hideSmartInventories) {
return false;
}
return actionsResponse.data.actions?.GET[key].filterable;
})
.map((key) => ({
key,
type: actionsResponse.data.actions?.GET[key].type,
})),
canEdit:
Boolean(actionsResponse.data.actions.POST) || isOverrideDisabled,
};

View File

@ -9,7 +9,11 @@ import { NotificationTemplatesAPI } from 'api';
import AlertModal from '../AlertModal';
import ErrorDetail from '../ErrorDetail';
import NotificationListItem from './NotificationListItem';
import PaginatedTable, { HeaderRow, HeaderCell } from '../PaginatedTable';
import PaginatedTable, {
HeaderRow,
HeaderCell,
getSearchableKeys,
} from '../PaginatedTable';
const QS_CONFIG = getQSConfig('notification', {
page: 1,
@ -89,9 +93,7 @@ function NotificationList({
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
if (showApprovalsToggle) {

View File

@ -0,0 +1,8 @@
export default function getSearchableKeys(keys = {}) {
return Object.keys(keys)
.filter((key) => keys[key].filterable)
.map((key) => ({
key,
type: keys[key].type,
}));
}

View File

@ -5,3 +5,4 @@ export { default as ActionItem } from './ActionItem';
export { default as ToolbarDeleteButton } from './ToolbarDeleteButton';
export { default as ToolbarAddButton } from './ToolbarAddButton';
export { default as ToolbarSyncSourceButton } from './ToolbarSyncSourceButton';
export { default as getSearchableKeys } from './getSearchableKeys';

View File

@ -11,6 +11,7 @@ import PaginatedTable, {
HeaderRow,
HeaderCell,
ToolbarAddButton,
getSearchableKeys,
} from '../PaginatedTable';
import DeleteRoleConfirmationModal from './DeleteRoleConfirmationModal';
import ResourceAccessListItem from './ResourceAccessListItem';
@ -89,9 +90,7 @@ function ResourceAccessList({ apiModel, resource }) {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
organizationRoles: orgRoles,
};
}, [apiModel, location, resource]),

View File

@ -14,6 +14,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from '../../PaginatedTable';
import DataListToolbar from '../../DataListToolbar';
import ScheduleListItem from './ScheduleListItem';
@ -61,9 +62,7 @@ function ScheduleList({
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),
searchableKeys: getSearchableKeys(scheduleActions.data.actions?.GET),
};
}, [location.search, loadSchedules, loadScheduleOptions]),
{

View File

@ -104,24 +104,28 @@ function LookupTypeInput({ value, type, setValue, maxSelectHeight }) {
key="gt"
value="gt"
description={t`Greater than comparison.`}
show={type !== 'json'}
/>
<Option
id="gte-option-select"
key="gte"
value="gte"
description={t`Greater than or equal to comparison.`}
show={type !== 'json'}
/>
<Option
id="lt-option-select"
key="lt"
value="lt"
description={t`Less than comparison.`}
show={type !== 'json'}
/>
<Option
id="lte-option-select"
key="lte"
value="lte"
description={t`Less than or equal to comparison.`}
show={type !== 'json'}
/>
<Option
id="isnull-option-select"

View File

@ -20,6 +20,7 @@ import PaginatedTable, {
HeaderRow,
HeaderCell,
ToolbarDeleteButton,
getSearchableKeys,
} from '../PaginatedTable';
import AddDropDownButton from '../AddDropDownButton';
import TemplateListItem from './TemplateListItem';
@ -69,9 +70,7 @@ function TemplateList({ defaultParams }) {
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),
searchableKeys: getSearchableKeys(responses[3].data.actions?.GET),
};
}, [location]), // eslint-disable-line react-hooks/exhaustive-deps
{

View File

@ -17,6 +17,7 @@ import DatalistToolbar from 'components/DataListToolbar';
import PaginatedTable, {
HeaderRow,
HeaderCell,
getSearchableKeys,
} from 'components/PaginatedTable';
import useRequest from 'hooks/useRequest';
import { getQSConfig, parseQueryString, updateQueryString } from 'util/qs';
@ -72,9 +73,7 @@ function ActivityStream() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
},
[location] // eslint-disable-line react-hooks/exhaustive-deps

View File

@ -6,6 +6,7 @@ import PaginatedTable, {
HeaderCell,
HeaderRow,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import { getQSConfig, parseQueryString } from 'util/qs';
import { TokensAPI, ApplicationsAPI } from 'api';
@ -57,9 +58,7 @@ function ApplicationTokenList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [id, location.search]),
{ tokens: [], itemCount: 0, relatedSearchableKeys: [], searchableKeys: [] }

View File

@ -16,6 +16,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarDeleteButton,
ToolbarAddButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import useSelected from 'hooks/useSelected';
@ -57,9 +58,7 @@ function ApplicationsList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{

View File

@ -12,6 +12,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import useRequest, { useDeleteItems } from 'hooks/useRequest';
import { getQSConfig, parseQueryString } from 'util/qs';
@ -44,9 +45,7 @@ function CredentialList() {
CredentialsAPI.read(params),
CredentialsAPI.readOptions(),
]);
const searchKeys = Object.keys(
credActions.data.actions?.GET || {}
).filter((key) => credActions.data.actions?.GET[key].filterable);
const searchKeys = getSearchableKeys(credActions.data.actions?.GET);
const item = searchKeys.indexOf('type');
if (item) {
searchKeys[item] = 'credential_type__kind';

View File

@ -12,6 +12,7 @@ import useRequest from 'hooks/useRequest';
import PaginatedTable, {
HeaderCell,
HeaderRow,
getSearchableKeys,
} from 'components/PaginatedTable';
const QS_CONFIG = getQSConfig('credential', {
@ -44,9 +45,7 @@ function CredentialsStep() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [history.location.search]),
{ credentials: [], count: 0, relatedSearchableKeys: [], searchableKeys: [] }

View File

@ -13,6 +13,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarDeleteButton,
ToolbarAddButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import ErrorDetail from 'components/ErrorDetail';
import AlertModal from 'components/AlertModal';
@ -57,9 +58,7 @@ function CredentialTypeList() {
relatedSearchableKeys: (
responseActions?.data?.related_search_fields || []
).map((val) => val.slice(0, -8)),
searchableKeys: Object.keys(
responseActions.data.actions?.GET || {}
).filter((key) => responseActions.data.actions?.GET[key].filterable),
searchableKeys: getSearchableKeys(responseActions.data.actions?.GET),
};
}, [location]),
{

View File

@ -12,6 +12,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarDeleteButton,
ToolbarAddButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import ErrorDetail from 'components/ErrorDetail';
import AlertModal from 'components/AlertModal';
@ -56,9 +57,7 @@ function ExecutionEnvironmentList() {
relatedSearchableKeys: (
responseActions?.data?.related_search_fields || []
).map((val) => val.slice(0, -8)),
searchableKeys: Object.keys(
responseActions.data.actions?.GET || {}
).filter((key) => responseActions.data.actions?.GET[key].filterable),
searchableKeys: getSearchableKeys(responseActions.data.actions?.GET),
};
}, [location]),
{

View File

@ -11,6 +11,7 @@ import DatalistToolbar from 'components/DataListToolbar';
import PaginatedTable, {
HeaderCell,
HeaderRow,
getSearchableKeys,
} from 'components/PaginatedTable';
import ExecutionEnvironmentTemplateListItem from './ExecutionEnvironmentTemplateListItem';
@ -56,9 +57,7 @@ function ExecutionEnvironmentTemplateList({ executionEnvironment }) {
relatedSearchableKeys: (
responseActions?.data?.related_search_fields || []
).map((val) => val.slice(0, -8)),
searchableKeys: Object.keys(
responseActions.data.actions?.GET || {}
).filter((key) => responseActions.data.actions?.GET[key].filterable),
searchableKeys: getSearchableKeys(responseActions.data.actions?.GET),
};
}, [location, id]),
{

View File

@ -15,6 +15,7 @@ import PaginatedTable, {
HeaderCell,
HeaderRow,
ToolbarAddButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import AssociateModal from 'components/AssociateModal';
import DisassociateButton from 'components/DisassociateButton';
@ -66,9 +67,7 @@ function HostGroupsList({ host }) {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [hostId, search]),
{

View File

@ -11,6 +11,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import useRequest, { useDeleteItems } from 'hooks/useRequest';
import useSelected from 'hooks/useSelected';
@ -68,9 +69,7 @@ function HostList() {
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
),
searchableKeys: getSearchableKeys(results[1].data.actions?.GET),
};
}, [location]),
{

View File

@ -13,6 +13,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import ErrorDetail from 'components/ErrorDetail';
import AlertModal from 'components/AlertModal';
@ -107,9 +108,7 @@ function InstanceGroupList({
relatedSearchableKeys: (
responseActions?.data?.related_search_fields || []
).map((val) => val.slice(0, -8)),
searchableKeys: Object.keys(
responseActions.data.actions?.GET || {}
).filter((key) => responseActions.data.actions?.GET[key].filterable),
searchableKeys: getSearchableKeys(responseActions.data.actions?.GET),
};
}, [location]),
{

View File

@ -9,6 +9,7 @@ import PaginatedTable, {
HeaderRow,
HeaderCell,
ToolbarAddButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import DisassociateButton from 'components/DisassociateButton';
import AssociateModal from 'components/AssociateModal';
@ -61,9 +62,7 @@ function InstanceList() {
relatedSearchableKeys: (
responseActions?.data?.related_search_fields || []
).map((val) => val.slice(0, -8)),
searchableKeys: Object.keys(
responseActions.data.actions?.GET || {}
).filter((key) => responseActions.data.actions?.GET[key].filterable),
searchableKeys: getSearchableKeys(responseActions.data.actions?.GET),
};
}, [location.search, instanceGroupId]),
{

View File

@ -17,6 +17,7 @@ import ErrorDetail from 'components/ErrorDetail';
import PaginatedTable, {
HeaderCell,
HeaderRow,
getSearchableKeys,
} from 'components/PaginatedTable';
import AssociateModal from 'components/AssociateModal';
import DisassociateButton from 'components/DisassociateButton';
@ -67,9 +68,7 @@ function InventoryGroupHostList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [groupId, inventoryId, location.search]),
{

View File

@ -11,6 +11,7 @@ import PaginatedTable, {
HeaderRow,
HeaderCell,
ToolbarAddButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import AdHocCommands from 'components/AdHocCommands/AdHocCommands';
import InventoryGroupItem from './InventoryGroupItem';
@ -62,9 +63,7 @@ function InventoryGroupsList() {
relatedSearchableKeys: (
groupOptions?.data?.related_search_fields || []
).map((val) => val.slice(0, -8)),
searchableKeys: Object.keys(
groupOptions.data.actions?.GET || {}
).filter((key) => groupOptions.data.actions?.GET[key].filterable),
searchableKeys: getSearchableKeys(groupOptions.data.actions?.GET),
};
}, [inventoryId, location]),
{

View File

@ -16,6 +16,7 @@ import PaginatedTable, {
HeaderRow,
HeaderCell,
ToolbarAddButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import AssociateModal from 'components/AssociateModal';
import DisassociateButton from 'components/DisassociateButton';
@ -72,9 +73,7 @@ function InventoryHostGroupsList() {
relatedSearchableKeys: (
hostGroupOptions?.data?.related_search_fields || []
).map((val) => val.slice(0, -8)),
searchableKeys: Object.keys(
hostGroupOptions.data.actions?.GET || {}
).filter((key) => hostGroupOptions.data.actions?.GET[key].filterable),
searchableKeys: getSearchableKeys(hostGroupOptions.data.actions?.GET),
};
}, [hostId, search]), // eslint-disable-line react-hooks/exhaustive-deps
{

View File

@ -12,6 +12,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import useSelected from 'hooks/useSelected';
import AdHocCommands from 'components/AdHocCommands/AdHocCommands';
@ -59,9 +60,7 @@ function InventoryHostList() {
relatedSearchableKeys: (
hostOptions?.data?.related_search_fields || []
).map((val) => val.slice(0, -8)),
searchableKeys: Object.keys(hostOptions.data.actions?.GET || {}).filter(
(key) => hostOptions.data.actions?.GET[key].filterable
),
searchableKeys: getSearchableKeys(hostOptions.data.actions?.GET),
};
}, [id, search]),
{

View File

@ -12,6 +12,7 @@ import PaginatedTable, {
HeaderRow,
HeaderCell,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import { getQSConfig, parseQueryString } from 'util/qs';
import AddDropDownButton from 'components/AddDropDownButton';
@ -54,9 +55,7 @@ function InventoryList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{

View File

@ -13,6 +13,7 @@ import DataListToolbar from 'components/DataListToolbar';
import PaginatedTable, {
HeaderCell,
HeaderRow,
getSearchableKeys,
} from 'components/PaginatedTable';
import AddDropDownButton from 'components/AddDropDownButton';
import AdHocCommands from 'components/AdHocCommands/AdHocCommands';
@ -65,9 +66,7 @@ function InventoryRelatedGroupList() {
relatedSearchableKeys: (actions?.data?.related_search_fields || []).map(
(val) => val.slice(0, -8)
),
searchableKeys: Object.keys(actions.data.actions?.GET || {}).filter(
(key) => actions.data.actions?.GET[key].filterable
),
searchableKeys: getSearchableKeys(actions.data.actions?.GET),
canAdd:
actions.data.actions &&
Object.prototype.hasOwnProperty.call(actions.data.actions, 'POST'),

View File

@ -11,6 +11,7 @@ import ErrorDetail from 'components/ErrorDetail';
import PaginatedTable, {
HeaderRow,
HeaderCell,
getSearchableKeys,
} from 'components/PaginatedTable';
import { useConfig } from 'contexts/Config';
import { parseQueryString, getQSConfig } from 'util/qs';
@ -25,9 +26,7 @@ const QS_CONFIG = getQSConfig('system_job_templates', {
const buildSearchKeys = (options) => {
const actions = options?.data?.actions?.GET || {};
const searchableKeys = Object.keys(actions).filter(
(key) => actions[key].filterable
);
const searchableKeys = getSearchableKeys(actions);
const relatedSearchableKeys = options?.data?.related_search_fields || [];
return { searchableKeys, relatedSearchableKeys };

View File

@ -15,6 +15,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import AlertModal from 'components/AlertModal';
import ErrorDetail from 'components/ErrorDetail';
@ -62,9 +63,7 @@ function NotificationTemplatesList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{

View File

@ -10,6 +10,7 @@ import useRequest from 'hooks/useRequest';
import PaginatedTable, {
HeaderRow,
HeaderCell,
getSearchableKeys,
} from 'components/PaginatedTable';
import DatalistToolbar from 'components/DataListToolbar';
@ -51,9 +52,7 @@ function OrganizationExecEnvList({ organization }) {
relatedSearchableKeys: (
responseActions?.data?.related_search_fields || []
).map((val) => val.slice(0, -8)),
searchableKeys: Object.keys(
responseActions.data.actions?.GET || {}
).filter((key) => responseActions.data.actions?.GET[key].filterable),
searchableKeys: getSearchableKeys(responseActions.data.actions?.GET),
};
}, [location, id]),
{

View File

@ -13,6 +13,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import { getQSConfig, parseQueryString } from 'util/qs';
import useSelected from 'hooks/useSelected';
@ -49,7 +50,6 @@ function OrganizationsList() {
OrganizationsAPI.read(params),
OrganizationsAPI.readOptions(),
]);
const keys = orgActions.data.actions?.GET || {};
return {
organizations: orgs.data.results,
organizationCount: orgs.data.count,
@ -57,15 +57,7 @@ function OrganizationsList() {
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
// ),
searchableKeys: Object.keys(keys)
.filter((key) => keys[key].filterable)
.map((key) => ({
key,
type: keys[key].type,
})),
searchableKeys: getSearchableKeys(orgActions.data.actions?.GET),
};
}, [location]),
{

View File

@ -7,6 +7,7 @@ import { OrganizationsAPI } from 'api';
import PaginatedTable, {
HeaderRow,
HeaderCell,
getSearchableKeys,
} from 'components/PaginatedTable';
import { getQSConfig, parseQueryString } from 'util/qs';
import useRequest from 'hooks/useRequest';
@ -39,9 +40,7 @@ function OrganizationTeamList({ id }) {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [id, location]),
{

View File

@ -12,6 +12,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import { getQSConfig, parseQueryString } from 'util/qs';
import useSelected from 'hooks/useSelected';
@ -54,9 +55,7 @@ function ProjectJobTemplatesList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location, projectId]),
{

View File

@ -15,6 +15,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import useSelected from 'hooks/useSelected';
import useExpanded from 'hooks/useExpanded';
@ -75,9 +76,7 @@ function ProjectList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{

View File

@ -14,6 +14,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import useSelected from 'hooks/useSelected';
import { getQSConfig, parseQueryString } from 'util/qs';
@ -55,9 +56,7 @@ function TeamList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{

View File

@ -16,6 +16,7 @@ import PaginatedTable, {
HeaderCell,
HeaderRow,
ToolbarAddButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import { getQSConfig, parseQueryString } from 'util/qs';
import ErrorDetail from 'components/ErrorDetail';
@ -69,9 +70,7 @@ function TeamRolesList({ me, team }) {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [me.id, team.id, team.organization, search]),
{

View File

@ -11,6 +11,7 @@ import CheckboxListItem from 'components/CheckboxListItem';
import PaginatedTable, {
HeaderCell,
HeaderRow,
getSearchableKeys,
} from 'components/PaginatedTable';
const QS_CONFIG = getQSConfig('inventory-sources', {
@ -40,9 +41,7 @@ function InventorySourcesList({ nodeResource, onUpdateNodeResource }) {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{

View File

@ -11,6 +11,7 @@ import CheckboxListItem from 'components/CheckboxListItem';
import PaginatedTable, {
HeaderCell,
HeaderRow,
getSearchableKeys,
} from 'components/PaginatedTable';
const QS_CONFIG = getQSConfig('job-templates', {
@ -42,9 +43,7 @@ function JobTemplatesList({ nodeResource, onUpdateNodeResource }) {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{

View File

@ -11,6 +11,7 @@ import CheckboxListItem from 'components/CheckboxListItem';
import PaginatedTable, {
HeaderCell,
HeaderRow,
getSearchableKeys,
} from 'components/PaginatedTable';
const QS_CONFIG = getQSConfig('projects', {
@ -40,9 +41,7 @@ function ProjectsList({ nodeResource, onUpdateNodeResource }) {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{

View File

@ -10,6 +10,7 @@ import CheckboxListItem from 'components/CheckboxListItem';
import PaginatedTable, {
HeaderCell,
HeaderRow,
getSearchableKeys,
} from 'components/PaginatedTable';
const QS_CONFIG = getQSConfig('system-job-templates', {
@ -46,9 +47,7 @@ function SystemJobTemplatesList({ nodeResource, onUpdateNodeResource }) {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{

View File

@ -11,6 +11,7 @@ import CheckboxListItem from 'components/CheckboxListItem';
import PaginatedTable, {
HeaderCell,
HeaderRow,
getSearchableKeys,
} from 'components/PaginatedTable';
const QS_CONFIG = getQSConfig('workflow-job-templates', {
@ -47,9 +48,7 @@ function WorkflowJobTemplatesList({ nodeResource, onUpdateNodeResource }) {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{

View File

@ -12,6 +12,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import useRequest, { useDeleteItems } from 'hooks/useRequest';
import useSelected from 'hooks/useSelected';
@ -53,9 +54,7 @@ function UserList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{

View File

@ -16,6 +16,7 @@ import PaginatedTable, {
HeaderRow,
HeaderCell,
ToolbarAddButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import ErrorDetail from 'components/ErrorDetail';
import AlertModal from 'components/AlertModal';
@ -67,9 +68,7 @@ function UserRolesList({ user }) {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [user.id, search]),
{

View File

@ -6,6 +6,7 @@ import PaginatedTable, {
HeaderRow,
HeaderCell,
ToolbarAddButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import DataListToolbar from 'components/DataListToolbar';
import DisassociateButton from 'components/DisassociateButton';
@ -66,9 +67,7 @@ function UserTeamList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [userId, location.search]),
{

View File

@ -8,6 +8,7 @@ import PaginatedTable, {
HeaderCell,
ToolbarAddButton,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import useSelected from 'hooks/useSelected';
import useRequest, { useDeleteItems } from 'hooks/useRequest';
@ -58,9 +59,7 @@ function UserTokenList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [id, location.search]),
{ tokens: [], itemCount: 0, relatedSearchableKeys: [], searchableKeys: [] }

View File

@ -7,6 +7,7 @@ import PaginatedTable, {
HeaderRow,
HeaderCell,
ToolbarDeleteButton,
getSearchableKeys,
} from 'components/PaginatedTable';
import AlertModal from 'components/AlertModal';
import ErrorDetail from 'components/ErrorDetail';
@ -50,9 +51,7 @@ function WorkflowApprovalsList() {
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),
searchableKeys: getSearchableKeys(actionsResponse.data.actions?.GET),
};
}, [location]),
{