The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Merge branch 'master' into feat/project-exhaustion-warnings
Terry Sutton9dab6b26e9d5
diff --cc studio/components/interfaces/Home/ProjectList/ProjectCard.tsxindex b9dcee111b2,28719add668..d4306e2b5ea--- a/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx+++ b/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx@@@ -4,9 -12,7 +4,8 @@@ import CardButton from 'components/ui/Cimport { BASE_PATH, PROJECT_STATUS } from 'lib/constants'import { Project } from 'types'import { IntegrationProjectConnection } from 'data/integrations/integrations.types'+import { ResourceWarning } from 'data/usage/resource-warnings-query'- import { useFlag } from 'hooks'+import { ProjectCardStatus } from './ProjectCardStatus'export interface ProjectCardProps {project: Projectdiff --cc studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsxindex 96924e3d888,05088113ee6..de7048a0dd7--- a/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx@@@ -15,11 -16,16 +15,11 @@@ import ProjectDropdown from './ProjectDimport { useProjectSubscriptionV2Query } from 'data/subscriptions/project-subscription-v2-query'const LayoutHeader = ({ customHeaderComponents, breadcrumbs = [], headerBorder = true }: any) => {- const selectedOrganization = useSelectedOrganization()- const selectedProject = useSelectedProject()-const { ref: projectRef } = useParams()- const { data: isReadOnlyMode } = useProjectReadOnlyQuery({- projectRef: selectedProject?.ref,- connectionString: selectedProject?.connectionString,- })+ const selectedProject = useSelectedProject()+ const selectedOrganization = useSelectedOrganization()- // Skip with org-level-billing, as quota is for the entire org+ // Skip with org-based-billing, as quota is for the entire orgconst { data: usage } = useProjectUsageQuery({ projectRef },{ enabled: selectedOrganization && !selectedOrganization.subscription_id }diff --cc studio/data/usage/resource-warnings-query.tsindex e85d8778fb7,00000000000..b1d56c12cfemode 100644,000000..100644--- a/studio/data/usage/resource-warnings-query.ts+++ b/studio/data/usage/resource-warnings-query.ts@@@ -1,50 -1,0 +1,31 @@@+import { useQuery, UseQueryOptions } from '@tanstack/react-query'++import { get } from 'data/fetchers'+import { usageKeys } from './keys'+import { ResponseError } from 'types'+import { components } from 'data/api'++export async function getResourceWarnings(signal?: AbortSignal) {+ const { data, error } = await get(`/platform/projects-resource-warnings`, { signal })+ if (error) throw error+- // return [- // {- // project: 'hpzzzjznweoqiwwaxymv',- // is_readonly_mode_enabled: false,- // disk_io_exhaustion: null,- // disk_space_exhaustion: null,- // cpu_exhaustion: null,- // memory_and_swap_exhaustion: 'critical',- // },- // {- // project: 'pkxlobkdgearimcwwgxk',- // is_readonly_mode_enabled: false,- // disk_io_exhaustion: 'critical',- // disk_space_exhaustion: null,- // cpu_exhaustion: null,- // memory_and_swap_exhaustion: null,- // },- // ] as ResourceWarning[]-+ return data+}++export type ResourceWarning = components['schemas']['ProjectResourceWarningsResponse']+export type ResourceWarningsData = Awaited<ReturnType<typeof getResourceWarnings>>+export type ResourceWarningsError = ResponseError++export const useResourceWarningsQuery = <TData = ResourceWarningsData>({+ enabled = true,+ ...options+}: UseQueryOptions<ResourceWarningsData, ResourceWarningsError, TData> = {}) =>+ useQuery<ResourceWarningsData, ResourceWarningsError, TData>(+ usageKeys.resourceWarnings(),+ ({ signal }) => getResourceWarnings(signal),+ {+ enabled,+ staleTime: 1000 * 60 * 30, // default 30 minutes+ ...options,+ }+ )