From 523d9b02b45ab9e895a81dacab312491c9aabe1d Mon Sep 17 00:00:00 2001 From: Andy Dixon Date: Thu, 21 May 2026 12:15:49 +0100 Subject: [PATCH] Refactor SnippetLibrary and State classes for improved readability and consistency - Updated formatting and indentation in snippets.js for better code clarity. - Enhanced error handling and notifications in sendToActiveSession method. - Improved variable resolution logic for command snippets. - Added new methods for managing session state in state.js. - Introduced new split pane functionality in terminal.js for better user experience. - Enhanced modal handling and user notifications across various components. --- frontend/src/js/app.js | 55 +++- frontend/src/js/commands.js | 14 + frontend/src/js/sftp.js | 115 +++++-- frontend/src/js/snippets.js | 576 +++++++++++++++++++----------------- frontend/src/js/state.js | 176 +++++------ frontend/src/js/terminal.js | 70 ++++- 6 files changed, 588 insertions(+), 418 deletions(-) diff --git a/frontend/src/js/app.js b/frontend/src/js/app.js index 16a21e3..254d80b 100644 --- a/frontend/src/js/app.js +++ b/frontend/src/js/app.js @@ -604,9 +604,11 @@ */ selectBroadcastTargets() { const { createElement, escapeHtml } = window.NexusTerminal; - const sessions = this.state.getAllSessions().filter( - (s) => s.state === "connected" && s.id !== this.state.activeSessionId, - ); + const sessions = this.state + .getAllSessions() + .filter( + (s) => s.state === "connected" && s.id !== this.state.activeSessionId, + ); if (sessions.length === 0) { this.notifications.error("No other connected sessions to broadcast to"); @@ -620,8 +622,13 @@ let listHtml = ""; for (const s of sessions) { const profile = this.state.getProfile(s.profileId); - const label = profile ? (profile.displayName || profile.host) : s.id.substring(0, 8); - const checked = currentTargets.size === 0 || currentTargets.has(s.id) ? "checked" : ""; + const label = profile + ? profile.displayName || profile.host + : s.id.substring(0, 8); + const checked = + currentTargets.size === 0 || currentTargets.has(s.id) + ? "checked" + : ""; listHtml += `