From 363b976e9477c43e2f570239da6b957e5384b15f Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Mon, 2 Jun 2025 16:28:23 +0800 Subject: [PATCH 1/9] Fix service checks coming up state (#35705) * Fix service checks coming up state * Fix delete project redirect * Smol fix * Remove unnecessary padding in Delete Project Panel * Address feedback * Rename confusing isSuccess param to isHealthy --- .../interfaces/Home/ServiceStatus.tsx | 51 +++++++------- .../DeleteProjectPanel/DeleteProjectModal.tsx | 11 ++- .../DeleteProjectPanel/DeleteProjectPanel.tsx | 67 ++++++++----------- .../interfaces/Settings/General/index.ts | 5 +- .../pages/project/[ref]/settings/general.tsx | 2 +- 5 files changed, 68 insertions(+), 68 deletions(-) diff --git a/apps/studio/components/interfaces/Home/ServiceStatus.tsx b/apps/studio/components/interfaces/Home/ServiceStatus.tsx index 2c3381b054b..41aae7700a8 100644 --- a/apps/studio/components/interfaces/Home/ServiceStatus.tsx +++ b/apps/studio/components/interfaces/Home/ServiceStatus.tsx @@ -25,20 +25,20 @@ const SERVICE_STATUS_THRESHOLD = 5 // minutes const StatusMessage = ({ status, isLoading, - isSuccess, + isHealthy, isProjectNew, }: { isLoading: boolean - isSuccess: boolean + isHealthy: boolean isProjectNew: boolean status?: ProjectServiceStatus }) => { + if (isHealthy) return 'Healthy' if (isLoading) return 'Checking status' if (status === 'UNHEALTHY') return 'Unhealthy' if (status === 'COMING_UP') return 'Coming up...' if (status === 'ACTIVE_HEALTHY') return 'Healthy' if (isProjectNew) return 'Coming up...' - if (isSuccess) return 'Healthy' return 'Unable to connect' } @@ -52,21 +52,21 @@ const CheckIcon = () => const StatusIcon = ({ isLoading, - isSuccess, + isHealthy, isProjectNew, projectStatus, }: { isLoading: boolean - isSuccess: boolean + isHealthy: boolean isProjectNew: boolean projectStatus?: ProjectServiceStatus }) => { + if (isHealthy) return if (isLoading) return if (projectStatus === 'UNHEALTHY') return if (projectStatus === 'COMING_UP') return if (projectStatus === 'ACTIVE_HEALTHY') return if (isProjectNew) return - if (isSuccess) return return } @@ -124,17 +124,17 @@ export const ServiceStatus = () => { error?: string docsUrl?: string isLoading: boolean - isSuccess?: boolean + isHealthy: boolean + status: ProjectServiceStatus logsUrl: string - status?: ProjectServiceStatus }[] = [ { name: 'Database', error: undefined, docsUrl: undefined, isLoading: isLoading, - isSuccess: dbStatus?.healthy, - status: dbStatus?.status, + isHealthy: !!dbStatus?.healthy, + status: dbStatus?.status ?? 'UNHEALTHY', logsUrl: '/logs/postgres-logs', }, { @@ -142,8 +142,8 @@ export const ServiceStatus = () => { error: restStatus?.error, docsUrl: undefined, isLoading, - isSuccess: restStatus?.healthy, - status: restStatus?.status, + isHealthy: !!restStatus?.healthy, + status: restStatus?.status ?? 'UNHEALTHY', logsUrl: '/logs/postgrest-logs', }, ...(authEnabled @@ -153,8 +153,8 @@ export const ServiceStatus = () => { error: authStatus?.error, docsUrl: undefined, isLoading, - isSuccess: authStatus?.healthy, - status: authStatus?.status, + isHealthy: !!authStatus?.healthy, + status: authStatus?.status ?? 'UNHEALTHY', logsUrl: '/logs/auth-logs', }, ] @@ -166,8 +166,8 @@ export const ServiceStatus = () => { error: realtimeStatus?.error, docsUrl: undefined, isLoading, - isSuccess: realtimeStatus?.healthy, - status: realtimeStatus?.status, + isHealthy: !!realtimeStatus?.healthy, + status: realtimeStatus?.status ?? 'UNHEALTHY', logsUrl: '/logs/realtime-logs', }, ] @@ -179,8 +179,8 @@ export const ServiceStatus = () => { error: storageStatus?.error, docsUrl: undefined, isLoading, - isSuccess: storageStatus?.healthy, - status: storageStatus?.status, + isHealthy: !!storageStatus?.healthy, + status: storageStatus?.status ?? 'UNHEALTHY', logsUrl: '/logs/storage-logs', }, ] @@ -192,7 +192,12 @@ export const ServiceStatus = () => { error: undefined, docsUrl: 'https://supabase.com/docs/guides/functions/troubleshooting', isLoading, - isSuccess: edgeFunctionsStatus?.healthy, + isHealthy: !!edgeFunctionsStatus?.healthy, + status: edgeFunctionsStatus?.healthy + ? 'ACTIVE_HEALTHY' + : isLoading + ? 'COMING_UP' + : ('UNHEALTHY' as ProjectServiceStatus), logsUrl: '/logs/edge-functions-logs', }, ] @@ -200,7 +205,7 @@ export const ServiceStatus = () => { ] const isLoadingChecks = services.some((service) => service.isLoading) - const allServicesOperational = services.every((service) => service.isSuccess) + const allServicesOperational = services.every((service) => service.isHealthy) // If the project is less than 5 minutes old, and status is not operational, then it's likely the service is still starting up const isProjectNew = @@ -234,7 +239,7 @@ export const ServiceStatus = () => { -