diff --git a/plugin/plugin.json b/plugin/plugin.json
index 870341e..ffb93ba 100644
--- a/plugin/plugin.json
+++ b/plugin/plugin.json
@@ -32,6 +32,15 @@
],
"icon": "features/code.png"
},
+ {
+ "code": "composer",
+ "explain": "运行可视化编排",
+ "cmds": [
+ "可视化编排",
+ "RunComposer"
+ ],
+ "icon": "features/code.png"
+ },
{
"code": "newcommand",
"explain": "快速新建快捷命令",
diff --git a/src/components/CommandEditor.vue b/src/components/CommandEditor.vue
index 5402754..64e68b2 100644
--- a/src/components/CommandEditor.vue
+++ b/src/components/CommandEditor.vue
@@ -38,7 +38,7 @@
@program-changed="programChanged"
@run="runCurrentCommand"
@save="saveCurrentCommand"
- @use-composer="handleComposer"
+ @show-composer="showComposer = true"
/>
@@ -71,6 +71,11 @@
@toggle-fullscreen="toggleFullscreen"
/>
+
+
+
+
+
@@ -82,6 +87,7 @@ import CommandSideBar from "components/editor/CommandSideBar";
import CommandLanguageBar from "components/editor/CommandLanguageBar";
import EditorTools from "components/editor/EditorTools";
import CommandRunResult from "components/CommandRunResult";
+import CommandComposer from "components/composer/CommandComposer.vue";
// 预加载 MonacoEditor
const MonacoEditorPromise = import("components/editor/MonacoEditor");
@@ -108,6 +114,7 @@ export default {
CommandSideBar,
CommandRunResult,
CommandLanguageBar,
+ CommandComposer,
EditorTools,
},
data() {
@@ -115,7 +122,10 @@ export default {
programLanguages: Object.keys(this.$root.programs),
sideBarWidth: 200,
languageBarHeight: 40,
- canCommandSave: this.action.type === "code" ? false : true,
+ showComposer: false,
+ isRunCodePage: this.action.type === "run",
+ canCommandSave: this.action.type !== "run",
+ showSidebar: this.action.type !== "run",
quickcommandInfo: {
program: "quickcommand",
cmd: "",
@@ -131,8 +141,6 @@ export default {
},
},
resultMaxLength: 10000,
- showSidebar: this.action.type !== "run",
- isRunCodePage: this.action.type === "run",
listener: null,
isFullscreen: false,
};
@@ -162,10 +170,9 @@ export default {
methods: {
// 命令初始化
commandInit() {
- let quickCommandInfo =
- this.action.type === "run"
- ? this.$root.utools.getDB("cfg_codeHistory")
- : this.action.data;
+ let quickCommandInfo = this.isRunCodePage
+ ? this.$root.utools.getDB("cfg_codeHistory")
+ : this.action.data;
quickCommandInfo?.program &&
Object.assign(
this.quickcommandInfo,
diff --git a/src/components/ComposerEditor.vue b/src/components/ComposerEditor.vue
new file mode 100644
index 0000000..19b7cdb
--- /dev/null
+++ b/src/components/ComposerEditor.vue
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
diff --git a/src/components/composer/CommandComposer.vue b/src/components/composer/CommandComposer.vue
index 1fa6e53..0de8d9f 100644
--- a/src/components/composer/CommandComposer.vue
+++ b/src/components/composer/CommandComposer.vue
@@ -12,6 +12,7 @@
@@ -76,7 +77,13 @@ export default defineComponent({
hasCommandNeedLoading: false,
};
},
- emits: ["use-composer", "update:modelValue"],
+ props: {
+ showCloseButton: {
+ type: Boolean,
+ default: true,
+ },
+ },
+ emits: ["use-composer"],
methods: {
addCommand(action) {
let newAction = window.lodashM.cloneDeep(action);
@@ -99,8 +106,10 @@ export default defineComponent({
case "run":
return this.runFlow(flow);
default:
- this.$emit("use-composer", { type, code });
- return this.$emit("update:modelValue", false);
+ return this.$emit("use-composer", {
+ type,
+ code: this.generateFlowCode(),
+ });
}
},
// 传入临时flow说明是运行单独的命令,否则是运行整个命令流
diff --git a/src/components/composer/ComposerFlow.vue b/src/components/composer/ComposerFlow.vue
index 961143c..fa34140 100644
--- a/src/components/composer/ComposerFlow.vue
+++ b/src/components/composer/ComposerFlow.vue
@@ -9,6 +9,7 @@
@@ -97,6 +98,10 @@ export default defineComponent({
type: Function,
required: true,
},
+ showCloseButton: {
+ type: Boolean,
+ default: true,
+ },
},
setup() {
const getCurrentVariables = inject("getCurrentVariables");
diff --git a/src/components/composer/flow/ComposerButtons.vue b/src/components/composer/flow/ComposerButtons.vue
index 5e413a7..c08d28a 100644
--- a/src/components/composer/flow/ComposerButtons.vue
+++ b/src/components/composer/flow/ComposerButtons.vue
@@ -22,17 +22,31 @@
v-if="isDev"
>
-
+
退出可视化编排
-
-
+
+
插入到编辑器光标处
-
+
清空编辑器内容并插入
-
+
保存
@@ -80,6 +94,10 @@ export default defineComponent({
type: Boolean,
default: false,
},
+ showCloseButton: {
+ type: Boolean,
+ default: true,
+ },
},
emits: ["action"],
diff --git a/src/components/editor/CommandLanguageBar.vue b/src/components/editor/CommandLanguageBar.vue
index d206ce2..c207c1d 100644
--- a/src/components/editor/CommandLanguageBar.vue
+++ b/src/components/editor/CommandLanguageBar.vue
@@ -39,8 +39,6 @@
-
{{ ["查看文档", "可视化编排"][index] }}
@@ -161,36 +158,13 @@
>
-
-
-
-
-
-
-
diff --git a/src/pages/RunComposerPage.vue b/src/pages/RunComposerPage.vue
new file mode 100644
index 0000000..f351fd8
--- /dev/null
+++ b/src/pages/RunComposerPage.vue
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
diff --git a/src/router/routes.js b/src/router/routes.js
index c671c01..4c68983 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -9,6 +9,11 @@ const routes = [
name: "code",
component: () => import("pages/RunCodePage.vue"),
},
+ {
+ path: "/composer",
+ name: "composer",
+ component: () => import("pages/RunComposerPage.vue"),
+ },
{
path: "/newcommand",
name: "newcommand",