mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 21:51:26 -03:30
update searchableKeys in all Lookups & JobOutput
This commit is contained in:
parent
262a2b70e2
commit
60f1919791
@ -9,6 +9,7 @@ import { CredentialsAPI } from 'api';
|
||||
import { getQSConfig, parseQueryString, mergeParams } from 'util/qs';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
import { required } from 'util/validators';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import Popover from '../Popover';
|
||||
|
||||
import ContentError from '../ContentError';
|
||||
@ -59,9 +60,7 @@ function AdHocCredentialStep({ credentialTypeId }) {
|
||||
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),
|
||||
};
|
||||
}, [credentialTypeId, history.location.search]),
|
||||
{
|
||||
|
||||
@ -6,6 +6,7 @@ import { Form, FormGroup } from '@patternfly/react-core';
|
||||
import { ExecutionEnvironmentsAPI } from 'api';
|
||||
|
||||
import { parseQueryString, getQSConfig, mergeParams } from 'util/qs';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
import Popover from '../Popover';
|
||||
import ContentError from '../ContentError';
|
||||
@ -60,9 +61,7 @@ function AdHocExecutionEnvironmentStep({ organizationId }) {
|
||||
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, organizationId]),
|
||||
{
|
||||
|
||||
@ -3,6 +3,7 @@ import { useHistory } from 'react-router-dom';
|
||||
|
||||
import { t } from '@lingui/macro';
|
||||
import { Button, Modal } from '@patternfly/react-core';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
import { getQSConfig, parseQueryString } from 'util/qs';
|
||||
import useSelected from 'hooks/useSelected';
|
||||
@ -53,9 +54,7 @@ function AssociateModal({
|
||||
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),
|
||||
};
|
||||
}, [fetchRequest, optionsRequest, history.location.search, displayKey]),
|
||||
{
|
||||
|
||||
@ -7,6 +7,7 @@ import { useField } from 'formik';
|
||||
import styled from 'styled-components';
|
||||
import { Alert, ToolbarItem } from '@patternfly/react-core';
|
||||
import { CredentialsAPI, CredentialTypesAPI } from 'api';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import { getQSConfig, parseQueryString } from 'util/qs';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
import AnsibleSelect from '../../AnsibleSelect';
|
||||
@ -88,9 +89,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),
|
||||
};
|
||||
}, [selectedType, history.location.search]),
|
||||
{ credentials: [], count: 0, relatedSearchableKeys: [], searchableKeys: [] }
|
||||
|
||||
@ -6,6 +6,7 @@ import { useField } from 'formik';
|
||||
import styled from 'styled-components';
|
||||
import { Alert } from '@patternfly/react-core';
|
||||
import { InventoriesAPI } from 'api';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import { getQSConfig, parseQueryString } from 'util/qs';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
import OptionsList from '../../OptionsList';
|
||||
@ -45,9 +46,7 @@ function InventoryStep({ warningMessage = null }) {
|
||||
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]),
|
||||
{
|
||||
|
||||
@ -5,6 +5,7 @@ import { t } from '@lingui/macro';
|
||||
import { FormGroup } from '@patternfly/react-core';
|
||||
import { ApplicationsAPI } from 'api';
|
||||
import { Application } from 'types';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import { getQSConfig, parseQueryString } from 'util/qs';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
import Lookup from './Lookup';
|
||||
@ -42,9 +43,7 @@ function ApplicationLookup({ onChange, value, label, fieldName, validate }) {
|
||||
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]),
|
||||
{
|
||||
|
||||
@ -14,6 +14,7 @@ import { t } from '@lingui/macro';
|
||||
import { FormGroup } from '@patternfly/react-core';
|
||||
import { CredentialsAPI } from 'api';
|
||||
import { Credential } from 'types';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import { getQSConfig, parseQueryString, mergeParams } from 'util/qs';
|
||||
import useAutoPopulateLookup from 'hooks/useAutoPopulateLookup';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
@ -82,12 +83,10 @@ function CredentialLookup({
|
||||
autoPopulateLookup(data.results);
|
||||
}
|
||||
|
||||
const searchKeys = Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter((key) => actionsResponse.data.actions?.GET[key].filterable);
|
||||
const item = searchKeys.indexOf('type');
|
||||
const searchKeys = getSearchableKeys(actionsResponse.data.actions?.GET);
|
||||
const item = searchKeys.find((k) => k.key === 'type');
|
||||
if (item) {
|
||||
searchKeys[item] = 'credential_type__kind';
|
||||
item.key = 'credential_type__kind';
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@ -4,6 +4,7 @@ import { useLocation } from 'react-router-dom';
|
||||
import { t } from '@lingui/macro';
|
||||
import { FormGroup, Tooltip } from '@patternfly/react-core';
|
||||
import { ExecutionEnvironmentsAPI, ProjectsAPI } from 'api';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import { ExecutionEnvironment } from 'types';
|
||||
import { getQSConfig, parseQueryString, mergeParams } from 'util/qs';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
@ -109,9 +110,7 @@ function ExecutionEnvironmentLookup({
|
||||
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,
|
||||
|
||||
@ -6,6 +6,7 @@ import { t, Trans } from '@lingui/macro';
|
||||
import { FormGroup } from '@patternfly/react-core';
|
||||
import { InstanceGroupsAPI } from 'api';
|
||||
import { InstanceGroup } from 'types';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import { getQSConfig, parseQueryString } from 'util/qs';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
import Popover from '../Popover';
|
||||
@ -47,9 +48,7 @@ function InstanceGroupsLookup({
|
||||
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]),
|
||||
{
|
||||
|
||||
@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
|
||||
import { t } from '@lingui/macro';
|
||||
import { ToolbarItem, Alert } from '@patternfly/react-core';
|
||||
import { CredentialsAPI, CredentialTypesAPI } from 'api';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
import { getQSConfig, parseQueryString } from 'util/qs';
|
||||
import useIsMounted from 'hooks/useIsMounted';
|
||||
@ -100,9 +101,7 @@ function MultiCredentialsLookup({
|
||||
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),
|
||||
};
|
||||
}, [selectedType, history.location]),
|
||||
{
|
||||
|
||||
@ -6,6 +6,7 @@ import { FormGroup } from '@patternfly/react-core';
|
||||
import { OrganizationsAPI } from 'api';
|
||||
import { Organization } from 'types';
|
||||
import { getQSConfig, parseQueryString } from 'util/qs';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
import useAutoPopulateLookup from 'hooks/useAutoPopulateLookup';
|
||||
import OptionsList from '../OptionsList';
|
||||
@ -57,9 +58,7 @@ function OrganizationLookup({
|
||||
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),
|
||||
};
|
||||
}, [autoPopulate, autoPopulateLookup, history.location.search]),
|
||||
{
|
||||
|
||||
@ -7,6 +7,7 @@ import { ProjectsAPI } from 'api';
|
||||
import { Project } from 'types';
|
||||
import useAutoPopulateLookup from 'hooks/useAutoPopulateLookup';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import { getQSConfig, parseQueryString } from 'util/qs';
|
||||
import OptionsList from '../OptionsList';
|
||||
import Popover from '../Popover';
|
||||
@ -56,9 +57,7 @@ function ProjectLookup({
|
||||
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),
|
||||
canEdit:
|
||||
Boolean(actionsResponse.data.actions.POST) || isOverrideDisabled,
|
||||
};
|
||||
|
||||
@ -14,6 +14,7 @@ import { Card, PageSection } from '@patternfly/react-core';
|
||||
import ContentError from 'components/ContentError';
|
||||
import ContentLoading from 'components/ContentLoading';
|
||||
import RoutedTabs from 'components/RoutedTabs';
|
||||
import { getSearchableKeys } from 'components/PaginatedTable';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
import { getJobModel } from 'util/jobs';
|
||||
import JobDetail from './JobDetail';
|
||||
@ -70,9 +71,7 @@ function Job({ setBreadcrumb }) {
|
||||
eventRelatedSearchableKeys: (
|
||||
eventOptions?.related_search_fields || []
|
||||
).map((val) => val.slice(0, -8)),
|
||||
eventSearchableKeys: Object.keys(
|
||||
eventOptions?.actions?.GET || {}
|
||||
).filter((key) => eventOptions?.actions?.GET[key].filterable),
|
||||
eventSearchableKeys: getSearchableKeys(eventOptions?.actions?.GET),
|
||||
};
|
||||
}, [id, type, setBreadcrumb]),
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user