From eb24d4965e93d8457cad56fa20aa9c8cce40390d Mon Sep 17 00:00:00 2001 From: "konrad.szwarc" Date: Thu, 12 Sep 2024 12:51:43 +0200 Subject: [PATCH] parse array, get rid of any --- .../packs/pack_queries_status_table.tsx | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx b/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx index 48f3024d499c3..b0a2dd8896d2d 100644 --- a/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx +++ b/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx @@ -187,7 +187,7 @@ const ViewResultsInLensActionComponent: React.FC { + (event: React.MouseEvent) => { event.preventDefault(); if (logsDataView?.id) { @@ -372,33 +372,31 @@ const ScheduledQueryLastResults: React.FC = ({ interval, }); + const timestamp = useMemo(() => { + const dateTime = lastResultsData?.['@timestamp']; + if (!dateTime) return undefined; + + return Array.isArray(dateTime) ? dateTime[0] : dateTime; + }, [lastResultsData]); + if (isLoading) { return ; } - if (!lastResultsData) { - return <>{'-'}; - } - return ( - {lastResultsData?.['@timestamp'] ? ( + {timestamp ? ( - {' '} - + {' '} + } >
- +
) : ( @@ -584,7 +582,7 @@ const PackQueriesStatusTableComponent: React.FC = ( Record> >({}); - const renderQueryColumn = useCallback((query: string, item: any) => { + const renderQueryColumn = useCallback((query: string, item: PackQueryFormData) => { const singleLine = removeMultilines(query); const content = singleLine.length > 55 ? `${singleLine.substring(0, 55)}...` : singleLine; @@ -618,7 +616,7 @@ const PackQueriesStatusTableComponent: React.FC = ( ); const renderLastResultsColumn = useCallback( - (item: any) => ( + (item: PackQueryFormData) => ( = ( [packName] ); const renderDocsColumn = useCallback( - (item: any) => ( + (item: PackQueryFormData) => ( ), [packName] ); const renderAgentsColumn = useCallback( - (item: any) => ( + (item: PackQueryFormData) => ( ), [packName] ); const renderErrorsColumn = useCallback( - (item: any) => ( + (item: PackQueryFormData) => ( = ( ); const renderDiscoverResultsAction = useCallback( - (item: any) => , + (item: PackQueryFormData) => , [packName] ); const renderLensResultsAction = useCallback( - (item: any) => , + (item: PackQueryFormData) => , [packName] );