Skip to content

Commit 5fa6b71

Browse files
author
Bogdan Tsechoev
committed
Merge branch 'fix-se-dblab-instance' into 'dle-4-0'
fix(ui): SE instance loading inside platform ui See merge request postgres-ai/database-lab!1009
2 parents 8ffc5e8 + 46a4436 commit 5fa6b71

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

Diff for: ui/packages/shared/pages/Instance/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const Instance = observer((props: Props) => {
102102
isPlatform ? <PlatformTabs {...props} /> : <Tabs {...props} />
103103

104104
useEffect(() => {
105-
load(instanceId)
105+
load(instanceId, isPlatform)
106106
}, [instanceId])
107107

108108
useEffect(() => {
@@ -133,7 +133,7 @@ export const Instance = observer((props: Props) => {
133133
className={classes.title}
134134
rightContent={
135135
<Button
136-
onClick={() => load(props.instanceId)}
136+
onClick={() => load(props.instanceId, isPlatform)}
137137
isDisabled={!instance && !instanceError}
138138
className={classes.reloadButton}
139139
>

Diff for: ui/packages/shared/pages/Instance/stores/Main.ts

+23-7
Original file line numberDiff line numberDiff line change
@@ -102,24 +102,40 @@ export class MainStore {
102102
return this.instance.state?.status.code === 'NO_RESPONSE'
103103
}
104104

105-
load = (instanceId: string) => {
105+
load = (instanceId: string, isPlatform: boolean = false) => {
106106
this.instance = null
107107
this.isReloadingInstance = true
108-
this.getBranches(instanceId)
108+
109+
if (!isPlatform) {
110+
this.getBranches(instanceId)
111+
}
112+
113+
const runRetrieval = () => {
114+
this.loadInstanceRetrieval(instanceId).then(() => {
115+
if (this.instanceRetrieval) {
116+
this.getConfig(instanceId)
117+
this.getFullConfig(instanceId)
118+
}
119+
})
120+
}
121+
109122
this.loadInstance(instanceId, false).then(() => {
110123
if (
111124
(this.instance?.createdAt && this.instance?.url) ||
112125
!this.instance?.createdAt
113126
) {
114127
this.snapshots.load(instanceId)
115128
}
116-
})
117-
this.loadInstanceRetrieval(instanceId).then(() => {
118-
if (this.instanceRetrieval) {
119-
this.getConfig(instanceId)
120-
this.getFullConfig(instanceId)
129+
130+
if (isPlatform && this.instance?.url) {
131+
this.getBranches(instanceId)
132+
runRetrieval()
121133
}
122134
})
135+
136+
if (!isPlatform) {
137+
runRetrieval()
138+
}
123139
}
124140

125141
reload = (instanceId: string) => {

0 commit comments

Comments
 (0)