From 7a4a3c49390a2cd1dfe9fa004aaf5b9526f11dca Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:21:58 -0400 Subject: [PATCH] Fleet UI: Fix dot problem so UI renders responses for columns with dot notation (#19528) --- changes/19528-dot-notation-bug-on-queries | 1 + .../hosts/details/HostQueryReport/HQRTable/HQRTableConfig.tsx | 2 +- .../details/components/QueryReport/QueryReportTableConfig.tsx | 2 +- .../edit/components/QueryResults/QueryResultsTableConfig.tsx | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changes/19528-dot-notation-bug-on-queries diff --git a/changes/19528-dot-notation-bug-on-queries b/changes/19528-dot-notation-bug-on-queries new file mode 100644 index 0000000000..2475c7d866 --- /dev/null +++ b/changes/19528-dot-notation-bug-on-queries @@ -0,0 +1 @@ +* Fix queries with dot notation in the column name to show results \ No newline at end of file diff --git a/frontend/pages/hosts/details/HostQueryReport/HQRTable/HQRTableConfig.tsx b/frontend/pages/hosts/details/HostQueryReport/HQRTable/HQRTableConfig.tsx index d5252ec5df..4939263100 100644 --- a/frontend/pages/hosts/details/HostQueryReport/HQRTable/HQRTableConfig.tsx +++ b/frontend/pages/hosts/details/HostQueryReport/HQRTable/HQRTableConfig.tsx @@ -31,7 +31,7 @@ const generateColumnConfigs = (rows: IWebSocketData[]): IHQRTTableColumn[] => isSortedDesc={headerProps.column.isSortedDesc} /> ), - accessor: colName, + accessor: (data) => data[colName], Cell: (cellProps: ITableStringCellProps) => { if (typeof cellProps?.cell?.value !== "string") return null; diff --git a/frontend/pages/queries/details/components/QueryReport/QueryReportTableConfig.tsx b/frontend/pages/queries/details/components/QueryReport/QueryReportTableConfig.tsx index b46383ecf6..0294dffe5c 100644 --- a/frontend/pages/queries/details/components/QueryReport/QueryReportTableConfig.tsx +++ b/frontend/pages/queries/details/components/QueryReport/QueryReportTableConfig.tsx @@ -65,7 +65,7 @@ const generateReportColumnConfigsFromResults = ( isSortedDesc={headerProps.column.isSortedDesc} /> ), - accessor: key, + accessor: (data) => data[key], Cell: (cellProps: ITableCellProps) => { if (typeof cellProps.cell.value !== "string") return null; diff --git a/frontend/pages/queries/edit/components/QueryResults/QueryResultsTableConfig.tsx b/frontend/pages/queries/edit/components/QueryResults/QueryResultsTableConfig.tsx index fd29edceb4..3f45c702d6 100644 --- a/frontend/pages/queries/edit/components/QueryResults/QueryResultsTableConfig.tsx +++ b/frontend/pages/queries/edit/components/QueryResults/QueryResultsTableConfig.tsx @@ -50,7 +50,7 @@ const generateColumnConfigsFromRows = >( isSortedDesc={headerProps.column.isSortedDesc} /> ), - accessor: colName, + accessor: (data) => data[colName], Cell: (cellProps: CellProps) => { const val = cellProps?.cell?.value; return !!val?.length && val.length > 300