From 25abfe2bd02511d8a0a359cde61531bbdfa68447 Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Fri, 9 Dec 2022 13:59:35 +0800 Subject: [PATCH] Prevent changing of compute size for subscription if already has a compute size add on but with 0 --- .../Billing/AddOns/ComputeSizeSelection.tsx | 39 +++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx index 65364ded9ad..7f0ce60de28 100644 --- a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx +++ b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx @@ -2,14 +2,15 @@ import { FC } from 'react' import Link from 'next/link' import { Badge, Button, Radio } from 'ui' -import { useStore, useFlag } from 'hooks' +import { useFlag, useParams } from 'hooks' import { getProductPrice } from '../Billing.utils' import DisabledWarningDueToIncident from 'components/ui/DisabledWarningDueToIncident' +import { DatabaseAddon } from './AddOns.types' interface Props { - computeSizes: any[] - currentComputeSize?: any - selectedComputeSize: any + computeSizes: DatabaseAddon[] + currentComputeSize?: DatabaseAddon + selectedComputeSize: DatabaseAddon onSelectOption: (option: any) => void } @@ -19,8 +20,7 @@ const ComputeSizeSelection: FC = ({ selectedComputeSize, onSelectOption, }) => { - const { ui } = useStore() - const projectRef = ui.selectedProjectRef + const { ref } = useParams() const addonUpdateDisabled = useFlag('disableProjectCreationAndUpdate') return ( @@ -36,6 +36,31 @@ const ComputeSizeSelection: FC = ({ {addonUpdateDisabled ? ( + ) : currentComputeSize?.isLocked ? ( +
+
+
+ Your project currently has the {currentComputeSize.name} +
+

+ If you would like to change your compute size, do reach out to us +

+
+ +
) : ( {computeSizes.map((option: any) => { @@ -76,7 +101,7 @@ const ComputeSizeSelection: FC = ({ description="Reach out to us - we've got you covered!" optionalLabel={