Skip to content

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

Update project settings if org billing

Joshen Lim8ddbbfba2326
diff --git a/studio/components/interfaces/Settings/General/General.tsx b/studio/components/interfaces/Settings/General/General.tsx
index 9fcbdac5795..caf145a67fd 100644
--- a/studio/components/interfaces/Settings/General/General.tsx
+++ b/studio/components/interfaces/Settings/General/General.tsx
@@ -1,6 +1,7 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useQueryClient } from '@tanstack/react-query'
-import { Form, Input } from 'ui'
+import Link from 'next/link'
+import { Button, Form, IconBarChart2, Input } from 'ui'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import {
@@ -11,16 +12,22 @@ import {
FormSectionContent,
FormSectionLabel,
} from 'components/ui/Forms'
+import Panel from 'components/ui/Panel'
+import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
import { invalidateProjectsQuery } from 'data/projects/projects-query'
-import { useCheckPermissions, useStore } from 'hooks'
+import { useCheckPermissions, useSelectedOrganization, useStore } from 'hooks'
import { patch } from 'lib/common/fetch'
import { API_URL } from 'lib/constants'
+import PauseProjectButton from './Infrastructure/PauseProjectButton'
+import RestartServerButton from './Infrastructure/RestartServerButton'
const General = () => {
- const queryClient = useQueryClient()
const { ui } = useStore()
+ const queryClient = useQueryClient()
const { project } = useProjectContext()
+ const organization = useSelectedOrganization()
+ const isOrgBilling = !!organization?.subscription_id
const formId = 'project-general-settings'
const initialValues = { name: project?.name ?? '', ref: project?.ref ?? '' }
const canUpdateProject = useCheckPermissions(PermissionAction.UPDATE, 'projects')
@@ -47,42 +54,102 @@ const General = () => {
}
return (
- <Form id={formId} initialValues={initialValues} onSubmit={onSubmit}>
- {({ isSubmitting, handleReset, values, initialValues }: any) => {
- const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)
- return (
- <>
- <FormHeader title="Project Settings" description="" />
-
- <FormPanel
- disabled={!canUpdateProject}
- footer={
- <div className="flex py-4 px-8">
- <FormActions
- form={formId}
- isSubmitting={isSubmitting}
- hasChanges={hasChanges}
- handleReset={handleReset}
- helper={
- !canUpdateProject
- ? "You need additional permissions to manage this project's settings"
- : undefined
- }
- />
+ <div>
+ <FormHeader title="Project Settings" description="" />
+ {project === undefined ? (
+ <GenericSkeletonLoader />
+ ) : (
+ <Form id={formId} initialValues={initialValues} onSubmit={onSubmit}>
+ {({ isSubmitting, handleReset, values, initialValues }: any) => {
+ const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)
+ return (
+ <FormPanel
+ disabled={!canUpdateProject}
+ footer={
+ <div className="flex py-4 px-8">
+ <FormActions
+ form={formId}
+ isSubmitting={isSubmitting}
+ hasChanges={hasChanges}
+ handleReset={handleReset}
+ helper={
+ !canUpdateProject
+ ? "You need additional permissions to manage this project's settings"
+ : undefined
+ }
+ />
+ </div>
+ }
+ >
+ <FormSection header={<FormSectionLabel>General settings</FormSectionLabel>}>
+ <FormSectionContent loading={false}>
+ <Input
+ id="name"
+ size="small"
+ label="Project name"
+ disabled={!canUpdateProject}
+ />
+ <Input copy disabled id="ref" size="small" label="Reference ID" />
+ </FormSectionContent>
+ </FormSection>
+ </FormPanel>
+ )
+ }}
+ </Form>
+ )}
+ {isOrgBilling && (
+ <>
+ <div className="mt-6">
+ <FormPanel>
+ <div className="flex w-full items-center justify-between px-8 py-4">
+ <div>
+ <p className="text-sm">Restart project</p>
+ <div className="max-w-[420px]">
+ <p className="text-sm text-scale-1100">
+ Your project will not be available for a few minutes.
+ </p>
+ </div>
</div>
- }
- >
- <FormSection header={<FormSectionLabel>General settings</FormSectionLabel>}>
- <FormSectionContent loading={false}>
- <Input id="name" size="small" label="Project name" disabled={!canUpdateProject} />
- <Input copy disabled id="ref" size="small" label="Reference ID" />
- </FormSectionContent>
- </FormSection>
+ {project && <RestartServerButton />}
+ </div>
+ <div className="flex w-full items-center justify-between px-8 py-4">
+ <div>
+ <p className="text-sm">Pause project</p>
+ <div className="max-w-[420px]">
+ <p className="text-sm text-scale-1100">
+ Your project will not be accessible while it is paused.
+ </p>
+ </div>
+ </div>
+ {project && <PauseProjectButton />}
+ </div>
</FormPanel>
- </>
- )
- }}
- </Form>
+ </div>
+ <div className="mt-6">
+ <Panel>
+ <Panel.Content>
+ <div className="flex justify-between">
+ <div className="flex space-x-4">
+ <IconBarChart2 strokeWidth={2} />
+ <div>
+ <p className="text-sm">Project usage statistics has been moved</p>
+ <p className="text-scale-1000 text-sm">
+ You may view your project's usage under your organization's settings
+ </p>
+ </div>
+ </div>
+ <Link href={`/org/${organization.slug}/usage?projectRef=${project?.ref}`}>
+ <a>
+ <Button type="default">View project usage</Button>
+ </a>
+ </Link>
+ </div>
+ </Panel.Content>
+ </Panel>
+ </div>
+ </>
+ )}
+ </div>
)
}
diff --git a/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx b/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx
index 7ae5146c214..42858f5fcad 100644
--- a/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx
+++ b/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx
@@ -59,7 +59,7 @@ const Infrastructure = ({}: InfrastructureProps) => {
</p>
</div>
</div>
- {project && <RestartServerButton project={project} />}
+ {project && <RestartServerButton />}
</div>
{isFreeProject && (
@@ -74,9 +74,7 @@ const Infrastructure = ({}: InfrastructureProps) => {
</p>
</div>
</div>
- {project && (
- <PauseProjectButton projectId={project.id} projectRef={project.ref} />
- )}
+ {project && <PauseProjectButton />}
</div>
</>
)}
diff --git a/studio/components/interfaces/Settings/General/Infrastructure/PauseProjectButton.tsx b/studio/components/interfaces/Settings/General/Infrastructure/PauseProjectButton.tsx
index fdd25f07510..92041294e39 100644
--- a/studio/components/interfaces/Settings/General/Infrastructure/PauseProjectButton.tsx
+++ b/studio/components/interfaces/Settings/General/Infrastructure/PauseProjectButton.tsx
@@ -1,9 +1,8 @@
import * as Tooltip from '@radix-ui/react-tooltip'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useQueryClient } from '@tanstack/react-query'
-import { observer } from 'mobx-react-lite'
import { useRouter } from 'next/router'
-import { FC, useState } from 'react'
+import { useState } from 'react'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import ConfirmModal from 'components/ui/Dialogs/ConfirmDialog'
@@ -13,12 +12,9 @@ import { post } from 'lib/common/fetch'
import { API_URL, PROJECT_STATUS } from 'lib/constants'
import { Button, IconPause } from 'ui'
-interface Props {
- projectId: number
- projectRef: string
-}
+export interface PauseProjectButtonProps {}
-const PauseProjectButton: FC<Props> = observer(({ projectRef, projectId }) => {
+const PauseProjectButton = () => {
const queryClient = useQueryClient()
const { ui } = useStore()
const { project } = useProjectContext()
@@ -29,6 +25,7 @@ const PauseProjectButton: FC<Props> = observer(({ projectRef, projectId }) => {
const openModal = () => setIsModalOpen(true)
const closeModal = () => setIsModalOpen(false)
+ const projectRef = project?.ref ?? ''
const isPaused = project?.status === PROJECT_STATUS.INACTIVE
const canPauseProject = useCheckPermissions(
PermissionAction.INFRA_EXECUTE,
@@ -122,6 +119,6 @@ const PauseProjectButton: FC<Props> = observer(({ projectRef, projectId }) => {
/>
</>
)
-})
+}
export default PauseProjectButton
diff --git a/studio/components/interfaces/Settings/General/Infrastructure/RestartServerButton.tsx b/studio/components/interfaces/Settings/General/Infrastructure/RestartServerButton.tsx
index 2435d800eea..ab04d82fc17 100644
--- a/studio/components/interfaces/Settings/General/Infrastructure/RestartServerButton.tsx
+++ b/studio/components/interfaces/Settings/General/Infrastructure/RestartServerButton.tsx
@@ -11,21 +11,18 @@ import { setProjectPostgrestStatus } from 'data/projects/projects-query'
import { useCheckPermissions, useStore } from 'hooks'
import { post } from 'lib/common/fetch'
import { API_URL } from 'lib/constants'
-import { Project } from 'types'
+import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
-export interface RestartServerButtonProps {
- project: Project
-}
-
-const RestartServerButton = ({ project }: RestartServerButtonProps) => {
+const RestartServerButton = () => {
const queryClient = useQueryClient()
+ const { project } = useProjectContext()
const { ui } = useStore()
const router = useRouter()
const [loading, setLoading] = useState(false)
const [serviceToRestart, setServiceToRestart] = useState<'project' | 'database'>()
- const projectRef = project.ref
- const projectRegion = project.region
+ const projectRef = project?.ref ?? ''
+ const projectRegion = project?.region
const canRestartProject = useCheckPermissions(PermissionAction.INFRA_EXECUTE, 'reboot')
@@ -105,7 +102,7 @@ const RestartServerButton = ({ project }: RestartServerButtonProps) => {
>
<div className="space-y-1">
<p className="block text-scale-1200">Fast database reboot</p>
- <p className="block text-scale-1100">
+ <p className="block text-scale-1100 text-xs">
Restarts only the database - faster but may not be able to recover from all
failure modes
</p>
diff --git a/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx b/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx
index c9a49c70075..c47e5cfae33 100644
--- a/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx
+++ b/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx
@@ -27,6 +27,7 @@ import { INFRA_ACTIVITY_METRICS } from './Infrastructure.constants'
const InfrastructureActivity = () => {
const { ref: projectRef } = useParams()
const organization = useSelectedOrganization()
+ const isOrgBilling = !!organization?.subscription_id
const [dateRange, setDateRange] = useState<any>()
const currentBillingCycleSelected = true
@@ -50,16 +51,20 @@ const InfrastructureActivity = () => {
}
const startDate = useMemo(() => {
+ if (dateRange?.period_start?.date === 'Invalid Date') return undefined
+
// If end date is in future, set end date to now
if (!dateRange?.period_start?.date) {
return undefined
} else {
// LF seems to have an issue with the milliseconds, causes infinite loading sometimes
- return new Date(dateRange?.period_start?.date).toISOString().slice(0, -5) + 'Z'
+ return new Date(dateRange?.period_start?.date ?? 0).toISOString().slice(0, -5) + 'Z'
}
}, [dateRange, subscription])
const endDate = useMemo(() => {
+ if (dateRange?.period_end?.date === 'Invalid Date') return undefined
+
// If end date is in future, set end date to end of current day
if (dateRange?.period_end?.date && dayjs(dateRange.period_end.date).isAfter(dayjs())) {
// LF seems to have an issue with the milliseconds, causes infinite loading sometimes
@@ -68,7 +73,7 @@ const InfrastructureActivity = () => {
return dayjs().endOf('day').toISOString().slice(0, -5) + 'Z'
} else if (dateRange?.period_end?.date) {
// LF seems to have an issue with the milliseconds, causes infinite loading sometimes
- return new Date(dateRange.period_end.date).toISOString().slice(0, -5) + 'Z'
+ return new Date(dateRange.period_end.date ?? 0).toISOString().slice(0, -5) + 'Z'
}
}, [dateRange, subscription])
@@ -131,6 +136,8 @@ const InfrastructureActivity = () => {
},
}
+ if (!isOrgBilling) return null
+
return (
<>
<ScaffoldContainer>
@@ -151,7 +158,7 @@ const InfrastructureActivity = () => {
id="billingCycle"
name="billingCycle"
onChange={setDateRange}
- value={TIME_PERIODS_BILLING[0].key}
+ value={TIME_PERIODS_REPORTS[0].key}
options={[...TIME_PERIODS_BILLING, ...TIME_PERIODS_REPORTS]}
loading={isLoadingSubscription}
currentBillingPeriodStart={subscription?.current_period_start}
diff --git a/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx b/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx
new file mode 100644
index 00000000000..6503048dd7a
--- /dev/null
+++ b/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx
@@ -0,0 +1,143 @@
+import Link from 'next/link'
+import * as Tooltip from '@radix-ui/react-tooltip'
+
+import { useParams } from 'common'
+import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
+import {
+ ScaffoldContainer,
+ ScaffoldDivider,
+ ScaffoldSection,
+ ScaffoldSectionContent,
+ ScaffoldSectionDetail,
+} from 'components/layouts/Scaffold'
+import AlertError from 'components/ui/AlertError'
+import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
+import { useProjectUpgradeEligibilityQuery } from 'data/config/project-upgrade-eligibility-query'
+import { useFlag } from 'hooks'
+import { Alert, Badge, Button, IconPackage, Input } from 'ui'
+import ProjectUpgradeAlert from '../General/Infrastructure/ProjectUpgradeAlert'
+
+const InfrastructureInfo = () => {
+ const { ref } = useParams()
+ const { project } = useProjectContext()
+ // const { data: subscription } = useProjectSubscriptionV2Query({ projectRef: ref })
+ // const isFreeProject = subscription?.plan?.id === 'free'
+
+ const {
+ data,
+ error,
+ isLoading: isLoadingUpgradeEligibility,
+ isError: isErrorUpgradeEligibility,
+ isSuccess: isSuccessUpgradeEligibility,
+ } = useProjectUpgradeEligibilityQuery({
+ projectRef: ref,
+ })
+ const { current_app_version, latest_app_version, requires_manual_intervention } = data || {}
+ const isOnLatestVersion = current_app_version === latest_app_version
+ const currentPgVersion = (current_app_version ?? '').split('supabase-postgres-')[1]
+ const latestPgVersion = (latest_app_version ?? '').split('supabase-postgres-')[1]
+
+ const showDbUpgrades = useFlag('databaseUpgrades')
+ const subject = 'Request%20for%20Postgres%20upgrade%20for%20project'
+ const message = `Upgrade information:%0A• Manual intervention reason: ${requires_manual_intervention}`
+
+ return (
+ <>
+ <ScaffoldContainer>
+ <div className="mx-auto flex flex-col gap-10 py-6">
+ <div>
+ <p className="text-xl">Infrastructure</p>
+ <p className="text-sm text-scale-1000">
+ General information regarding your server instance
+ </p>
+ </div>
+ </div>
+ </ScaffoldContainer>
+ <ScaffoldDivider />
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <ScaffoldSectionDetail>
+ <p>Configuration</p>
+ <p className="text-scale-1000 text-sm">Information on your server provider</p>
+ </ScaffoldSectionDetail>
+ <ScaffoldSectionContent>
+ <Input readOnly disabled value={project?.cloud_provider} label="Cloud provider" />
+ <Input readOnly disabled value={project?.region} label="Region" />
+ </ScaffoldSectionContent>
+ </ScaffoldSection>
+ <ScaffoldSection className="!pt-0">
+ <ScaffoldSectionDetail>
+ <p>Postgres</p>
+ <p className="text-scale-1000 text-sm">Information on your Postgres instance</p>
+ </ScaffoldSectionDetail>
+ <ScaffoldSectionContent>
+ {isLoadingUpgradeEligibility && <GenericSkeletonLoader />}
+ {isErrorUpgradeEligibility && (
+ <AlertError error={error} subject="Failed to retrieve Postgres version" />
+ )}
+ {isSuccessUpgradeEligibility && (
+ <>
+ <Input
+ readOnly
+ disabled
+ value={currentPgVersion}
+ label="Current version"
+ actions={[
+ isOnLatestVersion && (
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Trigger>
+ <Badge color="green" className="mr-1">
+ Latest
+ </Badge>
+ </Tooltip.Trigger>
+ <Tooltip.Portal>
+ <Tooltip.Content side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200 w-[200px]',
+ ].join(' ')}
+ >
+ <span className="text-xs text-scale-1200">
+ Project is on the latest version of Postgres that Supabase supports
+ </span>
+ </div>
+ </Tooltip.Content>
+ </Tooltip.Portal>
+ </Tooltip.Root>
+ ),
+ ]}
+ />
+ {showDbUpgrades && data?.eligible && <ProjectUpgradeAlert />}
+ {showDbUpgrades && !data?.eligible && data?.requires_manual_intervention && (
+ <Alert
+ icon={<IconPackage className="text-scale-1100" strokeWidth={1.5} />}
+ variant="neutral"
+ title="A new version of Postgres is available for your project"
+ >
+ <p className="mb-3">
+ Please reach out to us via our support form if you are keen to upgrade your
+ Postgres version to the latest available ({latestPgVersion}).
+ </p>
+ <Link
+ href={`/support/new?category=Database_unresponsive&ref=${ref}&subject=${subject}&message=${message}`}
+ >
+ <a target="_blank" rel="noreferrer">
+ <Button size="tiny" type="default">
+ Contact support
+ </Button>
+ </a>
+ </Link>
+ </Alert>
+ )}
+ </>
+ )}
+ </ScaffoldSectionContent>
+ </ScaffoldSection>
+ </ScaffoldContainer>
+ </>
+ )
+}
+
+export default InfrastructureInfo
diff --git a/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts b/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts
index 22768003e49..16b3fc02543 100644
--- a/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts
+++ b/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts
@@ -11,110 +11,156 @@ export const generateSettingsMenu = (
const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP
const buildingUrl = `/project/${ref}/building`
- return [
- {
- title: 'Project Settings',
- items: [
- {
- name: 'General',
- key: 'general',
- url: `/project/${ref}/settings/general`,
- items: [],
- },
- {
- name: 'Database',
- key: 'database',
- url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/database`,
- items: [],
- },
- {
- name: 'API',
- key: 'api',
- url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/api`,
- items: [],
- },
- ...(IS_PLATFORM
- ? [
- {
- name: 'Auth',
- key: 'auth',
- url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/auth`,
- items: [],
- },
- ]
- : []),
- ...(IS_PLATFORM
- ? [
- {
- name: 'Storage',
- key: 'storage',
- url: `/project/${ref}/settings/storage`,
- items: [],
- },
- ]
- : []),
- ...(isVaultEnabled
- ? [
- {
- name: 'Vault',
- key: 'vault',
- url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/vault/secrets`,
- items: [],
- label: 'BETA',
- },
- ]
- : []),
- ],
- },
- ...(IS_PLATFORM && !isOrgBilling
- ? [
+ if (isOrgBilling) {
+ return [
+ {
+ title: 'Project Settings',
+ items: [
{
- title: 'Billing',
- items: [
- {
- name: 'Subscription',
- key: 'subscription',
- url: isProjectBuilding
- ? buildingUrl
- : `/project/${ref}/settings/billing/subscription`,
- items: [],
- },
- {
- name: 'Usage',
- key: 'usage',
- url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/billing/usage`,
- items: [],
- },
- {
- name: 'Invoices',
- key: 'invoices',
- url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/billing/invoices`,
- items: [],
- },
- ],
+ name: 'General',
+ key: 'general',
+ url: `/project/${ref}/settings/general`,
+ items: [],
},
- ]
- : []),
- ...(IS_PLATFORM && isOrgBilling
- ? [
{
- title: 'Others',
- items: [
- {
- name: 'Add Ons',
- key: 'add-ons',
- url: `/project/${ref}/settings/billing/subscription`,
- items: [],
- },
- {
- name: 'Infrastructure',
- key: 'usage',
- url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/infrastructure`,
- items: [],
- },
- ],
+ name: 'Infrastructure',
+ key: 'infrastructure',
+ url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/infrastructure`,
+ items: [],
},
- ]
- : []),
- ]
+ {
+ name: 'Add Ons',
+ key: 'subscription',
+ url: `/project/${ref}/settings/billing/subscription`,
+ items: [],
+ },
+ ...(isVaultEnabled
+ ? [
+ {
+ name: 'Vault',
+ key: 'vault',
+ url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/vault/secrets`,
+ items: [],
+ label: 'BETA',
+ },
+ ]
+ : []),
+ ],
+ },
+ {
+ title: '',
+ items: [
+ {
+ name: 'Database',
+ key: 'database',
+ url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/database`,
+ items: [],
+ },
+ {
+ name: 'API',
+ key: 'api',
+ url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/api`,
+ items: [],
+ },
+ ...(IS_PLATFORM
+ ? [
+ {
+ name: 'Auth',
+ key: 'auth',
+ url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/auth`,
+ items: [],
+ },
+ ]
+ : []),
+ ...(IS_PLATFORM
+ ? [
+ {
+ name: 'Storage',
+ key: 'storage',
+ url: `/project/${ref}/settings/storage`,
+ items: [],
+ },
+ ]
+ : []),
+ ],
+ },
+ ]
+ } else {
+ return [
+ {
+ title: 'Project Settings',
+ items: [
+ {
+ name: 'General',
+ key: 'general',
+ url: `/project/${ref}/settings/general`,
+ items: [],
+ },
+ {
+ name: 'Database',
+ key: 'database',
+ url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/database`,
+ items: [],
+ },
+ {
+ name: 'API',
+ key: 'api',
+ url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/api`,
+ items: [],
+ },
+ ...(IS_PLATFORM
+ ? [
+ {
+ name: 'Auth',
+ key: 'auth',
+ url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/auth`,
+ items: [],
+ },
+ ]
+ : []),
+ ...(IS_PLATFORM
+ ? [
+ {
+ name: 'Storage',
+ key: 'storage',
+ url: `/project/${ref}/settings/storage`,
+ items: [],
+ },
+ ]
+ : []),
+ ],
+ },
+ ...(IS_PLATFORM
+ ? [
+ {
+ title: 'Billing',
+ items: [
+ {
+ name: 'Subscription',
+ key: 'subscription',
+ url: isProjectBuilding
+ ? buildingUrl
+ : `/project/${ref}/settings/billing/subscription`,
+ items: [],
+ },
+ {
+ name: 'Usage',
+ key: 'usage',
+ url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/billing/usage`,
+ items: [],
+ },
+ {
+ name: 'Invoices',
+ key: 'invoices',
+ url: isProjectBuilding
+ ? buildingUrl
+ : `/project/${ref}/settings/billing/invoices`,
+ items: [],
+ },
+ ],
+ },
+ ]
+ : []),
+ ]
+ }
}
diff --git a/studio/data/config/project-upgrade-eligibility-query.ts b/studio/data/config/project-upgrade-eligibility-query.ts
index 98e17eb287a..d547872b0bc 100644
--- a/studio/data/config/project-upgrade-eligibility-query.ts
+++ b/studio/data/config/project-upgrade-eligibility-query.ts
@@ -4,6 +4,7 @@ import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query
import { get } from 'lib/common/fetch'
import { API_ADMIN_URL } from 'lib/constants'
import { configKeys } from './keys'
+import { ResponseError } from 'types'
export type ProjectUpgradeEligibilityVariables = { projectRef?: string }
export type ProjectUpgradeEligibilityResponse = {
@@ -29,7 +30,7 @@ export async function getProjectUpgradeEligibility(
}
export type ProjectUpgradeEligibilityData = Awaited<ReturnType<typeof getProjectUpgradeEligibility>>
-export type ProjectUpgradeEligibilityError = unknown
+export type ProjectUpgradeEligibilityError = ResponseError
export const useProjectUpgradeEligibilityQuery = <TData = ProjectUpgradeEligibilityData>(
{ projectRef }: ProjectUpgradeEligibilityVariables,
diff --git a/studio/pages/project/[ref]/settings/general.tsx b/studio/pages/project/[ref]/settings/general.tsx
index 9049ec621ac..ca94e4d7bbd 100644
--- a/studio/pages/project/[ref]/settings/general.tsx
+++ b/studio/pages/project/[ref]/settings/general.tsx
@@ -1,5 +1,3 @@
-import { observer } from 'mobx-react-lite'
-
import { NextPageWithLayout } from 'types'
import { SettingsLayout } from 'components/layouts'
import {
@@ -9,16 +7,18 @@ import {
DeleteProjectPanel,
TransferProjectPanel,
} from 'components/interfaces/Settings/General'
-import { useFlag } from 'hooks'
+import { useFlag, useSelectedOrganization } from 'hooks'
const ProjectSettings: NextPageWithLayout = () => {
+ const organization = useSelectedOrganization()
+ const isOrgBilling = !!organization?.subscription_id
const transferProjectEnabled = useFlag('transferProject')
// [Joshen] Opting for larger gap instead of gap-8 as compared to other pages for better grouping of content
return (
<div className="1xl:px-28 mx-auto flex flex-col gap-10 px-5 py-6 lg:px-16 xl:px-24 2xl:px-32 ">
<General />
- <Infrastructure />
+ {!isOrgBilling && <Infrastructure />}
<CustomDomainConfig />
{transferProjectEnabled && <TransferProjectPanel />}
<DeleteProjectPanel />
@@ -27,4 +27,4 @@ const ProjectSettings: NextPageWithLayout = () => {
}
ProjectSettings.getLayout = (page) => <SettingsLayout title="General">{page}</SettingsLayout>
-export default observer(ProjectSettings)
+export default ProjectSettings
diff --git a/studio/pages/project/[ref]/settings/infrastructure.tsx b/studio/pages/project/[ref]/settings/infrastructure.tsx
index 062608f728d..a5456c9de88 100644
--- a/studio/pages/project/[ref]/settings/infrastructure.tsx
+++ b/studio/pages/project/[ref]/settings/infrastructure.tsx
@@ -1,9 +1,17 @@
import InfrastructureActivity from 'components/interfaces/Settings/Infrastructure/InfrastructureActivity'
+import InfrastructureInfo from 'components/interfaces/Settings/Infrastructure/InfrastructureInfo'
import { SettingsLayout } from 'components/layouts'
+import { ScaffoldDivider } from 'components/layouts/Scaffold'
import { NextPageWithLayout } from 'types'
const ProjectInfrastructure: NextPageWithLayout = () => {
- return <InfrastructureActivity />
+ return (
+ <>
+ <InfrastructureInfo />
+ <ScaffoldDivider />
+ <InfrastructureActivity />
+ </>
+ )
}
ProjectInfrastructure.getLayout = (page) => (