Skip to content

Commit

Permalink
fix: [UIE-8165] - DBaaS remove 512 GB plan selection (#11036)
Browse files Browse the repository at this point in the history
  • Loading branch information
corya-akamai authored Oct 4, 2024
1 parent ccb4e0b commit 47585a9
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 73 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11036-changed-1727881220211.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@linode/manager': Changed
---

Remove the 512GB plan selection from DBaaS ([#11036](https://github.com/linode/manager/pull/11036))
65 changes: 0 additions & 65 deletions packages/manager/src/features/components/PlansPanel/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { PlanSelectionType } from './types';
import type { ExtendedType } from 'src/utilities/extendType';

export const LIMITED_AVAILABILITY_COPY =
Expand Down Expand Up @@ -81,70 +80,6 @@ export const DEDICATED_512_GB_PLAN: ExtendedType = {
vcpus: 64,
};

export const DBAAS_DEDICATED_512_GB_PLAN: PlanSelectionType = {
class: 'dedicated',
disk: 7372800,
// engines: {
// mysql: [
// {
// price: {
// hourly: 12.48,
// monthly: 8320,
// },
// quantity: 1,
// },
// {
// price: {
// hourly: 24.96,
// monthly: 16640,
// },
// quantity: 2,
// },
// {
// price: {
// hourly: 37.44,
// monthly: 24960,
// },
// quantity: 3,
// },
// ],
// postgresql: [
// {
// price: {
// hourly: 12.48,
// monthly: 8320,
// },
// quantity: 1,
// },
// {
// price: {
// hourly: 24.96,
// monthly: 16640,
// },
// quantity: 2,
// },
// {
// price: {
// hourly: 37.44,
// monthly: 24960,
// },
// quantity: 3,
// },
// ],
// },
formattedLabel: 'Dedicated 512 GB',
heading: 'Dedicated 512 GB',
id: 'g6-dedicated-64',
label: 'DBaaS - Dedicated 512GB',
memory: 524288,
price: {
hourly: 12.48,
monthly: 8320,
},
subHeadings: ['$8320/mo ($12.48/hr)', '64 CPU, 7200 GB Storage, 512 GB RAM'],
vcpus: 64,
};

export const PREMIUM_512_GB_PLAN: ExtendedType = {
addons: {
backups: {
Expand Down
36 changes: 36 additions & 0 deletions packages/manager/src/features/components/PlansPanel/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
getIsLimitedAvailability,
getPlanSelectionsByPlanType,
planTypeOrder,
replaceOrAppendPlaceholder512GbPlans,
} from './utils';

import type { PlanSelectionType } from './types';
Expand Down Expand Up @@ -417,4 +418,39 @@ describe('extractPlansInformation', () => {
expect(result).toBe(PLAN_IS_CURRENTLY_UNAVAILABLE_COPY);
});
});

describe('replaceOrAppendPlaceholder512GbPlans', () => {
it('should not append to DBaaS plans', () => {
const plans = [
{
id: 'g6-dedicated-56',
label: 'DBaaS - Dedicated 256GB',
},
] as PlanSelectionType[];
const results = replaceOrAppendPlaceholder512GbPlans(plans);
expect(results.length).toEqual(1);
});

it('should append to Linode plans', () => {
const plans = [
{
id: 'g6-dedicated-56',
label: 'Dedicated 256GB',
},
] as PlanSelectionType[];
const results = replaceOrAppendPlaceholder512GbPlans(plans);
expect(results.length).toEqual(3);
});

it('should replace the Linode plan', () => {
const plans = [
{
id: 'not-the-right-id',
label: 'Premium 512GB',
},
] as PlanSelectionType[];
const results = replaceOrAppendPlaceholder512GbPlans(plans);
expect(results[0].id).toEqual('g7-premium-64');
});
});
});
15 changes: 7 additions & 8 deletions packages/manager/src/features/components/PlansPanel/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { arrayToList } from 'src/utilities/arrayToList';
import { ExtendedType } from 'src/utilities/extendType';

import {
DBAAS_DEDICATED_512_GB_PLAN,
DEDICATED_512_GB_PLAN,
LIMITED_AVAILABILITY_COPY,
PLAN_IS_CURRENTLY_UNAVAILABLE_COPY,
Expand Down Expand Up @@ -223,7 +222,11 @@ export const planTabInfoContent = {
export const replaceOrAppendPlaceholder512GbPlans = (
types: (ExtendedType | PlanSelectionType)[]
) => {
// DBaaS does not currently offer a 512 GB plan
const isInDatabasesFlow = types.some((type) => type.label.includes('DBaaS'));
if (isInDatabasesFlow) {
return types;
}

// Function to replace or append a specific plan
const replaceOrAppendPlan = <T extends ExtendedType | PlanSelectionType>(
Expand All @@ -239,13 +242,9 @@ export const replaceOrAppendPlaceholder512GbPlans = (
}
};

if (isInDatabasesFlow) {
replaceOrAppendPlan('DBaaS - Dedicated 512GB', DBAAS_DEDICATED_512_GB_PLAN);
} else {
// For Linodes and LKE
replaceOrAppendPlan('Dedicated 512GB', DEDICATED_512_GB_PLAN);
replaceOrAppendPlan('Premium 512GB', PREMIUM_512_GB_PLAN);
}
// For Linodes and LKE
replaceOrAppendPlan('Dedicated 512GB', DEDICATED_512_GB_PLAN);
replaceOrAppendPlan('Premium 512GB', PREMIUM_512_GB_PLAN);

return types;
};
Expand Down

0 comments on commit 47585a9

Please sign in to comment.