回车重连.

This commit is contained in:
lijiahang
2024-04-23 11:07:01 +08:00
parent c8c947d8a8
commit b6ee28731b
10 changed files with 46 additions and 122 deletions

View File

@@ -169,9 +169,12 @@ export default defineStore('terminal', {
async reOpenSession(sessionId: string, panelIndex: number = 0) {
// 切换到终端面板页面
this.tabManager.openTab(TerminalTabs.TERMINAL_PANEL);
// 获取当前面板并且分配新的 sessionId
// 获取当前面板 tab 并且分配新的 sessionId
const panel = this.panelManager.getPanel(panelIndex);
const tab = panel.getTab(sessionId);
const tab = panel.items.find(s => s.sessionId === sessionId);
if (!tab) {
return;
}
const newSessionId = tab.sessionId = nextId(10);
// 添加到最近连接
this.hosts.latestHosts = [...new Set([tab.hostId, ...this.hosts.latestHosts])];