diff --git a/orion-ops-ui/src/store/modules/terminal/index.ts b/orion-ops-ui/src/store/modules/terminal/index.ts index 8ad38f55..9acada97 100644 --- a/orion-ops-ui/src/store/modules/terminal/index.ts +++ b/orion-ops-ui/src/store/modules/terminal/index.ts @@ -4,7 +4,8 @@ import { getPreference, updatePreference } from '@/api/user/preference'; import { Message } from '@arco-design/web-vue'; import { useDark } from '@vueuse/core'; import { DEFAULT_SCHEMA } from '@/views/host/terminal/types/terminal.theme'; -import TerminalDispatcher from '@/views/host/terminal/handler/TerminalDispatcher'; +import TerminalDispatcher from '@/views/host/terminal/handler/terminal-dispatcher'; +import TerminalTabManager from '@/views/host/terminal/handler/terminal-tab-manager'; // 暗色主题 export const DarkTheme = { @@ -29,6 +30,7 @@ export default defineStore('terminal', { displaySetting: {} as TerminalDisplaySetting, themeSchema: {} as TerminalThemeSchema }, + tabs: new TerminalTabManager(), dispatcher: new TerminalDispatcher() }), diff --git a/orion-ops-ui/src/store/modules/terminal/types.ts b/orion-ops-ui/src/store/modules/terminal/types.ts index b7cae650..83016e58 100644 --- a/orion-ops-ui/src/store/modules/terminal/types.ts +++ b/orion-ops-ui/src/store/modules/terminal/types.ts @@ -4,6 +4,7 @@ import { Terminal } from 'xterm'; export interface TerminalState { isDarkTheme: Ref; preference: TerminalPreference; + tabs: ITerminalTabManager; dispatcher: ITerminalDispatcher; } @@ -66,11 +67,11 @@ export interface TerminalTabItem { [key: string]: unknown; } -// 终端调度器 -export interface ITerminalDispatcher { - // 当前活跃 tab +// 终端 tab 管理器定义 +export interface ITerminalTabManager { + // 当前 tab active: string; - // 所有 tab + // 全部 tab items: Array; // 点击 tab @@ -79,6 +80,12 @@ export interface ITerminalDispatcher { deleteTab: (key: string) => void; // 打开 tab openTab: (tab: TerminalTabItem) => void; + // 清空 + clear: () => void; +} + +// 终端调度器 +export interface ITerminalDispatcher { // 打开终端 openTerminal: (record: any) => void; // 注册终端处理器 diff --git a/orion-ops-ui/src/views/host/terminal/components/layout/terminal-content.vue b/orion-ops-ui/src/views/host/terminal/components/layout/terminal-content.vue index 40199b8d..ae6f4dfe 100644 --- a/orion-ops-ui/src/views/host/terminal/components/layout/terminal-content.vue +++ b/orion-ops-ui/src/views/host/terminal/components/layout/terminal-content.vue @@ -1,8 +1,8 @@