From 9cd96a5261d21ab1426331671c55453fd1508c71 Mon Sep 17 00:00:00 2001 From: glasstiger Date: Thu, 3 Apr 2025 18:49:41 +0100 Subject: [PATCH 1/7] feat(ui): owner setting for tables created during CSV import --- packages/browser-tests/questdb | 2 +- .../Import/ImportCSVFiles/files-to-upload.tsx | 38 ++++++++++++++- .../scenes/Import/ImportCSVFiles/index.tsx | 46 ++++++++++++++++++- .../src/scenes/Import/ImportCSVFiles/types.ts | 3 +- .../web-console/src/utils/questdb/client.ts | 2 + .../web-console/src/utils/questdb/types.ts | 1 + 6 files changed, 87 insertions(+), 5 deletions(-) diff --git a/packages/browser-tests/questdb b/packages/browser-tests/questdb index 68b17e486..32ad5f2c7 160000 --- a/packages/browser-tests/questdb +++ b/packages/browser-tests/questdb @@ -1 +1 @@ -Subproject commit 68b17e4860e3ce2d1a0e55faa18a899684998114 +Subproject commit 32ad5f2c7baa34d745cfa9d8e2bedde49c0a5491 diff --git a/packages/web-console/src/scenes/Import/ImportCSVFiles/files-to-upload.tsx b/packages/web-console/src/scenes/Import/ImportCSVFiles/files-to-upload.tsx index 759f81fbc..55b246d4c 100644 --- a/packages/web-console/src/scenes/Import/ImportCSVFiles/files-to-upload.tsx +++ b/packages/web-console/src/scenes/Import/ImportCSVFiles/files-to-upload.tsx @@ -78,6 +78,7 @@ type Props = { onFilesDropped: (files: File[]) => void onViewData: (result: UploadResult) => void dialogOpen: boolean + ownedByList: string[] } export const FilesToUpload = ({ @@ -89,6 +90,7 @@ export const FilesToUpload = ({ onFilesDropped, onViewData, dialogOpen, + ownedByList, }: Props) => { const uploadInputRef = useRef(null) const [renameDialogOpen, setRenameDialogOpen] = React.useState< @@ -224,7 +226,7 @@ export const FilesToUpload = ({ { header: "Table name", align: "flex-end", - width: "200px", + width: "180px", render: ({ data }) => { return ( + Table owner + + + } + > + + Required for external (non-database) users. + + + ), + align: "center", + width: "150px", + render: ({ data }) => ( + ) => + onFilePropertyChange(data.id, { + table_owner: e.target.value, + }) + } + options={Object.values(ownedByList).map((entity) => ({ + label: entity, + value: entity, + }))} + /> + ), + }, + ) + } + + columns.push( + { + header: ( + + Schema + + + } + > + + Optional. By default, QuestDB will infer schema from the + CSV file structure + + + ), + + align: "center", + width: "150px", + render: ({ data }) => { + const name = data.table_name ?? data.fileObject.name + return ( + + setSchemaDialogOpen(name ? data.id : undefined) + } + onSchemaChange={(schema) => { + onFilePropertyChange(data.id, { + schema: schema.schemaColumns, + partitionBy: schema.partitionBy, + timestamp: schema.timestamp, + }) + }} + name={name} + schema={data.schema} + partitionBy={data.partitionBy} + ttlValue={data.ttlValue} + ttlUnit={data.ttlUnit} + timestamp={data.timestamp} + isEditLocked={ + data.exists && data.table_name === data.fileObject.name + } + hasWalSetting={false} + ctaText="Save" + /> + ) + }, + }, + { + header: ( + + Write mode + + + } + > + + Append: data will be appended to the set. +
+ Overwrite: any existing data or structure + will be overwritten. Required for partitioning and + timestamp related changes. +
+
+ ), + align: "center", + width: "150px", + render: ({ data }) => ( + ) => - onFilePropertyChange(data.id, { - table_owner: e.target.value, - }) - } - options={Object.values(ownedByList).map((entity) => ({ - label: entity, - value: entity, - }))} - /> - ), - }, - { - header: ( - - Schema - - - } - > - - Optional. By default, QuestDB will infer schema from the - CSV file structure - - - ), - - align: "center", - width: "150px", - render: ({ data }) => { - const name = data.table_name ?? data.fileObject.name - return ( - - setSchemaDialogOpen(name ? data.id : undefined) - } - onSchemaChange={(schema) => { - onFilePropertyChange(data.id, { - schema: schema.schemaColumns, - partitionBy: schema.partitionBy, - timestamp: schema.timestamp, - }) - }} - name={name} - schema={data.schema} - partitionBy={data.partitionBy} - ttlValue={data.ttlValue} - ttlUnit={data.ttlUnit} - timestamp={data.timestamp} - isEditLocked={ - data.exists && data.table_name === data.fileObject.name - } - hasWalSetting={false} - ctaText="Save" - /> - ) - }, - }, - { - header: ( - - Write mode - - - } - > - - Append: data will be appended to the set. -
- Overwrite: any existing data or structure - will be overwritten. Required for partitioning and - timestamp related changes. -
-
- ), - align: "center", - width: "150px", - render: ({ data }) => ( -