Skip to content

Commit

Permalink
Some type changes
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-daniel committed Oct 31, 2023
1 parent dd7401b commit 6add192
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -34,12 +34,10 @@ export const TimestampList = ({}: Props) => {
const onAdd = () => {
setData({
...data,
[uuid()]: { pattern: "", supplier: "client" },
[uuid()]: { pattern: "" },
})
}



return (
<Root>
{Object.entries(data).map(([key, ts]) => (
Expand Down
43 changes: 40 additions & 3 deletions packages/web-console/src/components/SchemaEditor/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
export type Timestamp = {
pattern: string,
supplier: "server" | "client" // @TODO better name
}
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<RequestColumn>
formats: Record<ColumnType.TIMESTAMP | ColumnType.DATE, Timestamp[]>
}
2 changes: 2 additions & 0 deletions packages/web-console/src/modules/Import/import-file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit 6add192

Please sign in to comment.