'use client'
import type { Environment, EnvironmentStatus } from '@dify/contracts/enterprise/types.gen'
import { EnvironmentStatus as EnvironmentStatusEnum } from '@dify/contracts/enterprise/types.gen'
import { cn } from '@langgenius/dify-ui/cn'
import { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger } from '@langgenius/dify-ui/select'
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
import { useTranslation } from 'react-i18next'
import { TitleTooltip } from '../../shared/components/title-tooltip'
import { ModeBadge } from './status-badge'
export function Field({ label, hint, children }: {
label: string
hint?: string
children: React.ReactNode
}) {
return (
)
}
type SelectOption = {
value?: string
label: string
disabled?: boolean
disabledReason?: string
}
type SelectProps = {
value?: string
onChange: (value: string) => void
options: SelectOption[]
ariaLabel?: string
placeholder?: string
}
export function DeploymentSelect({ value, onChange, options, ariaLabel, placeholder }: SelectProps) {
const { t } = useTranslation('deployments')
const selectedOption = options.find(option => option.value === value)
return (
)
}
function EnvironmentHealthDot({ status }: {
status: EnvironmentStatus
}) {
const { t } = useTranslation('deployments')
const label = t(`health.${status}`)
const isReady = status === EnvironmentStatusEnum.ENVIRONMENT_STATUS_READY
return (
)}
/>
{label}
)
}
export function EnvironmentRow({ env }: { env: Environment }) {
const { t } = useTranslation('deployments')
const summary = env.description.trim() || t(`backend.${env.backend}`)
return (
{env.displayName}
{summary}
)
}