diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/CodeGenerators.java b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/CodeGenerators.java index ef578cb4..450262ed 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/CodeGenerators.java +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/CodeGenerators.java @@ -45,11 +45,12 @@ public class CodeGenerators { // .color("blue", "gray", "red", "green", "white") // .valueUseFields() // .build(), - Template.create("command_snippet_group", "命令片段分组", "command") + Template.create("command_snippet", "命令片段", "command") .disableUnitTest() - .cache("command:snippet:group:{}", "命令片段分组 ${userId}") + .cache("command:snippet:group:{}", "命令片段 ${userId}") .expire(1, TimeUnit.DAYS) - .vue("host", "command-snippet-group") + .vue("asset", "command-snippet") + .enableDrawerForm() .build(), }; // jdbc 配置 - 使用配置文件 diff --git a/orion-ops-ui/src/components/view/editor/index.vue b/orion-ops-ui/src/components/view/editor/index.vue index bc09b9cb..8d629092 100644 --- a/orion-ops-ui/src/components/view/editor/index.vue +++ b/orion-ops-ui/src/components/view/editor/index.vue @@ -11,7 +11,7 @@ diff --git a/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-form-drawer.vue b/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-form-drawer.vue new file mode 100644 index 00000000..827e7631 --- /dev/null +++ b/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-form-drawer.vue @@ -0,0 +1,152 @@ + + + + + + + diff --git a/orion-ops-ui/src/views/host/terminal/components/snippet/snippet-group.vue b/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-group.vue similarity index 90% rename from orion-ops-ui/src/views/host/terminal/components/snippet/snippet-group.vue rename to orion-ops-ui/src/views/host/command-snippet/components/command-snippet-group.vue index ad622246..3585baea 100644 --- a/orion-ops-ui/src/views/host/terminal/components/snippet/snippet-group.vue +++ b/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-group.vue @@ -10,7 +10,7 @@ @@ -21,14 +21,14 @@ @@ -116,6 +116,8 @@ import { useTerminalStore } from '@/store'; import { useDebounceFn } from '@vueuse/core'; import useCopy from '@/hooks/copy'; + import { inject } from 'vue'; + import { openUpdateSnippetKey, removeSnippetKey } from '../types/const'; const props = defineProps<{ item: CommandSnippetQueryResponse @@ -124,10 +126,16 @@ const { copy } = useCopy(); const { getCurrentTerminalSession } = useTerminalStore(); - // TODO 修改 删除 拼接有bug + // TODO 多行拼接有bug let clickCount = 0; + // 修改 + const openUpdateSnippet = inject<(item: CommandSnippetQueryResponse) => void>(openUpdateSnippetKey); + + // 删除 + const removeSnippet = inject<(id: number) => void>(removeSnippetKey); + // 点击命令 const clickItem = () => { if (++clickCount == 2) { @@ -161,7 +169,7 @@ // 执行 const exec = () => { - write(props.item.command + '\n'); + write(props.item.command + '\r\n'); }; // 写入命令 diff --git a/orion-ops-ui/src/views/host/terminal/components/snippet/snippet-drawer.vue b/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-list-drawer.vue similarity index 67% rename from orion-ops-ui/src/views/host/terminal/components/snippet/snippet-drawer.vue rename to orion-ops-ui/src/views/host/command-snippet/components/command-snippet-list-drawer.vue index 045fdc72..6fcd67a2 100644 --- a/orion-ops-ui/src/views/host/terminal/components/snippet/snippet-drawer.vue +++ b/orion-ops-ui/src/views/host/command-snippet/components/command-snippet-list-drawer.vue @@ -15,7 +15,9 @@
- + @@ -43,40 +45,45 @@
- +
+ +