From 6add19204601592a4a258452da684cecd15830c0 Mon Sep 17 00:00:00 2001 From: Oliver Daniel Date: Tue, 31 Oct 2023 16:51:32 -0400 Subject: [PATCH] Some type changes --- .../SchemaEditor/timestamps/list.tsx | 6 +-- .../src/components/SchemaEditor/types.ts | 43 +++++++++++++++++-- .../src/modules/Import/import-file.tsx | 2 + 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/packages/web-console/src/components/SchemaEditor/timestamps/list.tsx b/packages/web-console/src/components/SchemaEditor/timestamps/list.tsx index c8eeb1266..b37463753 100644 --- a/packages/web-console/src/components/SchemaEditor/timestamps/list.tsx +++ b/packages/web-console/src/components/SchemaEditor/timestamps/list.tsx @@ -16,7 +16,7 @@ const Root = styled.ul` export const TimestampList = ({}: Props) => { //@TODO hook up to API/context const [data, setData] = useState<{ [key: React.Key]: Timestamp }>({ - [uuid()]: { pattern: DEFAULT_TIMESTAMP_FORMAT, supplier: "client" }, + [uuid()]: { pattern: DEFAULT_TIMESTAMP_FORMAT }, }) const onChipClose = (key: React.Key) => { @@ -34,12 +34,10 @@ export const TimestampList = ({}: Props) => { const onAdd = () => { setData({ ...data, - [uuid()]: { pattern: "", supplier: "client" }, + [uuid()]: { pattern: "" }, }) } - - return ( {Object.entries(data).map(([key, ts]) => ( diff --git a/packages/web-console/src/components/SchemaEditor/types.ts b/packages/web-console/src/components/SchemaEditor/types.ts index 4771a7c27..dbbe8e636 100644 --- a/packages/web-console/src/components/SchemaEditor/types.ts +++ b/packages/web-console/src/components/SchemaEditor/types.ts @@ -1,4 +1,41 @@ export type Timestamp = { - pattern: string, - supplier: "server" | "client" // @TODO better name -} \ No newline at end of file + pattern: string + locale?: null + utf8?: boolean +} + +export enum ColumnType { + AUTO = "", + BINARY = "BINARY", + BOOLEAN = "BOOLEAN", + BYTE = "BYTE", + CHAR = "CHAR", + DATE = "DATE", + DOUBLE = "DOUBLE", + FLOAT = "FLOAT", + GEOHASH = "GEOHASH", + INT = "INT", + IPV4 = "IPV4", + LONG = "LONG", + LONG256 = "LONG256", + SHORT = "SHORT", + STRING = "STRING", + SYMBOL = "SYMBOL", + TIMESTAMP = "TIMESTAMP", + UUID = "UUID", +} + +export type RequestColumn = { + file_column_name: string + file_column_index: number + table_column_name: string + column_type: ColumnType +} & { + column_type: ColumnType.TIMESTAMP | ColumnType.DATE + formats: Timestamp[] +} + +export type SchemaRequest = { + columns: Array + formats: Record +} diff --git a/packages/web-console/src/modules/Import/import-file.tsx b/packages/web-console/src/modules/Import/import-file.tsx index 36afe7d0f..ed3fd1658 100644 --- a/packages/web-console/src/modules/Import/import-file.tsx +++ b/packages/web-console/src/modules/Import/import-file.tsx @@ -5,12 +5,14 @@ import { Result } from "./result" type State = { step: "dropbox" | "settings" | "result" + flow: "new_table" | "existing" file?: File fileChunk?: File } const initialState: State = { step: "dropbox", + flow: "new_table", file: undefined, fileChunk: undefined, }