'use client' import type { DeploymentEnvironmentOption } 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 { useTranslation } from 'react-i18next' import { environmentHealth, environmentMode, environmentName } from '../../environment' import { HealthBadge, ModeBadge } from '../status-badge' type EnvironmentOption = DeploymentEnvironmentOption & { disabled?: boolean } export function Field({ label, hint, children }: { label: string hint?: string children: React.ReactNode }) { return (
{label}
{hint && {hint}}
{children}
) } type SelectOption = { value: string label: string disabled?: boolean disabledReason?: string } type SelectProps = { value: string onChange: (value: string) => void options: SelectOption[] placeholder?: string } export function DeploymentSelect({ value, onChange, options, placeholder }: SelectProps) { const { t } = useTranslation('deployments') const selectedOption = options.find(option => option.value === value) return ( ) } export function EnvironmentRow({ env }: { env: EnvironmentOption }) { return (
{environmentName(env)}
{env.type ?? 'env'}
) }