Skip to content

Commit

Permalink
Type improvements and schema editor panel
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-daniel committed Oct 31, 2023
1 parent 6add192 commit 1586a64
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
17 changes: 16 additions & 1 deletion packages/web-console/src/components/SchemaEditor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import React, { useContext } from "react"
import { Table } from "@questdb/react-components"
import { ImportContext } from "../../modules/Import/import-file"
import { PaneContent, PaneWrapper } from "../../components"
import { Panel } from "../../components/Panel"

type Props = {}

export const SchemaEditor = ({}: Props) => {
return null
const { state, dispatch } = useContext(ImportContext)
return (
<PaneWrapper>
<Panel.Header title="Schema" shadow />
<PaneContent>
<p>Flow: {state.flow}</p>
<Table columns={[]} rows={[]} />
</PaneContent>
</PaneWrapper>
)
}
10 changes: 4 additions & 6 deletions packages/web-console/src/components/SchemaEditor/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ 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[]
column_type: keyof typeof ColumnType
formats?: Timestamp[]
}

export type SchemaRequest = {
columns: Array<RequestColumn>
formats: Record<ColumnType.TIMESTAMP | ColumnType.DATE, Timestamp[]>
columns: RequestColumn[]
formats: Record<"DATE" | "TIMESTAMP", Timestamp[]>
}
2 changes: 2 additions & 0 deletions packages/web-console/src/modules/Import/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useContext } from "react"
import styled from "styled-components"
import { PaneContent, PaneWrapper } from "../../components"
import { Panel } from "../../components/Panel"
import { SchemaEditor } from "../../components/SchemaEditor"
import { ImportContext } from "./import-file"
import { GlobalTimestampsPanel } from "./timestamps"

Expand All @@ -23,6 +24,7 @@ export const Settings = () => {
<Panel.Header title="Verify and import stuff go here" />
<Content>
<GlobalTimestampsPanel />
<SchemaEditor />
<PaneWrapper>
<Panel.Header title="Settings" shadow />
<PaneContent>
Expand Down

0 comments on commit 1586a64

Please sign in to comment.