mirror of
https://github.com/supabase/supabase.git
synced 2026-07-05 03:24:19 +08:00
* add new ui for restore to new project * rm false * fix typeerr badly * add form with name and new project pass * fix flash in loading > results state change * restore api types * update api types, add pitr picker * add additional monthly spend section * fix loading state jump * update copy * update api types * update to new clone status api res * fix mutation missing vars * dont render logical backups in list * fix state issue on submit * better pitr empty state * Update apps/studio/pages/project/[ref]/database/backups/restore-to-new-project.tsx Co-authored-by: Wen Bo Xie <5532241+w3b6x9@users.noreply.github.com> * Update apps/studio/pages/project/[ref]/database/backups/restore-to-new-project.tsx Co-authored-by: Joshen Lim <joshenlimek@gmail.com> * Apply suggestions from code review Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: Wen Bo Xie <5532241+w3b6x9@users.noreply.github.com> * update api types to accept recoveryTimeTarget for PITR restores * simplify pitr code a bit cleanup state bugs * cleanup * add PITR submit * dont show restore btn unless status is complete * update api types * fix backups nav * markdown descs and fix type err in nav * check if project is cloned * fix: make source project data optional * fix datepicker highlighted day style * fix tz picker * check if its same or before/after in isWithinRange * update api types fix issue with clones * unsus * fix markdown rendering issues * add badge * Update database roles and permissions description * Update restore message text in PITR form component * Update key attribute to item.id in DatabaseBackupsNav component * Add conditional rendering for multiple available dates * Refactor dialog section styles in restore-to-new-project.tsx * Update null to undefined in conditional text assignment * reuse component in pitr backups * Update apps/studio/pages/project/[ref]/database/backups/restore-to-new-project.tsx Co-authored-by: Wen Bo Xie <5532241+w3b6x9@users.noreply.github.com> * Update link to original project in RestoreToNewProject * fix prettier --------- Co-authored-by: Wen Bo Xie <5532241+w3b6x9@users.noreply.github.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: Crispy1975 <12525875+Crispy1975@users.noreply.github.com>
59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
|
|
import { useFlag } from 'hooks/ui/useFlag'
|
|
import Link from 'next/link'
|
|
import React from 'react'
|
|
|
|
import { Badge, NavMenu, NavMenuItem } from 'ui'
|
|
|
|
type Props = {
|
|
active: 'pitr' | 'scheduled' | 'rtnp'
|
|
}
|
|
|
|
function DatabaseBackupsNav({ active }: Props) {
|
|
const isCloneToNewProjectEnabled = useFlag('clonetonewproject')
|
|
const ref = useProjectContext()?.project?.ref
|
|
|
|
const navMenuItems = [
|
|
{
|
|
enabled: true,
|
|
id: 'scheduled',
|
|
label: 'Scheduled backups',
|
|
href: `/project/${ref}/database/backups/scheduled`,
|
|
},
|
|
{
|
|
enabled: true,
|
|
id: 'pitr',
|
|
label: 'Point in time',
|
|
href: `/project/${ref}/database/backups/pitr`,
|
|
},
|
|
{
|
|
enabled: isCloneToNewProjectEnabled,
|
|
id: 'rtnp',
|
|
label: (
|
|
<div className="flex items-center gap-1">
|
|
Restore to new project{' '}
|
|
<Badge size="small" className="!text-[10px] px-1 py-0">
|
|
New
|
|
</Badge>
|
|
</div>
|
|
),
|
|
href: `/project/${ref}/database/backups/restore-to-new-project`,
|
|
},
|
|
] as const
|
|
|
|
return (
|
|
<NavMenu>
|
|
{navMenuItems.map(
|
|
(item) =>
|
|
item.enabled && (
|
|
<NavMenuItem key={item.id} active={item.id === active}>
|
|
<Link href={item.href}>{item.label}</Link>
|
|
</NavMenuItem>
|
|
)
|
|
)}
|
|
</NavMenu>
|
|
)
|
|
}
|
|
|
|
export default DatabaseBackupsNav
|