Skip to content

Commit cdab569

Browse files
authored
upcoming: [UIE-9487] VPC UI not displaying DBaaS resources (#13504)
* fix: [UIE-9487] - Networking/DBaaS - Display DBaaS resource count and table in the VPC UI * Making enhancements to the SubnetDatabasesTable and cleaning up * Moving paginator in SubnetDatabasesTable * Applying initial feedback * Removing leftover change from old implementation * Adding unit tests for various changes related to dbaas resource count and table feature * adding changesets * Applying secondary feedback * Updating changeset and unit tests based on additional feedback * Applying feedback to fix text for database table IPV4 Address header
1 parent 56cab84 commit cdab569

26 files changed

Lines changed: 651 additions & 58 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/api-v4": Added
3+
---
4+
5+
SubnetAssignedDatabaseData interface and update to Subnet to include databases property ([#13504](https://github.com/linode/manager/pull/13504))

packages/api-v4/src/vpcs/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface CreateSubnetPayload {
4242

4343
export interface Subnet extends CreateSubnetPayload {
4444
created: string;
45+
databases: SubnetAssignedDatabaseData[];
4546
id: number;
4647
linodes: SubnetAssignedLinodeData[];
4748
nodebalancers: SubnetAssignedNodeBalancerData[];
@@ -68,6 +69,12 @@ export interface SubnetAssignedNodeBalancerData {
6869
ipv4_range: string;
6970
}
7071

72+
export interface SubnetAssignedDatabaseData {
73+
id: number;
74+
ipv4_range: string;
75+
ipv6_ranges: null | { range: string }[];
76+
}
77+
7178
export interface VPCIP {
7279
active: boolean;
7380
address: null | string;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Upcoming Features
3+
---
4+
5+
DBaaS resource counts and databases resource table in VPC UI ([#13504](https://github.com/linode/manager/pull/13504))

packages/manager/src/dev-tools/FeatureFlagTool.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ const options: { flag: keyof Flags; label: string }[] = [
9494
label: 'Object Storage Contextual Metrics',
9595
},
9696
{ flag: 'objSummaryPage', label: 'OBJ Summary Page' },
97+
{ flag: 'vpcDbaasResources', label: 'VPC DBaaS Resources' },
9798
{ flag: 'vpcIpv6', label: 'VPC IPv6' },
9899
{ flag: 'reserveIp', label: 'Reserve IP' },
99100
{ flag: 'marketplaceV2GlobalBanner', label: 'Marketplace V2 Global Banner' },

packages/manager/src/factories/databases.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ export const databaseInstanceFactory =
199199
label: Factory.each((i) => `example.com-database-${i}`),
200200
members: {
201201
'2.2.2.2': 'primary',
202+
'2.2.2.3': 'failover',
203+
'2.2.2.4': 'failover',
202204
},
203205
platform: 'rdbms-default',
204206
region: Factory.each((i) => possibleRegions[i % possibleRegions.length]),
@@ -268,6 +270,8 @@ export const databaseFactory = Factory.Sync.makeFactory<Database>({
268270
label: Factory.each((i) => `database-${i}`),
269271
members: {
270272
'2.2.2.2': 'primary',
273+
'2.2.2.3': 'failover',
274+
'2.2.2.4': 'failover',
271275
},
272276
oldest_restore_time: '2024-09-15T17:15:12',
273277
platform: 'rdbms-default',

packages/manager/src/factories/subnets.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Factory } from '@linode/utilities';
22

33
import type {
44
Subnet,
5+
SubnetAssignedDatabaseData,
56
SubnetAssignedLinodeData,
67
SubnetAssignedNodeBalancerData,
78
} from '@linode/api-v4/lib/vpcs/types';
@@ -27,6 +28,23 @@ export const subnetAssignedNodebalancerDataFactory =
2728
ipv4_range: Factory.each((i) => `192.168.${i}.0/30`),
2829
});
2930

31+
export const subnetAssignedDatabaseDataFactory =
32+
Factory.Sync.makeFactory<SubnetAssignedDatabaseData>({
33+
id: Factory.each((i) => i),
34+
ipv4_range: Factory.each((i) => `192.168.${i}.0/30`),
35+
ipv6_ranges: Factory.each((i) => [
36+
{
37+
range: `2600:3c11:e41c:${i}::/64`,
38+
},
39+
{
40+
range: `2600:3c11:e41c:${i}::/64`,
41+
},
42+
{
43+
range: `2600:3c11:e41c:${i}::/64`,
44+
},
45+
]),
46+
});
47+
3048
export const subnetFactory = Factory.Sync.makeFactory<Subnet>({
3149
created: '2023-07-12T16:08:53',
3250
id: Factory.each((i) => i),
@@ -46,5 +64,12 @@ export const subnetFactory = Factory.Sync.makeFactory<Subnet>({
4664
})
4765
)
4866
),
67+
databases: Factory.each((i) =>
68+
Array.from({ length: 3 }, (_, arrIdx) =>
69+
subnetAssignedDatabaseDataFactory.build({
70+
id: i * 10 + arrIdx,
71+
})
72+
)
73+
),
4974
updated: '2023-07-12T16:08:53',
5075
});

packages/manager/src/featureFlags.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ export interface Flags {
294294
udp: boolean;
295295
vmHostMaintenance: VMHostMaintenanceFlag;
296296
volumeSummaryPage: boolean;
297+
vpcDbaasResources: boolean;
297298
vpcIpv6: boolean;
298299
}
299300

packages/manager/src/features/Databases/DatabaseLanding/DatabaseLanding.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ export const DatabaseLanding = () => {
6868
page_size: newDatabasesPagination.pageSize,
6969
},
7070
databasesFilter,
71-
isDefaultEnabled // TODO (UIE-8634): Determine if check if still necessary
71+
isDefaultEnabled, // TODO (UIE-8634): Determine if check is still necessary
72+
20000
7273
);
7374

7475
if (databasesError) {

packages/manager/src/features/Databases/DatabaseLanding/DatabaseRow.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import { Link } from 'src/components/Link';
1212
import { DatabaseStatusDisplay } from 'src/features/Databases/DatabaseDetail/DatabaseStatusDisplay';
1313
import { DatabaseEngineVersion } from 'src/features/Databases/DatabaseEngineVersion';
1414
import { DatabaseActionMenu } from 'src/features/Databases/DatabaseLanding/DatabaseActionMenu';
15-
import { useIsDatabasesEnabled } from 'src/features/Databases/utilities';
15+
import {
16+
getIsLinkInactive,
17+
useIsDatabasesEnabled,
18+
} from 'src/features/Databases/utilities';
1619
import { isWithinDays, parseAPIDate } from 'src/utilities/date';
1720
import { formatDate } from 'src/utilities/formatDate';
1821

@@ -64,11 +67,6 @@ export const DatabaseRow = ({
6467
const plan = types?.find((t: DatabaseType) => t.id === type);
6568
const formattedPlan = plan && formatStorageUnits(plan.label);
6669
const actualRegion = regions?.find((r) => r.id === region);
67-
const isLinkInactive =
68-
status === 'suspended' ||
69-
status === 'suspending' ||
70-
status === 'resuming' ||
71-
status === 'migrated';
7270
const { isDatabasesV2GA } = useIsDatabasesEnabled();
7371

7472
const configuration =
@@ -97,7 +95,7 @@ export const DatabaseRow = ({
9795
flex: '0 1 20.5%',
9896
}}
9997
>
100-
{isDatabasesV2GA && isLinkInactive ? (
98+
{isDatabasesV2GA && getIsLinkInactive(status) ? (
10199
label
102100
) : (
103101
<Link to={`/databases/${engine}/${id}`}>{label}</Link>

packages/manager/src/features/Databases/utilities.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type {
99
DatabaseEngine,
1010
DatabaseFork,
1111
DatabaseInstance,
12+
DatabaseStatus,
1213
Engine,
1314
PendingUpdates,
1415
} from '@linode/api-v4';
@@ -256,3 +257,6 @@ export const convertPrivateToPublicHostname = (host: string) => {
256257
const baseHostName = host.slice(privateStrIndex + 1);
257258
return `public-${baseHostName}`;
258259
};
260+
261+
export const getIsLinkInactive = (status: DatabaseStatus) =>
262+
['migrated', 'resuming', 'suspended', 'suspending'].includes(status);

0 commit comments

Comments
 (0)