Skip to content

Commit 89cfbf4

Browse files
committed
Merge branch 'missing-label-and-reload-button' into 'master'
fix(ui): add missing alias and reload request on button click See merge request postgres-ai/database-lab!825
2 parents 51fa47d + 59b460f commit 89cfbf4

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

ui/packages/platform/src/pages/Instance/index.tsx

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useState } from 'react'
12
import { useParams } from 'react-router-dom'
23

34
import { Instance as InstancePage } from '@postgres.ai/shared/pages/Instance'
@@ -27,6 +28,7 @@ type Params = {
2728

2829
export const Instance = () => {
2930
const params = useParams<Params>()
31+
const [projectAlias, setProjectAlias] = useState<string>('')
3032

3133
const routes = {
3234
createClone: () =>
@@ -73,6 +75,14 @@ export const Instance = () => {
7375
hideDeprecatedApiBanner: bannersStore.hideDeprecatedApi,
7476
}
7577

78+
const instanceTitle = `#${params.instanceId} ${
79+
projectAlias
80+
? `(${projectAlias})`
81+
: params.project
82+
? `(${params.project})`
83+
: ''
84+
}`
85+
7686
const elements = {
7787
breadcrumbs: (
7888
<ConsoleBreadcrumbsWrapper
@@ -82,9 +92,7 @@ export const Instance = () => {
8292
breadcrumbs={[
8393
{ name: 'Database Lab Instances', url: 'instances' },
8494
{
85-
name: `Instance #${params.instanceId} ${
86-
params.project ? `(${params.project})` : ''
87-
}`,
95+
name: `Instance ${instanceTitle}`,
8896
url: null,
8997
},
9098
]}
@@ -95,9 +103,8 @@ export const Instance = () => {
95103
return (
96104
<InstancePage
97105
isPlatform
98-
title={`Database Lab instance #${params.instanceId} ${
99-
params.project ? `(${params.project})` : ''
100-
}`}
106+
setProjectAlias={setProjectAlias}
107+
title={`Database Lab instance ${instanceTitle}`}
101108
instanceId={params.instanceId}
102109
routes={routes}
103110
api={api}

ui/packages/shared/pages/Instance/context.ts

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export type Host = {
2727
}
2828
wsHost?: string
2929
isPlatform?: boolean
30+
setProjectAlias?: (alias: string) => void
3031
}
3132

3233
// Host context.

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,17 @@ export const Instance = observer((props: Props) => {
9797
load(instanceId)
9898
}, [instanceId])
9999

100+
useEffect(() => {
101+
if (props.setProjectAlias) props.setProjectAlias(instance?.projectAlias || '')
102+
}, [instance])
103+
100104
useEffect(() => {
101105
if (
102106
instance &&
103107
instance?.state?.retrieving?.status === 'pending' &&
104108
isConfigurationActive &&
105-
!props.isPlatform && !hasBeenRedirected
109+
!props.isPlatform &&
110+
!hasBeenRedirected
106111
) {
107112
setActiveTab(2)
108113
setHasBeenRedirected(true)

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

+3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ export class MainStore {
106106
this.instance = null
107107
this.isReloadingInstance = true
108108
this.loadInstance(instanceId, false).then(() => {
109+
if (this.api.refreshInstance)
110+
this.api.refreshInstance({ instanceId: instanceId })
111+
109112
if (this.instance?.url) {
110113
this.snapshots.load(instanceId)
111114
}

0 commit comments

Comments
 (0)