Skip to content

Commit 432041b

Browse files
author
Bogdan Tsechoev
committed
Merge branch 'ui-package-version-bump' into 'dle-4-0'
feat(ui): 3.5.0 backward compatibility & bump package versions to 4.0.0 & fix shared npm package build for DBLab 4.0 See merge request postgres-ai/database-lab!1028
2 parents c85c940 + a6aab6f commit 432041b

File tree

30 files changed

+104
-54
lines changed

30 files changed

+104
-54
lines changed

ui/packages/ce/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@postgres.ai/ce",
3-
"version": "3.5.0",
3+
"version": "4.0.0",
44
"private": true,
55
"dependencies": {
66
"@craco/craco": "^6.4.3",

ui/packages/ce/src/App/Instance/Branches/Branch/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useParams } from 'react-router-dom'
33
import { getBranches } from 'api/branches/getBranches'
44
import { deleteBranch } from 'api/branches/deleteBranch'
55
import { getSnapshotList } from 'api/branches/getSnapshotList'
6+
import { initWS } from 'api/engine/initWS'
67

78
import { PageContainer } from 'components/PageContainer'
89
import { NavPath } from 'components/NavPath'
@@ -20,6 +21,7 @@ export const Branch = () => {
2021
getBranches,
2122
deleteBranch,
2223
getSnapshotList,
24+
initWS
2325
}
2426

