diff --git a/api/routes.ts b/api/routes.ts index 51e3485..600b209 100644 --- a/api/routes.ts +++ b/api/routes.ts @@ -23,12 +23,7 @@ import { LogsInputSchema, } from '/api/clickhouse-client.ts' import { decodeSession, decryptMessage, encryptMessage } from '/api/user.ts' -import { - type ColumnInfo, - fetchTablesData, - runSQL, - SQLQueryError, -} from '/api/sql.ts' +import { fetchTablesData, runSQL, SQLQueryError } from '/api/sql.ts' const withUserSession = async ({ cookies }: RequestContext) => { const session = await decodeSession(cookies.session) @@ -471,9 +466,10 @@ const defs = { } try { + const columnsMap = new Map(tableDef.columns.map((c) => [c.name, c])) return fetchTablesData( { ...input, deployment: dep, table }, - tableDef.columnsMap as unknown as Map, + columnsMap, ) } catch (err) { log.error('fetchTablesData-error', { stack: (err as Error)?.stack }) diff --git a/api/sql.ts b/api/sql.ts index 42e10b5..82f02b2 100644 --- a/api/sql.ts +++ b/api/sql.ts @@ -118,10 +118,10 @@ export async function refreshOneSchema( const tables = [...tableMap.values()].map((t) => ({ ...t, columns: t.columns.sort((a, b) => a.ordinal - b.ordinal), - columnsMap: t.columns.reduce((map, col) => { - map.set(col.name, col) - return map - }, new Map()), + columnsMap: t.columns.reduce((obj, col) => { + obj[col.name] = col + return obj + }, {} as Record), })) const payload = { deploymentUrl: dep.url, diff --git a/web/components/BackgroundPattern.tsx b/web/components/BackgroundPattern.tsx index f2e4c78..c87f3d9 100644 --- a/web/components/BackgroundPattern.tsx +++ b/web/components/BackgroundPattern.tsx @@ -246,7 +246,7 @@ export const BackgroundPattern = () => { } return ( -
+
+
{ const TableContent = ({ rows }: { rows: AnyRecord[] }) => { const columns = Object.keys(rows[0] || {}) return ( - +
{rows.length === 0