-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: [UIE-8074] - DBaaS GA Summary tab #11091
Open
corya-akamai
wants to merge
1
commit into
linode:develop
Choose a base branch
from
mpolotsk-akamai:UIE-8074
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-11091-upcoming-features-1728668394698.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
DBaaS GA summary tab enhancements ([#11091](https://github.com/linode/manager/pull/11091)) |
216 changes: 216 additions & 0 deletions
216
...es/manager/src/features/Databases/DatabaseDetail/DatabaseSummary/DatabaseSummary.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,216 @@ | ||
import { Database } from '@linode/api-v4'; | ||
import { waitFor } from '@testing-library/react'; | ||
import * as React from 'react'; | ||
import { databaseFactory } from 'src/factories'; | ||
import { renderWithTheme } from 'src/utilities/testHelpers'; | ||
import { vi } from 'vitest'; | ||
import * as utils from '../../utilities'; | ||
import { DatabaseSummary } from './DatabaseSummary'; | ||
|
||
const CLUSTER_CONFIGURATION = 'Cluster Configuration'; | ||
const THREE_NODE = 'Primary +2 replicas'; | ||
const TWO_NODE = 'Primary +1 replicas'; | ||
const VERSION = 'Version'; | ||
|
||
const CONNECTION_DETAILS = 'Connection Details'; | ||
const PRIVATE_NETWORK_HOST = 'Private Network Host'; | ||
const PRIVATE_NETWORK_HOST_LABEL = 'private network host'; | ||
const READONLY_HOST_LABEL = 'read-only host'; | ||
const GA_READONLY_HOST_LABEL = 'Read-only Host'; | ||
|
||
const ACCESS_CONTROLS = 'Access Controls'; | ||
|
||
const DEFAULT_PLATFORM = 'rdbms-default'; | ||
const DEFAULT_PRIMARY = 'db-mysql-default-primary.net'; | ||
const DEFAULT_STANDBY = 'db-mysql-default-standby.net'; | ||
|
||
const LEGACY_PLATFORM = 'rdbms-legacy'; | ||
const LEGACY_PRIMARY = 'db-mysql-legacy-primary.net'; | ||
const LEGACY_SECONDARY = 'db-mysql-legacy-secondary.net'; | ||
|
||
const spy = vi.spyOn(utils, 'useIsDatabasesEnabled'); | ||
spy.mockReturnValue({ | ||
isDatabasesEnabled: true, | ||
isDatabasesV1Enabled: true, | ||
isDatabasesV2Enabled: true, | ||
isDatabasesV2Beta: false, | ||
isV2ExistingBetaUser: false, | ||
isV2NewBetaUser: false, | ||
isDatabasesGAEnabled: true, | ||
isV2GAUser: true, | ||
}); | ||
|
||
describe('Database Summary', () => { | ||
it('should render V2GA view default db', async () => { | ||
const database = databaseFactory.build({ | ||
platform: DEFAULT_PLATFORM, | ||
cluster_size: 2, | ||
hosts: { | ||
primary: DEFAULT_PRIMARY, | ||
standby: DEFAULT_STANDBY, | ||
}, | ||
}) as Database; | ||
|
||
const { queryAllByText } = renderWithTheme( | ||
<DatabaseSummary database={database} /> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(queryAllByText(CLUSTER_CONFIGURATION)).toHaveLength(1); | ||
expect(queryAllByText(TWO_NODE)).toHaveLength(1); | ||
expect(queryAllByText(VERSION)).toHaveLength(0); | ||
|
||
expect(queryAllByText(CONNECTION_DETAILS)).toHaveLength(1); | ||
expect(queryAllByText(PRIVATE_NETWORK_HOST)).toHaveLength(0); | ||
expect(queryAllByText(GA_READONLY_HOST_LABEL)).toHaveLength(1); | ||
expect(queryAllByText(DEFAULT_STANDBY)).toHaveLength(1); | ||
|
||
expect(queryAllByText(ACCESS_CONTROLS)).toHaveLength(0); | ||
}); | ||
}); | ||
|
||
it('should render V2GA view legacy db', async () => { | ||
const database = databaseFactory.build({ | ||
platform: LEGACY_PLATFORM, | ||
cluster_size: 3, | ||
hosts: { | ||
primary: LEGACY_PRIMARY, | ||
secondary: LEGACY_SECONDARY, | ||
}, | ||
}) as Database; | ||
|
||
const { queryAllByText } = renderWithTheme( | ||
<DatabaseSummary database={database} /> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(queryAllByText(CLUSTER_CONFIGURATION)).toHaveLength(1); | ||
expect(queryAllByText(THREE_NODE)).toHaveLength(1); | ||
expect(queryAllByText(VERSION)).toHaveLength(0); | ||
|
||
expect(queryAllByText(CONNECTION_DETAILS)).toHaveLength(1); | ||
expect(queryAllByText(PRIVATE_NETWORK_HOST)).toHaveLength(1); | ||
expect(queryAllByText(GA_READONLY_HOST_LABEL)).toHaveLength(0); | ||
expect(queryAllByText(LEGACY_SECONDARY)).toHaveLength(1); | ||
|
||
expect(queryAllByText(ACCESS_CONTROLS)).toHaveLength(0); | ||
}); | ||
}); | ||
|
||
it('should render Beta view default db', async () => { | ||
spy.mockReturnValue({ | ||
isDatabasesEnabled: true, | ||
isDatabasesV1Enabled: true, | ||
isDatabasesV2Enabled: true, | ||
isDatabasesV2Beta: true, | ||
isV2ExistingBetaUser: true, | ||
isV2NewBetaUser: false, | ||
isDatabasesGAEnabled: false, | ||
isV2GAUser: false, | ||
}); | ||
const database = databaseFactory.build({ | ||
platform: DEFAULT_PLATFORM, | ||
cluster_size: 2, | ||
hosts: { | ||
primary: DEFAULT_PRIMARY, | ||
standby: DEFAULT_STANDBY, | ||
secondary: undefined, | ||
}, | ||
}) as Database; | ||
|
||
const { queryAllByText } = renderWithTheme( | ||
<DatabaseSummary database={database} /> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(queryAllByText(CLUSTER_CONFIGURATION)).toHaveLength(1); | ||
expect(queryAllByText(TWO_NODE)).toHaveLength(1); | ||
expect(queryAllByText(VERSION)).toHaveLength(1); | ||
|
||
expect(queryAllByText(CONNECTION_DETAILS)).toHaveLength(1); | ||
expect(queryAllByText(PRIVATE_NETWORK_HOST_LABEL)).toHaveLength(0); | ||
expect(queryAllByText(READONLY_HOST_LABEL)).toHaveLength(1); | ||
expect(queryAllByText(/db-mysql-default-standby.net/)).toHaveLength(1); | ||
|
||
expect(queryAllByText(ACCESS_CONTROLS)).toHaveLength(1); | ||
}); | ||
}); | ||
|
||
it('should render Beta view legacy db', async () => { | ||
spy.mockReturnValue({ | ||
isDatabasesEnabled: true, | ||
isDatabasesV1Enabled: true, | ||
isDatabasesV2Enabled: true, | ||
isDatabasesV2Beta: true, | ||
isV2ExistingBetaUser: true, | ||
isV2NewBetaUser: false, | ||
isDatabasesGAEnabled: false, | ||
isV2GAUser: false, | ||
}); | ||
const database = databaseFactory.build({ | ||
platform: LEGACY_PLATFORM, | ||
cluster_size: 3, | ||
hosts: { | ||
primary: LEGACY_PRIMARY, | ||
secondary: LEGACY_SECONDARY, | ||
standby: undefined, | ||
}, | ||
}) as Database; | ||
|
||
const { queryAllByText } = renderWithTheme( | ||
<DatabaseSummary database={database} /> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(queryAllByText(CLUSTER_CONFIGURATION)).toHaveLength(1); | ||
expect(queryAllByText(THREE_NODE)).toHaveLength(1); | ||
expect(queryAllByText(VERSION)).toHaveLength(1); | ||
|
||
expect(queryAllByText(CONNECTION_DETAILS)).toHaveLength(1); | ||
expect(queryAllByText(PRIVATE_NETWORK_HOST_LABEL)).toHaveLength(1); | ||
expect(queryAllByText(READONLY_HOST_LABEL)).toHaveLength(0); | ||
expect(queryAllByText(/db-mysql-legacy-secondary.net/)).toHaveLength(1); | ||
|
||
expect(queryAllByText(ACCESS_CONTROLS)).toHaveLength(1); | ||
}); | ||
}); | ||
|
||
it('should render V1 view legacy db', async () => { | ||
spy.mockReturnValue({ | ||
isDatabasesEnabled: true, | ||
isDatabasesV1Enabled: true, | ||
isDatabasesV2Enabled: false, | ||
isDatabasesV2Beta: false, | ||
isV2ExistingBetaUser: false, | ||
isV2NewBetaUser: false, | ||
isDatabasesGAEnabled: false, | ||
isV2GAUser: false, | ||
}); | ||
const database = databaseFactory.build({ | ||
platform: LEGACY_PLATFORM, | ||
cluster_size: 3, | ||
hosts: { | ||
primary: LEGACY_PRIMARY, | ||
secondary: LEGACY_SECONDARY, | ||
standby: undefined, | ||
}, | ||
}) as Database; | ||
|
||
const { queryAllByText } = renderWithTheme( | ||
<DatabaseSummary database={database} /> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(queryAllByText(CLUSTER_CONFIGURATION)).toHaveLength(1); | ||
expect(queryAllByText(THREE_NODE)).toHaveLength(1); | ||
expect(queryAllByText(VERSION)).toHaveLength(1); | ||
|
||
expect(queryAllByText(CONNECTION_DETAILS)).toHaveLength(1); | ||
expect(queryAllByText(PRIVATE_NETWORK_HOST_LABEL)).toHaveLength(1); | ||
expect(queryAllByText(READONLY_HOST_LABEL)).toHaveLength(0); | ||
expect(queryAllByText(/db-mysql-legacy-secondary.net/)).toHaveLength(1); | ||
|
||
expect(queryAllByText(ACCESS_CONTROLS)).toHaveLength(1); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
...r/src/features/Databases/DatabaseDetail/DatabaseSummary/DatabaseSummaryAccessControls.tsx
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
...res/Databases/DatabaseDetail/DatabaseSummary/DatabaseSummaryClusterConfiguration.style.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { styled } from '@mui/material/styles'; | ||
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'; | ||
import { Box } from 'src/components/Box'; | ||
import { Typography } from 'src/components/Typography'; | ||
|
||
export const StyledGridContainer = styled(Grid2, { | ||
label: 'StyledGridContainer', | ||
})(({ theme }) => ({ | ||
'&>*:nth-of-type(even)': { | ||
boxShadow: `inset 0px -1px 0px 0 ${ | ||
theme.palette.mode === 'dark' | ||
? theme.color.white | ||
: theme.palette.grey[200] | ||
}`, | ||
}, | ||
'&>*:nth-of-type(odd)': { | ||
boxShadow: `inset 0px -1px 0px 0 ${theme.color.white}`, | ||
marginBottom: '1px', | ||
}, | ||
boxShadow: `inset 0 -1px 0 0 ${ | ||
theme.palette.mode === 'dark' ? theme.color.white : theme.palette.grey[200] | ||
}, inset 0 1px 0 0 ${ | ||
theme.palette.mode === 'dark' ? theme.color.white : theme.palette.grey[200] | ||
}, inset -1px 0 0 ${ | ||
theme.palette.mode === 'dark' ? theme.color.white : theme.palette.grey[200] | ||
}`, | ||
})); | ||
|
||
export const StyledLabelTypography = styled(Typography, { | ||
label: 'StyledLabelTypography', | ||
})(({ theme }) => ({ | ||
background: | ||
theme.palette.mode === 'dark' | ||
? theme.bg.tableHeader | ||
: theme.palette.grey[200], | ||
color: theme.palette.mode === 'dark' ? theme.color.grey6 : 'inherit', | ||
fontFamily: theme.font.bold, | ||
height: '100%', | ||
padding: '4px 15px', | ||
})); | ||
|
||
export const StyledValueBox = styled(Box, { | ||
label: 'StyledValueBox', | ||
})(({ theme }) => ({ | ||
'& > button': { | ||
marginTop: '-5px', | ||
}, | ||
'& > div': { | ||
alignSelf: 'flex-start', | ||
verticalAlign: 'sub', | ||
}, | ||
'& button.MuiButtonBase-root': { | ||
marginTop: '0', | ||
}, | ||
'& button.copy-tooltip': { | ||
marginTop: '-3px', | ||
}, | ||
color: theme.palette.mode === 'dark' ? theme.color.grey8 : theme.color.black, | ||
display: 'flex', | ||
padding: '3px 5px', | ||
})); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we do something like the following to improve alignment (vertically centered values), make use of flex, and avoid the need for another nested component within the Grid item by replacing the parent of
StyledValueBox
with:I was seeing some weirdness with the icons existing outside the grid container at really small screen sizes (which is also currently happening), so might need to make some adjustments to this still.