mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
Moves the `/settings/*`, `/advisors/*` and `/issues/*` page bodies into their route files and deletes the pages (FE-3106). Part 10 of the stack. **Depends on:** #53218 **Changed:** - `routes/project/$ref/settings/**` – 16 page bodies inlined. `settings/api` redirects with `<Navigate>`; billing usage, dashboard and replica pages use typed `navigate`/`Link` - `routes/project/$ref/{advisors,issues}/**` – 7 page bodies inlined - Settings tests moved from `tests/pages/**` to `tests/routes/**` and rendered with `renderRoute` - `routes/project/$ref/advisors{.tsx,/rules.tsx,/security.tsx,/performance.tsx,/health.tsx}` – carry master's #52993 (Advisors → Issues behind `issuesInbox`: `IssuesCategoryRedirect`, `LegacyAdvisorsLayout`, `parseLinterLevel`, named `LinterFilters`/`LintPageTabs`), ported from the deleted pages and checked against master's pages + route adapters; `LegacyAdvisorsPages.platform.test.tsx` now renders the routes (`tests/routes/project/$ref/advisors/legacy-advisors.platform.test.tsx`) **Removed:** - 23 page files, and `AdvisorRulesLayout` (only the deleted rules pages used it; `routes/project/$ref/advisors/rules.tsx` already inlines it) Addresses [FE-3106](https://linear.app/supabase/issue/FE-3106/move-page-bodies-into-route-files-and-delete-pages). ## To test - Project Settings (General, Compute, Infrastructure, Add-ons, API keys, JWT, Log drains, Webhooks, Integrations) – same layout and sidebar - `/project/<ref>/settings/api` – redirects as before - Advisors (Security, Performance, Rules) and Issues – same layout --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
84 lines
2.7 KiB
TypeScript
84 lines
2.7 KiB
TypeScript
import { createFileRoute } from '@tanstack/react-router'
|
|
import { IS_PLATFORM, useParams } from 'common'
|
|
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
|
|
|
|
import { JWTSecretKeysTable } from '@/components/interfaces/JwtSecrets/jwt-secret-keys-table'
|
|
import JWTKeysLayout from '@/components/layouts/JWTKeys/JWTKeysLayout'
|
|
import { AlertError } from '@/components/ui/AlertError'
|
|
import { LocalSetupGuide } from '@/components/ui/LocalSetupGuide'
|
|
import { NoPermission } from '@/components/ui/NoPermission'
|
|
import { useDeploymentMode } from '@/hooks/misc/useDeploymentMode'
|
|
import { DOCS_URL } from '@/lib/constants'
|
|
import { useGrant } from '@/lib/grants'
|
|
|
|
export const Route = createFileRoute('/project/$ref/settings/jwt/')({
|
|
component: SettingsJwtIndexRoute,
|
|
staticData: { settingsLayoutTitle: 'JWT Keys' },
|
|
})
|
|
|
|
// Inline the JWTKeysLayout wrap here rather than via a `settings/jwt.tsx`
|
|
// sub-shell — jwt/legacy doesn't use JWTKeysLayout, so a shared
|
|
// sub-shell would wrap legacy in the wrong layout.
|
|
function SettingsJwtIndexRoute() {
|
|
return (
|
|
<JWTKeysLayout>
|
|
<JWTSigningKeysPage />
|
|
</JWTKeysLayout>
|
|
)
|
|
}
|
|
|
|
function JWTSigningKeysPage() {
|
|
const { isCli, isSelfHosted } = useDeploymentMode()
|
|
const { ref: projectRef } = useParams()
|
|
const signingKeysGrant = useGrant('GET /v1/projects/{ref}/config/auth/signing-keys', {
|
|
projectRef,
|
|
})
|
|
|
|
if (!IS_PLATFORM) {
|
|
return (
|
|
<div className="space-y-4">
|
|
{isCli && (
|
|
<LocalSetupGuide
|
|
variant="cli"
|
|
body={
|
|
<p>
|
|
The asymmetric key pair used to sign user session JWTs is configured by the Supabase
|
|
CLI.
|
|
</p>
|
|
}
|
|
docsHref={`${DOCS_URL}/guides/local-development`}
|
|
/>
|
|
)}
|
|
{isSelfHosted && (
|
|
<LocalSetupGuide
|
|
variant="selfHosted"
|
|
body={
|
|
<p>
|
|
The asymmetric key pair used to sign user session JWTs is configured via environment
|
|
variables.
|
|
</p>
|
|
}
|
|
docsHref={`${DOCS_URL}/guides/self-hosting/self-hosted-auth-keys`}
|
|
/>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<>
|
|
{signingKeysGrant.status === 'loading' && <GenericSkeletonLoader />}
|
|
{signingKeysGrant.status === 'denied' && (
|
|
<NoPermission isFullPage resourceText="access your project's API keys" />
|
|
)}
|
|
{signingKeysGrant.status === 'error' && (
|
|
<AlertError
|
|
error={signingKeysGrant.error}
|
|
subject="Failed to check JWT signing keys permissions"
|
|
/>
|
|
)}
|
|
{signingKeysGrant.status === 'granted' && <JWTSecretKeysTable />}
|
|
</>
|
|
)
|
|
}
|