feat(terminal-dashboard): improve UX for pane/session management

- Add confirmation dialog when closing pane with active session
- Add explicit "Close Session" button to terminate backend PTY
- Handle "session not found" scenario with user-friendly message
- Add i18n keys for new UI elements (en/zh)
This commit is contained in:
catlog22
2026-02-20 21:21:02 +08:00
parent aa9f23782a
commit 1de283751b
5 changed files with 101 additions and 4 deletions

View File

@@ -361,6 +361,56 @@ export const useSessionManagerStore = create<SessionManagerStore>()(
throw error;
}
},
// ========== Session Lock Actions ==========
lockSession: (sessionId: string, reason: string, executionId?: string) => {
set(
(state) => {
const existing = state.terminalMetas[sessionId];
if (!existing) return state;
return {
terminalMetas: {
...state.terminalMetas,
[sessionId]: {
...existing,
status: 'locked' as TerminalStatus,
isLocked: true,
lockReason: reason,
lockedByExecutionId: executionId,
lockedAt: new Date().toISOString(),
},
},
};
},
false,
'lockSession'
);
},
unlockSession: (sessionId: string) => {
set(
(state) => {
const existing = state.terminalMetas[sessionId];
if (!existing) return state;
return {
terminalMetas: {
...state.terminalMetas,
[sessionId]: {
...existing,
status: 'active' as TerminalStatus,
isLocked: false,
lockReason: undefined,
lockedByExecutionId: undefined,
lockedAt: undefined,
},
},
};
},
false,
'unlockSession'
);
},
}),
{ name: 'SessionManagerStore' }
)