From ef91e772b4b5602f3b37d709e9d08dde6fe8a684 Mon Sep 17 00:00:00 2001 From: Leto Date: Mon, 31 Jul 2023 19:10:26 +0800 Subject: [PATCH 1/4] fix(dashboard): avoid having overflow in cartesian chart --- .../plugins/viz-components/cartesian/viz-cartesian-chart.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/src/plugins/viz-components/cartesian/viz-cartesian-chart.tsx b/dashboard/src/plugins/viz-components/cartesian/viz-cartesian-chart.tsx index 928f45eff..33693b4a1 100644 --- a/dashboard/src/plugins/viz-components/cartesian/viz-cartesian-chart.tsx +++ b/dashboard/src/plugins/viz-components/cartesian/viz-cartesian-chart.tsx @@ -144,7 +144,7 @@ export function VizCartesianChart({ context, instance }: VizViewProps) { const finalHeight = Math.max(0, height - topStatsHeight - bottomStatsHeight); return ( - + Date: Mon, 31 Jul 2023 19:11:48 +0800 Subject: [PATCH 2/4] fix(dashboard): avoid having overflow in boxplot chart --- .../boxplot-chart/viz-boxplot-chart.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dashboard/src/plugins/viz-components/boxplot-chart/viz-boxplot-chart.tsx b/dashboard/src/plugins/viz-components/boxplot-chart/viz-boxplot-chart.tsx index e24630b9a..51b94cac4 100644 --- a/dashboard/src/plugins/viz-components/boxplot-chart/viz-boxplot-chart.tsx +++ b/dashboard/src/plugins/viz-components/boxplot-chart/viz-boxplot-chart.tsx @@ -20,6 +20,7 @@ import { ClickBoxplotSeries } from './triggers'; import { DEFAULT_CONFIG, IBoxplotChartConf, IBoxplotDataItem } from './type'; import { parseDataKey } from '~/utils/data'; import { useRowDataMap } from '~/plugins/hooks/use-row-data-map'; +import { Box } from '@mantine/core'; echarts.use([ DataZoomComponent, @@ -79,13 +80,15 @@ export function VizBoxplotChart({ context, instance }: VizViewProps) { return null; } return ( - + + + ); } From c7738f269c32d8d9a5ad77cd341480179586ccea Mon Sep 17 00:00:00 2001 From: Leto Date: Mon, 31 Jul 2023 19:24:54 +0800 Subject: [PATCH 3/4] fix(dashboard): id_field error appears during initial rendering of viz-table --- .../viz-components/table/viz-table.tsx | 56 +++++++++++++------ 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/dashboard/src/plugins/viz-components/table/viz-table.tsx b/dashboard/src/plugins/viz-components/table/viz-table.tsx index 344a92f21..00356ae2d 100644 --- a/dashboard/src/plugins/viz-components/table/viz-table.tsx +++ b/dashboard/src/plugins/viz-components/table/viz-table.tsx @@ -1,15 +1,14 @@ import { Box, Table, TableProps, Text } from '@mantine/core'; import { Cell, + Row, + SortingState, createColumnHelper, flexRender, getCoreRowModel, getSortedRowModel, - Row, - SortingState, useReactTable, } from '@tanstack/react-table'; -import _ from 'lodash'; import React, { useCallback, useContext, useMemo, useState } from 'react'; import { useVirtual } from 'react-virtual'; import { useCurrentInteractionManager } from '~/interactions/hooks/use-current-interaction-manager'; @@ -18,12 +17,12 @@ import { HeadCell } from '~/plugins/viz-components/table/components/head-cell'; import { ClickCellContent } from '~/plugins/viz-components/table/triggers/click-cell-content'; import { baseTableSX, useTableStyles } from '~/plugins/viz-components/table/viz-table.styles'; import { AnyObject } from '~/types'; -import { VizInstance, VizViewProps } from '~/types/plugin'; +import { VizInstance, VizViewContext, VizViewProps } from '~/types/plugin'; +import { parseDataKey } from '~/utils/data'; import { IVizManager, PluginContext, useStorageData } from '../..'; import { TableCellContext } from './table-cell-context'; -import { DEFAULT_CONFIG, IColumnConf, ITableConf, TriggerConfigType, ValueType } from './type'; +import { IColumnConf, ITableConf, TriggerConfigType, ValueType } from './type'; import { CellValue } from './value'; -import { parseDataKey } from '~/utils/data'; const useGetCellContext = (context: { vizManager: IVizManager; @@ -40,10 +39,16 @@ const useGetCellContext = (context: { ); }; -export function VizTable({ context, instance }: VizViewProps) { - const data = context.data; - const { height, width } = context.viewport; - const { value: conf = DEFAULT_CONFIG } = useStorageData(context.instanceData, 'config'); +type IVizTableComponent = { + data: TPanelData; + width: number; + height: number; + conf: ITableConf; + instance: VizInstance; + context: VizViewContext; +}; + +function VizTableComponent({ data, width, height, conf, context, instance }: IVizTableComponent) { const { id_field, use_raw_columns, columns, ...rest } = conf; const { classes, cx } = useTableStyles(); @@ -126,13 +131,6 @@ export function VizTable({ context, instance }: VizViewProps) { const showInfoBar = totalRows > 0; const tableHeight = showInfoBar ? height - 22 : height; const theadTop = showInfoBar ? 22 : 0; - if (!id_field) { - return ( - - ID Field is not set, can't render a table without it - - ); - } if (!Array.isArray(queryData) || queryData.length === 0) { return ( @@ -194,3 +192,27 @@ export function VizTable({ context, instance }: VizViewProps) { ); } +export function VizTable({ context, instance }: VizViewProps) { + const data = context.data; + const { height, width } = context.viewport; + const { value: conf } = useStorageData(context.instanceData, 'config'); + + if (!conf) { + return null; + } + + if (!conf.id_field) { + console.group('🔴 what the fuck'); + console.log(conf); + console.groupEnd(); + return ( + + ID Field is not set, can't render a table without it + + ); + } + + return ( + + ); +} From b173e09fbb556cf8c56bc82bf0ec8fa0ad714ba2 Mon Sep 17 00:00:00 2001 From: Leto Date: Mon, 31 Jul 2023 19:25:19 +0800 Subject: [PATCH 4/4] chore: publish v10.9.8 --- api/package.json | 2 +- dashboard/package.json | 2 +- package.json | 2 +- settings-form/package.json | 2 +- website/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/package.json b/api/package.json index c126ac1e5..823ff8d94 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/api", - "version": "10.9.7", + "version": "10.9.8", "description": "", "main": "index.js", "scripts": { diff --git a/dashboard/package.json b/dashboard/package.json index b76b3d109..8fb91cde1 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/dashboard", - "version": "10.9.7", + "version": "10.9.8", "license": "Apache-2.0", "publishConfig": { "access": "public", diff --git a/package.json b/package.json index 9552336a3..766088c50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/root", - "version": "10.9.7", + "version": "10.9.8", "private": true, "workspaces": [ "api", diff --git a/settings-form/package.json b/settings-form/package.json index 08b1abd4b..d3cb9afb0 100644 --- a/settings-form/package.json +++ b/settings-form/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/settings-form", - "version": "10.9.7", + "version": "10.9.8", "license": "Apache-2.0", "publishConfig": { "access": "public", diff --git a/website/package.json b/website/package.json index 817be68d8..8e1ee13d4 100644 --- a/website/package.json +++ b/website/package.json @@ -2,7 +2,7 @@ "name": "@devtable/website", "private": true, "license": "Apache-2.0", - "version": "10.9.7", + "version": "10.9.8", "scripts": { "dev": "vite", "preview": "vite preview"