diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecCommandServiceImpl.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecCommandServiceImpl.java
index 8328cae9..d4063294 100644
--- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecCommandServiceImpl.java
+++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecCommandServiceImpl.java
@@ -221,6 +221,7 @@ public class ExecCommandServiceImpl implements ExecCommandService {
// 添加内置参数
params.put("userId", request.getUserId());
params.put("username", request.getUsername());
+ params.put("source", request.getSourceId());
params.put("sourceId", request.getSourceId());
params.put("seq", request.getExecSeq());
params.put("execId", execId);
diff --git a/orion-ops-ui/src/views/exec/exec-command/components/exec-command-panel-editor.vue b/orion-ops-ui/src/views/exec/exec-command/components/exec-command-panel-editor.vue
index 3173208c..3ae51380 100644
--- a/orion-ops-ui/src/views/exec/exec-command/components/exec-command-panel-editor.vue
+++ b/orion-ops-ui/src/views/exec/exec-command/components/exec-command-panel-editor.vue
@@ -5,7 +5,7 @@
执行命令
+ @click="emits('openTemplate')">
从模板中选择
@@ -17,9 +17,6 @@
使用 @{{ xxx }} 来替换参数, 输入_可以获取全部变量
-
- emits('selected', s)" />
@@ -30,17 +27,8 @@
diff --git a/orion-ops-ui/src/views/exec/exec-command/components/exec-command-panel.vue b/orion-ops-ui/src/views/exec/exec-command/components/exec-command-panel.vue
index 7c881a85..239d28c1 100644
--- a/orion-ops-ui/src/views/exec/exec-command/components/exec-command-panel.vue
+++ b/orion-ops-ui/src/views/exec/exec-command/components/exec-command-panel.vue
@@ -10,6 +10,7 @@
@@ -70,7 +71,7 @@
+ @open-template="() => templateModal.open()">
@@ -79,6 +80,9 @@
+
+
@@ -106,6 +110,7 @@
import ExecCommandPanelForm from './exec-command-panel-form.vue';
import ExecCommandPanelHistory from './exec-command-panel-history.vue';
import ExecCommandPanelEditor from './exec-command-panel-editor.vue';
+ import ExecTemplateModal from '@/components/exec/template/modal/index.vue';
const emits = defineEmits(['submit']);
@@ -121,6 +126,7 @@
const hostModal = ref();
const historyRef = ref();
const formRef = ref();
+ const templateModal = ref();
const parameterFormRef = ref();
const formModel = ref({ ...defaultForm() });
const parameterFormModel = ref>({});
@@ -257,6 +263,11 @@
}
.exec-form-container {
+
+ .form-wrapper {
+ margin-top: 8px;
+ }
+
.selected-host {
width: 100%;
height: 32px;
@@ -285,7 +296,7 @@
:deep(.panel-header) {
width: 100%;
height: 28px;
- margin-bottom: 12px;
+ margin-bottom: 4px;
display: flex;
justify-content: space-between;
align-items: flex-start;
diff --git a/orion-ops-ui/src/views/exec/exec-job/components/exec-job-form-drawer.vue b/orion-ops-ui/src/views/exec/exec-job/components/exec-job-form-drawer.vue
index 4cb921ea..c4ec3c4d 100644
--- a/orion-ops-ui/src/views/exec/exec-job/components/exec-job-form-drawer.vue
+++ b/orion-ops-ui/src/views/exec/exec-job/components/exec-job-form-drawer.vue
@@ -69,11 +69,20 @@
-
+
+
+ 从模板中选择
+
+
+
import type { ExecJobUpdateRequest } from '@/api/exec/exec-job';
+ import type { ExecTemplateQueryResponse } from '@/api/exec/exec-template';
import { onUnmounted, ref } from 'vue';
import useLoading from '@/hooks/loading';
import useVisible from '@/hooks/visible';
@@ -104,7 +114,7 @@
import { useDictStore } from '@/store';
import ExecEditor from '@/components/view/exec-editor/index.vue';
- const emits = defineEmits(['added', 'updated', 'openHost', 'testCron']);
+ const emits = defineEmits(['added', 'updated', 'openHost', 'openTemplate', 'testCron']);
const { visible, setVisible } = useVisible();
const { loading, setLoading } = useLoading();
@@ -170,7 +180,13 @@
formModel.value.hostIdList = hosts;
};
- defineExpose({ openAdd, openUpdate, setSelectedHost });
+ // 通过模板设置
+ const setWithTemplate = (template: ExecTemplateQueryResponse) => {
+ formModel.value.command = template.command;
+ formModel.value.timeout = template.timeout;
+ };
+
+ defineExpose({ openAdd, openUpdate, setSelectedHost, setWithTemplate });
// 打开选择主机
const openSelectHost = () => {
@@ -249,6 +265,14 @@
}
}
+ .command-item {
+ :deep(.arco-form-item-extra) {
+ margin-top: -18px;
+ width: 100%;
+ text-align: end;
+ }
+ }
+
.command-editor {
width: 100%;
height: calc(100vh - 264px);
diff --git a/orion-ops-ui/src/views/exec/exec-job/index.vue b/orion-ops-ui/src/views/exec/exec-job/index.vue
index 015610be..9b1945d5 100644
--- a/orion-ops-ui/src/views/exec/exec-job/index.vue
+++ b/orion-ops-ui/src/views/exec/exec-job/index.vue
@@ -11,11 +11,15 @@
@added="modalAddCallback"
@updated="modalUpdateCallback"
@open-host="(e) => hostModal.open(e)"
+ @open-template="() => templateModal.open()"
@test-cron="openNextCron" />
-
+
+
+ drawer.setWithTemplate(e)" />
drawer.setSelectedHost(e)" />
@@ -37,12 +41,14 @@
import ExecJobDetailDrawer from './components/exec-job-detail-drawer.vue';
import AuthorizedHostModal from '@/components/asset/host/authorized-host-modal/index.vue';
import NextCronModal from '@/components/meta/expression/next-cron-modal/index.vue';
+ import ExecTemplateModal from '@/components/exec/template/modal/index.vue';
const render = ref(false);
const table = ref();
const drawer = ref();
const detail = ref();
const nextCron = ref();
+ const templateModal = ref();
const hostModal = ref();
// 添加回调