Skip to content

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

Update CTA for manual disk size increase beyond limit (#23255)

Joshen Limae046a12f809
diff --git a/apps/studio/components/interfaces/Settings/Database/DiskSizeConfiguration.tsx b/apps/studio/components/interfaces/Settings/Database/DiskSizeConfiguration.tsx
index 40a026c0417..8ed19d53aa5 100644
--- a/apps/studio/components/interfaces/Settings/Database/DiskSizeConfiguration.tsx
+++ b/apps/studio/components/interfaces/Settings/Database/DiskSizeConfiguration.tsx
@@ -1,30 +1,42 @@
import * as Tooltip from '@radix-ui/react-tooltip'
-import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { PermissionAction, SupportCategories } from '@supabase/shared-types/out/constants'
import dayjs from 'dayjs'
+import { Info } from 'lucide-react'
import Link from 'next/link'
import { useState } from 'react'
import toast from 'react-hot-toast'
import { number, object } from 'yup'
import { useParams } from 'common'
+import { Markdown } from 'components/interfaces/Markdown'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import { FormHeader } from 'components/ui/Forms'
import Panel from 'components/ui/Panel'
import { useProjectDiskResizeMutation } from 'data/config/project-disk-resize-mutation'
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
import { useCheckPermissions, useSelectedOrganization } from 'hooks'
-import { Alert, Button, Form, InputNumber, Modal } from 'ui'
+import {
+ AlertDescription_Shadcn_,
+ AlertTitle_Shadcn_,
+ Alert_Shadcn_,
+ Button,
+ Form,
+ InputNumber,
+ Modal,
+} from 'ui'
+import { WarningIcon } from 'ui-patterns/Icons/StatusIcons'
export interface DiskSizeConfigurationProps {
disabled?: boolean
}
const DiskSizeConfiguration = ({ disabled = false }: DiskSizeConfigurationProps) => {
- const { project } = useProjectContext()
- const organization = useSelectedOrganization()
const { ref: projectRef } = useParams()
+ const { project } = useProjectContext()
const { lastDatabaseResizeAt } = project ?? {}
+ const organization = useSelectedOrganization()
+
const timeTillNextAvailableDatabaseResize =
lastDatabaseResizeAt === null ? 0 : 6 * 60 - dayjs().diff(lastDatabaseResizeAt, 'minutes')
const isAbleToResizeDatabase = timeTillNextAvailableDatabaseResize <= 0
@@ -68,9 +80,9 @@ const DiskSizeConfiguration = ({ disabled = false }: DiskSizeConfigurationProps)
const diskSizeValidationSchema = object({
'new-disk-size': number()
.required('Please enter a GB amount you want to resize the disk up to.')
- .moreThan(Number(currentDiskSize ?? 0), `Must be more than ${currentDiskSize} GB`)
+ .min(Number(currentDiskSize ?? 0), `Must be more than ${currentDiskSize} GB`)
// to do, update with max_disk_volume_size_gb
- .lessThan(Number(maxDiskSize), 'Must be no more than 200 GB'),
+ .max(Number(maxDiskSize), 'Must not be more than 200 GB'),
})
return (
@@ -129,51 +141,33 @@ const DiskSizeConfiguration = ({ disabled = false }: DiskSizeConfigurationProps)
</div>
</Panel.Content>
</Panel>
- <Alert withIcon variant="info" title={'Importing a lot of data?'}>
- <p className=" max-w-2xl">
- We auto-scale your disk as you need more storage, but can only do this every 6 hours.
- If you upload more than 1.5x the current size of your storage, your database will go
- into read-only mode. If you know how big your database is going to be, you can
- manually increase the size here.
- </p>
+ <Alert_Shadcn_>
+ <Info size={16} />
+ <AlertTitle_Shadcn_>Importing a lot of data?</AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ <Markdown
+ className="max-w-full"
+ content={`
+We auto-scale your disk as you need more storage, but can only do this every 6 hours.
+If you upload more than 1.5x the current size of your storage, your database will go
+into read-only mode. If you know how big your database is going to be, you can
+manually increase the size here.
- <p className="mt-4">
- Read more about{' '}
- <a
- className="underline"
- href="https://supabase.com/docs/guides/platform/database-size#disk-management"
- >
- disk management
- </a>
- .
- </p>
- </Alert>
+Read more about [disk management](https://supabase.com/docs/guides/platform/database-size#disk-management).
+`}
+ />
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
</div>
) : (
- <Alert
- withIcon
- variant="info"
- title={
- projectSubscriptionData?.plan?.id === 'free'
+ <Alert_Shadcn_>
+ <Info size={16} />
+ <AlertTitle_Shadcn_>
+ {projectSubscriptionData?.plan?.id === 'free'
? 'Disk size configuration is not available for projects on the Free plan'
- : 'Disk size configuration is only available when disabling the spend cap.'
- }
- actions={
- <Button asChild type="default">
- <Link
- href={`/org/${organization?.slug}/billing?panel=${
- projectSubscriptionData?.plan?.id === 'free' ? 'subscriptionPlan' : 'costControl'
- }`}
- target="_blank"
- >
- {projectSubscriptionData?.plan?.id === 'free'
- ? 'Upgrade subscription'
- : 'Disable spend cap'}
- </Link>
- </Button>
- }
- >
- <div>
+ : 'Disk size configuration is only available when the spend cap has been disabled'}
+ </AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
{projectSubscriptionData?.plan?.id === 'free' ? (
<p>
If you are intending to use more than 500MB of disk space, then you will need to
@@ -185,8 +179,20 @@ const DiskSizeConfiguration = ({ disabled = false }: DiskSizeConfigurationProps)
disable your spend cap.
</p>
)}
- </div>
- </Alert>
+ <Button asChild type="default" className="mt-3">
+ <Link
+ href={`/org/${organization?.slug}/billing?panel=${
+ projectSubscriptionData?.plan?.id === 'free' ? 'subscriptionPlan' : 'costControl'
+ }`}
+ target="_blank"
+ >
+ {projectSubscriptionData?.plan?.id === 'free'
+ ? 'Upgrade subscription'
+ : 'Disable spend cap'}
+ </Link>
+ </Button>
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
)}
<Modal
@@ -205,29 +211,42 @@ const DiskSizeConfiguration = ({ disabled = false }: DiskSizeConfigurationProps)
>
{() =>
currentDiskSize >= maxDiskSize ? (
- <>
- <Alert withIcon variant="warning" title="Maximum manual disk size increase reached">
- You cannot manually expand the disk size any more than {maxDiskSize} GB. If you
- need more than this, contact us to learn more about the Enterprise plan.
- </Alert>
- </>
+ <Alert_Shadcn_ variant="warning" className="rounded-t-none border-0">
+ <WarningIcon />
+ <AlertTitle_Shadcn_>Maximum manual disk size increase reached</AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ <p>
+ You cannot manually expand the disk size any more than {maxDiskSize}GB. If you
+ need more than this, contact us via support for help.
+ </p>
+ <Button asChild type="default" className="mt-3">
+ <Link
+ href={`/support/new?ref=${projectRef}&category=${SupportCategories.PERFORMANCE_ISSUES}&subject=Increase%20disk%20size%20beyond%20200GB`}
+ >
+ Contact support
+ </Link>
+ </Button>
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
) : (
<>
<Modal.Content>
<div className="w-full space-y-4 py-6">
- <Alert
- withIcon
- variant={isAbleToResizeDatabase ? 'info' : 'warning'}
- title="This operation is only possible every 6 hours"
- >
- {isAbleToResizeDatabase
- ? `Upon updating your disk size, the next disk size update will only be available from ${dayjs().format(
- 'DD MMM YYYY, HH:mm (ZZ)'
- )}`
- : `Your database was last resized at ${dayjs(lastDatabaseResizeAt).format(
- 'DD MMM YYYY, HH:mm (ZZ)'
- )}. You can resize your database again in approximately ${formattedTimeTillNextAvailableResize}`}
- </Alert>
+ <Alert_Shadcn_ variant={isAbleToResizeDatabase ? 'default' : 'warning'}>
+ <Info size={16} />
+ <AlertTitle_Shadcn_>
+ This operation is only possible every 6 hours
+ </AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ {isAbleToResizeDatabase
+ ? `Upon updating your disk size, the next disk size update will only be available from ${dayjs().format(
+ 'DD MMM YYYY, HH:mm (ZZ)'
+ )}`
+ : `Your database was last resized at ${dayjs(lastDatabaseResizeAt).format(
+ 'DD MMM YYYY, HH:mm (ZZ)'
+ )}. You can resize your database again in approximately ${formattedTimeTillNextAvailableResize}`}
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
<InputNumber
required
id="new-disk-size"
diff --git a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx
index dff9f2bfaa2..f838e146fa5 100644
--- a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx
@@ -111,6 +111,7 @@ const NavigationBar = () => {
<Link
href={IS_PLATFORM ? '/projects' : `/project/${projectRef}`}
className="mx-2 flex items-center h-[40px]"
+ onClick={onCloseNavigationIconLink}
>
<img
alt="Supabase"
diff --git a/apps/studio/components/layouts/SQLEditorLayout/SQLEditorMenu.tsx b/apps/studio/components/layouts/SQLEditorLayout/SQLEditorMenu.tsx
index 69f11ace730..47ae7581680 100644
--- a/apps/studio/components/layouts/SQLEditorLayout/SQLEditorMenu.tsx
+++ b/apps/studio/components/layouts/SQLEditorLayout/SQLEditorMenu.tsx
@@ -8,24 +8,16 @@ import toast from 'react-hot-toast'
import { useParams } from 'common'
import { untitledSnippetTitle } from 'components/interfaces/SQLEditor/SQLEditor.constants'
import { createSqlSnippetSkeleton } from 'components/interfaces/SQLEditor/SQLEditor.utils'
+import AlertError from 'components/ui/AlertError'
import { useContentDeleteMutation } from 'data/content/content-delete-mutation'
import { SqlSnippet, useSqlSnippetsQuery } from 'data/content/sql-snippets-query'
import { useCheckPermissions, useSelectedProject } from 'hooks'
import { uuidv4 } from 'lib/helpers'
import { useProfile } from 'lib/profile'
import { useSnippets, useSqlEditorStateSnapshot } from 'state/sql-editor'
-import {
- AlertDescription_Shadcn_,
- AlertTitle_Shadcn_,
- Alert_Shadcn_,
- Button,
- Modal,
- TooltipContent_Shadcn_,
- TooltipTrigger_Shadcn_,
- Tooltip_Shadcn_,
-} from 'ui'
+import { ResponseError } from 'types'
+import { Button, TooltipContent_Shadcn_, TooltipTrigger_Shadcn_, Tooltip_Shadcn_ } from 'ui'
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
-import { WarningIcon } from 'ui-patterns/Icons/StatusIcons'
import {
InnerSideBarEmptyPanel,
InnerSideBarFilterSearchInput,
@@ -51,7 +43,7 @@ const SideBarContent = () => {
const [selectedQueries, setSelectedQueries] = useState<string[]>([])
const snap = useSqlEditorStateSnapshot()
- const { isLoading, isSuccess } = useSqlSnippetsQuery(ref, {
+ const { isLoading, isSuccess, isError, error } = useSqlSnippetsQuery(ref, {
refetchOnWindowFocus: false,
staleTime: 300, // 5 minutes
onSuccess(data) {
@@ -205,37 +197,43 @@ const SideBarContent = () => {
return (
<>
<div className="mt-6">
- {isLoading ? (
- <InnerSideBarShimmeringLoaders />
- ) : isSuccess ? (
- <div>
- <div className="flex flex-col gap-4">
- <Button
- type="default"
- className="justify-start mx-4"
- onClick={() => handleNewQuery()}
- icon={<Plus className="text-foreground-muted" strokeWidth={1} size={14} />}
- >
- New query
- </Button>
-
- <div className="px-2">
- <InnerSideMenuItem
- title="Templates"
- isActive={router.asPath === `/project/${ref}/sql/templates`}
- href={`/project/${ref}/sql/templates`}
- >
- Templates
- </InnerSideMenuItem>
- <InnerSideMenuItem
- title="Quickstarts"
- isActive={router.asPath === `/project/${ref}/sql/quickstarts`}
- href={`/project/${ref}/sql/quickstarts`}
- >
- Quickstarts
- </InnerSideMenuItem>
- </div>
+ <div className="flex flex-col gap-4">
+ <Button
+ type="default"
+ className="justify-start mx-4"
+ onClick={() => handleNewQuery()}
+ icon={<Plus className="text-foreground-muted" strokeWidth={1} size={14} />}
+ >
+ New query
+ </Button>
+
+ <div className="px-2">
+ <InnerSideMenuItem
+ title="Templates"
+ isActive={router.asPath === `/project/${ref}/sql/templates`}
+ href={`/project/${ref}/sql/templates`}
+ >
+ Templates
+ </InnerSideMenuItem>
+ <InnerSideMenuItem
+ title="Quickstarts"
+ isActive={router.asPath === `/project/${ref}/sql/quickstarts`}
+ href={`/project/${ref}/sql/quickstarts`}
+ >
+ Quickstarts
+ </InnerSideMenuItem>
+ </div>
+ {isLoading && <InnerSideBarShimmeringLoaders />}
+
+ {isError && (
+ <div className="px-4">
+ <AlertError error={error as ResponseError} subject="Failed to load SQL snippets" />
+ </div>
+ )}
+
+ {isSuccess && (
+ <>
{snippets.length > 0 && (
<InnerSideBarFilters className="mx-2">
<InnerSideBarFilterSearchInput
@@ -343,9 +341,9 @@ const SideBarContent = () => {
</InnerSideMenuCollapsibleContent>
</InnerSideMenuCollapsible>
)}
- </div>
- </div>
- ) : null}
+ </>
+ )}
+ </div>
</div>
<ConfirmationModal