From a139cd22aa81d7b6e0de98a01002b0f8f00f28c6 Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Tue, 12 Apr 2022 22:20:28 -0700 Subject: [PATCH] Web console: Misc fixes and improvements (#12361) * Misc fixes * pad column numbers * make shard_type filterable --- licenses.yaml | 2 +- web-console/package-lock.json | 6 +- web-console/package.json | 2 +- web-console/script/cp-to | 1 + .../__snapshots__/table-cell.spec.tsx.snap | 18 +++ .../components/table-cell/table-cell.spec.tsx | 14 ++ .../src/components/table-cell/table-cell.tsx | 3 +- .../show-value-dialog/show-value-dialog.tsx | 7 +- .../src/druid-models/ingestion-spec.spec.ts | 62 ++++++-- .../src/druid-models/ingestion-spec.tsx | 109 +++++++++---- web-console/src/druid-models/metric-spec.tsx | 2 +- web-console/src/utils/general.spec.ts | 42 +++++ web-console/src/utils/general.tsx | 36 +++++ web-console/src/utils/object-change.ts | 16 +- web-console/src/variables.scss | 9 ++ .../query-view/column-tree/column-tree.tsx | 147 +++++++++--------- .../explain-dialog/explain-dialog.tsx | 2 +- .../src/views/query-view/query-utils.ts | 19 ++- .../__snapshots__/segments-view.spec.tsx.snap | 21 ++- .../views/segments-view/segments-view.scss | 17 ++ .../src/views/segments-view/segments-view.tsx | 126 ++++++++++----- 21 files changed, 477 insertions(+), 184 deletions(-) diff --git a/licenses.yaml b/licenses.yaml index 4d3d64615cc..f4235850c89 100644 --- a/licenses.yaml +++ b/licenses.yaml @@ -5656,7 +5656,7 @@ license_category: binary module: web-console license_name: Apache License version 2.0 copyright: Imply Data -version: 0.14.6 +version: 0.14.10 --- diff --git a/web-console/package-lock.json b/web-console/package-lock.json index 3f5aab0319e..64b73c39c68 100644 --- a/web-console/package-lock.json +++ b/web-console/package-lock.json @@ -8498,9 +8498,9 @@ } }, "druid-query-toolkit": { - "version": "0.14.6", - "resolved": "https://registry.npmjs.org/druid-query-toolkit/-/druid-query-toolkit-0.14.6.tgz", - "integrity": "sha512-Dv/oXD80+2SEV8J8m8Ib6giIU5fWcHK0hr/l04NbZMCpZhX/9NLDWW9HEQltRp9EyD3UEHbkoMChcbyRPAgc8w==", + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/druid-query-toolkit/-/druid-query-toolkit-0.14.10.tgz", + "integrity": "sha512-Y720YxnT3EmqtE/x1QkrkEiomn5TdVArxI3+gdLRH8FYMRedpSPe2nkQVNYma9b7Lww/rzk4Q+a8mNWQ1YH9oQ==", "requires": { "tslib": "^2.2.0" } diff --git a/web-console/package.json b/web-console/package.json index 457f3d7863c..f9cdf7f8cf9 100644 --- a/web-console/package.json +++ b/web-console/package.json @@ -79,7 +79,7 @@ "d3-axis": "^1.0.12", "d3-scale": "^3.2.0", "d3-selection": "^1.4.0", - "druid-query-toolkit": "^0.14.6", + "druid-query-toolkit": "^0.14.10", "file-saver": "^2.0.2", "follow-redirects": "^1.14.7", "fontsource-open-sans": "^3.0.9", diff --git a/web-console/script/cp-to b/web-console/script/cp-to index bbf31529e95..c6331a77f85 100755 --- a/web-console/script/cp-to +++ b/web-console/script/cp-to @@ -23,3 +23,4 @@ cp *.png "$1" cp console-config.js "$1" cp -r public "$1" cp -r assets "$1" +echo "Finished copying web-console files" diff --git a/web-console/src/components/table-cell/__snapshots__/table-cell.spec.tsx.snap b/web-console/src/components/table-cell/__snapshots__/table-cell.spec.tsx.snap index caf2d56db56..cd0a4e368b0 100644 --- a/web-console/src/components/table-cell/__snapshots__/table-cell.spec.tsx.snap +++ b/web-console/src/components/table-cell/__snapshots__/table-cell.spec.tsx.snap @@ -1,5 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`TableCell matches snapshot Date (invalid) 1`] = ` + + Unusable date + +`; + +exports[`TableCell matches snapshot Date 1`] = ` + + 2022-02-24T01:02:03.000Z + +`; + exports[`TableCell matches snapshot array long 1`] = ` { expect(container.firstChild).toMatchSnapshot(); }); + it('matches snapshot Date', () => { + const tableCell = ; + + const { container } = render(tableCell); + expect(container.firstChild).toMatchSnapshot(); + }); + + it('matches snapshot Date (invalid)', () => { + const tableCell = ; + + const { container } = render(tableCell); + expect(container.firstChild).toMatchSnapshot(); + }); + it('matches snapshot array short', () => { const tableCell = ; diff --git a/web-console/src/components/table-cell/table-cell.tsx b/web-console/src/components/table-cell/table-cell.tsx index 5fd4bf63712..7d20b717fc6 100644 --- a/web-console/src/components/table-cell/table-cell.tsx +++ b/web-console/src/components/table-cell/table-cell.tsx @@ -91,9 +91,10 @@ export const TableCell = React.memo(function TableCell(props: TableCellProps) { if (value !== '' && value != null) { if (value instanceof Date) { + const dateValue = value.valueOf(); return ( - {value.toISOString()} + {isNaN(dateValue) ? 'Unusable date' : value.toISOString()} ); } else if (Array.isArray(value)) { diff --git a/web-console/src/dialogs/show-value-dialog/show-value-dialog.tsx b/web-console/src/dialogs/show-value-dialog/show-value-dialog.tsx index f5291e172bc..8e1b0290865 100644 --- a/web-console/src/dialogs/show-value-dialog/show-value-dialog.tsx +++ b/web-console/src/dialogs/show-value-dialog/show-value-dialog.tsx @@ -27,13 +27,14 @@ import { AppToaster } from '../../singletons'; import './show-value-dialog.scss'; export interface ShowValueDialogProps { - onClose: () => void; + title?: string; str: string; size?: 'normal' | 'large'; + onClose: () => void; } export const ShowValueDialog = React.memo(function ShowValueDialog(props: ShowValueDialogProps) { - const { onClose, str, size } = props; + const { title, onClose, str, size } = props; function handleCopy() { copy(str, { format: 'text/plain' }); @@ -48,7 +49,7 @@ export const ShowValueDialog = React.memo(function ShowValueDialog(props: ShowVa className={classNames('show-value-dialog', size || 'normal')} isOpen onClose={onClose} - title="Full value" + title={title || 'Full value'} >