Home / Function/ ServiceRow() — supabase Function Reference

ServiceRow() — supabase Function Reference

Architecture documentation for the ServiceRow() function in ServiceHealthTable.tsx from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  df81e8a0_5f6e_1c37_6098_621a2b4628c6["ServiceRow()"]
  e46d510e_36d0_d279_c9e2_3efca1456e6c["getHealthStatus()"]
  df81e8a0_5f6e_1c37_6098_621a2b4628c6 -->|calls| e46d510e_36d0_d279_c9e2_3efca1456e6c
  6c669bfc_9720_085b_5bb4_e5b7164b4e8b["getStatusLabel()"]
  df81e8a0_5f6e_1c37_6098_621a2b4628c6 -->|calls| 6c669bfc_9720_085b_5bb4_e5b7164b4e8b
  2ad8e0d7_ad3e_cf04_b483_56e0680f20ca["getStatusVariant()"]
  df81e8a0_5f6e_1c37_6098_621a2b4628c6 -->|calls| 2ad8e0d7_ad3e_cf04_b483_56e0680f20ca
  57af1ed3_941d_cd79_d46a_6cfe2d2d3e08["getStatusTooltip()"]
  df81e8a0_5f6e_1c37_6098_621a2b4628c6 -->|calls| 57af1ed3_941d_cd79_d46a_6cfe2d2d3e08
  style df81e8a0_5f6e_1c37_6098_621a2b4628c6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/Observability/ServiceHealthTable.tsx lines 90–189

const ServiceRow = ({ service, data, onBarClick, datetimeFormat }: ServiceRowProps) => {
  const { status } = getHealthStatus(data.errorRate, data.total)
  const statusLabel = getStatusLabel(status)
  const statusVariant = getStatusVariant(status)
  const statusTooltip = getStatusTooltip(status)

  const errorRate = data.total > 0 ? data.errorRate : 0
  const warningRate = data.total > 0 ? (data.warningCount / data.total) * 100 : 0

  const reportUrl = service.reportUrl || service.logsUrl

  return (
    <Link
      href={reportUrl}
      className="block group p-4 border-b border-default last:border-b-0 hover:bg-surface-200 transition-colors cursor-pointer"
    >
      <div className="flex items-center justify-between mb-3">
        <div className="flex items-center gap-2">
          <span className="text-foreground font-medium">{service.name}</span>
          <Tooltip>
            <TooltipTrigger asChild>
              <button
                onClick={(e) => e.preventDefault()}
                className="text-foreground-lighter hover:text-foreground-light transition-colors"
              >
                <HelpCircle size={14} />
              </button>
            </TooltipTrigger>
            <TooltipContent side="right" className="max-w-xs">
              <p>{SERVICE_DESCRIPTIONS[service.key as ServiceKey] || service.description}</p>
            </TooltipContent>
          </Tooltip>
        </div>
        <div className="flex items-center gap-2">
          <Tooltip>
            <TooltipTrigger asChild>
              <Badge variant={statusVariant}>{statusLabel}</Badge>
            </TooltipTrigger>
            <TooltipContent side="top">
              <p>{statusTooltip}</p>
            </TooltipContent>
          </Tooltip>
          <ButtonTooltip
            type="text"
            size="tiny"
            className="p-1.5"
            tooltip={{ content: { text: `Go to ${service.name} report` } }}
          >
            <ChevronRight
              size={14}
              className="text-foreground-lighter group-hover:text-foreground"
            />
          </ButtonTooltip>
        </div>
      </div>

      <div className="h-16" onClick={(e) => e.preventDefault()}>
        <Loading active={data.isLoading}>
          {data.isLoading ? (
            <div />
          ) : (
            <LogsBarChart
              data={data.eventChartData}
              DateTimeFormat={datetimeFormat}
              onBarClick={onBarClick}
              EmptyState={
                <div className="flex items-center justify-center h-full text-xs text-foreground-lighter">
                  No data
                </div>
              }
            />
          )}
        </Loading>
      </div>

      {data.total > 0 && (
        <div className="flex items-center justify-center mt-2 text-xs text-foreground-lighter gap-4 font-mono tabular-nums tracking-tight">
          {errorRate > 0 && (
            <span className="flex items-center gap-1.5">
              <div className="w-1.5 h-1.5 rounded-full bg-destructive" />
              {errorRate.toFixed(2)}% errors
            </span>
          )}
          {warningRate > 0 && (
            <span className="flex items-center gap-1.5">
              <div className="w-1.5 h-1.5 rounded-full bg-warning" />
              {warningRate.toFixed(2)}% warnings
            </span>
          )}
          {errorRate === 0 && warningRate === 0 && (
            <span className="flex items-center gap-1.5">
              <div className="w-1.5 h-1.5 rounded-full bg-brand" />
              0% errors
            </span>
          )}
        </div>
      )}
    </Link>
  )
}

Subdomains

Frequently Asked Questions

What does ServiceRow() do?
ServiceRow() is a function in the supabase codebase.
What does ServiceRow() call?
ServiceRow() calls 4 function(s): getHealthStatus, getStatusLabel, getStatusTooltip, getStatusVariant.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free