mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
## Problem - Older orioledb projects show "Public Beta" instead of "Public Alpha" in UI. - List of backups in the "Scheduled backups" tab hangs. ## Solution - show in the UI "Public Alpha" for projects older than 17.11.0.001-orioledb - show in the UI "Public Beta" for new projects - enable scheduled-backup query for "Public Beta" <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Backup availability messages now reflect OrioleDB’s current release stage rather than always describing it as public beta. * AWS backup queries are no longer disabled for every OrioleDB project; they remain disabled during the alpha stage. * **New Features** * Added an informational notice and documentation link for scheduled backups on AWS OrioleDB projects in alpha. * Added release-stage details to the PITR availability notice. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
|
|
import { databaseKeys } from './keys'
|
|
import type { components } from '@/data/api'
|
|
import { get, handleError } from '@/data/fetchers'
|
|
import { useIsOrioleDbInAws, useOrioleDbReleaseStage } from '@/hooks/misc/useSelectedProject'
|
|
import { PROJECT_STATUS } from '@/lib/constants'
|
|
import type { ResponseError, UseCustomQueryOptions } from '@/types'
|
|
|
|
export type BackupsVariables = {
|
|
projectRef?: string
|
|
projectStatus?: string
|
|
}
|
|
|
|
export type DatabaseBackup = components['schemas']['BackupsResponse_Output']['backups'][number]
|
|
|
|
export async function getBackups({ projectRef }: BackupsVariables, signal?: AbortSignal) {
|
|
if (!projectRef) throw new Error('Project ref is required')
|
|
|
|
const { data, error } = await get(`/platform/database/{ref}/backups`, {
|
|
params: { path: { ref: projectRef } },
|
|
signal,
|
|
})
|
|
|
|
if (error) handleError(error)
|
|
return data
|
|
}
|
|
|
|
export type BackupsData = Awaited<ReturnType<typeof getBackups>>
|
|
export type BackupsError = ResponseError
|
|
|
|
export const useBackupsQuery = <TData = BackupsData>(
|
|
{ projectRef, projectStatus }: BackupsVariables,
|
|
{ enabled = true, ...options }: UseCustomQueryOptions<BackupsData, BackupsError, TData> = {}
|
|
) => {
|
|
// [Joshen] Check for specifically false to account for project not loaded yet
|
|
const isOrioleDbInAws = useIsOrioleDbInAws()
|
|
const orioleDbReleaseStage = useOrioleDbReleaseStage()
|
|
|
|
return useQuery<BackupsData, BackupsError, TData>({
|
|
queryKey: databaseKeys.backups(projectRef),
|
|
queryFn: ({ signal }) => getBackups({ projectRef }, signal),
|
|
enabled:
|
|
enabled &&
|
|
!(isOrioleDbInAws && orioleDbReleaseStage === 'alpha') &&
|
|
typeof projectRef !== 'undefined' &&
|
|
projectStatus !== PROJECT_STATUS.COMING_UP &&
|
|
projectStatus !== PROJECT_STATUS.UNKNOWN,
|
|
...options,
|
|
})
|
|
}
|