Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add feature flag for disabling project add on updates

Joshen Lim37dd5fb42b56
diff --git a/studio/components/interfaces/Billing/AddOns/AddonUpdateDisabledWarning.tsx b/studio/components/interfaces/Billing/AddOns/AddonUpdateDisabledWarning.tsx
new file mode 100644
index 00000000000..cea6196deff
--- /dev/null
+++ b/studio/components/interfaces/Billing/AddOns/AddonUpdateDisabledWarning.tsx
@@ -0,0 +1,25 @@
+import { IconAlertCircle } from '@supabase/ui'
+import InformationBox from 'components/ui/InformationBox'
+
+const AddonUpdateDisabledWarning = () => {
+ return (
+ <InformationBox
+ icon={<IconAlertCircle className="text-white" size="large" strokeWidth={1.5} />}
+ defaultVisibility={true}
+ hideCollapse
+ title="Updating database add-ons is currently disabled"
+ description={
+ <div className="space-y-3">
+ <p className="text-sm leading-normal">
+ Our engineers are currently working on a fix. You can follow updates on{' '}
+ <a className="text-brand-900" href="https://status.supabase.com/">
+ https://status.supabase.com/
+ </a>
+ </p>
+ </div>
+ }
+ />
+ )
+}
+
+export default AddonUpdateDisabledWarning
diff --git a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx
index 48a32c0f2c4..5028a4d48e8 100644
--- a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx
+++ b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx
@@ -1,26 +1,21 @@
import { FC } from 'react'
import Link from 'next/link'
import { Badge, Button, Radio } from '@supabase/ui'
-import { useStore } from 'hooks'
+
+import { useStore, useFlag } from 'hooks'
import { getProductPrice } from '../Billing.utils'
+import AddonUpdateDisabledWarning from './AddonUpdateDisabledWarning'
interface Props {
computeSizes: any[]
- currentComputeSize: any
selectedComputeSize: any
onSelectOption: (option: any) => void
}
-const ComputeSizeSelection: FC<Props> = ({
- computeSizes,
- currentComputeSize,
- selectedComputeSize,
- onSelectOption,
-}) => {
- // [Joshen] We should have some indication on what's the current compute
- // size of the project based on currentComputeSize
+const ComputeSizeSelection: FC<Props> = ({ computeSizes, selectedComputeSize, onSelectOption }) => {
const { ui } = useStore()
const projectRef = ui.selectedProjectRef
+ const addonUpdateDisabled = useFlag('disableProjectAddonUpdates')
return (
<div className="space-y-4">
@@ -29,49 +24,53 @@ const ComputeSizeSelection: FC<Props> = ({
<h4 className="text-lg">Database add-ons</h4>
<Badge color="green">Optional</Badge>
</div>
- <p className="text-sm text-scale-1100">
+ <p className="text-scale-1100 text-sm">
Choose the database instance size that best fits your needs
</p>
</div>
- <Radio.Group type="cards" className="billing-compute-radio">
- {computeSizes.map((option: any) => {
- const defaultPrice = getProductPrice(option)
- return (
- <Radio
- hidden
- key={option.id}
- align="vertical"
- label={option.name}
- // @ts-ignore
- description={
- <div>
- <p>{option.description}</p>
- <p>{option.metadata.features}</p>
- </div>
- }
- value={option.id}
- optionalLabel={<div>${defaultPrice.unit_amount / 100} / month</div>}
- checked={selectedComputeSize?.id === option.id}
- onChange={() => onSelectOption(option)}
- />
- )
- })}
- <Radio
- hidden
- disabled
- key="compute-size-cta"
- align="vertical"
- label="Need a larger add on?"
- description="Reach out to us - we've got you covered!"
- optionalLabel={
- <Link href={`/support/new?ref=${projectRef}&category=sales`}>
- <a>
- <Button>Contact us</Button>
- </a>
- </Link>
- }
- />
- </Radio.Group>
+ {addonUpdateDisabled ? (
+ <AddonUpdateDisabledWarning />
+ ) : (
+ <Radio.Group type="cards" className="billing-compute-radio">
+ {computeSizes.map((option: any) => {
+ const defaultPrice = getProductPrice(option)
+ return (
+ <Radio
+ hidden
+ key={option.id}
+ align="vertical"
+ label={option.name}
+ // @ts-ignore
+ description={
+ <div>
+ <p>{option.description}</p>
+ <p>{option.metadata.features}</p>
+ </div>
+ }
+ value={option.id}
+ optionalLabel={<div>${defaultPrice.unit_amount / 100} / month</div>}
+ checked={selectedComputeSize?.id === option.id}
+ onChange={() => onSelectOption(option)}
+ />
+ )
+ })}
+ <Radio
+ hidden
+ disabled
+ key="compute-size-cta"
+ align="vertical"
+ label="Need a larger add on?"
+ description="Reach out to us - we've got you covered!"
+ optionalLabel={
+ <Link href={`/support/new?ref=${projectRef}&category=sales`}>
+ <a>
+ <Button>Contact us</Button>
+ </a>
+ </Link>
+ }
+ />
+ </Radio.Group>
+ )}
</div>
)
}
diff --git a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx
index 20f73b165de..dfffe1df6de 100644
--- a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx
+++ b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx
@@ -169,14 +169,14 @@ const ProUpgrade: FC<Props> = ({
enter="transition ease-out duration-300"
enterFrom="transform opacity-0 translate-x-10"
enterTo="transform opacity-100 translate-x-0"
- className="w-full flex items-start justify-between"
+ className="flex w-full items-start justify-between"
>
<>
<div className="2xl:min-w-5xl mx-auto mt-10">
- <div className="relative px-5 space-y-4">
+ <div className="relative space-y-4 px-5">
<BackButton onClick={() => onSelectBack()} />
<div className="space-y-8">
- <h4 className="text-lg text-scale-900">Change your project's subscription</h4>
+ <h4 className="text-scale-900 text-lg">Change your project's subscription</h4>
<div
className="space-y-8 overflow-scroll pb-8"
style={{ height: 'calc(100vh - 9rem - 57px)' }}
@@ -187,7 +187,7 @@ const ProUpgrade: FC<Props> = ({
<h3 className="text-xl">
Welcome to <span className="text-brand-900">Pro</span>
</h3>
- <p className="text-base text-scale-1100">
+ <p className="text-scale-1100 text-base">
Your new subscription will begin immediately after payment
</p>
</>
@@ -196,24 +196,24 @@ const ProUpgrade: FC<Props> = ({
<h3 className="text-3xl">
Managing your <span className="text-brand-900">Pro</span> plan
</h3>
- <p className="text-base text-scale-1100">
+ <p className="text-scale-1100 text-base">
Your billing cycle will reset after payment
</p>
</>
)}
</div>
- <div className="flex items-center justify-between gap-16 border rounded px-6 py-4 bg-panel-body-light dark:bg-panel-body-dark drop-shadow-sm border-panel-border-light border-panel-border-dark">
+ <div className="bg-panel-body-light dark:bg-panel-body-dark border-panel-border-light border-panel-border-dark flex items-center justify-between gap-16 rounded border px-6 py-4 drop-shadow-sm">
<div>
<div className="flex items-center space-x-2">
<p>Enable spend cap</p>
<IconHelpCircle
size={16}
strokeWidth={1.5}
- className="cursor-pointer opacity-50 hover:opacity-100 transition"
+ className="cursor-pointer opacity-50 transition hover:opacity-100"
onClick={() => setShowSpendCapHelperModal(true)}
/>
</div>
- <p className="text-sm text-scale-1100">
+ <p className="text-scale-1100 text-sm">
If enabled, additional resources will not be charged on a per-usage basis
</p>
</div>
@@ -227,7 +227,6 @@ const ProUpgrade: FC<Props> = ({
<Divider light />
<ComputeSizeSelection
computeSizes={computeSizes || []}
- currentComputeSize={currentComputeSize}
selectedComputeSize={selectedComputeSize}
onSelectOption={onSelectComputeSizeOption}
/>
@@ -274,7 +273,7 @@ const ProUpgrade: FC<Props> = ({
header="Enabling spend cap"
onCancel={() => setShowSpendCapHelperModal(false)}
>
- <div className="py-4 space-y-4">
+ <div className="space-y-4 py-4">
<Modal.Content>
<div className="space-y-4">
<p className="text-sm">
@@ -289,11 +288,11 @@ const ProUpgrade: FC<Props> = ({
</p>
{/* Maybe instead of a table, show something more interactive like a spend cap playground */}
{/* Maybe ideate this in Figma first but this is good enough for now */}
- <div className="border border-scale-600 bg-scale-500 rounded">
+ <div className="border-scale-600 bg-scale-500 rounded border">
<div className="flex items-center px-4 pt-2 pb-1">
- <p className="w-[50%] text-sm text-scale-1100">Item</p>
- <p className="w-[25%] text-sm text-scale-1100">Limit</p>
- <p className="w-[25%] text-sm text-scale-1100">Rate</p>
+ <p className="text-scale-1100 w-[50%] text-sm">Item</p>
+ <p className="text-scale-1100 w-[25%] text-sm">Limit</p>
+ <p className="text-scale-1100 w-[25%] text-sm">Rate</p>
</div>
<div className="py-1">
<div className="flex items-center px-4 py-1">