diff --git a/orion-ops-ui/src/store/modules/terminal/index.ts b/orion-ops-ui/src/store/modules/terminal/index.ts index f8d33044..89e1a6cc 100644 --- a/orion-ops-ui/src/store/modules/terminal/index.ts +++ b/orion-ops-ui/src/store/modules/terminal/index.ts @@ -8,7 +8,7 @@ import type { TerminalShortcutSetting, TerminalState } from './types'; -import type { PanelSessionTab, TerminalPanelTabItem } from '@/views/host/terminal/types/terminal.type'; +import type { ISshSession, PanelSessionTab, TerminalPanelTabItem } from '@/views/host/terminal/types/terminal.type'; import type { AuthorizedHostQueryResponse } from '@/api/asset/asset-authorized-data'; import { getCurrentAuthorizedHost } from '@/api/asset/asset-authorized-data'; import type { HostQueryResponse } from '@/api/asset/host'; @@ -64,7 +64,8 @@ export default defineStore('terminal', { } as TerminalShortcutSetting, }, hosts: {} as AuthorizedHostQueryResponse, - tabManager: new TerminalTabManager(TerminalTabs.NEW_CONNECTION), + // fixme + tabManager: new TerminalTabManager(TerminalTabs.TERMINAL_PANEL), panelManager: new TerminalPanelManager(), sessionManager: new TerminalSessionManager() }), @@ -173,8 +174,8 @@ export default defineStore('terminal', { } }, - // 检查当前是否为终端页面 并且获取当前终端会话 - getAndCheckCurrentTerminalSession(tips: boolean = true) { + // 检查当前是否为终端页面 并且获取当前 ssh 会话 + getAndCheckCurrentSshSession(tips: boolean = true) { // 获取当前 activeTab const activeTab = this.tabManager.active; if (activeTab !== TerminalTabs.TERMINAL_PANEL.key) { @@ -184,15 +185,15 @@ export default defineStore('terminal', { return; } // 获取当前会话 - const session = this.getCurrentTerminalSession(); + const session = this.getCurrentSshSession(); if (!session && tips) { Message.warning('请打开终端'); } return session; }, - // 获取当前终端会话 - getCurrentTerminalSession() { + // 获取当前 ssh 会话 + getCurrentSshSession() { // 获取面板会话 const sessionTab = this.panelManager .getCurrentPanel() @@ -201,7 +202,7 @@ export default defineStore('terminal', { return; } // 获取会话 - return this.sessionManager.getSession(sessionTab.key); + return this.sessionManager.getSession(sessionTab.key); }, }, diff --git a/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-list-drawer.vue b/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-list-drawer.vue index 11634f17..9c63fd91 100644 --- a/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-list-drawer.vue +++ b/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-list-drawer.vue @@ -83,7 +83,7 @@ const { loading, setLoading } = useLoading(); const { visible, setVisible } = useVisible(); - const { getCurrentTerminalSession } = useTerminalStore(); + const { getCurrentSshSession } = useTerminalStore(); const cacheStore = useCacheStore(); const formDrawer = ref(); @@ -267,7 +267,7 @@ // 关闭回调 const onClose = () => { // 聚焦终端 - getCurrentTerminalSession()?.focus(); + getCurrentSshSession()?.focus(); }; diff --git a/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-list-item.vue b/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-list-item.vue index 3fb5be3c..c9e71ccb 100644 --- a/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-list-item.vue +++ b/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-list-item.vue @@ -125,7 +125,7 @@ }>(); const { copy } = useCopy(); - const { getAndCheckCurrentTerminalSession } = useTerminalStore(); + const { getAndCheckCurrentSshSession } = useTerminalStore(); let clickCount = 0; @@ -184,7 +184,7 @@ // 写入命令 const write = (command: string) => { - const handler = getAndCheckCurrentTerminalSession()?.handler; + const handler = getAndCheckCurrentSshSession()?.handler; if (handler && handler.enabledStatus('checkAppendMissing')) { handler.checkAppendMissing(command); } diff --git a/orion-ops-ui/src/views/host/terminal/components/layout/main-content.vue b/orion-ops-ui/src/views/host/terminal/components/layout/main-content.vue index e21ada5b..8855850d 100644 --- a/orion-ops-ui/src/views/host/terminal/components/layout/main-content.vue +++ b/orion-ops-ui/src/views/host/terminal/components/layout/main-content.vue @@ -45,17 +45,17 @@ import TerminalShortcutSetting from '../setting/shortcut/terminal-shortcut-setting.vue'; import TerminalPanelsView from '@/views/host/terminal/components/layout/terminal-panels-view.vue'; - const { preference, tabManager, getCurrentTerminalSession } = useTerminalStore(); + const { preference, tabManager, getCurrentSshSession } = useTerminalStore(); // 监听 tab 切换 watch(() => tabManager.active, (active, before) => { // 失焦 tab if (before === TerminalTabs.TERMINAL_PANEL.key) { - getCurrentTerminalSession()?.blur(); + getCurrentSshSession()?.blur(); } // 聚焦 tab if (active === TerminalTabs.TERMINAL_PANEL.key) { - getCurrentTerminalSession()?.focus(); + getCurrentSshSession()?.focus(); } // 修改标题 document.title = Object.values(TerminalTabs) diff --git a/orion-ops-ui/src/views/host/terminal/components/layout/right-sidebar.vue b/orion-ops-ui/src/views/host/terminal/components/layout/right-sidebar.vue index d8084384..4a8e942f 100644 --- a/orion-ops-ui/src/views/host/terminal/components/layout/right-sidebar.vue +++ b/orion-ops-ui/src/views/host/terminal/components/layout/right-sidebar.vue @@ -28,7 +28,7 @@ const emits = defineEmits(['openTransfer']); - const { getAndCheckCurrentTerminalSession } = useTerminalStore(); + const { getAndCheckCurrentSshSession } = useTerminalStore(); const snippetRef = ref(); @@ -59,7 +59,7 @@ // 终端截屏 const screenshot = () => { - const handler = getAndCheckCurrentTerminalSession()?.handler; + const handler = getAndCheckCurrentSshSession()?.handler; if (handler && handler.enabledStatus('screenshot')) { handler.screenshot(); } diff --git a/orion-ops-ui/src/views/host/terminal/components/layout/terminal-panel.vue b/orion-ops-ui/src/views/host/terminal/components/layout/terminal-panel.vue index 56534ca4..ee88e1d2 100644 --- a/orion-ops-ui/src/views/host/terminal/components/layout/terminal-panel.vue +++ b/orion-ops-ui/src/views/host/terminal/components/layout/terminal-panel.vue @@ -44,7 +44,7 @@