Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev
This commit is contained in:
@@ -23,8 +23,14 @@ class TerminalManager:
|
|||||||
|
|
||||||
def _start_idle_check(self) -> None:
|
def _start_idle_check(self) -> None:
|
||||||
"""Start the idle timeout background task."""
|
"""Start the idle timeout background task."""
|
||||||
if self._idle_check_task is None or self._idle_check_task.done():
|
if self._idle_check_task is not None and not self._idle_check_task.done():
|
||||||
self._idle_check_task = asyncio.create_task(self._idle_check_loop())
|
return
|
||||||
|
try:
|
||||||
|
loop = asyncio.get_running_loop()
|
||||||
|
self._idle_check_task = loop.create_task(self._idle_check_loop())
|
||||||
|
except RuntimeError:
|
||||||
|
# No event loop running yet, will be started lazily
|
||||||
|
pass
|
||||||
|
|
||||||
async def _idle_check_loop(self) -> None:
|
async def _idle_check_loop(self) -> None:
|
||||||
"""Periodically check for idle sessions and clean them up."""
|
"""Periodically check for idle sessions and clean them up."""
|
||||||
@@ -54,6 +60,9 @@ class TerminalManager:
|
|||||||
container_id: str,
|
container_id: str,
|
||||||
) -> TerminalSession:
|
) -> TerminalSession:
|
||||||
"""Get existing session or create a new one."""
|
"""Get existing session or create a new one."""
|
||||||
|
# Ensure idle check is running (lazy start)
|
||||||
|
self._start_idle_check()
|
||||||
|
|
||||||
instance_id_str = str(instance_id)
|
instance_id_str = str(instance_id)
|
||||||
|
|
||||||
# Check for existing session
|
# Check for existing session
|
||||||
|
|||||||
@@ -201,7 +201,15 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
|||||||
term.loadAddon(fitAddon);
|
term.loadAddon(fitAddon);
|
||||||
term.loadAddon(new WebLinksAddon());
|
term.loadAddon(new WebLinksAddon());
|
||||||
|
|
||||||
term.open(terminalRef.current);
|
// Ensure container has explicit dimensions before xterm initializes
|
||||||
|
const container = terminalRef.current;
|
||||||
|
const parentRect = container.parentElement?.getBoundingClientRect();
|
||||||
|
if (parentRect) {
|
||||||
|
container.style.width = `${parentRect.width}px`;
|
||||||
|
container.style.height = `${parentRect.height}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
term.open(container);
|
||||||
|
|
||||||
// Connect WebSocket
|
// Connect WebSocket
|
||||||
const ws = connectWebSocket();
|
const ws = connectWebSocket();
|
||||||
|
|||||||
Reference in New Issue
Block a user