From a6db3ddfa446b92554f71c93eb3f3379e866ee0c Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Tue, 17 Mar 2026 13:41:28 -0400 Subject: [PATCH] feat: fix 6 frontend issues (F-1, F-5, F-6, F-7, F-10, F-11) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit F-1 (Theme Application): Theme selection now applies to all active xterm.js terminals at runtime via session store reactive propagation. TerminalView watches sessionStore.activeTheme and calls terminal.options.theme = {...}. F-5 (Tab Badges): isRootUser() now checks session.username, connection options JSON, and connection tags — no longer hardcoded to false. F-6 (Keyboard Shortcuts): Added Ctrl+W (close tab), Ctrl+Tab / Ctrl+Shift+Tab (next/prev tab), Ctrl+1–9 (tab by index), Ctrl+B (toggle sidebar). Input field guard prevents shortcuts from firing while typing. F-7 (Status Bar Dimensions): StatusBar now reads live cols×rows from sessionStore.activeDimensions. TerminalView hooks onResize to call sessionStore.setTerminalDimensions(). Falls back to "120×40" until first resize. F-10 (Multiple Sessions): Removed the "already connected" early-return guard. Multiple SSH/RDP sessions to the same host are now allowed. Disambiguated tab names auto-generated: "Asgard", "Asgard (2)", "Asgard (3)", etc. F-11 (First-Run MobaConf): onMounted checks connectionStore.connections.length after loadAll(). If empty, shows a dialog offering to import from MobaXTerm. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/components/common/StatusBar.vue | 5 +- frontend/src/components/session/TabBar.vue | 19 +++- .../src/components/terminal/TerminalView.vue | 44 ++++++++ frontend/src/layouts/MainLayout.vue | 106 +++++++++++++++++- frontend/src/stores/session.store.ts | 72 ++++++++++-- 5 files changed, 230 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/common/StatusBar.vue b/frontend/src/components/common/StatusBar.vue index b34c9e2..0c22239 100644 --- a/frontend/src/components/common/StatusBar.vue +++ b/frontend/src/components/common/StatusBar.vue @@ -53,7 +53,10 @@ Theme: {{ activeThemeName }} UTF-8 - 120×40 + + {{ sessionStore.activeDimensions.cols }}×{{ sessionStore.activeDimensions.rows }} + + 120×40 diff --git a/frontend/src/components/session/TabBar.vue b/frontend/src/components/session/TabBar.vue index 8d5f6a4..0d93d7b 100644 --- a/frontend/src/components/session/TabBar.vue +++ b/frontend/src/components/session/TabBar.vue @@ -85,11 +85,24 @@ function getSessionTags(session: Session): string[] { /** Check if the connection for this session uses the root user. */ function isRootUser(session: Session): boolean { + // Check username stored on the session object (set during connect) + if (session.username === "root") return true; + + // Fall back to checking the connection's options JSON for a stored username const conn = connectionStore.connections.find((c) => c.id === session.connectionId); if (!conn) return false; - // TODO: Get actual username from the credential or session - // For now, check mock data — root user detection will come from the session/credential store - return false; + + if (conn.options) { + try { + const opts = JSON.parse(conn.options); + if (opts?.username === "root") return true; + } catch { + // ignore malformed options + } + } + + // Also check if "root" appears in the connection tags + return conn.tags?.includes("root") ?? false; } /** Return Tailwind classes for environment tag badges. */ diff --git a/frontend/src/components/terminal/TerminalView.vue b/frontend/src/components/terminal/TerminalView.vue index da78db5..3be2e5f 100644 --- a/frontend/src/components/terminal/TerminalView.vue +++ b/frontend/src/components/terminal/TerminalView.vue @@ -9,6 +9,7 @@