mirror of
https://github.com/supabase/supabase.git
synced 2026-06-12 08:29:15 +08:00
## What kind of change does this PR introduce? Dashboard cleanup and docs update. ## What is the current behaviour? Project Settings > General still shows a legacy "Project usage" section explaining that usage statistics moved to organisation settings. One troubleshooting page also links to the old project billing usage page. ## What is the new behaviour? The legacy Project Settings usage callout is removed, while the existing old usage route redirect remains in place for stale links. The MAU troubleshooting page now points users to the organisation usage page and tells them to select a specific project from the dropdown. | Before | After | | --- | --- | | <img width="1450" height="1314" alt="CleanShot 2026-04-30 at 16 11 16@2x" src="https://github.com/user-attachments/assets/3ad8c41f-2eab-406c-bfd8-f5737ae9a5a3" /> | <img width="1474" height="1004" alt="CleanShot 2026-04-30 at 16 11 04@2x-7CACB175-B6A9-4811-968F-030745F685AE" src="https://github.com/user-attachments/assets/f541ee60-0c24-49e4-9446-3bd58c516797" /> | <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated Monthly Active Users (MAU) documentation to reflect accessing usage data from the organization-level page instead of project settings * **Refactor** * Removed project-level usage viewing option from project settings interface <!-- end of auto-generated comment: release notes by coderabbit.ai -->
111 lines
4.1 KiB
TypeScript
111 lines
4.1 KiB
TypeScript
import Link from 'next/link'
|
|
import { Button, Card, CardContent } from 'ui'
|
|
import {
|
|
PageSection,
|
|
PageSectionContent,
|
|
PageSectionDescription,
|
|
PageSectionMeta,
|
|
PageSectionSummary,
|
|
PageSectionTitle,
|
|
} from 'ui-patterns/PageSection'
|
|
|
|
import PauseProjectButton from './Infrastructure/PauseProjectButton'
|
|
import RestartServerButton from './Infrastructure/RestartServerButton'
|
|
import { ResumeProjectButton } from '@/components/interfaces/Project/ResumeProjectButton'
|
|
import { useProjectPauseStatusQuery } from '@/data/projects/project-pause-status-query'
|
|
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
|
|
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
|
|
import { PROJECT_STATUS } from '@/lib/constants'
|
|
|
|
export const Project = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const isPaused = project?.status === PROJECT_STATUS.INACTIVE
|
|
const { projectSettingsRestartProject } = useIsFeatureEnabled([
|
|
'project_settings:restart_project',
|
|
])
|
|
const {
|
|
data: pauseStatus,
|
|
isError: isPauseStatusError,
|
|
isSuccess: isPauseStatusSuccess,
|
|
} = useProjectPauseStatusQuery({ ref: project?.ref }, { enabled: isPaused })
|
|
|
|
const shouldShowDashboardLink =
|
|
isPaused && (isPauseStatusError || (isPauseStatusSuccess && !pauseStatus.can_restore))
|
|
|
|
const primaryActionLabel = isPaused
|
|
? shouldShowDashboardLink
|
|
? 'View project dashboard'
|
|
: 'Resume project'
|
|
: projectSettingsRestartProject
|
|
? 'Restart project'
|
|
: 'Restart database'
|
|
|
|
const primaryActionDescription = isPaused
|
|
? isPauseStatusSuccess && !pauseStatus.can_restore
|
|
? 'This project can no longer be resumed here. Open the dashboard to download backups and view recovery options.'
|
|
: isPauseStatusError
|
|
? 'Open the dashboard to manage this paused project.'
|
|
: 'Bring your paused project back online.'
|
|
: 'Your project will not be available for a few minutes.'
|
|
|
|
return (
|
|
<>
|
|
<PageSection id="restart-project">
|
|
<PageSectionMeta>
|
|
<PageSectionSummary>
|
|
<PageSectionTitle>Project availability</PageSectionTitle>
|
|
<PageSectionDescription>
|
|
{isPaused
|
|
? 'Resume your paused project or review recovery options'
|
|
: 'Restart or pause your project when performing maintenance'}
|
|
</PageSectionDescription>
|
|
</PageSectionSummary>
|
|
</PageSectionMeta>
|
|
<PageSectionContent>
|
|
<Card>
|
|
<CardContent>
|
|
<div className="flex flex-col @lg:flex-row @lg:justify-between @lg:items-center gap-4">
|
|
<div>
|
|
<p className="text-sm">{primaryActionLabel}</p>
|
|
<div className="max-w-[420px]">
|
|
<p className="text-sm text-foreground-light">{primaryActionDescription}</p>
|
|
</div>
|
|
</div>
|
|
{isPaused ? (
|
|
shouldShowDashboardLink ? (
|
|
<Button asChild type="default">
|
|
<Link href={`/project/${project?.ref}`}>View project dashboard</Link>
|
|
</Button>
|
|
) : (
|
|
<ResumeProjectButton />
|
|
)
|
|
) : (
|
|
<RestartServerButton />
|
|
)}
|
|
</div>
|
|
</CardContent>
|
|
{!isPaused && (
|
|
<CardContent>
|
|
<div
|
|
className="flex w-full flex-col @lg:flex-row @lg:justify-between @lg:items-center gap-4"
|
|
id="pause-project"
|
|
>
|
|
<div>
|
|
<p className="text-sm">Pause project</p>
|
|
<div className="max-w-[420px]">
|
|
<p className="text-sm text-foreground-light">
|
|
Your project will not be accessible while it is paused.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<PauseProjectButton />
|
|
</div>
|
|
</CardContent>
|
|
)}
|
|
</Card>
|
|
</PageSectionContent>
|
|
</PageSection>
|
|
</>
|
|
)
|
|
}
|