Fix konzola: auto-connect, welcome poruka, redirect posle Pusti
- Auto-connect WS na running sesije kad se otvori /console - Welcome poruka u terminalu kad nema aktivne sesije - Redirect na /console posle uspešnog "Pusti" klika - CSS fix: min-height i position za xterm kontejner Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c970cb2419
commit
64df1e784c
@ -694,6 +694,8 @@ body {
|
|||||||
|
|
||||||
.console-terminal {
|
.console-terminal {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: var(--bg-deep);
|
background: var(--bg-deep);
|
||||||
}
|
}
|
||||||
@ -703,6 +705,10 @@ body {
|
|||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.console-terminal .xterm-screen {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.console-terminal .xterm-viewport {
|
.console-terminal .xterm-viewport {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -142,7 +142,10 @@ function initTerminal(idx) {
|
|||||||
sessions[idx].fitAddon = fitAddon;
|
sessions[idx].fitAddon = fitAddon;
|
||||||
sessions[idx].ws = null;
|
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 ─────────────────────────────
|
// ── WebSocket connection ─────────────────────────────
|
||||||
@ -313,6 +316,24 @@ window.addEventListener('resize', function() {
|
|||||||
|
|
||||||
// ── Initialize ───────────────────────────────────────
|
// ── Initialize ───────────────────────────────────────
|
||||||
initTerminal(0);
|
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() {});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -4,9 +4,11 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>KAOS Dashboard</title>
|
<title>KAOS Dashboard</title>
|
||||||
|
<script>(function(){var m=localStorage.getItem('kaos-theme')||'dark',t=m;if(m==='auto'){t=window.matchMedia('(prefers-color-scheme:light)').matches?'light':'dark'}document.documentElement.setAttribute('data-theme',t)})()</script>
|
||||||
<link rel="stylesheet" href="/static/style.css">
|
<link rel="stylesheet" href="/static/style.css">
|
||||||
<script src="/static/htmx.min.js"></script>
|
<script src="/static/htmx.min.js"></script>
|
||||||
<script src="/static/sortable.min.js"></script>
|
<script src="/static/sortable.min.js"></script>
|
||||||
|
<script src="/static/theme.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -22,6 +24,11 @@
|
|||||||
autocomplete="off">
|
autocomplete="off">
|
||||||
<div id="search-results" class="search-results-dropdown"></div>
|
<div id="search-results" class="search-results-dropdown"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="theme-toggle">
|
||||||
|
<button class="theme-btn" data-theme-mode="light" onclick="setTheme('light')" title="Svetla tema">☀️</button>
|
||||||
|
<button class="theme-btn" data-theme-mode="dark" onclick="setTheme('dark')" title="Tamna tema">🌙</button>
|
||||||
|
<button class="theme-btn" data-theme-mode="auto" onclick="setTheme('auto')" title="Sistemska tema">🔄</button>
|
||||||
|
</div>
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
<a href="/" class="btn btn-active">Kanban</a>
|
<a href="/" class="btn btn-active">Kanban</a>
|
||||||
<a href="/docs" class="btn">Dokumenti</a>
|
<a href="/docs" class="btn">Dokumenti</a>
|
||||||
@ -79,6 +86,8 @@ document.body.addEventListener('htmx:afterRequest', function(e) {
|
|||||||
if (xhr.status === 200) {
|
if (xhr.status === 200) {
|
||||||
var data = JSON.parse(xhr.responseText);
|
var data = JSON.parse(xhr.responseText);
|
||||||
showToast(data.exec_id ? 'Pokrenuto u sesiji ' + data.session : 'Pokrenuto', 'success');
|
showToast(data.exec_id ? 'Pokrenuto u sesiji ' + data.session : 'Pokrenuto', 'success');
|
||||||
|
// Redirect to console after short delay so user can see output
|
||||||
|
setTimeout(function() { window.location.href = '/console'; }, 800);
|
||||||
} else {
|
} else {
|
||||||
var data = JSON.parse(xhr.responseText);
|
var data = JSON.parse(xhr.responseText);
|
||||||
showToast(data.error || 'Greška', 'error');
|
showToast(data.error || 'Greška', 'error');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user