mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
* Add restrictions for orioledb technical preview * Add callouts to pgvector and postgis if orioledb * Restrict restore to new project for orioledb * Scaffold client side validation for preventing org upgrade if org has oriole db present * Hook up proper logic for oriole * Fix * Remove console log * Fix type * Disable version selector if only one version is available * chore: oriole badges * UI updates based on requests * Update copy * Fix * Dont open assistant if opt is selected * Fix * Fix * Update badge * Add feature flag for orioleDB * Feature flag oriole check in plan update --------- Co-authored-by: Paul Cioanca <paul.cioanca@supabase.io>
30 lines
952 B
TypeScript
30 lines
952 B
TypeScript
import { useIsLoggedIn, useParams } from 'common'
|
|
import { useProjectDetailQuery } from 'data/projects/project-detail-query'
|
|
import { useProjectsQuery } from 'data/projects/projects-query'
|
|
import { useMemo } from 'react'
|
|
|
|
export function useSelectedProject({ enabled = true } = {}) {
|
|
const { ref } = useParams()
|
|
const { data } = useProjectDetailQuery({ ref }, { enabled })
|
|
|
|
return useMemo(
|
|
() => data && { ...data, parentRef: data?.parent_project_ref ?? data?.ref },
|
|
[data]
|
|
)
|
|
}
|
|
|
|
export function useProjectByRef(ref?: string) {
|
|
const isLoggedIn = useIsLoggedIn()
|
|
const { data: projects } = useProjectsQuery({ enabled: isLoggedIn })
|
|
return useMemo(() => {
|
|
if (!ref) return undefined
|
|
return projects?.find((project) => project.ref === ref)
|
|
}, [projects, ref])
|
|
}
|
|
|
|
export const useIsOrioleDb = () => {
|
|
const project = useSelectedProject()
|
|
const isOrioleDb = project?.dbVersion?.endsWith('orioledb')
|
|
return isOrioleDb
|
|
}
|