mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* artifact list page component: fix url params for pagination not being defined as numbers
* Improvement to tests (maybe)
(cherry picked from commit 34dfeeb7ec
)
Co-authored-by: Paul Tavares <56442535+paul-tavares@users.noreply.github.com>
This commit is contained in:
parent
bea60d1592
commit
8661bbd1a2
2 changed files with 14 additions and 11 deletions
|
@ -18,9 +18,7 @@ import {
|
|||
|
||||
jest.mock('../../../common/components/user_privileges');
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/129837
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/129836
|
||||
describe.skip('When using the ArtifactListPage component', () => {
|
||||
describe('When using the ArtifactListPage component', () => {
|
||||
let render: (
|
||||
props?: Partial<ArtifactListPageProps>
|
||||
) => ReturnType<AppContextTestRender['render']>;
|
||||
|
@ -115,7 +113,7 @@ describe.skip('When using the ArtifactListPage component', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should persist pagination `page size` changes to the URL', async () => {
|
||||
it('should persist pagination `pageSize` changes to the URL', async () => {
|
||||
const { getByTestId } = await renderWithListData();
|
||||
act(() => {
|
||||
userEvent.click(getByTestId('tablePaginationPopoverButton'));
|
||||
|
@ -124,6 +122,8 @@ describe.skip('When using the ArtifactListPage component', () => {
|
|||
await waitFor(() => {
|
||||
expect(getByTestId('tablePagination-20-rows'));
|
||||
});
|
||||
});
|
||||
act(() => {
|
||||
userEvent.click(getByTestId('tablePagination-20-rows'));
|
||||
});
|
||||
|
||||
|
@ -159,7 +159,9 @@ describe.skip('When using the ArtifactListPage component', () => {
|
|||
const { getByTestId } = await renderWithListData();
|
||||
await clickCardAction('delete');
|
||||
|
||||
expect(getByTestId('testPage-deleteModal')).toBeTruthy();
|
||||
await waitFor(() => {
|
||||
expect(getByTestId('testPage-deleteModal')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -259,7 +261,6 @@ describe.skip('When using the ArtifactListPage component', () => {
|
|||
});
|
||||
|
||||
await waitFor(() => {
|
||||
// console.log(`\n\n${renderResult.getByTestId('testPage-list').outerHTML}\n\n\n`);
|
||||
expect(renderResult.getByTestId('testPage-list-noResults')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,16 +10,14 @@ import { Pagination } from '@elastic/eui';
|
|||
import { useQuery } from 'react-query';
|
||||
import type { ServerApiError } from '../../../../common/types';
|
||||
import { useIsMounted } from '../../hooks/use_is_mounted';
|
||||
import {
|
||||
MANAGEMENT_DEFAULT_PAGE_SIZE,
|
||||
MANAGEMENT_PAGE_SIZE_OPTIONS,
|
||||
} from '../../../common/constants';
|
||||
import { MANAGEMENT_PAGE_SIZE_OPTIONS } from '../../../common/constants';
|
||||
import { useUrlParams } from '../../hooks/use_url_params';
|
||||
import { ExceptionsListApiClient } from '../../../services/exceptions_list/exceptions_list_api_client';
|
||||
import { ArtifactListPageUrlParams } from '../types';
|
||||
import { MaybeImmutable } from '../../../../../common/endpoint/types';
|
||||
import { useKueryFromExceptionsSearchFilter } from './use_kuery_from_exceptions_search_filter';
|
||||
import { useListArtifact } from '../../../hooks/artifacts';
|
||||
import { useUrlPagination } from '../../hooks/use_url_pagination';
|
||||
|
||||
type WithArtifactListDataInterface = ReturnType<typeof useListArtifact> & {
|
||||
/**
|
||||
|
@ -46,9 +44,13 @@ export const useWithArtifactListData = (
|
|||
const isMounted = useIsMounted();
|
||||
|
||||
const {
|
||||
urlParams: { page = 1, pageSize = MANAGEMENT_DEFAULT_PAGE_SIZE, filter, includedPolicies },
|
||||
urlParams: { filter, includedPolicies },
|
||||
} = useUrlParams<ArtifactListPageUrlParams>();
|
||||
|
||||
const {
|
||||
pagination: { page, pageSize },
|
||||
} = useUrlPagination();
|
||||
|
||||
// Used to determine if the `does data exist` check should be done.
|
||||
const kuery = useKueryFromExceptionsSearchFilter(filter, searchableFields, includedPolicies);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue