From d8ff30912eb8f940850562375ab39ea3e0524736 Mon Sep 17 00:00:00 2001 From: Sam Mans Date: Thu, 14 Nov 2024 15:17:57 -0500 Subject: [PATCH] fix: [UIE-8259] dbaas summary blank read-only host should be N/A --- .../pr-11265-fixed-1731619488790.md | 5 +++++ .../DatabaseSummaryConnectionDetails.test.tsx | 21 +++++++++++++++++++ .../DatabaseSummaryConnectionDetails.tsx | 12 +++++------ 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 packages/manager/.changeset/pr-11265-fixed-1731619488790.md diff --git a/packages/manager/.changeset/pr-11265-fixed-1731619488790.md b/packages/manager/.changeset/pr-11265-fixed-1731619488790.md new file mode 100644 index 00000000000..eefc3564125 --- /dev/null +++ b/packages/manager/.changeset/pr-11265-fixed-1731619488790.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Fixed +--- + +dbaas summary read-only host field is blank ([#11265](https://github.com/linode/manager/pull/11265)) diff --git a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSummary/DatabaseSummaryConnectionDetails.test.tsx b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSummary/DatabaseSummaryConnectionDetails.test.tsx index 7b0e11c7009..9643fe9a5b0 100644 --- a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSummary/DatabaseSummaryConnectionDetails.test.tsx +++ b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSummary/DatabaseSummaryConnectionDetails.test.tsx @@ -77,6 +77,27 @@ describe('DatabaseSummaryConnectionDetails', () => { }); }); + it('should display N/A for default DB with blank read-only Host field', async () => { + const database = databaseFactory.build({ + engine: POSTGRESQL, + hosts: { + primary: DEFAULT_PRIMARY, + secondary: undefined, + standby: undefined, + }, + id: 99, + platform: 'rdbms-default', + port: 22496, + ssl_connection: true, + }); + + const { queryAllByText } = renderWithTheme( + + ); + + expect(queryAllByText('N/A')).toHaveLength(1); + }); + it('should display correctly for legacy db', async () => { queryMocks.useDatabaseCredentialsQuery.mockReturnValue({ data: { diff --git a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSummary/DatabaseSummaryConnectionDetails.tsx b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSummary/DatabaseSummaryConnectionDetails.tsx index 2e1d6435165..4559aca4d86 100644 --- a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSummary/DatabaseSummaryConnectionDetails.tsx +++ b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSummary/DatabaseSummaryConnectionDetails.tsx @@ -116,16 +116,14 @@ export const DatabaseSummaryConnectionDetails = (props: Props) => { database?.hosts?.standby ?? database?.hosts?.secondary ?? ''; const readOnlyHost = () => { - const defaultValue = isLegacy ? '-' : 'not available'; - const value = readOnlyHostValue ?? defaultValue; + const defaultValue = isLegacy ? '-' : 'N/A'; + const value = readOnlyHostValue ? readOnlyHostValue : defaultValue; + const displayCopyTooltip = value !== '-' && value !== 'N/A'; return ( <> {value} - {value && ( - + {value && displayCopyTooltip && ( + )} {isLegacy && (