diff --git a/orion-ops-ui/src/api/asset/command-snippet.ts b/orion-ops-ui/src/api/asset/command-snippet.ts
index 4325a90f..80ffd328 100644
--- a/orion-ops-ui/src/api/asset/command-snippet.ts
+++ b/orion-ops-ui/src/api/asset/command-snippet.ts
@@ -29,7 +29,7 @@ export interface CommandSnippetQueryResponse extends CommandSnippetQueryResponse
export interface CommandSnippetQueryResponseExtra {
visible: boolean;
- expand: boolean;
+ expand?: boolean;
}
/**
diff --git a/orion-ops-ui/src/components/asset/host-group/host-group-tree.vue b/orion-ops-ui/src/components/asset/host-group/host-group-tree.vue
index ee47ed37..01a21501 100644
--- a/orion-ops-ui/src/components/asset/host-group/host-group-tree.vue
+++ b/orion-ops-ui/src/components/asset/host-group/host-group-tree.vue
@@ -74,10 +74,10 @@
-
-
暂无数据
+
+ 暂无数据
点击上方 '' 添加一个分组吧~
-
+
@@ -214,8 +214,8 @@
// 保存节点
const saveNode = async (node: TreeNodeData) => {
- const key = node.key
- const newTitle = node.title
+ const key = node.key;
+ const newTitle = node.title;
node.modCount = (node.modCount || 0) + 1;
if (node.modCount != 1) {
return;
diff --git a/orion-ops-ui/src/store/modules/terminal/index.ts b/orion-ops-ui/src/store/modules/terminal/index.ts
index 31451696..bdd65705 100644
--- a/orion-ops-ui/src/store/modules/terminal/index.ts
+++ b/orion-ops-ui/src/store/modules/terminal/index.ts
@@ -159,7 +159,20 @@ export default defineStore('terminal', {
if (host) {
this.openTerminal(host);
}
- }
+ },
+
+ // 获取当前终端会话
+ getCurrentTerminalSession(tips: boolean = true) {
+ const tab = this.tabManager.getCurrentTab();
+ if (!tab || tab.type !== TerminalTabType.TERMINAL) {
+ if (tips) {
+ Message.warning('请切换到终端标签页');
+ }
+ return;
+ }
+ // 获取处理器并截图
+ return this.sessionManager.getSession(tab.key);
+ },
},
diff --git a/orion-ops-ui/src/views/host/terminal/components/layout/terminal-right-sidebar.vue b/orion-ops-ui/src/views/host/terminal/components/layout/terminal-right-sidebar.vue
index 88066dd4..54c5975c 100644
--- a/orion-ops-ui/src/views/host/terminal/components/layout/terminal-right-sidebar.vue
+++ b/orion-ops-ui/src/views/host/terminal/components/layout/terminal-right-sidebar.vue
@@ -30,7 +30,7 @@
const emits = defineEmits(['openSftp', 'openTransfer']);
- const { tabManager, sessionManager } = useTerminalStore();
+ const { getCurrentTerminalSession } = useTerminalStore();
const snippetRef = ref();
@@ -67,15 +67,10 @@
// 终端截屏
const screenshot = () => {
- const tab = tabManager.getCurrentTab();
- if (!tab || tab.type !== TerminalTabType.TERMINAL) {
- Message.warning('请切换到终端标签页');
- return;
+ const handler = getCurrentTerminalSession()?.handler;
+ if (handler && handler.enabledStatus('screenshot')) {
+ handler.screenshot();
}
- // 获取处理器并截图
- sessionManager.getSession(tab.key)
- ?.handler
- ?.screenshot();
};
diff --git a/orion-ops-ui/src/views/host/terminal/components/setting/terminal-shortcut-keys-block.vue b/orion-ops-ui/src/views/host/terminal/components/setting/terminal-shortcut-keys-block.vue
index 5f528085..652d0f48 100644
--- a/orion-ops-ui/src/views/host/terminal/components/setting/terminal-shortcut-keys-block.vue
+++ b/orion-ops-ui/src/views/host/terminal/components/setting/terminal-shortcut-keys-block.vue
@@ -17,7 +17,7 @@
import type { TerminalShortcutKeyEditable } from '@/store/modules/terminal/types';
+ import type { VNodeRef } from 'vue';
import { nextTick } from 'vue';
defineProps<{
diff --git a/orion-ops-ui/src/views/host/terminal/components/snippet/snippet-drawer.vue b/orion-ops-ui/src/views/host/terminal/components/snippet/snippet-drawer.vue
index 142c888e..1fa20adb 100644
--- a/orion-ops-ui/src/views/host/terminal/components/snippet/snippet-drawer.vue
+++ b/orion-ops-ui/src/views/host/terminal/components/snippet/snippet-drawer.vue
@@ -1,7 +1,8 @@
+ :footer="false"
+ @close="onClose">
@@ -10,7 +11,7 @@
-
+
+
+
+
+
+
+
+ 暂无数据
+ 点击上方 '' 添加一条数据吧~
+
-
-
+
@@ -56,9 +71,11 @@
import { getCommandSnippetList } from '@/api/asset/command-snippet';
import SnippetItem from './snippet-item.vue';
import SnippetGroup from './snippet-group.vue';
+ import { useTerminalStore } from '@/store';
const { loading, setLoading } = useLoading();
const { visible, setVisible } = useVisible();
+ const { getCurrentTerminalSession } = useTerminalStore();
const filterValue = ref();
const snippet = ref();
@@ -70,6 +87,8 @@
await fetchData();
};
+ // TODO 新增
+
defineExpose({ open });
// 加载数据
@@ -106,13 +125,18 @@
});
};
- onMounted(() => {
- open();
- });
+ // 关闭
+ const onClose = () => {
+ setVisible(false);
+ // 聚焦终端
+ getCurrentTerminalSession(false)?.focus();
+ };
+
+ // fixme
+ onMounted(open);
-