mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 02:15:05 +03:00
## Context Related prior work was making edge functions page accessible while project is restoring - however the status of the project gets flipped to COMING_UP while it's restoring hence why the functions page was still inaccessible. ## Changes involved - Update `NavigationBar.utils` to have edge functions link to `/functions` irregardless of project status - (Unrelated) Disable (with tooltip) deploy new function CTA on edge functions page if project is not active <img width="403" height="108" alt="image" src="https://github.com/user-attachments/assets/88479247-999b-4d41-a444-6705f8c3993e" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Deploy Edge Function button now disables and shows a tooltip when the project is inactive to make deployment status clear. * **Bug Fixes** * Edge Functions link now points consistently to the functions view regardless of project build state. * **Refactor** * Consolidated project-active check and reorganized related UI wiring to standardize inactive-state handling across settings and controls. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import { useParams } from 'common'
|
|
import { useProjectDetailQuery } from 'data/projects/project-detail-query'
|
|
import { PROJECT_STATUS, PROVIDERS } from 'lib/constants'
|
|
|
|
export function useSelectedProjectQuery({ enabled = true } = {}) {
|
|
const { ref } = useParams()
|
|
|
|
return useProjectDetailQuery(
|
|
{ ref },
|
|
{
|
|
enabled,
|
|
select: (data) => {
|
|
return {
|
|
...data,
|
|
parentRef: data.parent_project_ref ?? data.ref,
|
|
}
|
|
},
|
|
}
|
|
)
|
|
}
|
|
|
|
export const useIsAwsCloudProvider = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const isAws = project?.cloud_provider === PROVIDERS.AWS.id
|
|
|
|
return isAws
|
|
}
|
|
|
|
export const useIsAwsK8sCloudProvider = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const isAwsK8s = project?.cloud_provider === PROVIDERS.AWS_K8S.id
|
|
|
|
return isAwsK8s
|
|
}
|
|
|
|
export const useIsAwsNimbusCloudProvider = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const isAwsNimbus = project?.cloud_provider === PROVIDERS.AWS_NIMBUS.id
|
|
|
|
return isAwsNimbus
|
|
}
|
|
|
|
export const useIsOrioleDb = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const isOrioleDb = project?.dbVersion?.endsWith('orioledb')
|
|
return isOrioleDb
|
|
}
|
|
|
|
export const useIsOrioleDbInAws = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const isOrioleDbInAws =
|
|
project?.dbVersion?.endsWith('orioledb') && project?.cloud_provider === PROVIDERS.AWS.id
|
|
return isOrioleDbInAws
|
|
}
|
|
|
|
export const useIsProjectActive = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
return project?.status === PROJECT_STATUS.ACTIVE_HEALTHY
|
|
}
|