Skip to content

Commit 76a6d29

Browse files
committed
Merge branch 'correct-disable-state-for-dle-install' into 'master'
fix(ui): correct disabled call for install DLE button, conditionally call the snapshots API, increase cypress timeout duration, improve types See merge request postgres-ai/database-lab!803
2 parents e7e2023 + 4da59cf commit 76a6d29

File tree

17 files changed

+39
-36
lines changed

17 files changed

+39
-36
lines changed

ui/packages/ce/cypress.config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { defineConfig } from "cypress";
1+
import { defineConfig } from 'cypress'
22

33
export default defineConfig({
4+
pageLoadTimeout: 10000,
5+
defaultCommandTimeout: 10000,
46
e2e: {
57
testIsolation: false,
68
supportFile: false,
@@ -11,8 +13,8 @@ export default defineConfig({
1113

1214
component: {
1315
devServer: {
14-
framework: "create-react-app",
15-
bundler: "webpack",
16+
framework: 'create-react-app',
17+
bundler: 'webpack',
1618
},
1719
},
18-
});
20+
})

ui/packages/platform/src/components/DbLabInstanceInstallForm/DbLabInstanceInstallFormSidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const DbLabInstanceFormInstallSidebar = ({
9999
variant="contained"
100100
color="primary"
101101
onClick={handleCreate}
102-
disabled={!state.name || !state.verificationToken || !disabled}
102+
disabled={!state.name || !state.verificationToken || disabled}
103103
>
104104
Install DLE
105105
</Button>

ui/packages/shared/components/ResetCloneModal/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ import { ImportantText } from '@postgres.ai/shared/components/ImportantText'
1818
import { Spinner } from '@postgres.ai/shared/components/Spinner'
1919
import { SimpleModalControls } from '@postgres.ai/shared/components/SimpleModalControls'
2020
import { compareSnapshotsDesc } from '@postgres.ai/shared/utils/snapshot'
21-
import { InstanceState } from '@postgres.ai/shared/types/api/entities/instanceState'
2221

2322
type Props = {
2423
isOpen: boolean
2524
onClose: () => void
2625
clone: Clone
2726
onResetClone: (snapshotId: string) => void
2827
snapshots: Snapshot[] | null
29-
version: InstanceState['engine']['version']
28+
version: string | null | undefined
3029
}
3130

3231
const useStyles = makeStyles(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ export const Clone = observer((props: Props) => {
398398

399399
<p className={classes.text}>
400400
<span className={classes.paramTitle}>Logical data size:</span>
401-
{instance.state.dataSize
401+
{instance.state?.dataSize
402402
? formatBytesIEC(instance.state.dataSize)
403403
: '-'}
404404
</p>
@@ -625,7 +625,7 @@ export const Clone = observer((props: Props) => {
625625
clone={clone}
626626
snapshots={stores.main.snapshots.data}
627627
onResetClone={resetClone}
628-
version={instance.state.engine.version}
628+
version={instance.state?.engine.version}
629629
/>
630630
</>
631631
</div>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export const CreateClone = observer((props: Props) => {
210210
<p className={styles.param}>
211211
<span>Data size:</span>
212212
<strong>
213-
{stores.main.instance.state.dataSize
213+
{stores.main.instance.state?.dataSize
214214
? formatBytesIEC(stores.main.instance.state.dataSize)
215215
: '-'}
216216
</strong>
@@ -220,7 +220,7 @@ export const CreateClone = observer((props: Props) => {
220220
<span>Expected cloning time:</span>
221221
<strong>
222222
{round(
223-
stores.main.instance.state.cloning.expectedCloningTime,
223+
stores.main.instance.state?.cloning.expectedCloningTime as number,
224224
2,
225225
)}{' '}
226226
s

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ export const Clones = observer(() => {
6363
const host = useHost()
6464

6565
const { instance } = stores.main
66-
if (!instance) return null
66+
if (!instance || !instance.state) return null
6767

6868
const isShortList = isMobile && isShortListForMobile
6969
const toggleListSize = () => setIsShortListForMobile(!isShortListForMobile)
7070

7171
const goToCloneAddPage = () => history.push(host.routes.createClone())
7272

7373
const showListSizeButton =
74-
instance.state.cloning.clones?.length > SHORT_LIST_SIZE && isMobile
74+
instance.state?.cloning.clones?.length > SHORT_LIST_SIZE && isMobile
7575

7676
const isLoadingSnapshots = stores.main.snapshots.isLoading
7777
const hasSnapshots = Boolean(stores.main.snapshots.data?.length)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const ClonesModal = observer(() => {
3636

3737
return (
3838
<Modal
39-
title={`Clones (${instance.state.cloning.clones.length})`}
39+
title={`Clones (${instance.state?.cloning.clones.length})`}
4040
isOpen={isOpenModal}
4141
onClose={closeModal}
4242
size="md"
@@ -58,7 +58,7 @@ export const ClonesModal = observer(() => {
5858
>
5959
<ClonesList
6060
isDisabled={false}
61-
clones={instance.state.cloning.clones.filter((clone) => {
61+
clones={instance.state?.cloning.clones.filter((clone) => {
6262
const isMatchedByPool = !pool || pool === clone.snapshot?.pool
6363
const isMatchedBySnapshot =
6464
!snapshotId || snapshotId === clone.snapshot?.id

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const InactiveInstance = ({
6060
}) => {
6161
const classes = useStyles()
6262

63-
const getVersionDigits = (str: string | undefined) => {
63+
const getVersionDigits = (str: string | undefined | null) => {
6464
if (!str) {
6565
return 'N/A'
6666
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const Disks = observer(() => {
2222

2323
return (
2424
<Section title="Disks">
25-
{instance.state.pools?.map((pool) => {
25+
{instance.state?.pools?.map((pool) => {
2626
return (
2727
<Disk
2828
key={pool.name}
@@ -38,11 +38,11 @@ export const Disks = observer(() => {
3838
totalDataSize={pool.fileSystem.size}
3939
usedDataSize={pool.fileSystem.used}
4040
freeDataSize={pool.fileSystem.free}
41-
refreshingStartDate={instance.state.retrieving?.lastRefresh ?? null}
41+
refreshingStartDate={instance.state?.retrieving?.lastRefresh ?? null}
4242
/>
4343
)
4444
}) ??
45-
(instance.state.fileSystem && (
45+
(instance.state?.fileSystem && (
4646
<Disk
4747
status={'active'}
4848
name={'Main'}

ui/packages/shared/pages/Instance/Info/Retrieval/RefreshFailedAlert/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const RefreshFailedAlert = observer(() => {
1212
const stores = useStores()
1313

1414
const refreshFailed =
15-
stores.main.instance?.state.retrieving?.alerts?.refreshFailed
15+
stores.main.instance?.state?.retrieving?.alerts?.refreshFailed
1616
if (!refreshFailed) return null
1717

1818
return (

0 commit comments

Comments
 (0)