The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Bring in changes from master and resolve conflicts
Joshen Lim7128dac7c791
diff --cc studio/components/interfaces/Database/Backups/BackupsList.tsxindex ce3a6d4e662,6add480cb2c..971ff1e3612--- a/studio/components/interfaces/Database/Backups/BackupsList.tsx+++ b/studio/components/interfaces/Database/Backups/BackupsList.tsx@@@ -22,12 -21,15 +22,13 @@@ const BackupsList = () =>'queue_job.restore.prepare')- const isPitrEnabled = backups?.configuration?.pitr_enabled-- if (backups.isLoading) return <Loading />- if (backups.error) return <BackupsError />-- const { tierKey } = backups.configuration- const sortedBackups = backups.list()+ const planKey = backups?.tierKey ?? ''+ const sortedBackups = (backups?.backups ?? []).sort(+ (a: any, b: any) => new Date(b.inserted_at).valueOf() - new Date(a.inserted_at).valueOf()+ )++ const isPitrEnabled = backups?.pitr_enabled- if (tierKey === 'FREE') {+ if (planKey === 'FREE') {return (<UpgradeToProicon={<IconClock size="large" />}@@@ -39,9 -41,13 +40,11 @@@)}- if (isPitrEnabled) {- return null- }++ if (isPitrEnabled) return null+return (<div className="space-y-6">- {!sortedBackups?.length && tierKey !== 'FREE' ? (+ {sortedBackups.length === 0 && planKey !== 'FREE' ? (<BackupsEmpty />) : (<>diff --cc studio/pages/project/[ref]/database/backups/pitr.tsxindex ba1bbf0c646,aca401c15ac..d26020d3228--- a/studio/pages/project/[ref]/database/backups/pitr.tsx+++ b/studio/pages/project/[ref]/database/backups/pitr.tsx@@@ -7,13 -6,13 +6,14 @@@ import { Tabs } from 'uiimport { PITRNotice, PITRSelection } from 'components/interfaces/Database/Backups/PITR'import { DatabaseLayout } from 'components/layouts'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'+ import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'-import Loading from 'components/ui/Loading'+import AlertError from 'components/ui/AlertError'import NoPermission from 'components/ui/NoPermission'+import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'import UpgradeToPro from 'components/ui/UpgradeToPro'+import { useBackupsQuery } from 'data/database/backups-query'import { useProjectSubscriptionV2Query } from 'data/subscriptions/project-subscription-v2-query'-import { useCheckPermissions, useStore } from 'hooks'+import { useCheckPermissions } from 'hooks'import { NextPageWithLayout } from 'types'const DatabasePhysicalBackups: NextPageWithLayout = () => {@@@ -74,11 -65,27 +73,11 @@@ const PITR = observer(() =>const ref = project?.ref ?? 'default'const plan = subscription?.plan?.id- const isEnabled = backups?.walg_enabled ?? false- const isEnabled = configuration.pitr_enabled++ const isEnabled = backups?.pitr_enabledconst canReadPhysicalBackups = useCheckPermissions(PermissionAction.READ, 'physical_backups')- if (!canReadPhysicalBackups) return <NoPermission resourceText="view PITR backups" />- if (isLoading) return <Loading />- if (error) return <BackupsError />- if (!isEnabled) {- return (- <UpgradeToPro- projectRef={ref}- primaryText="Point in time recovery is a Pro plan add-on."- secondaryText={- plan === 'free'- ? 'Upgrade to the Pro plan with the PITR add-on selected to enable point in time recovery for your project.'- : 'Please enable the add-on to enable point in time recovery for your project.'- }- addon="pitr"- />- )- }+ if (!canReadPhysicalBackups) return <NoPermission resourceText="view PITR backups" />return (<>diff --cc studio/pages/project/[ref]/database/backups/scheduled.tsxindex 17245238308,463c65f012f..6a4863b24d9--- a/studio/pages/project/[ref]/database/backups/scheduled.tsx+++ b/studio/pages/project/[ref]/database/backups/scheduled.tsx@@@ -7,97 -6,81 +6,100 @@@ import { IconInfo, Tabs } from 'uiimport { BackupsList } from 'components/interfaces/Database'import { DatabaseLayout } from 'components/layouts'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'+ import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'++import AlertError from 'components/ui/AlertError'import InformationBox from 'components/ui/InformationBox'import NoPermission from 'components/ui/NoPermission'--import { useCheckPermissions, useStore } from 'hooks'- import { NextPageWithLayout } from 'types'- import { useBackupsQuery } from 'data/database/backups-query'+import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'- import AlertError from 'components/ui/AlertError'++import { useBackupsQuery } from 'data/database/backups-query'++import { useCheckPermissions } from 'hooks'+ import { NextPageWithLayout } from 'types'const DatabaseScheduledBackups: NextPageWithLayout = () => {const router = useRouter()const { project } = useProjectContext()const ref = project?.ref- const isPitrEnabled = backups?.configuration?.pitr_enabled+ const {+ data: backups,+ error,+ isLoading,+ isError,+ isSuccess,+ } = useBackupsQuery({ projectRef: ref })- const isPitrEnabled = backups?.walg_enabled ?? false++ const isPitrEnabled = backups?.pitr_enabledconst canReadScheduledBackups = useCheckPermissions(PermissionAction.READ, 'back_ups')return (- <div- className={clsx(- 'mx-auto flex flex-col px-5 pt-6 pb-14',- 'lg:pt-8 lg:px-14 1xl:px-28 2xl:px-32 h-full'- )}- >- <div className="space-y-6">- <h3 className="text-xl text-scale-1200">Backups</h3>+ <ScaffoldContainer>+ <ScaffoldSection>+ <div className="col-span-12">+ <div className="space-y-6">+ <h3 className="text-xl text-scale-1200">Database Backups</h3>- <Tabs- type="underlined"- size="small"- activeId="scheduled"- onChange={(id: any) => {- if (id === 'pitr') router.push(`/project/${ref}/database/backups/pitr`)- }}- >- <Tabs.Panel id="scheduled" label="Scheduled backups" />- <Tabs.Panel id="pitr" label="Point in Time" />- </Tabs>+ <Tabs+ type="underlined"+ size="small"+ activeId="scheduled"+ onChange={(id: any) => {+ if (id === 'pitr') router.push(`/project/${ref}/database/backups/pitr`)+ }}+ >+ <Tabs.Panel id="scheduled" label="Scheduled backups" />+ <Tabs.Panel id="pitr" label="Point in Time" />+ </Tabs>- {canReadScheduledBackups ? (- <div className="space-y-4">- {isLoading && <GenericSkeletonLoader />}+ <div className="space-y-4">- {!isPitrEnabled && (- <p className="text-sm text-scale-1100">- Projects are backed up daily around midnight of your project's region and can be- restored at any time.- </p>- )}++ {isLoading && <GenericSkeletonLoader />}- {isError && <AlertError error={error} subject="Failed to retrieve scheduled backups" />}- {isPitrEnabled && (- <InformationBox- hideCollapse- defaultVisibility- icon={<IconInfo strokeWidth={2} />}- title="Point-In-Time-Recovery (PITR) enabled"- description={- <div>- Your project uses PITR and full daily backups are no longer taken. They're not- needed, as PITR supports a superset of functionality, in terms of the granular- recovery that can be performed.{' '}- <a- className="text-brand transition-colors hover:text-brand-600"- href="https://supabase.com/docs/guides/platform/backups"- >- Learn more- </a>- </div>- }- />++ {isError && (++ <AlertError error={error} subject="Failed to retrieve scheduled backups" />+ )}- {isSuccess && (- <>- {isPitrEnabled ? (- <InformationBox- hideCollapse- defaultVisibility- icon={<IconInfo strokeWidth={2} />}- title="Point-In-Time-Recovery (PITR) enabled"- description={- <div>- Your project uses PITR and full daily backups are no longer taken. They're- not needed, as PITR supports a superset of functionality, in terms of the- granular recovery that can be performed.{' '}- <a- className="text-brand transition-colors hover:text-brand-600"- href="https://supabase.com/docs/guides/platform/backups"- >- Learn more- </a>- </div>- }- />- ) : (- <>- {canReadScheduledBackups ? (- <BackupsList />- ) : (- <NoPermission resourceText="view scheduled backups" />++ {isSuccess && (++ <>++ {!isPitrEnabled && (+ <p className="text-sm text-scale-1100">+ Projects are backed up daily around midnight of your project's region and can+ be restored at any time.+ </p>++ )}++++ {isPitrEnabled && (++ <InformationBox++ hideCollapse++ defaultVisibility++ icon={<IconInfo strokeWidth={2} />}++ title="Point-In-Time-Recovery (PITR) enabled"++ description={++ <div>++ Your project uses PITR and full daily backups are no longer taken. They're++ not needed, as PITR supports a superset of functionality, in terms of the++ granular recovery that can be performed.{' '}++ <a++ className="text-brand transition-colors hover:text-brand-600"++ href="https://supabase.com/docs/guides/platform/backups"++ >++ Learn more++ </a>++ </div>++ }++ />++ )}++++ {canReadScheduledBackups ? (+ <BackupsList />- </>- )}- </>- )}++ ) : (++ <NoPermission resourceText="view scheduled backups" />++ )}++ </>+ )}+ </div></div>- ) : (- <NoPermission resourceText="view scheduled backups" />- )}- </div>- </div>+ </div>+ </ScaffoldSection>+ </ScaffoldContainer>)}