Skip to content

Commit 4bcd3e0

Browse files
authored
Fix: Adjustments to upgrade docs (#3286)
1 parent ba1dadd commit 4bcd3e0

File tree

24 files changed

+230
-127
lines changed

24 files changed

+230
-127
lines changed

web/client/openapi.json

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,9 @@
697697
},
698698
"/api/modules": {
699699
"get": {
700-
"summary": "Get Api Meta",
700+
"summary": "Get Api Modules",
701701
"description": "Get the modules",
702-
"operationId": "get_api_meta_api_modules_get",
702+
"operationId": "get_api_modules_api_modules_get",
703703
"responses": {
704704
"200": {
705705
"description": "Successful Response",
@@ -708,7 +708,7 @@
708708
"schema": {
709709
"items": { "$ref": "#/components/schemas/Modules" },
710710
"type": "array",
711-
"title": "Response Get Api Meta Api Modules Get"
711+
"title": "Response Get Api Modules Api Modules Get"
712712
}
713713
}
714714
}
@@ -1205,13 +1205,19 @@
12051205
"previous_finalized_snapshots": {
12061206
"anyOf": [{ "items": {}, "type": "array" }, { "type": "null" }],
12071207
"title": "Previous Finalized Snapshots"
1208+
},
1209+
"requirements": {
1210+
"additionalProperties": { "type": "string" },
1211+
"type": "object",
1212+
"title": "Requirements",
1213+
"default": {}
12081214
}
12091215
},
12101216
"additionalProperties": false,
12111217
"type": "object",
12121218
"required": ["snapshots", "start_at", "plan_id"],
12131219
"title": "Environment",
1214-
"description": "Represents an isolated environment.\n\nEnvironments are isolated workspaces that hold pointers to physical tables.\n\nArgs:\n snapshots: The snapshots that are part of this environment.\n start_at: The start time of the environment.\n end_at: The end time of the environment.\n plan_id: The ID of the plan that last updated this environment.\n previous_plan_id: The ID of the previous plan that updated this environment.\n expiration_ts: The timestamp when this environment will expire.\n finalized_ts: The timestamp when this environment was finalized.\n promoted_snapshot_ids: The IDs of the snapshots that are promoted in this environment\n (i.e. for which the views are created). If not specified, all snapshots are promoted.\n previous_finalized_snapshots: Snapshots that were part of this environment last time it was finalized."
1220+
"description": "Represents an isolated environment.\n\nEnvironments are isolated workspaces that hold pointers to physical tables.\n\nArgs:\n snapshots: The snapshots that are part of this environment.\n start_at: The start time of the environment.\n end_at: The end time of the environment.\n plan_id: The ID of the plan that last updated this environment.\n previous_plan_id: The ID of the previous plan that updated this environment.\n expiration_ts: The timestamp when this environment will expire.\n finalized_ts: The timestamp when this environment was finalized.\n promoted_snapshot_ids: The IDs of the snapshots that are promoted in this environment\n (i.e. for which the views are created). If not specified, all snapshots are promoted.\n previous_finalized_snapshots: Snapshots that were part of this environment last time it was finalized.\n requirements: A mapping of library versions for all the snapshots in this environment."
12151221
},
12161222
"EnvironmentSuffixTarget": {
12171223
"type": "string",
@@ -1404,6 +1410,10 @@
14041410
"anyOf": [{ "type": "string" }, { "type": "null" }],
14051411
"title": "Sql"
14061412
},
1413+
"definition": {
1414+
"anyOf": [{ "type": "string" }, { "type": "null" }],
1415+
"title": "Definition"
1416+
},
14071417
"default_catalog": {
14081418
"anyOf": [{ "type": "string" }, { "type": "null" }],
14091419
"title": "Default Catalog"
@@ -1467,6 +1477,10 @@
14671477
"anyOf": [{ "type": "integer" }, { "type": "null" }],
14681478
"title": "Retention"
14691479
},
1480+
"table_format": {
1481+
"anyOf": [{ "type": "string" }, { "type": "null" }],
1482+
"title": "Table Format"
1483+
},
14701484
"storage_format": {
14711485
"anyOf": [{ "type": "string" }, { "type": "null" }],
14721486
"title": "Storage Format"

web/client/src/App.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { useEffect, Suspense } from 'react'
1+
import { useEffect, Suspense, lazy } from 'react'
22
import { RouterProvider } from 'react-router-dom'
33
import { Divider } from '@components/divider/Divider'
4-
import Header from './library/pages/root/Header'
5-
import Footer from './library/pages/root/Footer'
64
import { getBrowserRouter } from './routes'
75
import { useApiModules } from './api'
86
import { useStoreContext } from '@context/context'
@@ -11,6 +9,13 @@ import {
119
EnumErrorKey,
1210
useNotificationCenter,
1311
} from './library/pages/root/context/notificationCenter'
12+
import { isNotNil } from './utils'
13+
14+
const IS_HEADLESS: boolean = Boolean((window as any).__IS_HEADLESS__ ?? false)
15+
const Header: Optional<React.LazyExoticComponent<() => JSX.Element>> =
16+
IS_HEADLESS ? undefined : lazy(() => import('./library/pages/root/Header'))
17+
const Footer: Optional<React.LazyExoticComponent<() => JSX.Element>> =
18+
IS_HEADLESS ? undefined : lazy(() => import('./library/pages/root/Footer'))
1419

1520
export default function App(): JSX.Element {
1621
const { addError } = useNotificationCenter()
@@ -38,8 +43,12 @@ export default function App(): JSX.Element {
3843

3944
return (
4045
<>
41-
<Header />
42-
<Divider />
46+
{isNotNil(Header) && (
47+
<>
48+
<Header />
49+
<Divider />
50+
</>
51+
)}
4352
<main className="h-full overflow-hidden relative">
4453
{isFetching && (
4554
<LoadingSegment className="absolute w-full h-full bg-theme z-10">
@@ -50,8 +59,12 @@ export default function App(): JSX.Element {
5059
<RouterProvider router={router} />
5160
</Suspense>
5261
</main>
53-
<Divider />
54-
<Footer />
62+
{isNotNil(Footer) && (
63+
<>
64+
<Divider />
65+
<Footer />
66+
</>
67+
)}
5568
</>
5669
)
5770
}

web/client/src/api/channels.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { isFalse, isNil, isNotNil } from '../utils'
2+
import { getUrlPrefix } from './instance'
23

34
type ChannelCallback<TData = any> = (data: TData) => void
4-
interface Channel {
5+
export type EventSourceChannel = <TData = any>(
6+
topic: string,
7+
callback?: ChannelCallback<TData>,
8+
) => Channel
9+
export interface Channel {
510
subscribe: () => void
611
unsubscribe: () => void
712
}
@@ -120,12 +125,16 @@ class EventSourceConnection {
120125
}
121126
}
122127

123-
const Connection = new EventSourceConnection('/api/events', DELAY_AND_RECONNECT)
128+
let Connection: EventSourceConnection
124129

125130
export function useChannelEvents(): <TData = any>(
126131
topic: string,
127132
callback?: ChannelCallback<TData>,
128133
) => Channel {
134+
if (isNil(Connection)) {
135+
Connection = new EventSourceConnection(`${getUrlPrefix()}api/events`)
136+
}
137+
129138
return (topic, callback) => ({
130139
subscribe() {
131140
if (

web/client/src/api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import {
4949
type BodyInitiateApplyApiCommandsApplyPostCategories,
5050
type Model,
5151
getModelApiModelsNameGet,
52-
getApiMetaApiModulesGet,
52+
getApiModulesApiModulesGet,
5353
type Modules,
5454
type ColumnLineageApiLineageModelNameColumnNameGetParams,
5555
} from './client'
@@ -95,7 +95,7 @@ export function useApiModules(
9595
return useQueryWithTimeout(
9696
{
9797
queryKey: ['/api/modules'],
98-
queryFn: getApiMetaApiModulesGet,
98+
queryFn: getApiModulesApiModulesGet,
9999
enabled: true,
100100
},
101101
{

web/client/src/api/instance.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { isNil } from '@utils/index'
22
import { tableFromIPC } from 'apache-arrow'
33

4-
const baseURL = window.location.origin
5-
64
export interface ResponseWithDetail {
75
ok: boolean
86
detail?: string
@@ -36,10 +34,12 @@ export async function fetchAPI<T = any, B extends object = any>(
3634
): Promise<T & ResponseWithDetail> {
3735
const { url, method, params, data, headers, credentials, mode, cache } =
3836
config
39-
4037
const hasSearchParams = Object.keys({ ...params }).length > 0
4138
const fullUrl = url.replace(/([^:]\/)\/+/g, '$1')
42-
const input = new URL(fullUrl, baseURL)
39+
const input = new URL(
40+
`${getUrlPrefix()}${fullUrl}`.replaceAll('//', '/'),
41+
window.location.origin,
42+
)
4343

4444
if (hasSearchParams) {
4545
const searchParams: Record<string, string> = Object.entries({
@@ -120,4 +120,8 @@ function toRequestBody(obj: unknown): BodyInit {
120120
}
121121
}
122122

123+
export function getUrlPrefix(): string {
124+
return (window as any).__BASE_URL__ ?? '/'
125+
}
126+
123127
export default fetchAPI

web/client/src/context/context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const PROD = 'prod'
5151

5252
const environments = new Set(ModelEnvironment.getEnvironments())
5353
const environment =
54-
ModelEnvironment.getEnvironment() ?? environments.values().next().value
54+
ModelEnvironment.getEnvironment() ?? environments.values().next().value!
5555

5656
export const useStoreContext = create<ContextStore>((set, get) => ({
5757
version: undefined,
@@ -137,7 +137,7 @@ export const useStoreContext = create<ContextStore>((set, get) => ({
137137
}))
138138
},
139139
getNextEnvironment() {
140-
return get().environments.values().next().value
140+
return get().environments.values().next().value ?? environment
141141
},
142142
isExistingEnvironment(environment) {
143143
const s = get()

web/client/src/context/project.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface ProjectStore {
2828
selectedFile?: ModelFile
2929
setSelectedFile: (selectedFile?: ModelFile) => void
3030
findArtifactByPath: (path: string) => ModelArtifact | undefined
31-
refreshFiles: () => void
31+
refreshFiles: (files?: ModelFile[]) => void
3232
inActiveRange: (artifact: ModelArtifact) => boolean
3333
}
3434

@@ -83,10 +83,10 @@ export const useStoreProject = create<ProjectStore>((set, get) => ({
8383

8484
return ModelArtifact.findArtifactByPath(s.project, path)
8585
},
86-
refreshFiles() {
86+
refreshFiles(files) {
8787
const s = get()
8888

89-
s.setFiles(s.project.allFiles)
89+
s.setFiles(files ?? s.project.allFiles)
9090
},
9191
}))
9292

0 commit comments

Comments
 (0)