-
Notifications
You must be signed in to change notification settings - Fork 397
upcoming: [UIE-10178] - Use new hostname endpoint in Database Summary and Network tab #13413
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
base: develop
Are you sure you want to change the base?
Changes from all commits
c02de8c
b591469
dd94dbe
f0ee457
1ac1c01
8eeb1c6
ecc0a56
8b886ce
22933b5
9ad2d79
4c8508b
9770d1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/api-v4": Changed | ||
| --- | ||
|
|
||
| Export `HostEndpoint` and rename `private_access` to `public_access` ([#13413](https://github.com/linode/manager/pull/13413)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/manager": Upcoming Features | ||
| --- | ||
|
|
||
| Use new hostname endpoint in Database Summary and Network tab ([#13413](https://github.com/linode/manager/pull/13413)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ const options: { flag: keyof Flags; label: string }[] = [ | |
| }, | ||
| { flag: 'gecko2', label: 'Gecko' }, | ||
| { flag: 'generationalPlansv2', label: 'Generational compute plans' }, | ||
| { flag: 'hostnameEndpoints', label: 'Hostname Endpoints' }, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this new feature flag be mentioned in the description? Maybe under the change list and verification steps?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's mentioned under the change list and verification steps |
||
| { flag: 'limitsEvolution', label: 'Limits Evolution' }, | ||
| { flag: 'linodeDiskEncryption', label: 'Linode Disk Encryption (LDE)' }, | ||
| { flag: 'linodeInterfaces', label: 'Linode Interfaces' }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import { TooltipIcon } from '@linode/ui'; | ||
| import { styled } from '@mui/material/styles'; | ||
| import * as React from 'react'; | ||
|
|
||
| import { CopyTooltip } from 'src/components/CopyTooltip/CopyTooltip'; | ||
|
|
||
| import { | ||
| SUMMARY_HOST_TOOLTIP_COPY, | ||
| SUMMARY_PRIVATE_HOST_COPY, | ||
| } from '../constants'; | ||
|
|
||
| import type { HostEndpoint } from '@linode/api-v4/lib/databases/types'; | ||
|
|
||
| interface ConnectionDetailsHostDisplayProps { | ||
| host: HostEndpoint; | ||
| } | ||
|
|
||
| export const ConnectionDetailsHostDisplay = ( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extracted from |
||
| props: ConnectionDetailsHostDisplayProps | ||
| ) => { | ||
| const { host } = props; | ||
|
|
||
| return ( | ||
| <> | ||
| {host?.address} | ||
| <StyledCopyTooltip text={host.address} /> | ||
| <TooltipIcon | ||
| componentsProps={{ | ||
| tooltip: { | ||
| style: { | ||
| minWidth: 285, | ||
| }, | ||
| }, | ||
| }} | ||
| status="info" | ||
| sxTooltipIcon={{ | ||
| marginLeft: '4px', | ||
| padding: '0px', | ||
| }} | ||
| text={ | ||
| !host?.public_access | ||
| ? SUMMARY_PRIVATE_HOST_COPY | ||
| : SUMMARY_HOST_TOOLTIP_COPY | ||
| } | ||
| /> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export const StyledCopyTooltip = styled(CopyTooltip, { | ||
| label: 'StyledCopyTooltip', | ||
| })(({ theme }) => ({ | ||
| '& svg': { | ||
| height: theme.spacingFunction(16), | ||
| width: theme.spacingFunction(16), | ||
| }, | ||
| '&:hover': { | ||
| backgroundColor: 'transparent', | ||
| }, | ||
| display: 'inline-flex', | ||
| marginLeft: theme.spacingFunction(4), | ||
| })); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
| import { screen } from '@testing-library/react'; | ||
| import React from 'react'; | ||
|
|
||
| import { databaseFactory } from 'src/factories/databases'; | ||
| import { renderWithTheme } from 'src/utilities/testHelpers'; | ||
|
|
||
| import { ConnectionDetailsHostRows2 } from './ConnectionDetailsHostRows2'; | ||
|
|
||
| import type { Database } from '@linode/api-v4/lib/databases'; | ||
|
|
||
| const DEFAULT_PRIMARY = 'db-mysql-default-primary.net'; | ||
| const DEFAULT_STANDBY = 'db-mysql-default-standby.net'; | ||
|
|
||
| const PRIVATE_PRIMARY = `private-${DEFAULT_PRIMARY}`; | ||
| const PRIVATE_STANDBY = `private-${DEFAULT_STANDBY}`; | ||
|
|
||
| describe('ConnectionDetailsHostRows2', () => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is a copy of |
||
| it('should display Host and Read-only Host fields for a default database with no VPC configured', () => { | ||
| const database = databaseFactory.build({ | ||
| hosts: { | ||
| primary: DEFAULT_PRIMARY, | ||
| standby: DEFAULT_STANDBY, | ||
| endpoints: [ | ||
| { | ||
| role: 'primary', | ||
| address: DEFAULT_PRIMARY, | ||
| port: 15847, | ||
| public_access: true, | ||
| }, | ||
| { | ||
| role: 'standby', | ||
| address: DEFAULT_STANDBY, | ||
| port: 15847, | ||
| public_access: true, | ||
| }, | ||
| ], | ||
| }, | ||
| platform: 'rdbms-default', | ||
|
Check warning on line 38 in packages/manager/src/features/Databases/DatabaseDetail/ConnectionDetailsHostRows2.test.tsx
|
||
| private_network: null, // No VPC configured, so Host and Read-only Host fields render | ||
| }) as Database; | ||
|
|
||
| renderWithTheme(<ConnectionDetailsHostRows2 database={database} />); | ||
|
|
||
| expect(screen.getByText('Host')).toBeVisible(); | ||
| expect(screen.getByText(DEFAULT_PRIMARY)).toBeVisible(); | ||
|
|
||
| expect(screen.getByText('Read-only Host')).toBeVisible(); | ||
| expect(screen.getByText(DEFAULT_STANDBY)).toBeVisible(); | ||
| }); | ||
|
|
||
| it('should display N/A for default DB with blank read-only Host field', () => { | ||
| const database = databaseFactory.build({ | ||
| hosts: { | ||
| primary: DEFAULT_PRIMARY, | ||
| standby: undefined, | ||
|
Check warning on line 55 in packages/manager/src/features/Databases/DatabaseDetail/ConnectionDetailsHostRows2.test.tsx
|
||
| endpoints: [ | ||
| { | ||
| role: 'primary', | ||
| address: DEFAULT_PRIMARY, | ||
| port: 15847, | ||
| public_access: true, | ||
| }, | ||
| ], | ||
| }, | ||
| platform: 'rdbms-default', | ||
| }); | ||
|
|
||
| renderWithTheme(<ConnectionDetailsHostRows2 database={database} />); | ||
|
|
||
| expect(screen.getByText('N/A')).toBeVisible(); | ||
| }); | ||
|
|
||
| it('should display provisioning text when hosts are not available', () => { | ||
| const database = databaseFactory.build({ | ||
| hosts: undefined, | ||
|
Check warning on line 75 in packages/manager/src/features/Databases/DatabaseDetail/ConnectionDetailsHostRows2.test.tsx
|
||
| platform: 'rdbms-default', | ||
| }) as Database; | ||
|
|
||
| const { getByText } = renderWithTheme( | ||
| <ConnectionDetailsHostRows2 database={database} /> | ||
| ); | ||
|
|
||
| const hostNameProvisioningText = getByText( | ||
| 'Your hostname will appear here once it is available.' | ||
| ); | ||
|
|
||
| expect(hostNameProvisioningText).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('should display Private variations of Host and Read-only fields when a VPC is configured with public access set to false', () => { | ||
| const database = databaseFactory.build({ | ||
| hosts: { | ||
| primary: PRIVATE_PRIMARY, | ||
| standby: PRIVATE_STANDBY, | ||
| endpoints: [ | ||
| { | ||
| role: 'primary', | ||
| address: PRIVATE_PRIMARY, | ||
| port: 15847, | ||
| public_access: false, | ||
| }, | ||
| { | ||
| role: 'standby', | ||
| address: PRIVATE_STANDBY, | ||
| port: 15847, | ||
| public_access: false, | ||
| }, | ||
| ], | ||
| }, | ||
| platform: 'rdbms-default', | ||
| private_network: { | ||
| public_access: false, | ||
| subnet_id: 1, | ||
| vpc_id: 123, | ||
| }, // VPC configuration with public access set to false | ||
| }) as Database; | ||
|
|
||
| renderWithTheme(<ConnectionDetailsHostRows2 database={database} />); | ||
|
|
||
| expect(screen.getByText('Private Host')).toBeVisible(); | ||
| expect(screen.getByText(PRIVATE_PRIMARY)).toBeVisible(); | ||
| expect(screen.getByText('Private Read-only Host')).toBeVisible(); | ||
| expect(screen.getByText(PRIVATE_STANDBY)).toBeVisible(); | ||
| }); | ||
|
|
||
| it('should display Private and Public variations of Host and Read-only Host fields when a VPC is configured with public access set to true', () => { | ||
| const database = databaseFactory.build({ | ||
| hosts: { | ||
| primary: PRIVATE_PRIMARY, | ||
| standby: PRIVATE_STANDBY, | ||
| endpoints: [ | ||
| { | ||
| role: 'primary', | ||
| address: `public-${DEFAULT_PRIMARY}`, | ||
| port: 15847, | ||
| public_access: true, | ||
| }, | ||
| { | ||
| role: 'standby', | ||
| address: `public-${DEFAULT_STANDBY}`, | ||
| port: 15847, | ||
| public_access: true, | ||
| }, | ||
| { | ||
| role: 'primary', | ||
| address: PRIVATE_PRIMARY, | ||
| port: 15847, | ||
| public_access: false, | ||
| }, | ||
| { | ||
| role: 'standby', | ||
| address: PRIVATE_STANDBY, | ||
| port: 15847, | ||
| public_access: false, | ||
| }, | ||
| ], | ||
| }, | ||
| platform: 'rdbms-default', | ||
| private_network: { | ||
| public_access: true, | ||
| subnet_id: 1, | ||
| vpc_id: 123, | ||
| }, // VPC configuration with public access set to true | ||
| }) as Database; | ||
|
|
||
| renderWithTheme(<ConnectionDetailsHostRows2 database={database} />); | ||
|
|
||
| // Verify that Private and Public Host and Readonly-host fields are rendered | ||
| expect(screen.getByText('Private Host')).toBeVisible(); | ||
| expect(screen.getByText('Public Host')).toBeVisible(); | ||
| expect(screen.getByText('Private Read-only Host')).toBeVisible(); | ||
| expect(screen.getByText('Public Read-only Host')).toBeVisible(); | ||
|
|
||
| // Verify that the Private and Public hostname is rendered correctly | ||
| expect(screen.getByText(PRIVATE_PRIMARY)).toBeVisible(); | ||
| expect(screen.getByText(`public-${DEFAULT_PRIMARY}`)).toBeVisible(); | ||
|
|
||
| // Verify that the Private and Public read-only hostname is rendered correctly | ||
| expect(screen.getByText(PRIVATE_STANDBY)).toBeVisible(); | ||
| expect(screen.getByText(`public-${DEFAULT_STANDBY}`)).toBeVisible(); | ||
| }); | ||
| }); | ||
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.
Went ahead and updated the
private_accessfield topublic_accesssince it was soft approved