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.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
fix(frontend): hide single-target picker, clean up terminal routing and errors
Juan Denis4dc71d57743a
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsxindex 382fc527..3f1f58b7 100644--- a/frontend/src/App.jsx+++ b/frontend/src/App.jsx@@ -352,6 +352,7 @@ function AppRoutes() {<Route path="email" element={<Email />} /><Route path="email/:tab" element={<Email />} /><Route path="terminal" element={<Terminal />} />+ <Route path="terminal/terminal" element={<Navigate to="/terminal/shell" replace />} /><Route path="terminal/:tab" element={<Terminal />} /><Route path="secrets" element={<SecretsWebhooks />} /><Route path="secrets/:tab" element={<SecretsWebhooks />} />diff --git a/frontend/src/components/RemoteTerminal.jsx b/frontend/src/components/RemoteTerminal.jsxindex 9bee2490..3cf0d5a9 100644--- a/frontend/src/components/RemoteTerminal.jsx+++ b/frontend/src/components/RemoteTerminal.jsx@@ -17,6 +17,7 @@ export default function RemoteTerminal({ serverId, onClose }) {const terminalRef = useRef(null);const terminalInstance = useRef(null);const fitAddon = useRef(null);+ const attemptedForServer = useRef(null);const [sessionId, setSessionId] = useState(null);const [connected, setConnected] = useState(false);const [error, setError] = useState(null);@@ -93,6 +94,8 @@ export default function RemoteTerminal({ serverId, onClose }) {// Create terminal sessionuseEffect(() => {if (!terminalInstance.current || !serverId) return;+ if (attemptedForServer.current === serverId) return;+ attemptedForServer.current = serverId;const createSession = async () => {try {@@ -116,9 +119,6 @@ export default function RemoteTerminal({ serverId, onClose }) {} catch (err) {console.error('Failed to create terminal session:', err);setError(err.message);- if (terminalInstance.current) {- terminalInstance.current.writeln(`\x1b[1;31mError: ${err.message}\x1b[0m`);- }}};diff --git a/frontend/src/components/TargetPicker.jsx b/frontend/src/components/TargetPicker.jsxindex 7b907de8..38f7025f 100644--- a/frontend/src/components/TargetPicker.jsx+++ b/frontend/src/components/TargetPicker.jsx@@ -58,20 +58,35 @@ export default function TargetPicker({ feature, value, onChange, includeLocal =? value.server_id: (value?.kind && value.kind !== 'local' ? value.kind : 'local');+ const optionCount = (includeLocal ? 1 : 0) + eligible.length + extraOptions.length;+ const singleLabel = useMemo(() => {+ if (selectValue !== 'local') {+ const agent = eligible.find(s => s.id === selectValue);+ if (agent) return agent.name || agent.hostname || agent.id;+ const extra = extraOptions.find(o => o.value === selectValue);+ if (extra) return extra.label;+ }+ return 'Local (this server)';+ }, [selectValue, eligible, extraOptions]);+return (<div className="target-picker"><Server size={14} className="target-picker__icon" />- <select value={selectValue} onChange={handleChange} className="target-picker__select">- {includeLocal && <option value="local">Local (this server)</option>}- {eligible.map(s => (- <option key={s.id} value={s.id}>- {s.name || s.hostname || s.id}- </option>- ))}- {extraOptions.map(o => (- <option key={o.value} value={o.value}>{o.label}</option>- ))}- </select>+ {optionCount <= 1 ? (+ <span className="target-picker__single">{singleLabel}</span>+ ) : (+ <select value={selectValue} onChange={handleChange} className="target-picker__select">+ {includeLocal && <option value="local">Local (this server)</option>}+ {eligible.map(s => (+ <option key={s.id} value={s.id}>+ {s.name || s.hostname || s.id}+ </option>+ ))}+ {extraOptions.map(o => (+ <option key={o.value} value={o.value}>{o.label}</option>+ ))}+ </select>+ )}</div>);}diff --git a/frontend/src/pages/Terminal.jsx b/frontend/src/pages/Terminal.jsxindex a3cebf4d..66e772ee 100644--- a/frontend/src/pages/Terminal.jsx+++ b/frontend/src/pages/Terminal.jsx@@ -20,12 +20,12 @@ import {// 'logs' stays first so the default landing keeps working on installs with no// paired agents (the interactive shell needs a connected agent).-const VALID_TABS = ['logs', 'journal', 'processes', 'services', 'terminal'];+const VALID_TABS = ['logs', 'journal', 'processes', 'services', 'shell'];// Section tabs rendered inline in the PageTopbar (Servers-style), routed via// /terminal/<tab>. Logs is the default landing (/terminal).const TERMINAL_TABS = [- { to: '/terminal/terminal', label: 'Terminal', icon: <TerminalIcon size={15} /> },+ { to: '/terminal/shell', label: 'Terminal', icon: <TerminalIcon size={15} /> },{ to: '/terminal', label: 'Log Files', end: true, icon: <FileText size={15} /> },{ to: '/terminal/journal', label: 'System Journal', icon: <ScrollText size={15} /> },{ to: '/terminal/processes', label: 'Processes', icon: <Cpu size={15} /> },@@ -44,7 +44,7 @@ const Terminal = () => {/><div className="tab-content">- {activeTab === 'terminal' && <TerminalShellTab />}+ {activeTab === 'shell' && <TerminalShellTab />}{activeTab === 'logs' && <LogFilesTab />}{activeTab === 'journal' && <JournalTab />}{activeTab === 'processes' && <ProcessesTab />}@@ -65,10 +65,12 @@ const TerminalShellTab = () => {useEffect(() => {(async () => {try {- const data = await api.getServers();- const list = Array.isArray(data) ? data : (data.servers || []);- setServers(list);- const firstOnline = list.find(s => s.status === 'online');+ const list = await api.getAvailableServers();+ const eligible = Array.isArray(list)+ ? list.filter(s => s.capabilities && s.capabilities.terminal)+ : [];+ setServers(eligible);+ const firstOnline = eligible.find(s => s.status === 'online');if (firstOnline) setSelectedId(firstOnline.id);} catch (err) {console.error('Failed to load servers:', err);@@ -87,7 +89,7 @@ const TerminalShellTab = () => {<div className="term-shell__grp">Agent servers</div>{loading && <div className="term-shell__hint">Loading servers…</div>}{!loading && servers.length === 0 && (- <div className="term-shell__hint">No servers paired yet.</div>+ <div className="term-shell__hint">No agent servers with shell access are paired yet.</div>)}{servers.map(s => {const online = s.status === 'online';@@ -117,7 +119,7 @@ const TerminalShellTab = () => {<p>{anyOnline? 'Pick a server on the left to open a shell.'- : 'Interactive shells run over the ServerKit agent. Pair a server (Servers → Add Server) and it will show up here.'}+ : 'Interactive shells run over the ServerKit agent. Pair a server (Servers → Add Server) with shell access and it will show up here.'}</p></div>)}diff --git a/frontend/src/styles/pages/_file-manager.scss b/frontend/src/styles/pages/_file-manager.scssindex 6dc53221..7b1a2ee7 100644--- a/frontend/src/styles/pages/_file-manager.scss+++ b/frontend/src/styles/pages/_file-manager.scss@@ -1777,13 +1777,18 @@ $drawer-width: 520px;background: var(--surface-2);border: 1px solid var(--border);border-radius: 8px;- .target-picker__select {+ .target-picker__select,+ .target-picker__single {background: transparent;border: none;color: var(--text-primary);font-size: $font-size-sm;outline: none;- cursor: pointer;+ }+ .target-picker__select { cursor: pointer; }+ .target-picker__single {+ padding-right: $space-1;+ white-space: nowrap;}.target-picker__icon { color: var(--text-secondary); }}