File tree Expand file tree Collapse file tree 17 files changed +39
-36
lines changed
platform/src/components/DbLabInstanceInstallForm
components/ResetCloneModal Expand file tree Collapse file tree 17 files changed +39
-36
lines changed Original file line number Diff line number Diff line change 1
- import { defineConfig } from " cypress" ;
1
+ import { defineConfig } from ' cypress'
2
2
3
3
export default defineConfig ( {
4
+ pageLoadTimeout : 10000 ,
5
+ defaultCommandTimeout : 10000 ,
4
6
e2e : {
5
7
testIsolation : false ,
6
8
supportFile : false ,
@@ -11,8 +13,8 @@ export default defineConfig({
11
13
12
14
component : {
13
15
devServer : {
14
- framework : " create-react-app" ,
15
- bundler : " webpack" ,
16
+ framework : ' create-react-app' ,
17
+ bundler : ' webpack' ,
16
18
} ,
17
19
} ,
18
- } ) ;
20
+ } )
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ export const DbLabInstanceFormInstallSidebar = ({
99
99
variant = "contained"
100
100
color = "primary"
101
101
onClick = { handleCreate }
102
- disabled = { ! state . name || ! state . verificationToken || ! disabled }
102
+ disabled = { ! state . name || ! state . verificationToken || disabled }
103
103
>
104
104
Install DLE
105
105
</ Button >
Original file line number Diff line number Diff line change @@ -18,15 +18,14 @@ import { ImportantText } from '@postgres.ai/shared/components/ImportantText'
18
18
import { Spinner } from '@postgres.ai/shared/components/Spinner'
19
19
import { SimpleModalControls } from '@postgres.ai/shared/components/SimpleModalControls'
20
20
import { compareSnapshotsDesc } from '@postgres.ai/shared/utils/snapshot'
21
- import { InstanceState } from '@postgres.ai/shared/types/api/entities/instanceState'
22
21
23
22
type Props = {
24
23
isOpen : boolean
25
24
onClose : ( ) => void
26
25
clone : Clone
27
26
onResetClone : ( snapshotId : string ) => void
28
27
snapshots : Snapshot [ ] | null
29
- version : InstanceState [ 'engine' ] [ 'version' ]
28
+ version : string | null | undefined
30
29
}
31
30
32
31
const useStyles = makeStyles (
Original file line number Diff line number Diff line change @@ -398,7 +398,7 @@ export const Clone = observer((props: Props) => {
398
398
399
399
< p className = { classes . text } >
400
400
< span className = { classes . paramTitle } > Logical data size:</ span >
401
- { instance . state . dataSize
401
+ { instance . state ? .dataSize
402
402
? formatBytesIEC ( instance . state . dataSize )
403
403
: '-' }
404
404
</ p >
@@ -625,7 +625,7 @@ export const Clone = observer((props: Props) => {
625
625
clone = { clone }
626
626
snapshots = { stores . main . snapshots . data }
627
627
onResetClone = { resetClone }
628
- version = { instance . state . engine . version }
628
+ version = { instance . state ? .engine . version }
629
629
/>
630
630
</ >
631
631
</ div >
Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ export const CreateClone = observer((props: Props) => {
210
210
< p className = { styles . param } >
211
211
< span > Data size:</ span >
212
212
< strong >
213
- { stores . main . instance . state . dataSize
213
+ { stores . main . instance . state ? .dataSize
214
214
? formatBytesIEC ( stores . main . instance . state . dataSize )
215
215
: '-' }
216
216
</ strong >
@@ -220,7 +220,7 @@ export const CreateClone = observer((props: Props) => {
220
220
< span > Expected cloning time:</ span >
221
221
< strong >
222
222
{ round (
223
- stores . main . instance . state . cloning . expectedCloningTime ,
223
+ stores . main . instance . state ? .cloning . expectedCloningTime as number ,
224
224
2 ,
225
225
) } { ' ' }
226
226
s
Original file line number Diff line number Diff line change @@ -63,15 +63,15 @@ export const Clones = observer(() => {
63
63
const host = useHost ( )
64
64
65
65
const { instance } = stores . main
66
- if ( ! instance ) return null
66
+ if ( ! instance || ! instance . state ) return null
67
67
68
68
const isShortList = isMobile && isShortListForMobile
69
69
const toggleListSize = ( ) => setIsShortListForMobile ( ! isShortListForMobile )
70
70
71
71
const goToCloneAddPage = ( ) => history . push ( host . routes . createClone ( ) )
72
72
73
73
const showListSizeButton =
74
- instance . state . cloning . clones ?. length > SHORT_LIST_SIZE && isMobile
74
+ instance . state ? .cloning . clones ?. length > SHORT_LIST_SIZE && isMobile
75
75
76
76
const isLoadingSnapshots = stores . main . snapshots . isLoading
77
77
const hasSnapshots = Boolean ( stores . main . snapshots . data ?. length )
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export const ClonesModal = observer(() => {
36
36
37
37
return (
38
38
< Modal
39
- title = { `Clones (${ instance . state . cloning . clones . length } )` }
39
+ title = { `Clones (${ instance . state ? .cloning . clones . length } )` }
40
40
isOpen = { isOpenModal }
41
41
onClose = { closeModal }
42
42
size = "md"
@@ -58,7 +58,7 @@ export const ClonesModal = observer(() => {
58
58
>
59
59
< ClonesList
60
60
isDisabled = { false }
61
- clones = { instance . state . cloning . clones . filter ( ( clone ) => {
61
+ clones = { instance . state ? .cloning . clones . filter ( ( clone ) => {
62
62
const isMatchedByPool = ! pool || pool === clone . snapshot ?. pool
63
63
const isMatchedBySnapshot =
64
64
! snapshotId || snapshotId === clone . snapshot ?. id
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ export const InactiveInstance = ({
60
60
} ) => {
61
61
const classes = useStyles ( )
62
62
63
- const getVersionDigits = ( str : string | undefined ) => {
63
+ const getVersionDigits = ( str : string | undefined | null ) => {
64
64
if ( ! str ) {
65
65
return 'N/A'
66
66
}
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export const Disks = observer(() => {
22
22
23
23
return (
24
24
< Section title = "Disks" >
25
- { instance . state . pools ?. map ( ( pool ) => {
25
+ { instance . state ? .pools ?. map ( ( pool ) => {
26
26
return (
27
27
< Disk
28
28
key = { pool . name }
@@ -38,11 +38,11 @@ export const Disks = observer(() => {
38
38
totalDataSize = { pool . fileSystem . size }
39
39
usedDataSize = { pool . fileSystem . used }
40
40
freeDataSize = { pool . fileSystem . free }
41
- refreshingStartDate = { instance . state . retrieving ?. lastRefresh ?? null }
41
+ refreshingStartDate = { instance . state ? .retrieving ?. lastRefresh ?? null }
42
42
/>
43
43
)
44
44
} ) ??
45
- ( instance . state . fileSystem && (
45
+ ( instance . state ? .fileSystem && (
46
46
< Disk
47
47
status = { 'active' }
48
48
name = { 'Main' }
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export const RefreshFailedAlert = observer(() => {
12
12
const stores = useStores ( )
13
13
14
14
const refreshFailed =
15
- stores . main . instance ?. state . retrieving ?. alerts ?. refreshFailed
15
+ stores . main . instance ?. state ? .retrieving ?. alerts ?. refreshFailed
16
16
if ( ! refreshFailed ) return null
17
17
18
18
return (
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export const Retrieval = observer(() => {
41
41
const { instance, instanceRetrieval } = stores . main
42
42
if ( ! instance ) return null
43
43
44
- const { retrieving } = instance . state
44
+ const retrieving = instance . state ?. retrieving
45
45
if ( ! retrieving ) return null
46
46
47
47
if ( ! instanceRetrieval ) return null
Original file line number Diff line number Diff line change 1
- import { InstanceState } from '@postgres.ai/shared/types/api/entities/instanceState'
2
-
3
- export const getTypeByStatus = (
4
- status : Exclude < InstanceState [ 'retrieving' ] , undefined > [ 'status' ] ,
5
- ) => {
1
+ export const getTypeByStatus = ( status : string | undefined ) => {
6
2
if ( status === 'finished' ) return 'ok'
7
3
if ( status === 'refreshing' ) return 'waiting'
8
4
if ( status === 'failed' ) return 'error'
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ export const Status = observer(() => {
30
30
const stores = useStores ( )
31
31
32
32
const { instance } = stores . main
33
- if ( ! instance ) return null
33
+ if ( ! instance || ! instance . state ) return null
34
34
35
35
const { code, message } = instance . state . status
36
36
const { version, startedAt } = instance . state . engine
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ export const ConnectionModal = observer((props: Props) => {
76
76
const { instance } = stores . main
77
77
if ( ! instance ) return null
78
78
79
- const clone = instance . state . cloning . clones . find (
79
+ const clone = instance . state ? .cloning . clones . find (
80
80
( clone ) => clone . id === cloneId ,
81
81
)
82
82
if ( ! clone ) return null
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ export const MenuCell = observer((props: Props) => {
91
91
onResetClone = { ( snapshotId ) =>
92
92
stores . main . resetClone ( clone . id , snapshotId )
93
93
}
94
- version = { stores . main . instance . state . engine . version }
94
+ version = { stores . main . instance . state ? .engine . version }
95
95
/>
96
96
</ TableBodyCellMenu >
97
97
)
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ import { ConnectionModal } from './ConnectionModal'
39
39
import styles from './styles.module.scss'
40
40
41
41
type Props = {
42
- clones : Clone [ ]
42
+ clones ? : Clone [ ]
43
43
isDisabled : boolean
44
44
emptyStubText : string
45
45
}
@@ -62,7 +62,7 @@ export const ClonesList = (props: Props) => {
62
62
setIsOpenConnectionModal ( false )
63
63
}
64
64
65
- if ( ! props . clones . length )
65
+ if ( ! props . clones ? .length )
66
66
return < p className = { styles . emptyStub } > { props . emptyStubText } </ p >
67
67
68
68
return (
Original file line number Diff line number Diff line change @@ -89,27 +89,33 @@ export class MainStore {
89
89
load = ( instanceId : string ) => {
90
90
this . instance = null
91
91
this . isReloadingInstance = true
92
- this . loadInstance ( instanceId , false )
92
+ this . loadInstance ( instanceId , false ) . then ( ( ) => {
93
+ if ( this . instance ?. url ) {
94
+ this . snapshots . load ( instanceId )
95
+ }
96
+ } )
93
97
this . loadInstanceRetrieval ( instanceId ) . then ( ( ) => {
94
98
if ( this . instanceRetrieval ) {
95
99
this . getConfig ( )
96
100
this . getFullConfig ( )
97
101
}
98
102
} )
99
- this . snapshots . load ( instanceId )
100
103
}
101
104
102
105
reload = ( instanceId : string ) => {
103
106
this . instance = null
104
107
this . isReloadingInstance = true
105
- this . loadInstance ( instanceId )
108
+ this . loadInstance ( instanceId , false ) . then ( ( ) => {
109
+ if ( this . instance ?. url ) {
110
+ this . snapshots . load ( instanceId )
111
+ }
112
+ } )
106
113
this . loadInstanceRetrieval ( instanceId ) . then ( ( ) => {
107
114
if ( this . instanceRetrieval ) {
108
115
this . getConfig ( )
109
116
this . getFullConfig ( )
110
117
}
111
118
} )
112
- this . snapshots . load ( instanceId )
113
119
}
114
120
115
121
reloadSnapshots = async ( ) => {
@@ -269,7 +275,7 @@ export class MainStore {
269
275
270
276
return {
271
277
response,
272
- error
278
+ error,
273
279
}
274
280
}
275
281
You can’t perform that action at this time.
0 commit comments