Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Move shared widgets onto the shared field components

Juan Denis145129731783
diff --git a/frontend/src/components/EmailProviders.jsx b/frontend/src/components/EmailProviders.jsx
index fe94a576..ed58a9a9 100644
--- a/frontend/src/components/EmailProviders.jsx
+++ b/frontend/src/components/EmailProviders.jsx
@@ -4,6 +4,7 @@ import api from '../services/api';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
+import PortField from './PortField';
import { useToast } from '../contexts/useToast.js';
import { useTranslation } from 'react-i18next';
@@ -188,10 +189,22 @@ export default function EmailProviders() {
STARTTLS
</label>
</Field>
+ ) : f === 'port' ? (
+ // The relay's SMTP port (25/465/587): a remote port,
+ // never one this host binds, so no host check.
+ <Field key={f} label={FIELD_LABELS[f] || f}>
+ <PortField
+ host={false}
+ allowPrivileged
+ placeholder="587"
+ value={form.port || ''}
+ onChange={(v) => onField('port', v === '' ? '' : String(v))}
+ />
+ </Field>
) : (
<Field key={f} label={FIELD_LABELS[f] || f}>
<Input
- type={spec.secrets.includes(f) ? 'password' : (f === 'port' ? 'number' : 'text')}
+ type={spec.secrets.includes(f) ? 'password' : 'text'}
value={form[f] || ''}
onChange={(e) => onField(f, e.target.value)}
/>
diff --git a/frontend/src/components/EnvironmentVariables.jsx b/frontend/src/components/EnvironmentVariables.jsx
index bc306ed2..aa4f5c01 100644
--- a/frontend/src/components/EnvironmentVariables.jsx
+++ b/frontend/src/components/EnvironmentVariables.jsx
@@ -10,6 +10,7 @@ import { Textarea } from '@/components/ui/textarea';
import { Checkbox } from '@/components/ui/checkbox';
import { Badge } from '@/components/ui/badge';
import { Label } from '@/components/ui/label';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
import Modal from './Modal';
import EmptyState from './EmptyState';
import { DataTable, DataTableFooter, ListToolbar, SearchField } from '@/components/ds';
@@ -67,6 +68,8 @@ const ENV_VIEWS = [
},
];
+const EVERY_SERVICE = '__all';
+
const EnvironmentVariables = ({ appId }) => {
const { t } = useTranslation();
const toast = useToast();
@@ -654,17 +657,20 @@ const EnvironmentVariables = ({ appId }) => {
</div>
{composeServices.length > 0 && (
<div className="form-group">
- <Label>{t('app.environmentVariables.appliesTo', 'Applies to')}</Label>
- <select
- className="env-target-select__control"
- value={newTargetService}
- onChange={(e) => setNewTargetService(e.target.value)}
+ <Label htmlFor="env-add-target">{t('app.environmentVariables.appliesTo', 'Applies to')}</Label>
+ {/* Radix reserves '' for "no selection": "All services" rides a sentinel. */}
+ <Select
+ value={newTargetService || EVERY_SERVICE}
+ onValueChange={(v) => setNewTargetService(v === EVERY_SERVICE ? '' : v)}
>
- <option value="">{t('app.environmentVariables.allServices', 'All services')}</option>
- {composeServices.map((svc) => (
- <option key={svc} value={svc}>{svc}</option>
- ))}
- </select>
+ <SelectTrigger id="env-add-target"><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value={EVERY_SERVICE}>{t('app.environmentVariables.allServices', 'All services')}</SelectItem>
+ {composeServices.map((svc) => (
+ <SelectItem key={svc} value={svc}>{svc}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
)}
<p className="hint env-modal-hint">
diff --git a/frontend/src/components/JournalControls.jsx b/frontend/src/components/JournalControls.jsx
index 62b2d610..a7d0042b 100644
--- a/frontend/src/components/JournalControls.jsx
+++ b/frontend/src/components/JournalControls.jsx
@@ -1,9 +1,14 @@
import { Input } from '@/components/ui/input';
import { Button } from '@/components/ui/button';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
import { useTranslation } from 'react-i18next';
+// Radix Select reserves '' for "no selection", so "All" travels as a sentinel
+// and is turned back into '' before it reaches the caller.
+const ALL_PRIORITIES = '__all';
+
const PRIORITY_OPTIONS = [
- { value: '', labelKey: 'common.labels.all', label: 'All' },
+ { value: ALL_PRIORITIES, labelKey: 'common.labels.all', label: 'All' },
{ value: '0', labelKey: 'app.journalControls.emergency', label: 'Emergency' },
{ value: '1', labelKey: 'app.journalControls.alert', label: 'Alert' },
{ value: '2', labelKey: 'app.journalControls.critical', label: 'Critical' },
@@ -62,22 +67,35 @@ export function JournalControls({
{onLineCountChange && (
<div className="control-group">
<label>{t('app.journalControls.lines', 'Lines')}</label>
- <select value={lineCount} onChange={(e) => onLineCountChange(parseInt(e.target.value, 10))}>
- {lineCountOptions.map(n => (
- <option key={n} value={n}>{n}</option>
- ))}
- </select>
+ <Select value={String(lineCount)} onValueChange={(v) => onLineCountChange(parseInt(v, 10))}>
+ <SelectTrigger aria-label={t('app.journalControls.lines', 'Lines')}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {lineCountOptions.map(n => (
+ <SelectItem key={n} value={String(n)}>{n}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
)}
{showPriority && onPriorityChange && (
<div className="control-group">
<label>{t('app.journalControls.priority', 'Priority')}</label>
- <select value={priority ?? ''} onChange={(e) => onPriorityChange(e.target.value)}>
- {PRIORITY_OPTIONS.map(o => (
- <option key={o.value} value={o.value}>{o.label}</option>
- ))}
- </select>
+ <Select
+ value={priority == null || priority === '' ? ALL_PRIORITIES : String(priority)}
+ onValueChange={(v) => onPriorityChange(v === ALL_PRIORITIES ? '' : v)}
+ >
+ <SelectTrigger aria-label={t('app.journalControls.priority', 'Priority')}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {PRIORITY_OPTIONS.map(o => (
+ <SelectItem key={o.value} value={o.value}>{o.label}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
)}
diff --git a/frontend/src/components/LinkAppModal.jsx b/frontend/src/components/LinkAppModal.jsx
index 1225257e..ce6876c0 100644
--- a/frontend/src/components/LinkAppModal.jsx
+++ b/frontend/src/components/LinkAppModal.jsx
@@ -4,6 +4,7 @@ import api from '../services/api';
import Modal from './Modal';
import { useTranslation } from 'react-i18next';
import { Button as SharedButton } from '@/components/ui/button';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
const LinkAppModal = ({ app, onClose, onLinked }) => {
const { t } = useTranslation();
@@ -98,19 +99,19 @@ const LinkAppModal = ({ app, onClose, onLinked }) => {
</div>
<div className="form-group">
- <label>{t('app.linkAppModal.linkToApplication', 'Link to Application')}</label>
- <select
- value={selectedAppId}
- onChange={(e) => setSelectedAppId(e.target.value)}
- required
- >
- <option value="">{t('app.linkAppModal.selectAnApplication', 'Select an application…')}</option>
- {apps.map(a => (
- <option key={a.id} value={a.id}>
- {a.name} (Port: {a.port || 'N/A'})
- </option>
- ))}
- </select>
+ <label htmlFor="link-app-target">{t('app.linkAppModal.linkToApplication', 'Link to Application')}</label>
+ <Select value={selectedAppId} onValueChange={setSelectedAppId} required>
+ <SelectTrigger id="link-app-target">
+ <SelectValue placeholder={t('app.linkAppModal.selectAnApplication', 'Select an application…')} />
+ </SelectTrigger>
+ <SelectContent>
+ {apps.map(a => (
+ <SelectItem key={a.id} value={String(a.id)}>
+ {a.name} (Port: {a.port || 'N/A'})
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
<div className="form-group">
diff --git a/frontend/src/components/PrivateURLSection.jsx b/frontend/src/components/PrivateURLSection.jsx
index 5bd4c0e7..bf008a8f 100644
--- a/frontend/src/components/PrivateURLSection.jsx
+++ b/frontend/src/components/PrivateURLSection.jsx
@@ -2,7 +2,7 @@ import { useState } from 'react';
import api from '../services/api';
import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
-import { useClipboard } from '../hooks/useClipboard';
+import CopyField from './CopyField';
import { useTranslation } from 'react-i18next';
import { Button as SharedButton } from '@/components/ui/button';
@@ -10,7 +10,6 @@ const PrivateURLSection = ({ app, onUpdate }) => {
const { t } = useTranslation();
const toast = useToast();
const { confirm } = useConfirm();
- const { copy } = useClipboard({ successMessage: 'URL copied to clipboard' });
const [loading, setLoading] = useState(false);
const [customSlug, setCustomSlug] = useState('');
const [editMode, setEditMode] = useState(false);
@@ -89,10 +88,6 @@ const PrivateURLSection = ({ app, onUpdate }) => {
}
}
- function copyToClipboard() {
- copy(privateUrl);
- }
-
function handleSlugInput(e) {
// Only allow lowercase letters, numbers, and hyphens
const value = e.target.value.toLowerCase().replace(/[^a-z0-9-]/g, '');
@@ -145,21 +140,9 @@ const PrivateURLSection = ({ app, onUpdate }) => {
<div className="private-url-enabled">
<div className="private-url-display">
<div className="url-box">
- <span className="url-label">{t('app.privateURLSection.yourPrivateUrl', 'Your private URL:')}</span>
- <code className="url-value">{privateUrl}</code>
+ <CopyField label={t('app.privateURLSection.yourPrivateUrl', 'Your private URL:')} value={privateUrl} />
</div>
<div className="url-actions">
- <SharedButton variant="outline" type="button"
- className="btn btn-secondary btn-sm"
- onClick={copyToClipboard}
- title={t('app.privateURLSection.copyToClipboard', 'Copy to clipboard')}
- >
- <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
- <rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
- <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
- </svg>
- {t('common.actions.copy', 'Copy')}
- </SharedButton>
<SharedButton variant="outline" type="button"
className="btn btn-secondary btn-sm"
onClick={handleRegenerate}
diff --git a/frontend/src/components/SchedulePicker.jsx b/frontend/src/components/SchedulePicker.jsx
index 3e3563dc..b2472167 100644
--- a/frontend/src/components/SchedulePicker.jsx
+++ b/frontend/src/components/SchedulePicker.jsx
@@ -275,17 +275,18 @@ export default function SchedulePicker({ value = '', onChange, compact = false,
{mode === 'builder' && (
<div className="schedule-picker__builder">
<div className="schedule-picker__row">
- <label htmlFor="sp-frequency">{t('app.schedulePicker.frequency', 'Frequency')}</label>
- <select
- id="sp-frequency"
+ <label id="sp-frequency">{t('app.schedulePicker.frequency', 'Frequency')}</label>
+ <SegControl
+ aria-labelledby="sp-frequency"
value={builder.frequency}
- onChange={(e) => patchBuilder({ frequency: e.target.value })}
- >
- <option value="hourly">{t('app.schedulePicker.hourly', 'Hourly')}</option>
- <option value="daily">{t('app.schedulePicker.daily', 'Daily')}</option>
- <option value="weekly">{t('app.schedulePicker.weekly', 'Weekly')}</option>
- <option value="monthly">{t('app.schedulePicker.monthly', 'Monthly')}</option>
- </select>
+ onChange={(frequency) => patchBuilder({ frequency })}
+ options={[
+ { value: 'hourly', label: t('app.schedulePicker.hourly', 'Hourly') },
+ { value: 'daily', label: t('app.schedulePicker.daily', 'Daily') },
+ { value: 'weekly', label: t('app.schedulePicker.weekly', 'Weekly') },
+ { value: 'monthly', label: t('app.schedulePicker.monthly', 'Monthly') },
+ ]}
+ />
</div>
{builder.frequency !== 'hourly' && (
diff --git a/frontend/src/components/ai/ConnectionSelector.jsx b/frontend/src/components/ai/ConnectionSelector.jsx
index 821454e2..41f54982 100644
--- a/frontend/src/components/ai/ConnectionSelector.jsx
+++ b/frontend/src/components/ai/ConnectionSelector.jsx
@@ -2,6 +2,11 @@ import { FormField } from '../FormField';
import { useServerkitAI } from '../../contexts/useServerkitAI';
import { useTranslation } from 'react-i18next';
import ModelBinding from './ModelBinding';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '../ui/select';
+
+// Radix Select reserves '' for "no selection"; automatic routing is '' to the
+// AI context, so it travels as a sentinel inside the control.
+const AUTO_PROFILE = '__auto';
export default function ConnectionSelector() {
const { t } = useTranslation();
@@ -12,20 +17,27 @@ export default function ConnectionSelector() {
<div className="sk-ai-task-selector">
<div className="sk-ai-connection-selector">
<FormField htmlFor="ai-chat-workflow" label={t('ai.tasks.task', 'Task')}>
- <select id="ai-chat-workflow" value={workflow} disabled={isStreaming} onChange={(e) => selectWorkflow(e.target.value)}>
- <option value="chat">{t('ai.tasks.chat', 'Chat')}</option>
- <option value="summarize">{t('ai.tasks.summarize', 'Summarize')}</option>
- <option value="extract">{t('ai.tasks.extract', 'Extract structured facts')}</option>
- <option value="diagnose">{t('ai.tasks.diagnose', 'Read-only diagnosis')}</option>
- </select>
+ <Select value={workflow} disabled={isStreaming} onValueChange={selectWorkflow}>
+ <SelectTrigger id="ai-chat-workflow"><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value="chat">{t('ai.tasks.chat', 'Chat')}</SelectItem>
+ <SelectItem value="summarize">{t('ai.tasks.summarize', 'Summarize')}</SelectItem>
+ <SelectItem value="extract">{t('ai.tasks.extract', 'Extract structured facts')}</SelectItem>
+ <SelectItem value="diagnose">{t('ai.tasks.diagnose', 'Read-only diagnosis')}</SelectItem>
+ </SelectContent>
+ </Select>
</FormField>
<FormField htmlFor="ai-chat-profile" label={t('ai.tasks.role', 'Model role')}>
- <select id="ai-chat-profile" value={profile} disabled={isStreaming} onChange={(e) => selectProfile(e.target.value)}>
- <option value="">{t('ai.tasks.automatic', 'Task default / automatic routing')}</option>
- <option value="utility">{t('ai.management.utility', 'Utility')}</option>
- <option value="standard">{t('ai.management.standard', 'Standard')}</option>
- <option value="advanced">{t('ai.management.advanced', 'Advanced')}</option>
- </select>
+ <Select value={profile || AUTO_PROFILE} disabled={isStreaming}
+ onValueChange={(v) => selectProfile(v === AUTO_PROFILE ? '' : v)}>
+ <SelectTrigger id="ai-chat-profile"><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value={AUTO_PROFILE}>{t('ai.tasks.automatic', 'Task default / automatic routing')}</SelectItem>
+ <SelectItem value="utility">{t('ai.management.utility', 'Utility')}</SelectItem>
+ <SelectItem value="standard">{t('ai.management.standard', 'Standard')}</SelectItem>
+ <SelectItem value="advanced">{t('ai.management.advanced', 'Advanced')}</SelectItem>
+ </SelectContent>
+ </Select>
</FormField>
</div>
<details><summary>{t('ai.tasks.override', 'Override connection and model')}</summary>
diff --git a/frontend/src/components/ai/ModelBinding.jsx b/frontend/src/components/ai/ModelBinding.jsx
index dd07b22d..3f3c3b8d 100644
--- a/frontend/src/components/ai/ModelBinding.jsx
+++ b/frontend/src/components/ai/ModelBinding.jsx
@@ -4,6 +4,10 @@ import api from '../../services/api';
import { FormField } from '../FormField';
import { Button } from '../ui/button';
import ModelPicker from './ModelPicker';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '../ui/select';
+
+// Radix Select reserves '' for "no selection", so "inherit / none" is a sentinel.
+const NO_CONNECTION = '__none';
export default function ModelBinding({ id, value, onChange, connections, disabled, allowInherit = false, inheritLabel, discover = false }) {
const { t } = useTranslation();
@@ -22,14 +26,17 @@ export default function ModelBinding({ id, value, onChange, connections, disable
};
return <div className="sk-ai-binding">
<FormField htmlFor={`${id}-connection`} label={t('ai.connections.connection', 'Connection')}>
- <select id={`${id}-connection`} disabled={disabled || busy} value={value?.connection_id || ''} onChange={(event) => {
- const next = connections.find((item) => item.id === event.target.value);
+ <Select disabled={disabled || busy} value={value?.connection_id ? String(value.connection_id) : NO_CONNECTION} onValueChange={(picked) => {
+ const next = connections.find((item) => String(item.id) === picked);
setModels(null); setError('');
onChange(next ? { connection_id: next.id, model: next.model } : null);
}}>
- <option value="">{allowInherit ? (inheritLabel || t('ai.management.inherit', 'Use Standard / panel default')) : t('ai.management.chooseConnection', 'Choose a connection')}</option>
- {connections.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}
- </select>
+ <SelectTrigger id={`${id}-connection`}><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value={NO_CONNECTION}>{allowInherit ? (inheritLabel || t('ai.management.inherit', 'Use Standard / panel default')) : t('ai.management.chooseConnection', 'Choose a connection')}</SelectItem>
+ {connections.map((item) => <SelectItem key={item.id} value={String(item.id)}>{item.name}</SelectItem>)}
+ </SelectContent>
+ </Select>
</FormField>
{value && <FormField htmlFor={`${id}-model`} label={t('ai.connections.model', 'Model')}>
<ModelPicker id={`${id}-model`} value={value.model} models={catalog} disabled={disabled || busy}
diff --git a/frontend/src/components/ai/ModelPicker.jsx b/frontend/src/components/ai/ModelPicker.jsx
index 66e3e92b..a4d3a369 100644
--- a/frontend/src/components/ai/ModelPicker.jsx
+++ b/frontend/src/components/ai/ModelPicker.jsx
@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';
import { Button } from '../ui/button';
import { Input } from '../ui/input';
import { Popover, PopoverTrigger, PopoverContent } from '../ui/popover';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '../ui/select';
import { Command, CommandInput, CommandList, CommandEmpty, CommandItem } from '../ui/command';
// Model IDs are opaque: preserve gateway aliases (including slashes) verbatim.
@@ -34,13 +35,18 @@ export default function ModelPicker({ id, value, models, onChange, disabled }) {
<CommandInput placeholder={t('ai.connections.searchModels', 'Search models…')} />
<div className="sk-model-picker__filters">
<label htmlFor={`${id}-filter`}>{t('ai.models.capability', 'Capability')}</label>
- <select id={`${id}-filter`} value={filter} onChange={(event) => setFilter(event.target.value)}>
- <option value="all">{t('ai.models.all', 'All models')}</option>
- <option value="tools">{t('ai.models.tools', 'Tool calling')}</option>
- <option value="vision">{t('ai.models.vision', 'Vision')}</option>
- <option value="reasoning">{t('ai.models.reasoning', 'Reasoning')}</option>
- <option value="structured">{t('ai.models.structured', 'Structured output')}</option>
- </select>
+ <Select value={filter} onValueChange={setFilter}>
+ <SelectTrigger id={`${id}-filter`}><SelectValue /></SelectTrigger>
+ {/* The list portals out of the DOM but React still bubbles its
+ keys to the Command root, where Enter would pick a model. */}
+ <SelectContent onKeyDown={(event) => event.stopPropagation()}>
+ <SelectItem value="all">{t('ai.models.all', 'All models')}</SelectItem>
+ <SelectItem value="tools">{t('ai.models.tools', 'Tool calling')}</SelectItem>
+ <SelectItem value="vision">{t('ai.models.vision', 'Vision')}</SelectItem>
+ <SelectItem value="reasoning">{t('ai.models.reasoning', 'Reasoning')}</SelectItem>
+ <SelectItem value="structured">{t('ai.models.structured', 'Structured output')}</SelectItem>
+ </SelectContent>
+ </Select>
</div>
<CommandList>
<CommandEmpty>{t('ai.connections.noModels', 'No matching models. Enter a model ID manually.')}</CommandEmpty>
diff --git a/frontend/src/components/deploy-console/ConsoleToolbar.jsx b/frontend/src/components/deploy-console/ConsoleToolbar.jsx
index 5f8971ab..a13d5594 100644
--- a/frontend/src/components/deploy-console/ConsoleToolbar.jsx
+++ b/frontend/src/components/deploy-console/ConsoleToolbar.jsx
@@ -1,6 +1,7 @@
import { ArrowDown, ArrowUp, Copy, Download, Maximize2, Minimize2, Search } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Button as SharedButton } from '@/components/ui/button';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
const LEVELS = ['all', 'info', 'warn', 'error', 'debug'];
@@ -50,14 +51,18 @@ export default function ConsoleToolbar({
>
{t('app.consoleToolbar.timestamps', 'Timestamps')}
</SharedButton>
- <label className="deploy-console__level">
- <span className="sr-only">{t('app.consoleToolbar.logLevel', 'Log level')}</span>
- <select value={level} onChange={(e) => onLevelChange(e.target.value)}>
- {LEVELS.map((l) => (
- <option key={l} value={l}>{l === 'all' ? 'All levels' : l}</option>
- ))}
- </select>
- </label>
+ <div className="deploy-console__level">
+ <Select value={level} onValueChange={onLevelChange}>
+ <SelectTrigger aria-label={t('app.consoleToolbar.logLevel', 'Log level')}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {LEVELS.map((l) => (
+ <SelectItem key={l} value={l}>{l === 'all' ? 'All levels' : l}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
{errorCount > 0 && (
<SharedButton variant="unstyled"
type="button"
diff --git a/frontend/src/components/deploy-console/ErrorCard.jsx b/frontend/src/components/deploy-console/ErrorCard.jsx
index 73b0b687..e10d0163 100644
--- a/frontend/src/components/deploy-console/ErrorCard.jsx
+++ b/frontend/src/components/deploy-console/ErrorCard.jsx
@@ -1,7 +1,7 @@
import { useContext, useState } from 'react';
-import { AlertTriangle, RefreshCw, Copy, Sparkles, ChevronDown, ChevronRight } from 'lucide-react';
+import { AlertTriangle, RefreshCw, Sparkles, ChevronDown, ChevronRight } from 'lucide-react';
import { AIContext } from '../../contexts/useServerkitAI.js';
-import { copyToClipboard } from '@/utils/clipboard';
+import { CopyButton } from '@/components/CopyButton';
import { useTranslation } from 'react-i18next';
import { Button as SharedButton } from '@/components/ui/button';
@@ -25,14 +25,11 @@ export default function ErrorCard({ failedStepName, failureTail, hint, errorMess
const tailText = Array.isArray(failureTail) ? failureTail.join('\n') : (failureTail || '');
const tailLines = tailText ? tailText.split('\n') : [];
- const copyError = () => {
- const blob = [
- failedStepName ? `Failed step: ${failedStepName}` : null,
- errorMessage ? `Error: ${errorMessage}` : null,
- tailText ? `\n${tailText}` : null,
- ].filter(Boolean).join('\n');
- copyToClipboard(blob);
- };
+ const errorReport = [
+ failedStepName ? `Failed step: ${failedStepName}` : null,
+ errorMessage ? `Error: ${errorMessage}` : null,
+ tailText ? `\n${tailText}` : null,
+ ].filter(Boolean).join('\n');
const askAI = () => {
if (!ai?.open) return;
@@ -71,9 +68,16 @@ export default function ErrorCard({ failedStepName, failureTail, hint, errorMess
<RefreshCw size={14} className={retrying ? 'deploy-console__spin' : ''} />
{retrying ? 'Retrying…' : 'Retry deploy'}
</SharedButton>
- <SharedButton variant="unstyled" type="button" className="deploy-console__btn" onClick={copyError}>
- <Copy size={14} /> {t('app.errorCard.copyError', 'Copy error')}
- </SharedButton>
+ <CopyButton
+ value={errorReport}
+ variant="unstyled"
+ size="default"
+ className="deploy-console__btn"
+ label={t('app.errorCard.copyError', 'Copy error')}
+ copiedLabel={t('app.copyField.copied', 'Copied')}
+ >
+ {t('app.errorCard.copyError', 'Copy error')}
+ </CopyButton>
{ai?.open && (
<SharedButton variant="unstyled" type="button" className="deploy-console__btn" onClick={askAI}>
<Sparkles size={14} /> {t('app.errorCard.askAi', 'Ask AI')}
diff --git a/frontend/src/components/log-viewer/LogToolbar.jsx b/frontend/src/components/log-viewer/LogToolbar.jsx
index c3b617c1..45e9e374 100644
--- a/frontend/src/components/log-viewer/LogToolbar.jsx
+++ b/frontend/src/components/log-viewer/LogToolbar.jsx
@@ -1,6 +1,7 @@
import { Search, RefreshCw, Download, Trash2, Maximize2, Minimize2, X, ArrowDownToLine, Hash, WrapText } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Button as SharedButton } from '@/components/ui/button';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
export default function LogToolbar({
searchPattern, onSearchChange, onSearchSubmit, onSearchClear,
@@ -31,16 +32,20 @@ export default function LogToolbar({
</SharedButton>
)}
</div>
- <select
- className="lv-select"
- value={lineCount}
- onChange={(e) => onLineCountChange(parseInt(e.target.value, 10))}
- title={t('app.logToolbar.linesToFetch', 'Lines to fetch')}
- >
- {lineCountOptions.map((n) => (
- <option key={n} value={n}>{n.toLocaleString()} lines</option>
- ))}
- </select>
+ <Select value={String(lineCount)} onValueChange={(v) => onLineCountChange(parseInt(v, 10))}>
+ <SelectTrigger
+ className="lv-select"
+ title={t('app.logToolbar.linesToFetch', 'Lines to fetch')}
+ aria-label={t('app.logToolbar.linesToFetch', 'Lines to fetch')}
+ >
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {lineCountOptions.map((n) => (
+ <SelectItem key={n} value={String(n)}>{n.toLocaleString()} lines</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
<div className="lv-toolbar-right">
diff --git a/frontend/src/components/monitoring/FleetCapacityPanel.jsx b/frontend/src/components/monitoring/FleetCapacityPanel.jsx
index a19517f7..487b2580 100644
--- a/frontend/src/components/monitoring/FleetCapacityPanel.jsx
+++ b/frontend/src/components/monitoring/FleetCapacityPanel.jsx
@@ -8,6 +8,8 @@ import api from '../../services/api';
import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { DataTable, DataTableFooter, Pill } from '@/components/ds';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
+import ServerPicker from '@/components/ServerPicker';
import { CHART_COLORS, METRIC_LABELS } from './fleetMetrics';
import { downloadBlob } from '@/utils/downloadBlob';
import { useTranslation } from 'react-i18next';
@@ -209,11 +211,14 @@ export default function FleetCapacityPanel({ scope, refreshKey = 0 }) {
</div>
<div className="form-group">
<span className="mon-field-label">{t('app.fleetCapacityPanel.metric', 'Metric')}</span>
- <select value={compMetric} onChange={(e) => setCompMetric(e.target.value)}>
- {Object.entries(METRIC_LABELS).map(([k, v]) => (
- <option key={k} value={k}>{v}</option>
- ))}
- </select>
+ <Select value={compMetric} onValueChange={setCompMetric}>
+ <SelectTrigger aria-label={t('app.fleetCapacityPanel.metric', 'Metric')}><SelectValue /></SelectTrigger>
+ <SelectContent>
+ {Object.entries(METRIC_LABELS).map(([k, v]) => (
+ <SelectItem key={k} value={k}>{v}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
<div className="form-group">
<span className="mon-field-label">{t('app.fleetCapacityPanel.period', 'Period')}</span>
@@ -306,18 +311,24 @@ export default function FleetCapacityPanel({ scope, refreshKey = 0 }) {
<div className="mon-compare-controls">
<div className="form-group">
<span className="mon-field-label">{t('common.labels.server', 'Server')}</span>
- <select value={forecastServer} onChange={(e) => setForecastServer(e.target.value)}>
- <option value="">{t('app.fleetCapacityPanel.selectAServer', 'Select a server…')}</option>
- {servers.map((s) => <option key={s.id} value={s.id}>{s.name}</option>)}
- </select>
+ <ServerPicker
+ value={forecastServer}
+ onChange={(id) => setForecastServer(id)}
+ includeLocal={false}
+ onlineOnly={false}
+ label={t('app.fleetCapacityPanel.selectAServer', 'Select a server…')}
+ />
</div>
<div className="form-group">
<span className="mon-field-label">{t('app.fleetCapacityPanel.metric', 'Metric')}</span>
- <select value={forecastMetric} onChange={(e) => setForecastMetric(e.target.value)}>
- <option value="disk">{t('common.labels.disk', 'Disk')}</option>
- <option value="memory">{t('common.labels.memory', 'Memory')}</option>
- <option value="cpu">CPU</option>
- </select>
+ <Select value={forecastMetric} onValueChange={setForecastMetric}>
+ <SelectTrigger aria-label={t('app.fleetCapacityPanel.metric', 'Metric')}><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value="disk">{t('common.labels.disk', 'Disk')}</SelectItem>
+ <SelectItem value="memory">{t('common.labels.memory', 'Memory')}</SelectItem>
+ <SelectItem value="cpu">CPU</SelectItem>
+ </SelectContent>
+ </Select>
</div>
</div>
diff --git a/frontend/src/components/monitoring/FleetThresholdsPanel.jsx b/frontend/src/components/monitoring/FleetThresholdsPanel.jsx
index 1e2ac254..b42006c2 100644
--- a/frontend/src/components/monitoring/FleetThresholdsPanel.jsx
+++ b/frontend/src/components/monitoring/FleetThresholdsPanel.jsx
@@ -6,6 +6,12 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { DataTable, DataTableFooter } from '@/components/ds';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
+import ServerPicker from '@/components/ServerPicker';
+
+// ServerPicker's "no server" entry: a threshold without server_id is the
+// fleet default.
+const FLEET_DEFAULT = '__fleet';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { METRIC_LABELS } from './fleetMetrics';
@@ -21,7 +27,7 @@ const DEFAULT_THRESHOLD = {
// Per-server limits, sitting under the panel host's own limits on the Rules
// tab: same idea, wider scope. Two lists rather than one because they are two
// backends — the host's four values are a single config, these are rows.
-export default function FleetThresholdsPanel({ servers = [], refreshKey = 0 }) {
+export default function FleetThresholdsPanel({ refreshKey = 0 }) {
const { t } = useTranslation();
const toast = useToast();
const [thresholds, setThresholds] = useState([]);
@@ -138,27 +144,26 @@ export default function FleetThresholdsPanel({ servers = [], refreshKey = 0 }) {
{adding && (
<div className="mon-threshold-form">
<div className="form-group">
- <Label htmlFor="fleet-threshold-server">{t('app.fleetThresholdsPanel.appliesTo', 'Applies to')}</Label>
- <select
- id="fleet-threshold-server"
- value={draft.server_id || ''}
- onChange={(e) => setDraft((p) => ({ ...p, server_id: e.target.value || undefined }))}
- >
- <option value="">{t('app.fleetThresholdsPanel.everyServerFleetDefault', 'Every server (fleet default)')}</option>
- {servers.map((s) => <option key={s.id} value={s.id}>{s.name}</option>)}
- </select>
+ <Label>{t('app.fleetThresholdsPanel.appliesTo', 'Applies to')}</Label>
+ <ServerPicker
+ value={draft.server_id || FLEET_DEFAULT}
+ onChange={(id) => setDraft((p) => ({ ...p, server_id: id === FLEET_DEFAULT ? undefined : id }))}
+ includeLocal={false}
+ onlineOnly={false}
+ extraOptions={[{ value: FLEET_DEFAULT, label: t('app.fleetThresholdsPanel.everyServerFleetDefault', 'Every server (fleet default)') }]}
+ label={t('app.fleetThresholdsPanel.appliesTo', 'Applies to')}
+ />
</div>
<div className="form-group">
<Label htmlFor="fleet-threshold-metric">{t('app.fleetThresholdsPanel.metric', 'Metric')}</Label>
- <select
- id="fleet-threshold-metric"
- value={draft.metric}
- onChange={(e) => setDraft((p) => ({ ...p, metric: e.target.value }))}
- >
- <option value="cpu">CPU</option>
- <option value="memory">{t('common.labels.memory', 'Memory')}</option>
- <option value="disk">{t('common.labels.disk', 'Disk')}</option>
- </select>
+ <Select value={draft.metric} onValueChange={(metric) => setDraft((p) => ({ ...p, metric }))}>
+ <SelectTrigger id="fleet-threshold-metric"><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value="cpu">CPU</SelectItem>
+ <SelectItem value="memory">{t('common.labels.memory', 'Memory')}</SelectItem>
+ <SelectItem value="disk">{t('common.labels.disk', 'Disk')}</SelectItem>
+ </SelectContent>
+ </Select>
</div>
<div className="form-group">
<Label htmlFor="fleet-threshold-warning">{t('app.fleetThresholdsPanel.warning2', 'Warning (%)')}</Label>
diff --git a/frontend/src/styles/pages/_deploy-console.scss b/frontend/src/styles/pages/_deploy-console.scss
index 5d4303ad..37cad89a 100644
--- a/frontend/src/styles/pages/_deploy-console.scss
+++ b/frontend/src/styles/pages/_deploy-console.scss
@@ -282,13 +282,21 @@ $dc-surface-line: rgba(255, 255, 255, 0.04);
}
}
- &__level select {
+ &__level .ui-select-trigger {
+ width: auto;
+ height: auto;
+ gap: 4px;
padding: 4px 6px;
font-size: $font-size-sm;
border-radius: $radius-md;
border: 1px solid $border-subtle;
background: $bg-card;
color: $text-secondary;
+
+ .ui-select-icon {
+ width: 14px;
+ height: 14px;
+ }
}
&__search {
diff --git a/frontend/src/styles/pages/_terminal.scss b/frontend/src/styles/pages/_terminal.scss
index bc708f9a..87f722f8 100644
--- a/frontend/src/styles/pages/_terminal.scss
+++ b/frontend/src/styles/pages/_terminal.scss
@@ -689,6 +689,14 @@ $lk-default: #646b7a;
border-color: var(--border-strong);
outline: none;
}
+
+ // The Radix trigger (LogToolbar) keeps the compact toolbar size rather
+ // than the full-width 40px form field it defaults to.
+ &.ui-select-trigger {
+ width: auto;
+ height: auto;
+ gap: $space-1;
+ }
}
.lv-icon-btn {
@@ -992,7 +1000,7 @@ $lk-default: #646b7a;
}
input,
- select {
+ .ui-select-trigger {
min-height: 36px;
padding: $space-2 $space-3;
border: 1px solid $border-subtle;
@@ -1004,6 +1012,11 @@ $lk-default: #646b7a;
input {
width: 200px;
}
+
+ .ui-select-trigger {
+ height: auto;
+ min-width: 120px;
+ }
}
}