Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions apps/studio/components/interfaces/HomeNew/ServiceStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import dayjs from 'dayjs'
import { ChevronRight, Loader2 } from 'lucide-react'
import Link from 'next/link'

import { useParams } from 'common'
import { InlineLink } from 'components/ui/InlineLink'
import { SingleStat } from 'components/ui/SingleStat'
import { useBranchesQuery } from 'data/branches/branches-query'
import { useEdgeFunctionServiceStatusQuery } from 'data/service-status/edge-functions-status-query'
import { useProjectServiceStatusQuery } from 'data/service-status/service-status-query'
import dayjs from 'dayjs'
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { DOCS_URL } from 'lib/constants'
import { InfoIcon, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, Popover_Shadcn_, cn } from 'ui'
import { ChevronRight, Loader2 } from 'lucide-react'
import Link from 'next/link'
import { cn, InfoIcon, Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_ } from 'ui'

import {
extractDbSchema,
ProjectServiceStatus,
StatusIcon,
StatusMessage,
extractDbSchema,
} from '../Home/ServiceStatus'

const SERVICE_STATUS_THRESHOLD = 5 // minutes
Expand Down Expand Up @@ -224,10 +224,11 @@ export const ServiceStatus = () => {
currentBranch?.status === 'RUNNING_MIGRATIONS' ||
isMigrationLoading))

const isProjectComingUp = ['COMING_UP', 'UNKNOWN'].includes(project?.status ?? '')

const anyUnhealthy = services.some((service) => service.status === 'UNHEALTHY')
const anyComingUp = services.some((service) => service.status === 'COMING_UP')
// Spinner only while the overall project is in COMING_UP; otherwise show 6-dot grid
const showSpinnerIcon = project?.status === 'COMING_UP'
const anyComingUp =
isProjectComingUp || services.some((service) => service.status === 'COMING_UP')

const getOverallStatusLabel = (): string => {
if (isLoadingChecks) return 'Checking...'
Expand All @@ -243,7 +244,8 @@ export const ServiceStatus = () => {
<PopoverTrigger_Shadcn_>
<SingleStat
icon={
showSpinnerIcon ? (
// Spinner only while the overall project is in COMING_UP; otherwise show 6-dot grid
isProjectComingUp ? (
<Loader2 className="animate-spin" size={18} />
) : (
<div className="grid grid-cols-3 gap-1">
Expand Down Expand Up @@ -288,7 +290,11 @@ export const ServiceStatus = () => {
<StatusMessage
isLoading={service.isLoading}
isProjectNew={isProjectNew}
status={service.status}
status={
isProjectComingUp && service.status === 'UNHEALTHY'
? 'COMING_UP'
: service.status
}
/>
</p>
</div>
Expand Down
Loading
Loading