From f63f198e09308a370883e31d5dd753f6959f0d0c Mon Sep 17 00:00:00 2001 From: Sina Javaheri Date: Wed, 7 Aug 2024 13:03:51 +0200 Subject: [PATCH] fix(inventory-changes-timeline): remove mock data --- .../InventoryChangesTimeline.tsx | 141 +----------------- 1 file changed, 2 insertions(+), 139 deletions(-) diff --git a/src/pages/panel/inventory-search/InventoryChangesTimeline.tsx b/src/pages/panel/inventory-search/InventoryChangesTimeline.tsx index e4fa77c2..02ec52f6 100644 --- a/src/pages/panel/inventory-search/InventoryChangesTimeline.tsx +++ b/src/pages/panel/inventory-search/InventoryChangesTimeline.tsx @@ -8,7 +8,7 @@ import { useUserProfile } from 'src/core/auth' import { useThemeMode } from 'src/core/theme' import { useFixQueryParser } from 'src/shared/fix-query-parser' import { LoadingSuspenseFallback } from 'src/shared/loading' -import { PostWorkspaceInventoryHistoryTimelineResponse, WorkspaceInventoryNodeHistoryChanges } from 'src/shared/types/server' +import { WorkspaceInventoryNodeHistoryChanges } from 'src/shared/types/server' import { getNumberFormatter } from 'src/shared/utils/getNumberFormatter' import { postWorkspaceInventoryHistoryTimelineQuery } from './postWorkspaceInventoryHistoryTimeline.query' import { inventoryRenderNodeChangeCellToString } from './utils/inventoryRenderNodeChangeCell' @@ -32,142 +32,6 @@ const getColorFromHistoryChange = (change: WorkspaceInventoryNodeHistoryChanges, } } -const fakeData = [ - { - at: '2024-05-22T18:14:24.000Z', - group: { - change: 'node_updated', - }, - v: 1, - }, - { - at: '2024-05-23T17:16:48.000Z', - group: { - change: 'node_created', - }, - v: 6, - }, - { - at: '2024-05-23T17:16:48.000Z', - group: { - change: 'node_deleted', - }, - v: 6, - }, - { - at: '2024-05-23T17:16:48.000Z', - group: { - change: 'node_vulnerable', - }, - v: 2, - }, - { - at: '2024-05-23T17:16:48.000Z', - group: { - change: 'node_compliant', - }, - v: 2, - }, - { - at: '2024-05-23T17:16:48.000Z', - group: { - change: 'node_updated', - }, - v: 6, - }, - { - at: '2024-05-24T04:48:00.000Z', - group: { - change: 'node_created', - }, - v: 24, - }, - { - at: '2024-05-24T04:48:00.000Z', - group: { - change: 'node_deleted', - }, - v: 18, - }, - { - at: '2024-05-24T16:19:12.000Z', - group: { - change: 'node_updated', - }, - v: 1, - }, - { - at: '2024-05-28T00:57:36.000Z', - group: { - change: 'node_created', - }, - v: 2, - }, - { - at: '2024-05-28T00:57:36.000Z', - group: { - change: 'node_updated', - }, - v: 5, - }, - { - at: '2024-05-29T11:31:12.000Z', - group: { - change: 'node_updated', - }, - v: 4524, - }, - { - at: '2024-05-29T11:31:12.000Z', - group: { - change: 'node_created', - }, - v: 4859, - }, - { - at: '2024-05-30T10:33:36.000Z', - group: { - change: 'node_updated', - }, - v: 230, - }, - { - at: '2024-05-31T09:36:00.000Z', - group: { - change: 'node_updated', - }, - v: 11, - }, - { - at: '2024-05-31T21:07:12.000Z', - group: { - change: 'node_updated', - }, - v: 1, - }, - { - at: '2024-06-01T20:09:36.000Z', - group: { - change: 'node_updated', - }, - v: 73, - }, - { - at: '2024-06-02T07:40:48.000Z', - group: { - change: 'node_updated', - }, - v: 150, - }, - { - at: '2024-06-02T19:12:00.000Z', - group: { - change: 'node_updated', - }, - v: 21, - }, -] as PostWorkspaceInventoryHistoryTimelineResponse - export const InventoryChangesTimeline = ({ searchCrit }: InventoryChangesTimelineProps) => { const { history: { changes, after, before }, @@ -180,7 +44,7 @@ export const InventoryChangesTimeline = ({ searchCrit }: InventoryChangesTimelin const { i18n: { locale }, } = useLingui() - const { isLoading } = useQuery({ + const { data, isLoading } = useQuery({ queryKey: [ 'workspace-inventory-history-timeline', selectedWorkspace?.id, @@ -192,7 +56,6 @@ export const InventoryChangesTimeline = ({ searchCrit }: InventoryChangesTimelin ], queryFn: postWorkspaceInventoryHistoryTimelineQuery, }) - const data = fakeData const { series, labels } = useMemo(() => { if (data) { const numberFormatter = getNumberFormatter(locale)