2527
const elements = {

ui/packages/ce/src/App/Instance/Branches/CreateBranch/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { getBranches } from 'api/branches/getBranches'
22
import { createBranch } from 'api/branches/createBranch'
33
import { getSnapshots } from 'api/snapshots/getSnapshots'
4+
import { initWS } from 'api/engine/initWS'
45

56
import { CreateBranchPage } from '@postgres.ai/shared/pages/CreateBranch'
67

@@ -18,6 +19,7 @@ export const CreateBranch = () => {
1819
getBranches,
1920
createBranch,
2021
getSnapshots,
22+
initWS
2123
}
2224

2325
const elements = {

ui/packages/ce/src/App/Instance/Clones/Clone/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import { resetClone } from 'api/clones/resetClone'
1010
import { destroyClone } from 'api/clones/destroyClone'
1111
import { updateClone } from 'api/clones/updateClone'
1212
import { createSnapshot } from 'api/snapshots/createSnapshot'
13+
import { initWS } from 'api/engine/initWS'
14+
import { destroySnapshot } from 'api/snapshots/destroySnapshot'
1315

1416
import { PageContainer } from 'components/PageContainer'
1517
import { NavPath } from 'components/NavPath'
1618
import { ROUTES } from 'config/routes'
17-
import { destroySnapshot } from 'api/snapshots/destroySnapshot'
1819

1920
type Params = {
2021
cloneId: string
@@ -33,6 +34,7 @@ export const Clone = () => {
3334
destroySnapshot,
3435
updateClone,
3536
createSnapshot,
37+
initWS,
3638
}
3739

3840
const elements = {

ui/packages/ce/src/App/Instance/Clones/CreateClone/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { createClone } from 'api/clones/createClone'
99
import { getClone } from 'api/clones/getClone'
1010
import { getBranches } from 'api/branches/getBranches'
1111
import { getSnapshots } from 'api/snapshots/getSnapshots'
12+
import { initWS } from 'api/engine/initWS'
1213

1314
export const CreateClone = () => {
1415
const routes = {
@@ -23,6 +24,7 @@ export const CreateClone = () => {
2324
getClone,
2425
getBranches,
2526
getSnapshots,
27+
initWS
2628
}
2729

2830
const elements = {

ui/packages/ce/src/App/Instance/Snapshots/CreateSnapshot/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createSnapshot } from 'api/snapshots/createSnapshot'
22
import { getInstance } from 'api/instances/getInstance'
3+
import { initWS } from 'api/engine/initWS'
34

45
import { CreateSnapshotPage } from '@postgres.ai/shared/pages/CreateSnapshot'
56

@@ -11,6 +12,7 @@ export const CreateSnapshot = () => {
1112
const api = {
1213
createSnapshot,
1314
getInstance,
15+
initWS
1416
}
1517

1618
const elements = {

ui/packages/ce/src/App/Instance/Snapshots/Snapshot/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { PageContainer } from 'components/PageContainer'
99
import { destroySnapshot } from 'api/snapshots/destroySnapshot'
1010
import { getSnapshots } from 'api/snapshots/getSnapshots'
1111
import { getBranchSnapshot } from 'api/snapshots/getBranchSnapshot'
12+
import { initWS } from 'api/engine/initWS'
1213

1314
type Params = {
1415
snapshotId: string
@@ -21,6 +22,7 @@ export const Snapshot = () => {
2122
destroySnapshot,
2223
getSnapshots,
2324
getBranchSnapshot,
25+
initWS,
2426
}
2527

2628
const elements = {

ui/packages/shared/.gitlab-ci.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,25 @@ publish-shared-preview:
2727
- cd ui/packages/shared
2828
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
2929

30-
# Get base version from package.json (strip any -pr or other suffix)
30+
# Get base version from package.json (strip any suffix)
3131
- BASE_VERSION=$(jq -r .version package.json)
3232
- BASE_VERSION=${BASE_VERSION%%-*}
3333
- export PREID="pr-${CI_MERGE_REQUEST_IID:-preview}"
3434

35-
# Detect next available patch for same PR
36-
- EXISTING_TAGS=$(npm view @postgres.ai/shared versions --json | jq -r '.[]' | grep "^${BASE_VERSION}-${PREID}" || true)
37-
- COUNT=$(echo "$EXISTING_TAGS" | wc -l | xargs)
38-
- if [ "$COUNT" -eq 0 ]; then VERSION="${BASE_VERSION}-${PREID}"; else VERSION="${BASE_VERSION}-${PREID}.${COUNT}"; fi
35+
# Get all existing versions
36+
- EXISTING_TAGS=$(npm view @postgres.ai/shared versions --json | jq -r '.[]' || echo "")
37+
38+
# Find next available version suffix
39+
- VERSION=""
40+
- for i in $(seq 0 20); do
41+
CANDIDATE="${BASE_VERSION}-${PREID}";
42+
[ "$i" -gt 0 ] && CANDIDATE="${CANDIDATE}.${i}";
43+
if ! echo "$EXISTING_TAGS" | grep -qx "$CANDIDATE"; then
44+
VERSION="$CANDIDATE";
45+
break;
46+
fi;
47+
done
48+
- if [ -z "$VERSION" ]; then echo "❌ Failed to determine unique preview version"; exit 1; fi
3949
- echo "Publishing version $VERSION"
4050
- npm version "$VERSION" --no-git-tag-version
4151

ui/packages/shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@postgres.ai/shared",
3-
"version": "3.5.0",
3+
"version": "4.0.0",
44
"scripts": {
55
"build": "tsc -p tsconfig.build.json && node scripts/copy-assets.js",
66
"pack": "node scripts/pack.js"

ui/packages/shared/pages/Branches/Branch/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import { Host } from './context'
4343
import { DeleteBranch } from '@postgres.ai/shared/types/api/endpoints/deleteBranch'
4444
import { InstanceTabs, TABS_INDEX } from "../../Instance/Tabs";
4545

46-
type Props = Host & { isPlatform?: boolean }
46+
type Props = Host & { isPlatform?: boolean, hideBranchingFeatures?: boolean }
4747

4848
const useStyles = makeStyles(
4949
() => ({
@@ -187,6 +187,8 @@ export const BranchesPage = observer((props: Props) => {
187187
tab={TABS_INDEX.BRANCHES}
188188
isPlatform={props.isPlatform}
189189
instanceId={props.instanceId}
190+
hasLogs={props.api.initWS !== undefined}
191+
hideInstanceTabs={props.hideBranchingFeatures}
190192
/>
191193
</SectionTitle>
192194
</>

ui/packages/shared/pages/Branches/Branch/stores/Main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
SnapshotList,
1515
GetSnapshotList,
1616
} from '@postgres.ai/shared/types/api/endpoints/getSnapshotList'
17+
import { InitWS } from '@postgres.ai/shared/types/api/endpoints/initWS'
1718

1819
type Error = {
1920
title?: string
@@ -24,6 +25,7 @@ export type Api = {
2425
getBranches: GetBranches
2526
deleteBranch: DeleteBranch
2627
getSnapshotList: GetSnapshotList
28+
initWS?: InitWS
2729
}
2830

2931
export class MainStore {

ui/packages/shared/pages/Clone/index.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const useStyles = makeStyles(
188188
{ index: 1 },
189189
)
190190

191-
type Props = Host & { isPlatform?: boolean }
191+
type Props = Host & { isPlatform?: boolean, hideBranchingFeatures?: boolean }
192192

193193
export const Clone = observer((props: Props) => {
194194
const classes = useStyles()
@@ -233,6 +233,8 @@ export const Clone = observer((props: Props) => {
233233
tab={TABS_INDEX.CLONES}
234234
isPlatform={props.isPlatform}
235235
instanceId={props.instanceId}
236+
hasLogs={props.api.initWS !== undefined}
237+
hideInstanceTabs={props.hideBranchingFeatures}
236238
/>
237239
</SectionTitle>
238240
</>
@@ -340,19 +342,19 @@ export const Clone = observer((props: Props) => {
340342
<Spinner size="sm" className={classes.spinner} />
341343
)}
342344
</Button>
343-
<Button
345+
{!props.hideBranchingFeatures && <Button
344346
variant="contained"
345347
color="primary"
346348
onClick={createSnapshot}
347349
disabled={isDisabledControls}
348-
title={'Delete this clone'}
350+
title={'Create snapshot'}
349351
className={classes.actionButton}
350352
>
351353
Create snapshot
352354
{snapshots.snapshotDataLoading && (
353355
<Spinner size="sm" className={classes.spinner} />
354356
)}
355-
</Button>
357+
</Button>}
356358
<Button
357359
variant="outlined"
358360
color="secondary"
@@ -373,12 +375,12 @@ export const Clone = observer((props: Props) => {
373375
className={classes.errorStub}
374376
/>
375377
))}
376-
<div>
378+
{!props.hideBranchingFeatures && <div>
377379
<p>
378380
<strong>Branch</strong>
379381
</p>
380382
<p className={classes.text}>{clone.branch}</p>
381-
</div>
383+
</div>}
382384

383385
<div className={classes.title}>
384386
<p>

ui/packages/shared/pages/Clone/stores/Main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { Clone } from '@postgres.ai/shared/types/api/entities/clone'
2020
import { Instance } from '@postgres.ai/shared/types/api/entities/instance'
2121
import { checkIsCloneStable } from '@postgres.ai/shared/utils/clone'
2222
import { getTextFromUnknownApiError } from '@postgres.ai/shared/utils/api'
23+
import { InitWS } from '@postgres.ai/shared/types/api/endpoints/initWS'
2324

2425
const UNSTABLE_CLONE_UPDATE_TIMEOUT = 1000
2526

@@ -29,6 +30,7 @@ export type Api = SnapshotsApi & {
2930
resetClone: ResetClone
3031
destroyClone: DestroyClone
3132
updateClone: UpdateClone
33+
initWS?: InitWS
3234
}
3335

3436
type Error = {

ui/packages/shared/pages/CreateBranch/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ interface CreateBranchProps {
3838
breadcrumbs: React.ReactNode
3939
}
4040
isPlatform?: boolean
41+
hideBranchingFeatures?: boolean
4142
}
4243

4344
const useStyles = makeStyles(
@@ -101,7 +102,7 @@ const useStyles = makeStyles(
101102
)
102103

103104
export const CreateBranchPage = observer(
104-
({ instanceId, api, elements, routes, isPlatform }: CreateBranchProps) => {
105+
({ instanceId, api, elements, routes, isPlatform, hideBranchingFeatures }: CreateBranchProps) => {
105106
const stores = useCreatedStores(api)
106107
const classes = useStyles()
107108
const history = useHistory()
@@ -166,6 +167,8 @@ export const CreateBranchPage = observer(
166167
tab={TABS_INDEX.BRANCHES}
167168
isPlatform={isPlatform}
168169
instanceId={instanceId}
170+
hasLogs={api.initWS !== undefined}
171+
hideInstanceTabs={hideBranchingFeatures}
169172
/>
170173
</SectionTitle>
171174
<div className={classes.wrapper}>

ui/packages/shared/pages/CreateBranch/stores/Main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from '@postgres.ai/shared/types/api/endpoints/createBranch'
1515
import { Branch } from '@postgres.ai/shared/types/api/endpoints/getBranches'
1616
import { GetSnapshots } from '@postgres.ai/shared/types/api/endpoints/getSnapshots'
17+
import { InitWS } from '@postgres.ai/shared/types/api/endpoints/initWS'
1718

1819
type Error = {
1920
title?: string
@@ -24,6 +25,7 @@ export type MainStoreApi = {
2425
getBranches: GetBranches
2526
createBranch: CreateBranch
2627
getSnapshots: GetSnapshots
28+
initWS?: InitWS
2729
}
2830

2931
export class MainStore {

ui/packages/shared/pages/CreateClone/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type Host = {
4242
}
4343
}
4444

45-
type Props = Host & { isPlatform?: boolean }
45+
type Props = Host & { isPlatform?: boolean, hideBranchingFeatures?: boolean }
4646

4747
export const CreateClone = observer((props: Props) => {
4848
const history = useHistory()
@@ -156,6 +156,8 @@ export const CreateClone = observer((props: Props) => {
156156
tab={TABS_INDEX.CLONES}
157157
isPlatform={props.isPlatform}
158158
instanceId={props.instanceId}
159+
hasLogs={props.api.initWS !== undefined}
160+
hideInstanceTabs={props.hideBranchingFeatures}
159161
/>
160162
</SectionTitle>
161163
</>

ui/packages/shared/pages/CreateClone/stores/Main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { getTextFromUnknownApiError } from '@postgres.ai/shared/utils/api'
1515
import { checkIsCloneStable } from '@postgres.ai/shared/utils/clone'
1616

1717
import { FormValues } from '../useForm'
18+
import { InitWS } from '@postgres.ai/shared/types/api/endpoints/initWS'
1819

1920
const UNSTABLE_CLONE_UPDATE_TIMEOUT = 1000
2021

@@ -24,6 +25,7 @@ export type MainStoreApi = SnapshotsApi & {
2425
getClone: GetClone
2526
getBranches?: GetBranches
2627
getSnapshots?: GetSnapshots
28+
initWS?: InitWS
2729
}
2830

2931
export class MainStore {

ui/packages/shared/pages/CreateSnapshot/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ interface CreateSnapshotProps {
3636
breadcrumbs: React.ReactNode
3737
}
3838
isPlatform?: boolean
39+
hideBranchingFeatures?: boolean
3940
}
4041

4142
const useStyles = makeStyles(
@@ -94,7 +95,7 @@ const useStyles = makeStyles(
9495
)
9596

9697
export const CreateSnapshotPage = observer(
97-
({ instanceId, api, elements, routes, isPlatform }: CreateSnapshotProps) => {
98+
({ instanceId, api, elements, routes, isPlatform, hideBranchingFeatures }: CreateSnapshotProps) => {
9899
const stores = useCreatedStores(api)
99100
const classes = useStyles()
100101
const history = useHistory()
@@ -158,6 +159,8 @@ export const CreateSnapshotPage = observer(
158159
tab={TABS_INDEX.SNAPSHOTS}
159160
isPlatform={isPlatform}
160161
instanceId={instanceId}
162+
hasLogs={api.initWS !== undefined}
163+
hideInstanceTabs={hideBranchingFeatures}
161164
/>
162165
</SectionTitle>
163166
<div className={classes.wrapper}>

ui/packages/shared/pages/CreateSnapshot/stores/Main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
MainStore as InstanceStore,
1313
Api as InstanceStoreApi,
1414
} from '@postgres.ai/shared/pages/Instance/stores/Main'
15+
import { InitWS } from '@postgres.ai/shared/types/api/endpoints/initWS'
1516

1617
type Error = {
1718
title?: string
@@ -20,6 +21,7 @@ type Error = {
2021

2122
export type MainStoreApi = InstanceStoreApi & {
2223
createSnapshot: CreateSnapshot
24+
initWS?: InitWS
2325
}
2426

2527
export class MainStore {

0 commit comments

Comments
 (0)