diff --git a/code/web/static/style.css b/code/web/static/style.css index 1a5ad53..6613619 100644 --- a/code/web/static/style.css +++ b/code/web/static/style.css @@ -694,6 +694,8 @@ body { .console-terminal { flex: 1; + min-height: 0; + position: relative; overflow: hidden; background: var(--bg-deep); } @@ -703,6 +705,10 @@ body { padding: 4px; } +.console-terminal .xterm-screen { + height: 100%; +} + .console-terminal .xterm-viewport { overflow-y: auto; } diff --git a/code/web/templates/console.html b/code/web/templates/console.html index 85e342f..0b77342 100644 --- a/code/web/templates/console.html +++ b/code/web/templates/console.html @@ -142,7 +142,10 @@ function initTerminal(idx) { sessions[idx].fitAddon = fitAddon; sessions[idx].ws = null; - setTimeout(function() { fitAddon.fit(); }, 50); + setTimeout(function() { + fitAddon.fit(); + term.write('\x1b[33mSesija ' + num + ' — upiši komandu dole i pritisni Enter\x1b[0m\r\n'); + }, 50); } // ── WebSocket connection ───────────────────────────── @@ -313,6 +316,24 @@ window.addEventListener('resize', function() { // ── Initialize ─────────────────────────────────────── initTerminal(0); + +// Auto-connect to running sessions on page load +fetch('/console/sessions') + .then(function(r) { return r.json(); }) + .then(function(data) { + for (var i = 0; i < data.length; i++) { + if (data[i].status === 'running') { + var idx = data[i].session - 1; + if (idx === 1 && !sessions[1].term) { + document.getElementById('panel-2').style.display = 'flex'; + document.getElementById('toggle-panel').textContent = '- Sesija 2'; + initTerminal(1); + } + connectWS(idx); + } + } + }) + .catch(function() {}); diff --git a/code/web/templates/layout.html b/code/web/templates/layout.html index 646305b..d2acebe 100644 --- a/code/web/templates/layout.html +++ b/code/web/templates/layout.html @@ -4,9 +4,11 @@ KAOS Dashboard + +
@@ -22,6 +24,11 @@ autocomplete="off">
+
+ + + +