Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add restore project function

Terry Sutton3dbcf55f91ca
diff --git a/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx b/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx
index 447810fb6b5..dce757a3efd 100644
--- a/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx
+++ b/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx
@@ -19,7 +19,6 @@ const ProjectCard: FC<Props> = ({
onSelectDelete,
rewriteHref,
}) => {
- console.log({ rewriteHref })
const { name, ref: projectRef } = project
const desc = `${project.cloud_provider} | ${project.region}`
diff --git a/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx b/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx
index 42100fff1d0..2dfab00d30c 100644
--- a/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx
+++ b/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx
@@ -3,9 +3,11 @@ import { Button, IconAlertCircle, IconPauseCircle } from '@supabase/ui'
import { Project } from 'types'
import Link from '@supabase/ui/dist/cjs/components/Typography/Link'
-import router from 'next/router'
import { useStore, useSubscriptionStats } from 'hooks'
import { DEFAULT_FREE_PROJECTS_LIMIT } from 'lib/constants'
+import { post } from 'lib/common/fetch'
+import { API_URL, PROJECT_STATUS } from 'lib/constants'
+import { useRouter } from 'next/router'
interface Props {
project: Project
@@ -13,8 +15,9 @@ interface Props {
const ProjectPausedState: FC<Props> = ({ project }) => {
const [isSubmitting, setIsSubmitting] = useState(false)
+ const router = useRouter()
const { ref } = router.query
- const { ui } = useStore()
+ const { ui, app } = useStore()
const subscriptionStats = useSubscriptionStats()
const {
total_free_projects: totalFreeProjects,
@@ -23,6 +26,12 @@ const ProjectPausedState: FC<Props> = ({ project }) => {
} = subscriptionStats
const freeProjectsLimit = ui.profile?.free_project_limit ?? DEFAULT_FREE_PROJECTS_LIMIT
+ const restoreProject = async (project: Project) => {
+ app.onProjectUpdated({ ...project, status: PROJECT_STATUS.RESTORING })
+ await post(`${API_URL}/projects/${project.ref}/restore`, {})
+ //router.reload()
+ }
+
return (
<>
<div className="mx-auto mt-8 mb-16 w-full max-w-7xl">
@@ -37,7 +46,7 @@ const ProjectPausedState: FC<Props> = ({ project }) => {
<div className="flex items-center justify-center gap-4">
<Button
- // onClick={}
+ onClick={() => restoreProject(project)}
size="small"
loading={isSubmitting}
type="primary"