/** * javascript/terminal.js * * Terminal panel: opens a real, fully interactive terminal inline (as an * '; }, 200); }).catch(function (err) { resetFrame('Could not open terminal: ' + P.escapeHtml(err.message)); }).finally(function () { btn.disabled = false; }); } function disconnect() { if (!openName) return; const btn = P.el('term-disconnect-btn'); btn.disabled = true; closeCurrent().finally(function () { resetFrame('Disconnected. Pick a container and click "Open Terminal" to start a new session.'); }); } function init() { P.el('term-open-btn').addEventListener('click', openLiveTerminal); P.el('term-disconnect-btn').addEventListener('click', disconnect); return loadContainers(); } // refresh() only repopulates the container select — it must never touch // #term-frame-wrap, or an already-open terminal would be torn down out // from under the user just by switching tabs and back. P.registerPanel('terminal', { init: init, refresh: loadContainers }); })();