mirror of
https://github.com/supabase/supabase.git
synced 2026-09-09 03:19:36 +08:00
## What
The Workers list page at `/project/[ref]/workers`, behind
`useFlag('workers')`. Reads `GET /v2/projects/{ref}/workers`.
- Sidebar and command-menu entries, both hidden when the flag is off
- Name search, state and access filters, pagination
- Read-only
Gating, in order: flag off redirects to the project home; a 404 from the
API means the project is outside the alpha allow-list ("not enabled for
this project"); a 403 means the caller lacks the permission
(`NoPermission`); anything else is an `AlertError`.
`parseWorker` in `data/workers/workers.utils.ts` is the only place the
API shape becomes the view model. It validates with zod, so a drifted
response fails the query instead of half-rendering a row.
## How to test
Only on the **Mockamaster** project in staging — it is the one project
in the alpha allow-list, and standing a worker up anywhere else is
involved right now.
1. Staging dashboard → Mockamaster → **Compute** in the sidebar
2. Expect the `dashboard-test` worker: state `Active`, runtime Deno,
private, US West, 2 GB · 1 vCPU · 1 inst
3. Open any other project's `/workers` URL → "Compute is not enabled for
this project"
4. Turn the `workers` flag off → the sidebar entry disappears and the
URL redirects to the project home
Closes FE-4188
37 lines
2.0 KiB
TypeScript
37 lines
2.0 KiB
TypeScript
import { useFlag, useIsLoggedIn } from 'common'
|
|
|
|
import { useStorageGotoCommands } from '../interfaces/Storage/Storage.Commands'
|
|
import { useAdvisorsGoToCommands } from './AdvisorsLayout/Advisors.Commands'
|
|
import { useAuthGotoCommands } from './AuthLayout/Auth.Commands'
|
|
import { useBillingGotoCommands } from './BillingLayout/Billing.Commands'
|
|
import { useDatabaseGotoCommands } from './DatabaseLayout/Database.Commands'
|
|
import { useFunctionsGotoCommands } from './EdgeFunctionsLayout/EdgeFunctions.Commands'
|
|
import { useIntegrationsGotoCommands } from './IntegrationsLayout/Integrations.Commands'
|
|
import { useLogsGotoCommands } from './LogsLayout/Logs.Commands'
|
|
import { useProjectSettingsGotoCommands } from './ProjectSettingsLayout/ProjectSettings.Commands'
|
|
import { useReportsGotoCommands } from './ReportsLayout/Reports.Commands'
|
|
import { useSqlEditorGotoCommands } from './SQLEditorLayout/SqlEditor.Commands'
|
|
import { useTableEditorGotoCommands } from './TableEditorLayout/TableEditor.Commands'
|
|
import { useWorkersGotoCommands } from './WorkersLayout/Workers.Commands'
|
|
import { useApiDocsGotoCommands } from '@/components/interfaces/ProjectAPIDocs/ProjectAPIDocs.Commands'
|
|
|
|
export function useLayoutNavCommands() {
|
|
const isLoggedIn = useIsLoggedIn()
|
|
const workersEnabled = useFlag('workers')
|
|
|
|
useTableEditorGotoCommands({ enabled: isLoggedIn })
|
|
useSqlEditorGotoCommands({ enabled: isLoggedIn })
|
|
useDatabaseGotoCommands({ enabled: isLoggedIn })
|
|
useAuthGotoCommands({ enabled: isLoggedIn })
|
|
useAdvisorsGoToCommands({ enabled: isLoggedIn })
|
|
useStorageGotoCommands({ enabled: isLoggedIn })
|
|
useFunctionsGotoCommands({ enabled: isLoggedIn })
|
|
useWorkersGotoCommands({ enabled: isLoggedIn && workersEnabled })
|
|
useLogsGotoCommands({ enabled: isLoggedIn })
|
|
useReportsGotoCommands({ enabled: isLoggedIn })
|
|
useApiDocsGotoCommands({ enabled: isLoggedIn })
|
|
useProjectSettingsGotoCommands({ enabled: isLoggedIn })
|
|
useIntegrationsGotoCommands({ enabled: isLoggedIn })
|
|
useBillingGotoCommands({ enabled: isLoggedIn })
|
|
}
|