The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix project status filter (#27923)
Joshen Lim728dcdbf743b
diff --git a/apps/studio/components/interfaces/Home/ProjectList/ProjectList.tsx b/apps/studio/components/interfaces/Home/ProjectList/ProjectList.tsxindex 602e8b32e43..29ee738b473 100644--- a/apps/studio/components/interfaces/Home/ProjectList/ProjectList.tsx+++ b/apps/studio/components/interfaces/Home/ProjectList/ProjectList.tsx@@ -14,7 +14,7 @@ import { usePermissionsQuery } from 'data/permissions/permissions-query'import { ProjectInfo, useProjectsQuery } from 'data/projects/projects-query'import { ResourceWarning, useResourceWarningsQuery } from 'data/usage/resource-warnings-query'import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'-import { IS_PLATFORM } from 'lib/constants'+import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'import { makeRandomString } from 'lib/helpers'import { Plus } from 'lucide-react'import type { Organization, ResponseError } from 'types'@@ -91,7 +91,9 @@ const ProjectList = ({<div className="space-y-1">{/* [Joshen] Just keeping it simple for now unless we decide to extend this to other statuses */}<p className="text-sm text-foreground">- No projects found with status as {filterStatus[0] === 'INACTIVE' ? 'paused' : 'active'}+ {filterStatus.length === 0+ ? `No projects found`+ : `No ${filterStatus[0] === 'INACTIVE' ? 'paused' : 'active'} projects found`}</p><p className="text-sm text-foreground-light">Your search for projects with the specified status did not return any results@@ -180,9 +182,13 @@ const OrganizationProjects = ({)}): sortedProjects++ // [Joshen] Just a UI thing, but we take all projects other than paused as "active"const filteredProjectsByStatus =filterStatus !== undefined- ? filteredProjects.filter((project) => filterStatus.includes(project.status))+ ? filterStatus.includes(PROJECT_STATUS.ACTIVE_HEALTHY)+ ? filteredProjects+ : filteredProjects.filter((project) => filterStatus.includes(project.status)): filteredProjectsconst { data: integrations } = useOrgIntegrationsQuery({ orgSlug: organization?.slug })diff --git a/apps/studio/components/interfaces/HomePageActions.tsx b/apps/studio/components/interfaces/HomePageActions.tsxindex b400ffa4060..a6ed78b1cd4 100644--- a/apps/studio/components/interfaces/HomePageActions.tsx+++ b/apps/studio/components/interfaces/HomePageActions.tsx@@ -20,6 +20,7 @@ import {PopoverTrigger_Shadcn_,Popover_Shadcn_,} from 'ui'+import { PROJECT_STATUS } from 'lib/constants'interface HomePageActionsProps {organizations: { name: string; slug: string }[]@@ -94,8 +95,8 @@ const HomePageActions = ({<p className="text-xs">Filter projects by status</p><div className="flex flex-col">{[- { key: 'ACTIVE_HEALTHY', label: 'Active' },- { key: 'INACTIVE', label: 'Paused' },+ { key: PROJECT_STATUS.ACTIVE_HEALTHY, label: 'Active' },+ { key: PROJECT_STATUS.INACTIVE, label: 'Paused' },].map(({ key, label }) => (<div key={key} className="group flex items-center justify-between py-0.5"><div className="flex items-center gap-x-2">diff --git a/apps/studio/pages/projects.tsx b/apps/studio/pages/projects.tsxindex 0d89f430724..95d5e4bced8 100644--- a/apps/studio/pages/projects.tsx+++ b/apps/studio/pages/projects.tsx@@ -10,13 +10,16 @@ import { useOrganizationsQuery } from 'data/organizations/organizations-query'import { useAutoProjectsPrefetch } from 'data/projects/projects-query'import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'import { useFlag } from 'hooks/ui/useFlag'-import { IS_PLATFORM, LOCAL_STORAGE_KEYS } from 'lib/constants'+import { IS_PLATFORM, LOCAL_STORAGE_KEYS, PROJECT_STATUS } from 'lib/constants'import type { NextPageWithLayout } from 'types'const ProjectsPage: NextPageWithLayout = () => {const router = useRouter()const [search, setSearch] = useState('')- const [filterStatus, setFilterStatus] = useState<string[]>(['ACTIVE_HEALTHY', 'INACTIVE'])+ const [filterStatus, setFilterStatus] = useState<string[]>([+ PROJECT_STATUS.ACTIVE_HEALTHY,+ PROJECT_STATUS.INACTIVE,+ ])const { data: organizations, isError, isSuccess } = useOrganizationsQuery()useAutoProjectsPrefetch()