Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 92c1496

Browse files
committedNov 16, 2023
fix(ui): update card container height correctly, improve cypress test scenario, fix console warnings
1 parent 72922c9 commit 92c1496

File tree

17 files changed

+103
-59
lines changed

17 files changed

+103
-59
lines changed
 

‎assets/database-lab-dark-mode.svg

+4-4
Loading

‎assets/database-lab-light-mode.svg

+4-4
Loading

‎assets/dle-simple.svg

+4-4
Loading

‎assets/dle.svg

+6-6
Loading

‎assets/dle_button.svg

+6-6
Loading

‎ui/packages/ce/cypress/e2e/tabs.cy.js

+30-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,44 @@
11
/* eslint-disable no-undef */
22

3-
describe('Instance page should have "Configuration" tab with content', () => {
4-
it('should have token in local storage', () => {
3+
describe('Configuration tab', () => {
4+
before(() => {
5+
// Set the token in local storage
56
cy.window().then((win) => {
67
if (!win.localStorage.getItem('token')) {
78
win.localStorage.setItem('token', 'demo-token')
89
}
910
})
1011
})
11-
it('should have "Configuration" tab with content', () => {
12+
13+
it('should have token in local storage', () => {
14+
// Check if the token exists in local storage
15+
cy.window()
16+
.should('have.property', 'localStorage')
17+
.and('have.property', 'token', 'demo-token')
18+
})
19+
20+
it('should have "Configuration" tab with form inputs', () => {
21+
// Visit the page
1222
cy.visit('/', {
1323
retryOnStatusCodeFailure: true,
1424
onLoad: () => {
15-
cy.get('.MuiTabs-flexContainer').contains('Configuration')
16-
cy.get('.MuiBox-root')
17-
.contains('p')
18-
.should('have.length.greaterThan', 0)
25+
// Click on the "Configuration" tab
26+
cy.get('.MuiTabs-flexContainer').contains('Configuration').click({
27+
force: true,
28+
})
29+
30+
// Check for elements on the "Configuration" tab
31+
cy.get('input[type="text"]').should('exist')
32+
cy.get('input[type="checkbox"]').should('exist')
33+
cy.get('button[type="button"]').should('exist')
34+
35+
// Click on the "Cancel" button within the "Configuration" tab
36+
cy.get('button').contains('Cancel').click({
37+
force: true,
38+
})
39+
40+
// Check if the URL has changed to "/instance"
41+
cy.url().should('eq', Cypress.config().baseUrl + '/instance')
1942
},
2043
})
2144
})

‎ui/packages/ce/src/App/Menu/Header/icons/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const StarsIcon = ({ className }: { className?: string }) => (
8383
xmlns="http://www.w3.org/2000/svg"
8484
className={className}
8585
>
86-
<g clip-path="url(#clip0_3156:7537)">
86+
<g clipPath="url(#clip0_3156:7537)">
8787
<path
8888
d="M15.5319 4.94739C14.5807 4.94739 13.6874 5.31433 13.0162 5.98071C12.3453 6.64673 11.976 7.53381 11.976 8.47852C11.976 8.73743 11.766 8.94727 11.5072 8.94727C11.2483 8.94727 11.0385 8.73743 11.0385 8.47852C11.0385 7.53381 10.6689 6.64673 9.99805 5.98071C9.32691 5.31433 8.43359 4.94739 7.48242 4.94739C7.22351 4.94739 7.01367 4.73755 7.01367 4.47864C7.01367 4.21973 7.22351 4.00989 7.48242 4.00989C9.44312 4.00989 11.0385 2.42115 11.0385 0.468388C11.0385 0.209476 11.2483 -0.000362396 11.5072 -0.000362396C11.766 -0.000362396 11.976 0.209476 11.976 0.468388C11.976 2.42115 13.5712 4.00989 15.5319 4.00989C15.7908 4.00989 16.0006 4.21973 16.0006 4.47864C16.0006 4.73755 15.7908 4.94739 15.5319 4.94739ZM11.5072 2.45923C11.0719 3.32996 10.3604 4.04053 9.48779 4.47608C9.91565 4.68823 10.3107 4.96997 10.6586 5.31543C11.0081 5.66235 11.2928 6.05664 11.5071 6.48389C11.7214 6.05664 12.0062 5.66235 12.3556 5.31543C12.7035 4.96997 13.0986 4.68823 13.5264 4.47608C12.6539 4.04053 11.9424 3.32996 11.5072 2.45923Z"
8989
fill="currentColor"

‎ui/packages/ce/src/App/Menu/icons/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export const Github = () => (
125125
>
126126
<path
127127
fillRule="evenodd"
128-
clip-rule="evenodd"
128+
clipRule="evenodd"
129129
d="M12.649 0C5.664 0 0 5.664 0 12.65c0 5.59 3.624 10.33 8.651 12.004.633.116.864-.275.864-.61 0-.3-.011-1.096-.018-2.151-3.518.764-4.26-1.696-4.26-1.696-.576-1.461-1.405-1.85-1.405-1.85-1.149-.785.087-.77.087-.77 1.27.09 1.937 1.304 1.937 1.304 1.128 1.933 2.961 1.375 3.682 1.052.115-.818.441-1.376.803-1.692-2.809-.319-5.762-1.405-5.762-6.252 0-1.38.493-2.51 1.302-3.394-.13-.32-.565-1.606.123-3.348 0 0 1.063-.34 3.48 1.297 1.008-.28 2.09-.421 3.166-.426 1.074.005 2.157.145 3.167.426 2.415-1.637 3.475-1.297 3.475-1.297.69 1.742.257 3.028.126 3.348.811.884 1.301 2.013 1.301 3.394 0 4.86-2.958 5.93-5.776 6.242.454.39.859 1.163.859 2.343 0 1.69-.016 3.055-.016 3.47 0 .338.228.732.87.609 5.023-1.677 8.644-6.415 8.644-12.002C25.3 5.664 19.636 0 12.649 0Z"
130130
fill="#fff"
131131
/>

‎ui/packages/platform/public/images/dblab.svg

+6-6
Loading

‎ui/packages/platform/src/components/CheckupAgentForm/CheckupAgentFormWrapper.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export const CheckupAgentFormWrapper = (props: CheckupAgentFormProps) => {
3838
},
3939
heading: {
4040
...theme.typography.h3,
41+
} as {
42+
[key: string]: string
4143
},
4244
fieldValue: {
4345
display: 'inline-block',

‎ui/packages/platform/src/components/CreateClusterCards/CreateClusterCards.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import classNames from 'classnames'
12
import { StubContainer } from '@postgres.ai/shared/components/StubContainer'
23
import { icons } from '@postgres.ai/shared/styles/icons'
34
import { ConsoleButtonWrapper } from 'components/ConsoleButton/ConsoleButtonWrapper'
@@ -9,9 +10,11 @@ import { messages } from '../../assets/messages'
910
import { useStyles } from 'components/CreateDbLabCards/CreateDbLabCards'
1011

1112
export const CreateClusterCards = ({
13+
isModal,
1214
props,
1315
dblabPermitted,
1416
}: {
17+
isModal?: boolean
1518
props: DashboardProps
1619
dblabPermitted: boolean | undefined
1720
}) => {
@@ -92,7 +95,12 @@ export const CreateClusterCards = ({
9295
]
9396

9497
return (
95-
<StubContainer className={classes.stubContainerProjects}>
98+
<StubContainer
99+
className={classNames(
100+
!isModal && classes.zeroMaxHeight,
101+
classes.stubContainerProjects,
102+
)}
103+
>
96104
{productData.map((product) => (
97105
<ProductCardWrapper
98106
inline

‎ui/packages/platform/src/components/CreateDbLabCards/CreateDbLabCards.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import classNames from 'classnames'
12
import { makeStyles } from '@material-ui/core'
23
import { StubContainer } from '@postgres.ai/shared/components/StubContainer'
34
import { icons } from '@postgres.ai/shared/styles/icons'
@@ -9,6 +10,9 @@ import Urls from '../../utils/urls'
910
import { messages } from '../../assets/messages'
1011

1112
export const useStyles = makeStyles((theme) => ({
13+
zeroMaxHeight: {
14+
maxHeight: 0,
15+
},
1216
stubContainerProjects: {
1317
marginRight: '-20px',
1418
padding: '0 40px',
@@ -75,9 +79,11 @@ export const useStyles = makeStyles((theme) => ({
7579
}))
7680

7781
export const CreatedDbLabCards = ({
82+
isModal,
7883
props,
7984
dblabPermitted,
8085
}: {
86+
isModal?: boolean
8187
props: DashboardProps
8288
dblabPermitted: boolean | undefined
8389
}) => {
@@ -154,7 +160,12 @@ export const CreatedDbLabCards = ({
154160
]
155161

156162
return (
157-
<StubContainer className={classes.stubContainerProjects}>
163+
<StubContainer
164+
className={classNames(
165+
!isModal && classes.zeroMaxHeight,
166+
classes.stubContainerProjects,
167+
)}
168+
>
158169
{productData.map((product) => (
159170
<ProductCardWrapper
160171
inline

‎ui/packages/platform/src/components/DbLabInstances/DbLabInstances.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ class DbLabInstances extends Component<
420420
aria-labelledby="simple-modal-title"
421421
aria-describedby="simple-modal-description"
422422
>
423-
<CreatedDbLabCards props={this.props} dblabPermitted={addPermitted} />
423+
<CreatedDbLabCards isModal props={this.props} dblabPermitted={addPermitted} />
424424
</Modal>
425425
)
426426

‎ui/packages/platform/src/components/PostgresClusters/PostgresClusters.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ class PostgresClusters extends Component<
422422
aria-labelledby="simple-modal-title"
423423
aria-describedby="simple-modal-description"
424424
>
425-
<CreateClusterCards props={this.props} dblabPermitted={addPermitted} />
425+
<CreateClusterCards isModal props={this.props} dblabPermitted={addPermitted} />
426426
</Modal>
427427
)
428428

‎ui/packages/shared/icons/Renewable/index.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,42 @@ export const RenewableIcon = React.forwardRef<SVGSVGElement, Props>(
2525
>
2626
<path
2727
fillRule="evenodd"
28-
clip-rule="evenodd"
28+
clipRule="evenodd"
2929
// eslint-disable-next-line max-len
3030
d="M6.14337 0L8.19809 2.9755L4.59387 3.26718L5.16139 2.07055C4.22847 2.10806 3.3161 2.48386 2.66614 3.18795L2.20594 2.76312C3.05679 1.84141 4.26977 1.40592 5.45883 1.44339L6.14337 0Z"
3131
fill="currentColor"
3232
/>
3333
<path
3434
fillRule="evenodd"
35-
clip-rule="evenodd"
35+
clipRule="evenodd"
3636
// eslint-disable-next-line max-len
3737
d="M9.7343 9.13905L6.12728 9.39371L7.71025 6.14261L8.45158 7.24009C8.89401 6.4179 9.03479 5.44126 8.75942 4.52346L9.35931 4.34347C9.71979 5.54495 9.47743 6.81074 8.8401 7.81527L9.7343 9.13905Z"
3838
fill="currentColor"
3939
/>
4040
<path
4141
fillRule="evenodd"
42-
clip-rule="evenodd"
42+
clipRule="evenodd"
4343
// eslint-disable-next-line max-len
4444
d="M0 7.57495L1.61898 4.34163L3.60962 7.36037L2.28757 7.43896C2.76953 8.23862 3.53811 8.85742 4.46813 9.08819L4.3173 9.69607C3.09983 9.39397 2.13422 8.54041 1.59468 7.48015L0 7.57495Z"
4545
fill="currentColor"
4646
/>
4747
<path
4848
fillRule="evenodd"
49-
clip-rule="evenodd"
49+
clipRule="evenodd"
5050
// eslint-disable-next-line max-len
5151
d="M6.26612 2.51078C5.07868 2.17637 3.73747 2.48899 2.89616 3.40036L1.97575 2.55072C3.17071 1.25624 5.01514 0.857134 6.60567 1.30506L6.26612 2.51078Z"
5252
fill="currentColor"
5353
/>
5454
<path
5555
fillRule="evenodd"
56-
clip-rule="evenodd"
56+
clipRule="evenodd"
5757
// eslint-disable-next-line max-len
5858
d="M7.33938 8.11969C8.34588 7.28131 8.83847 5.87691 8.45939 4.61345L9.65917 4.25348C10.1969 6.04581 9.49312 7.95595 8.14107 9.08215L7.33938 8.11969Z"
5959
fill="currentColor"
6060
/>
6161
<path
6262
fillRule="evenodd"
63-
clip-rule="evenodd"
63+
clipRule="evenodd"
6464
// eslint-disable-next-line max-len
6565
d="M2.07072 5.82736C2.20416 7.20026 3.19328 8.44922 4.54348 8.78425L4.24181 10C2.32911 9.5254 1.00387 7.79934 0.823976 5.94853L2.07072 5.82736Z"
6666
fill="currentColor"

‎ui/packages/shared/pages/Instance/Info/Disks/Disk/ActionsMenu/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const ActionsMenu = (props: Props) => {
7575
Copy name
7676
</MenuItem>
7777
{props.isActive && (
78-
<>
78+
<div>
7979
<MenuItem
8080
onClick={() => {
8181
closeMenu()
@@ -92,7 +92,7 @@ export const ActionsMenu = (props: Props) => {
9292
>
9393
List snapshots
9494
</MenuItem>
95-
</>
95+
</div>
9696
)}
9797
</Menu>
9898
</>

‎ui/packages/shared/styles/icons.tsx

+8-8
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.