From c81c04ea6b22cccb65b4d352d00c8fba1ef909a3 Mon Sep 17 00:00:00 2001 From: scottybollinger Date: Tue, 1 Dec 2020 15:12:32 -0600 Subject: [PATCH 1/8] Add IndexingStatusLogic --- .../indexing_status_logic.test.ts | 110 ++++++++++++++++++ .../indexing_status/indexing_status_logic.ts | 80 +++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.test.ts create mode 100644 x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.test.ts new file mode 100644 index 0000000000000..c9145bc61a7cc --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.test.ts @@ -0,0 +1,110 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { resetContext } from 'kea'; + +jest.mock('../http', () => ({ + HttpLogic: { + values: { http: { get: jest.fn() } }, + }, +})); +import { HttpLogic } from '../http'; + +jest.mock('../flash_messages', () => ({ + flashAPIErrors: jest.fn(), +})); +import { flashAPIErrors } from '../flash_messages'; + +import { IndexingStatusLogic } from './indexing_status_logic'; + +describe('IndexingStatusLogic', () => { + jest.useFakeTimers(); + + let unmount: any; + + const mockStatusResponse = { + percentageComplete: 50, + numDocumentsWithErrors: 3, + activeReindexJobId: 1, + }; + + beforeEach(() => { + jest.clearAllMocks(); + resetContext({}); + unmount = IndexingStatusLogic.mount(); + }); + + it('has expected default values', () => { + expect(IndexingStatusLogic.values).toEqual({ + percentageComplete: 100, + numDocumentsWithErrors: 0, + }); + }); + + describe('setIndexingStatus', () => { + it('sets reducers', () => { + IndexingStatusLogic.actions.setIndexingStatus(mockStatusResponse); + + expect(IndexingStatusLogic.values.percentageComplete).toEqual( + mockStatusResponse.percentageComplete + ); + expect(IndexingStatusLogic.values.numDocumentsWithErrors).toEqual( + mockStatusResponse.numDocumentsWithErrors + ); + }); + }); + + describe('fetchIndexingStatus', () => { + const statusPath = '/api/workplace_search/path/123'; + const onComplete = jest.fn(); + const TIMEOUT = 3000; + + it('calls API and sets values', async () => { + const setIndexingStatusSpy = jest.spyOn(IndexingStatusLogic.actions, 'setIndexingStatus'); + const promise = Promise.resolve(mockStatusResponse); + (HttpLogic.values.http.get as jest.Mock).mockReturnValue(promise); + + IndexingStatusLogic.actions.fetchIndexingStatus({ statusPath, onComplete }); + jest.advanceTimersByTime(TIMEOUT); + + expect(HttpLogic.values.http.get).toHaveBeenCalledWith(statusPath); + await promise; + + expect(setIndexingStatusSpy).toHaveBeenCalledWith(mockStatusResponse); + }); + + it('handles error', async () => { + const promise = Promise.reject('An error occured'); + (HttpLogic.values.http.get as jest.Mock).mockReturnValue(promise); + + IndexingStatusLogic.actions.fetchIndexingStatus({ statusPath, onComplete }); + jest.advanceTimersByTime(TIMEOUT); + + try { + await promise; + } catch { + expect(flashAPIErrors).toHaveBeenCalledWith('An error occured'); + } + }); + + it('handles indexing complete state', async () => { + const promise = Promise.resolve({ ...mockStatusResponse, percentageComplete: 100 }); + (HttpLogic.values.http.get as jest.Mock).mockReturnValue(promise); + IndexingStatusLogic.actions.fetchIndexingStatus({ statusPath, onComplete }); + jest.advanceTimersByTime(TIMEOUT); + + await promise; + + expect(clearInterval).toHaveBeenCalled(); + expect(onComplete).toHaveBeenCalledWith(mockStatusResponse.numDocumentsWithErrors); + }); + + it('handles unmounting', async () => { + unmount(); + expect(clearInterval).toHaveBeenCalled(); + }); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts new file mode 100644 index 0000000000000..e7cb41ebc71cc --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts @@ -0,0 +1,80 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { kea, MakeLogicType } from 'kea'; + +import { HttpLogic } from '../http'; + +import { IIndexingStatus } from '../types'; + +import { flashAPIErrors } from '../flash_messages'; + +interface IndexingStatusProps { + statusPath: string; + onComplete(numDocumentsWithErrors: number): void; +} + +interface IndexingStatusActions { + fetchIndexingStatus(props: IndexingStatusProps): IndexingStatusProps; + setIndexingStatus({ + percentageComplete, + numDocumentsWithErrors, + }: IIndexingStatus): IIndexingStatus; +} + +interface IndexingStatusValues { + percentageComplete: number; + numDocumentsWithErrors: number; +} + +let pollingInterval: number; + +export const IndexingStatusLogic = kea>({ + actions: { + fetchIndexingStatus: ({ statusPath, onComplete }) => ({ statusPath, onComplete }), + setIndexingStatus: ({ numDocumentsWithErrors, percentageComplete }) => ({ + numDocumentsWithErrors, + percentageComplete, + }), + }, + reducers: { + percentageComplete: [ + 100, + { + setIndexingStatus: (_, { percentageComplete }) => percentageComplete, + }, + ], + numDocumentsWithErrors: [ + 0, + { + setIndexingStatus: (_, { numDocumentsWithErrors }) => numDocumentsWithErrors, + }, + ], + }, + listeners: ({ actions }) => ({ + fetchIndexingStatus: ({ statusPath, onComplete }: IndexingStatusProps) => { + pollingInterval = window.setInterval(async () => { + try { + const response = (await HttpLogic.values.http.get(statusPath)) as IIndexingStatus; + if (response.percentageComplete >= 100) { + clearInterval(pollingInterval); + } + actions.setIndexingStatus(response); + if (response.percentageComplete >= 100 && onComplete) { + onComplete(response.numDocumentsWithErrors); + } + } catch (e) { + flashAPIErrors(e); + } + }, 3000); + }, + }), + events: () => ({ + beforeUnmount() { + clearInterval(pollingInterval); + }, + }), +}); From 887c195b0f70215811c411dd98d9e181ee16db0c Mon Sep 17 00:00:00 2001 From: scottybollinger Date: Tue, 1 Dec 2020 15:28:19 -0600 Subject: [PATCH 2/8] Replace IndexingStatusFetcher with logic --- .../indexing_status/indexing_status.test.tsx | 32 +++++++--- .../indexing_status/indexing_status.tsx | 56 ++++++++++------ .../indexing_status_fetcher.tsx | 64 ------------------- 3 files changed, 58 insertions(+), 94 deletions(-) delete mode 100644 x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_fetcher.tsx diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.test.tsx index 097c3bbc8e9ff..1044a4c6eb70a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.test.tsx @@ -4,6 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ +import '../../__mocks__/kea.mock'; +import '../../__mocks__/shallow_useeffect.mock'; + +import { setMockActions, setMockValues } from '../../__mocks__'; + import React from 'react'; import { shallow } from 'enzyme'; @@ -11,7 +16,6 @@ import { EuiPanel } from '@elastic/eui'; import { IndexingStatusContent } from './indexing_status_content'; import { IndexingStatusErrors } from './indexing_status_errors'; -import { IndexingStatusFetcher } from './indexing_status_fetcher'; import { IndexingStatus } from './indexing_status'; describe('IndexingStatus', () => { @@ -19,6 +23,7 @@ describe('IndexingStatus', () => { const getStatusPath = jest.fn(); const onComplete = jest.fn(); const setGlobalIndexingStatus = jest.fn(); + const fetchIndexingStatus = jest.fn(); const props = { percentageComplete: 50, @@ -32,20 +37,29 @@ describe('IndexingStatus', () => { setGlobalIndexingStatus, }; + beforeEach(() => { + setMockActions({ fetchIndexingStatus }); + }); + it('renders', () => { + setMockValues({ + percentageComplete: 50, + numDocumentsWithErrors: 0, + }); const wrapper = shallow(); - const fetcher = wrapper.find(IndexingStatusFetcher).prop('children')( - props.percentageComplete, - props.numDocumentsWithErrors - ); - expect(shallow(fetcher).find(EuiPanel)).toHaveLength(1); - expect(shallow(fetcher).find(IndexingStatusContent)).toHaveLength(1); + expect(wrapper.find(EuiPanel)).toHaveLength(1); + expect(wrapper.find(IndexingStatusContent)).toHaveLength(1); + expect(fetchIndexingStatus).toHaveBeenCalled(); }); it('renders errors', () => { + setMockValues({ + percentageComplete: 100, + numDocumentsWithErrors: 1, + }); const wrapper = shallow(); - const fetcher = wrapper.find(IndexingStatusFetcher).prop('children')(100, 1); - expect(shallow(fetcher).find(IndexingStatusErrors)).toHaveLength(1); + + expect(wrapper.find(IndexingStatusErrors)).toHaveLength(1); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx index beec0babea590..bcf13a5668d5f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx @@ -4,13 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { useEffect } from 'react'; + +import { useValues, useActions } from 'kea'; import { EuiPanel, EuiSpacer } from '@elastic/eui'; import { IndexingStatusContent } from './indexing_status_content'; import { IndexingStatusErrors } from './indexing_status_errors'; -import { IndexingStatusFetcher } from './indexing_status_fetcher'; +import { IndexingStatusLogic } from './indexing_status_logic'; import { IIndexingStatus } from '../types'; @@ -23,22 +25,34 @@ export interface IIndexingStatusProps extends IIndexingStatus { setGlobalIndexingStatus?(activeReindexJob: IIndexingStatus): void; } -export const IndexingStatus: React.FC = (props) => ( - - {(percentageComplete, numDocumentsWithErrors) => ( -
- {percentageComplete < 100 && ( - - - - )} - {percentageComplete === 100 && numDocumentsWithErrors > 0 && ( - <> - - - - )} -
- )} -
-); +export const IndexingStatus: React.FC = ({ + itemId, + activeReindexJobId, + viewLinkPath, + getStatusPath, + onComplete, +}) => { + const { percentageComplete, numDocumentsWithErrors } = useValues(IndexingStatusLogic); + const { fetchIndexingStatus } = useActions(IndexingStatusLogic); + const statusPath = getStatusPath(itemId, activeReindexJobId); + + useEffect(() => { + fetchIndexingStatus({ statusPath, onComplete }); + }, []); + + return ( +
+ {percentageComplete < 100 && ( + + + + )} + {percentageComplete === 100 && numDocumentsWithErrors > 0 && ( + <> + + + + )} +
+ ); +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_fetcher.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_fetcher.tsx deleted file mode 100644 index cb7c82f91ed61..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_fetcher.tsx +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React, { useEffect, useState, useRef } from 'react'; - -import { HttpLogic } from '../http'; -import { flashAPIErrors } from '../flash_messages'; - -interface IIndexingStatusFetcherProps { - activeReindexJobId: number; - itemId: string; - percentageComplete: number; - numDocumentsWithErrors: number; - onComplete?(numDocumentsWithErrors: number): void; - getStatusPath(itemId: string, activeReindexJobId: number): string; - children(percentageComplete: number, numDocumentsWithErrors: number): JSX.Element; -} - -export const IndexingStatusFetcher: React.FC = ({ - activeReindexJobId, - children, - getStatusPath, - itemId, - numDocumentsWithErrors, - onComplete, - percentageComplete = 0, -}) => { - const [indexingStatus, setIndexingStatus] = useState({ - numDocumentsWithErrors, - percentageComplete, - }); - const pollingInterval = useRef(); - - useEffect(() => { - pollingInterval.current = window.setInterval(async () => { - try { - const response = await HttpLogic.values.http.get(getStatusPath(itemId, activeReindexJobId)); - if (response.percentageComplete >= 100) { - clearInterval(pollingInterval.current); - } - setIndexingStatus({ - percentageComplete: response.percentageComplete, - numDocumentsWithErrors: response.numDocumentsWithErrors, - }); - if (response.percentageComplete >= 100 && onComplete) { - onComplete(response.numDocumentsWithErrors); - } - } catch (e) { - flashAPIErrors(e); - } - }, 3000); - - return () => { - if (pollingInterval.current) { - clearInterval(pollingInterval.current); - } - }; - }, []); - - return children(indexingStatus.percentageComplete, indexingStatus.numDocumentsWithErrors); -}; From 3d79dd37ff656f3d2f55e5f59c9be60821c43434 Mon Sep 17 00:00:00 2001 From: scottybollinger Date: Tue, 1 Dec 2020 17:39:46 -0600 Subject: [PATCH 3/8] Refactor out unnecessary conditional onComplete is not optional so these if blocks can be consolidated --- .../shared/indexing_status/indexing_status_logic.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts index e7cb41ebc71cc..2f89b56e16434 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts @@ -61,11 +61,9 @@ export const IndexingStatusLogic = kea= 100) { clearInterval(pollingInterval); - } - actions.setIndexingStatus(response); - if (response.percentageComplete >= 100 && onComplete) { onComplete(response.numDocumentsWithErrors); } + actions.setIndexingStatus(response); } catch (e) { flashAPIErrors(e); } From a5efd2fef92c1da7bbc54939840a5c8bbb4b12bf Mon Sep 17 00:00:00 2001 From: Scotty Bollinger Date: Wed, 2 Dec 2020 10:20:56 -0600 Subject: [PATCH 4/8] Misc styling - destructuring and typing Co-authored-by: Constance --- .../shared/indexing_status/indexing_status_logic.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts index 2f89b56e16434..c09c803e7fe99 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts @@ -56,9 +56,11 @@ export const IndexingStatusLogic = kea ({ fetchIndexingStatus: ({ statusPath, onComplete }: IndexingStatusProps) => { + const { http } = HttpLogic.values; + pollingInterval = window.setInterval(async () => { try { - const response = (await HttpLogic.values.http.get(statusPath)) as IIndexingStatus; + const response: IIndexingStatus = await http.get(statusPath); if (response.percentageComplete >= 100) { clearInterval(pollingInterval); onComplete(response.numDocumentsWithErrors); From ec2b2c5c7287ff4b986aad30f73b14900eb58a77 Mon Sep 17 00:00:00 2001 From: Scotty Bollinger Date: Wed, 2 Dec 2020 10:21:11 -0600 Subject: [PATCH 5/8] Misc styling - imports Co-authored-by: Constance --- .../shared/indexing_status/indexing_status_logic.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts index c09c803e7fe99..cb484f19c157f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.ts @@ -7,9 +7,7 @@ import { kea, MakeLogicType } from 'kea'; import { HttpLogic } from '../http'; - import { IIndexingStatus } from '../types'; - import { flashAPIErrors } from '../flash_messages'; interface IndexingStatusProps { From d2f3a8659b02cd82cb5253483beb3564ae0ab143 Mon Sep 17 00:00:00 2001 From: scottybollinger Date: Wed, 2 Dec 2020 10:32:40 -0600 Subject: [PATCH 6/8] Remove div --- .../applications/shared/indexing_status/indexing_status.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx index bcf13a5668d5f..ce929c5586ba8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx @@ -41,7 +41,7 @@ export const IndexingStatus: React.FC = ({ }, []); return ( -
+ <> {percentageComplete < 100 && ( @@ -53,6 +53,6 @@ export const IndexingStatus: React.FC = ({ )} -
+ ); }; From 9a0095bb6cad5243c0268839d4fd08f54b49badf Mon Sep 17 00:00:00 2001 From: scottybollinger Date: Wed, 2 Dec 2020 10:32:53 -0600 Subject: [PATCH 7/8] Refactor test --- .../shared/indexing_status/indexing_status_logic.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.test.ts index c9145bc61a7cc..9fa5fe0f84bab 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status_logic.test.ts @@ -21,8 +21,6 @@ import { flashAPIErrors } from '../flash_messages'; import { IndexingStatusLogic } from './indexing_status_logic'; describe('IndexingStatusLogic', () => { - jest.useFakeTimers(); - let unmount: any; const mockStatusResponse = { @@ -58,6 +56,7 @@ describe('IndexingStatusLogic', () => { }); describe('fetchIndexingStatus', () => { + jest.useFakeTimers(); const statusPath = '/api/workplace_search/path/123'; const onComplete = jest.fn(); const TIMEOUT = 3000; @@ -86,8 +85,9 @@ describe('IndexingStatusLogic', () => { try { await promise; } catch { - expect(flashAPIErrors).toHaveBeenCalledWith('An error occured'); + // Do nothing } + expect(flashAPIErrors).toHaveBeenCalledWith('An error occured'); }); it('handles indexing complete state', async () => { From fa4f6e5c0c771c3ecea63bacdb0120f50330dccb Mon Sep 17 00:00:00 2001 From: scottybollinger Date: Wed, 2 Dec 2020 11:48:01 -0600 Subject: [PATCH 8/8] Replace method with string for statusPath In ent-search, we use Rails helpers to generate paths. These were in the form of routes.whateverPath(). We passed these method to the IndexingStatus component to generate the app-specific rotues in the shared component. In Kibana, we will not have these generators and should instead pass the path strings directly --- .../shared/indexing_status/indexing_status.test.tsx | 5 ++--- .../shared/indexing_status/indexing_status.tsx | 9 +++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.test.tsx index 1044a4c6eb70a..42cb6c229ad63 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.test.tsx @@ -20,7 +20,6 @@ import { IndexingStatus } from './indexing_status'; describe('IndexingStatus', () => { const getItemDetailPath = jest.fn(); - const getStatusPath = jest.fn(); const onComplete = jest.fn(); const setGlobalIndexingStatus = jest.fn(); const fetchIndexingStatus = jest.fn(); @@ -30,9 +29,9 @@ describe('IndexingStatus', () => { numDocumentsWithErrors: 1, activeReindexJobId: 12, viewLinkPath: '/path', + statusPath: '/other_path', itemId: '1', getItemDetailPath, - getStatusPath, onComplete, setGlobalIndexingStatus, }; @@ -58,7 +57,7 @@ describe('IndexingStatus', () => { percentageComplete: 100, numDocumentsWithErrors: 1, }); - const wrapper = shallow(); + const wrapper = shallow(); expect(wrapper.find(IndexingStatusErrors)).toHaveLength(1); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx index ce929c5586ba8..b2109b7ef3f0b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/indexing_status/indexing_status.tsx @@ -16,25 +16,22 @@ import { IndexingStatusLogic } from './indexing_status_logic'; import { IIndexingStatus } from '../types'; -export interface IIndexingStatusProps extends IIndexingStatus { +export interface IIndexingStatusProps { viewLinkPath: string; itemId: string; + statusPath: string; getItemDetailPath?(itemId: string): string; - getStatusPath(itemId: string, activeReindexJobId: number): string; onComplete(numDocumentsWithErrors: number): void; setGlobalIndexingStatus?(activeReindexJob: IIndexingStatus): void; } export const IndexingStatus: React.FC = ({ - itemId, - activeReindexJobId, viewLinkPath, - getStatusPath, + statusPath, onComplete, }) => { const { percentageComplete, numDocumentsWithErrors } = useValues(IndexingStatusLogic); const { fetchIndexingStatus } = useActions(IndexingStatusLogic); - const statusPath = getStatusPath(itemId, activeReindexJobId); useEffect(() => { fetchIndexingStatus({ statusPath, onComplete });