import { ReactNode } from 'react' import { Badge } from 'ui' import { Admonition } from 'ui-patterns/Admonition' import { InfoTooltip } from 'ui-patterns/info-tooltip' import { PageContainer } from 'ui-patterns/PageContainer' import { PageSection, PageSectionContent, PageSectionDescription, PageSectionMeta, PageSectionSummary, PageSectionTitle, } from 'ui-patterns/PageSection' import { COMPUTE_REGION_LABEL, LISTENING_PORT } from '../Compute.constants' import type { ComputeInstance } from '../Compute.types' import { formatSize, getRuntimeMeta } from '../Compute.utils' import { ComputeInstanceCommandLine } from '../ComputeInstanceCommandLine' import { buildComputeInstanceCliCommands } from '../computeInstanceSnippets' import { COMPUTE_INSTANCE_CALL_TABS, ComputeInstanceSnippetTabs, } from '../ComputeInstanceSnippetTabs' import { RuntimeBadge } from '../RuntimeBadge' import { CLI_NAME } from '@/lib/constants/compute' interface ComputeInstanceOverviewTabProps { instance: ComputeInstance } const ComputeInstanceCount = ({ label, value, tooltip, }: { label: string value: number tooltip: ReactNode }) => (
{label} {tooltip} {value}
) const SettingsRow = ({ label, children, isFirst, }: { label: string children: ReactNode isFirst?: boolean }) => (
{label} {children}
) export const ComputeInstanceOverviewTab = ({ instance }: ComputeInstanceOverviewTabProps) => { const runtime = getRuntimeMeta(instance.runtime) const commands = buildComputeInstanceCliCommands(instance.name) return ( {instance.buildState === 'failed' && (

{instance.stateReason ?? 'The build did not complete.'}

)} {instance.instancesError !== undefined && ( {instance.instancesError} )} Instances {instance.instances === undefined ? (

No instances are running for this instance yet.

) : (

{instance.instances.ready} of{' '} {instance.instances.declared}{' '} instances ready

)}
Container The runtime image and entrypoint resolved for this instance.
{instance.imageVersion !== undefined && ( {instance.imageVersion} )} {runtime !== undefined && ( {runtime.baseImage} )} {runtime !== undefined && ( {runtime.entrypoint} )} $PORT → {LISTENING_PORT}
Resources
{formatSize(instance.size)} {instance.declaredInstances} {instance.access === 'public' ? ( Public ) : ( Private )} {COMPUTE_REGION_LABEL} (locked)
How to call Call the instance over its gateway URL. Develop locally Manage this instance from the Supabase CLI.
{commands.map((command) => ( ))}
) }