/** * Environment Variables Sub-Panel * Panel for configuring environment variables for SSH connections */ import { Plus,X } from 'lucide-react'; import React from 'react'; import { useI18n } from '../../application/i18n/I18nProvider'; import { EnvVar } from '../../types'; import { AsidePanel,AsidePanelContent,type AsidePanelLayout,type AsidePanelResizeProps } from '../ui/aside-panel'; import { Button } from '../ui/button'; import { Card } from '../ui/card'; import { Input } from '../ui/input'; export interface EnvVarsPanelProps { hostLabel: string; hostHostname: string; environmentVariables: EnvVar[]; newEnvName: string; newEnvValue: string; setNewEnvName: (name: string) => void; setNewEnvValue: (value: string) => void; onAddEnvVar: () => void; onRemoveEnvVar: (index: number) => void; onUpdateEnvVar: (index: number, field: 'name' | 'value', value: string) => void; onSave: () => void; onBack: () => void; onCancel: () => void; layout?: AsidePanelLayout; } export type EnvVarsPanelPropsWithResize = EnvVarsPanelProps & AsidePanelResizeProps; export const EnvVarsPanel: React.FC = ({ hostLabel, hostHostname, environmentVariables, newEnvName, newEnvValue, setNewEnvName, setNewEnvValue, onAddEnvVar, onRemoveEnvVar, onUpdateEnvVar, onSave, onBack, onCancel, layout = 'overlay', resizable, persistWidthStorageKey, resizeAriaLabel, }) => { const { t } = useI18n(); return ( {t('common.save')} } >
{t('hostDetails.envVars.desc', { host: hostLabel || hostHostname })}

{t('hostDetails.envVars.note')}

{/* Existing variables */} {environmentVariables.map((envVar, index) => (
{t('hostDetails.envVars.variable')}
onUpdateEnvVar(index, 'name', e.target.value)} className="h-10" /> onUpdateEnvVar(index, 'value', e.target.value)} className="h-10" />
))} {/* New variable input */}
{t('hostDetails.envVars.newVariable')}
setNewEnvName(e.target.value)} className="h-10" /> setNewEnvValue(e.target.value)} className="h-10" />
); }; export default EnvVarsPanel;