🔨 是否使用脚本执行.
This commit is contained in:
@@ -12,11 +12,10 @@
|
||||
ref="formRef"
|
||||
class="form-wrapper"
|
||||
label-align="right"
|
||||
:auto-label-width="true"
|
||||
:rules="formRules">
|
||||
<!-- 执行主机 -->
|
||||
<a-form-item field="hostIdList"
|
||||
label="执行主机"
|
||||
label-col-flex="72px">
|
||||
<a-form-item field="hostIdList" label="执行主机">
|
||||
<div class="selected-host">
|
||||
<!-- 已选择数量 -->
|
||||
<span class="usn" v-if="formModel.hostIdList?.length">
|
||||
@@ -28,17 +27,13 @@
|
||||
</div>
|
||||
</a-form-item>
|
||||
<!-- 执行描述 -->
|
||||
<a-form-item field="description"
|
||||
label="执行描述"
|
||||
label-col-flex="72px">
|
||||
<a-form-item field="description" label="执行描述">
|
||||
<a-input v-model="formModel.description"
|
||||
placeholder="请输入执行描述"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 超时时间 -->
|
||||
<a-form-item field="timeout"
|
||||
label="超时时间"
|
||||
label-col-flex="72px">
|
||||
<a-form-item field="timeout" label="超时时间">
|
||||
<a-input-number v-model="formModel.timeout"
|
||||
placeholder="为0则不超时"
|
||||
:min="0"
|
||||
@@ -49,6 +44,20 @@
|
||||
</template>
|
||||
</a-input-number>
|
||||
</a-form-item>
|
||||
<!-- 脚本执行 -->
|
||||
<a-form-item field="scriptExec" label="脚本执行">
|
||||
<div class="flex-center">
|
||||
<a-switch v-model="formModel.scriptExec"
|
||||
type="round"
|
||||
:checked-value="EnabledStatus.ENABLED"
|
||||
:unchecked-value="EnabledStatus.DISABLED" />
|
||||
<div class="question-right ml8">
|
||||
<a-tooltip content="启用后会将命令写入脚本文件 传输到主机后执行">
|
||||
<icon-question-circle />
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</template>
|
||||
<!-- 参数表单 -->
|
||||
@@ -60,7 +69,6 @@
|
||||
:key="item.name"
|
||||
:field="item.name as string"
|
||||
:label="item.name"
|
||||
label-col-flex="72px"
|
||||
required>
|
||||
<a-input v-model="parameterFormModel[item.name as string]"
|
||||
:placeholder="item.desc"
|
||||
@@ -104,6 +112,7 @@
|
||||
import formRules from '../types/form.rules';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { batchExecCommand } from '@/api/exec/exec-command';
|
||||
import { EnabledStatus } from '@/types/const';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import ExecEditor from '@/components/view/exec-editor/index.vue';
|
||||
import AuthorizedHostModal from '@/components/asset/host/authorized-host-modal/index.vue';
|
||||
@@ -116,8 +125,12 @@
|
||||
|
||||
const defaultForm = (): ExecCommandRequest => {
|
||||
return {
|
||||
description: '',
|
||||
command: '',
|
||||
timeout: 0,
|
||||
scriptExec: EnabledStatus.DISABLED,
|
||||
parameterSchema: '[]',
|
||||
hostIdList: [],
|
||||
};
|
||||
};
|
||||
|
||||
@@ -149,6 +162,7 @@
|
||||
command: record.command,
|
||||
description: record.name,
|
||||
timeout: record.timeout,
|
||||
scriptExec: record.scriptExec,
|
||||
};
|
||||
parameterSchema.value = record.parameterSchema ? JSON.parse(record.parameterSchema) : [];
|
||||
if (parameterSchema.value.length) {
|
||||
@@ -168,6 +182,7 @@
|
||||
command: record.command,
|
||||
description: record.description,
|
||||
timeout: record.timeout,
|
||||
scriptExec: record.scriptExec,
|
||||
hostIdList: record.hostIdList
|
||||
};
|
||||
parameterSchema.value = record.parameterSchema ? JSON.parse(record.parameterSchema) : [];
|
||||
|
||||
@@ -25,9 +25,15 @@ export const timeout = [{
|
||||
message: '超时时间需要在 0 - 100000 之间'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const scriptExec = [{
|
||||
required: true,
|
||||
message: '请选择是否使用脚本执行'
|
||||
}] as FieldRule[];
|
||||
|
||||
export default {
|
||||
description,
|
||||
hostIdList,
|
||||
command,
|
||||
timeout,
|
||||
scriptExec,
|
||||
} as Record<string, FieldRule | FieldRule[]>;
|
||||
|
||||
@@ -42,6 +42,14 @@
|
||||
{{ getDictValue(execJobStatusKey, record.status) }}
|
||||
</a-tag>
|
||||
</a-descriptions-item>
|
||||
<!-- 脚本执行 -->
|
||||
<a-descriptions-item label="脚本执行">
|
||||
{{ record.scriptExec === EnabledStatus.ENABLED ? '是' : '否' }}
|
||||
</a-descriptions-item>
|
||||
<!-- 创建时间 -->
|
||||
<a-descriptions-item label="创建时间">
|
||||
{{ dateFormat(new Date(record.createTime)) }}
|
||||
</a-descriptions-item>
|
||||
<!-- 修改时间 -->
|
||||
<a-descriptions-item label="修改时间">
|
||||
{{ dateFormat(new Date(record.updateTime)) }}
|
||||
@@ -86,7 +94,8 @@
|
||||
import { dateFormat } from '@/utils';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { getExecJob } from '@/api/exec/exec-job';
|
||||
import { execJobStatusKey } from '@/views/exec/exec-job/types/const';
|
||||
import { EnabledStatus } from '@/types/const';
|
||||
import { execJobStatusKey } from '../types/const';
|
||||
|
||||
const { getDictValue, toOptions } = useDictStore();
|
||||
const { visible, setVisible } = useVisible();
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
<a-spin class="full spin-wrapper" :loading="loading">
|
||||
<a-form :model="formModel"
|
||||
ref="formRef"
|
||||
label-align="left"
|
||||
label-align="right"
|
||||
:auto-label-width="true"
|
||||
:rules="formRules">
|
||||
<a-row :gutter="16">
|
||||
<!-- 任务名称 -->
|
||||
<a-col :span="14">
|
||||
<a-col :span="13">
|
||||
<a-form-item field="name" label="任务名称">
|
||||
<a-input v-model="formModel.name"
|
||||
placeholder="请输入任务名称"
|
||||
@@ -24,7 +24,7 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 执行主机 -->
|
||||
<a-col :span="10">
|
||||
<a-col :span="11">
|
||||
<a-form-item field="hostIdList" label="执行主机">
|
||||
<div class="selected-host">
|
||||
<!-- 已选择数量 -->
|
||||
@@ -38,7 +38,7 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- cron -->
|
||||
<a-col :span="14">
|
||||
<a-col :span="13">
|
||||
<a-form-item field="expression" label="cron">
|
||||
<a-input v-model="formModel.expression"
|
||||
placeholder="请输入 cron 表达式"
|
||||
@@ -54,7 +54,7 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 超时时间 -->
|
||||
<a-col :span="10">
|
||||
<a-col :span="6">
|
||||
<a-form-item field="timeout" label="超时时间">
|
||||
<a-input-number v-model="formModel.timeout"
|
||||
placeholder="为0则不超时"
|
||||
@@ -67,6 +67,22 @@
|
||||
</a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 脚本执行 -->
|
||||
<a-col :span="5">
|
||||
<a-form-item field="scriptExec" label="脚本执行">
|
||||
<div class="flex-center">
|
||||
<a-switch v-model="formModel.scriptExec"
|
||||
type="round"
|
||||
:checked-value="EnabledStatus.ENABLED"
|
||||
:unchecked-value="EnabledStatus.DISABLED" />
|
||||
<div class="question-right ml8">
|
||||
<a-tooltip position="tr" content="启用后会将命令写入脚本文件 传输到主机后执行">
|
||||
<icon-question-circle />
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 执行命令 -->
|
||||
<a-col :span="24">
|
||||
<a-form-item class="command-item"
|
||||
@@ -111,6 +127,7 @@
|
||||
import { jobBuiltinsParams } from '../types/const';
|
||||
import { createExecJob, getExecJob, updateExecJob } from '@/api/exec/exec-job';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { EnabledStatus } from '@/types/const';
|
||||
import { useDictStore } from '@/store';
|
||||
import ExecEditor from '@/components/view/exec-editor/index.vue';
|
||||
|
||||
@@ -131,6 +148,7 @@
|
||||
name: undefined,
|
||||
expression: undefined,
|
||||
timeout: 0,
|
||||
scriptExec: EnabledStatus.DISABLED,
|
||||
command: undefined,
|
||||
parameterSchema: '[]',
|
||||
hostIdList: []
|
||||
@@ -169,6 +187,7 @@
|
||||
name: record.name,
|
||||
expression: record.expression,
|
||||
timeout: record.timeout,
|
||||
scriptExec: record.scriptExec,
|
||||
command: record.command,
|
||||
parameterSchema: record.parameterSchema,
|
||||
hostIdList: record.hostIdList,
|
||||
|
||||
@@ -24,6 +24,16 @@ export const expression = [{
|
||||
export const timeout = [{
|
||||
required: true,
|
||||
message: '请输入超时时间'
|
||||
}, {
|
||||
type: 'number',
|
||||
min: 0,
|
||||
max: 100000,
|
||||
message: '超时时间需要在 0 - 100000 之间'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const scriptExec = [{
|
||||
required: true,
|
||||
message: '请选择是否使用脚本执行'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const command = [{
|
||||
@@ -36,5 +46,6 @@ export default {
|
||||
hostIdList,
|
||||
expression,
|
||||
timeout,
|
||||
scriptExec,
|
||||
command,
|
||||
} as Record<string, FieldRule | FieldRule[]>;
|
||||
|
||||
@@ -12,32 +12,18 @@
|
||||
<!-- 命令表单 -->
|
||||
<a-form :model="formModel"
|
||||
ref="formRef"
|
||||
label-align="left"
|
||||
label-align="right"
|
||||
:auto-label-width="true"
|
||||
:rules="formRules">
|
||||
<a-row :gutter="16">
|
||||
<!-- 执行描述 -->
|
||||
<a-col :span="10">
|
||||
<a-col :span="16">
|
||||
<a-form-item field="description" label="执行描述">
|
||||
<a-input v-model="formModel.description"
|
||||
placeholder="请输入执行描述"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 执行主机 -->
|
||||
<a-col :span="7">
|
||||
<a-form-item field="hostIdList" label="执行主机">
|
||||
<div class="selected-host">
|
||||
<!-- 已选择数量 -->
|
||||
<span class="usn" v-if="formModel.hostIdList?.length">
|
||||
已选择<span class="selected-host-count span-blue">{{ formModel.hostIdList?.length }}</span>台主机
|
||||
</span>
|
||||
<span class="usn pointer span-blue" @click="openSelectHost">
|
||||
{{ formModel.hostIdList?.length ? '重新选择' : '选择主机' }}
|
||||
</span>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 超时时间 -->
|
||||
<a-col :span="7">
|
||||
<a-form-item field="timeout"
|
||||
@@ -53,6 +39,36 @@
|
||||
</a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 执行主机 -->
|
||||
<a-col :span="16">
|
||||
<a-form-item field="hostIdList" label="执行主机">
|
||||
<div class="selected-host">
|
||||
<!-- 已选择数量 -->
|
||||
<span class="usn" v-if="formModel.hostIdList?.length">
|
||||
已选择<span class="selected-host-count span-blue">{{ formModel.hostIdList?.length }}</span>台主机
|
||||
</span>
|
||||
<span class="usn pointer span-blue" @click="openSelectHost">
|
||||
{{ formModel.hostIdList?.length ? '重新选择' : '选择主机' }}
|
||||
</span>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 脚本执行 -->
|
||||
<a-col :span="8">
|
||||
<a-form-item field="scriptExec" label="脚本执行">
|
||||
<div class="flex-center">
|
||||
<a-switch v-model="formModel.scriptExec"
|
||||
type="round"
|
||||
:checked-value="EnabledStatus.ENABLED"
|
||||
:unchecked-value="EnabledStatus.DISABLED" />
|
||||
<div class="question-right ml8">
|
||||
<a-tooltip position="tr" content="启用后会将命令写入脚本文件 传输到主机后执行">
|
||||
<icon-question-circle />
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 执行命令 -->
|
||||
<a-col :span="24">
|
||||
<a-form-item field="command"
|
||||
@@ -113,6 +129,7 @@
|
||||
import useVisible from '@/hooks/visible';
|
||||
import formRules from '../../exec-command/types/form.rules';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { EnabledStatus } from '@/types/const';
|
||||
import { batchExecCommand } from '@/api/exec/exec-command';
|
||||
import ExecEditor from '@/components/view/exec-editor/index.vue';
|
||||
|
||||
@@ -138,6 +155,7 @@
|
||||
formModel.value = {
|
||||
description: record.name,
|
||||
timeout: record.timeout,
|
||||
scriptExec: record.scriptExec,
|
||||
command: record.command,
|
||||
hostIdList: []
|
||||
};
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
<a-spin class="full modal-form" :loading="loading">
|
||||
<a-form :model="formModel"
|
||||
ref="formRef"
|
||||
label-align="left"
|
||||
label-align="right"
|
||||
:auto-label-width="true"
|
||||
:rules="formRules">
|
||||
<a-row :gutter="16">
|
||||
<!-- 模板名称 -->
|
||||
<a-col :span="14">
|
||||
<a-col :span="12">
|
||||
<a-form-item field="name" label="模板名称">
|
||||
<a-input v-model="formModel.name"
|
||||
placeholder="请输入模板名称"
|
||||
@@ -24,7 +24,7 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 超时时间 -->
|
||||
<a-col :span="10">
|
||||
<a-col :span="7">
|
||||
<a-form-item field="timeout" label="超时时间">
|
||||
<a-input-number v-model="formModel.timeout"
|
||||
placeholder="为0则不超时"
|
||||
@@ -37,6 +37,22 @@
|
||||
</a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 脚本执行 -->
|
||||
<a-col :span="5">
|
||||
<a-form-item field="scriptExec" label="脚本执行">
|
||||
<div class="flex-center">
|
||||
<a-switch v-model="formModel.scriptExec"
|
||||
type="round"
|
||||
:checked-value="EnabledStatus.ENABLED"
|
||||
:unchecked-value="EnabledStatus.DISABLED" />
|
||||
<div class="question-right ml8">
|
||||
<a-tooltip position="tr" content="启用后会将命令写入脚本文件 传输到主机后执行">
|
||||
<icon-question-circle />
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- 模板命令 -->
|
||||
<a-col :span="24">
|
||||
<a-form-item field="command"
|
||||
@@ -115,6 +131,7 @@
|
||||
import formRules from '../types/form.rules';
|
||||
import { createExecTemplate, updateExecTemplate } from '@/api/exec/exec-template';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { EnabledStatus } from '@/types/const';
|
||||
import ExecEditor from '@/components/view/exec-editor/index.vue';
|
||||
|
||||
const { visible, setVisible } = useVisible();
|
||||
@@ -129,6 +146,7 @@
|
||||
name: undefined,
|
||||
command: undefined,
|
||||
timeout: 0,
|
||||
scriptExec: EnabledStatus.DISABLED,
|
||||
parameterSchema: undefined,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -23,8 +23,14 @@ export const timeout = [{
|
||||
message: '超时时间需要在 0 - 100000 之间'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const scriptExec = [{
|
||||
required: true,
|
||||
message: '请选择是否使用脚本执行'
|
||||
}] as FieldRule[];
|
||||
|
||||
export default {
|
||||
name,
|
||||
command,
|
||||
timeout,
|
||||
scriptExec,
|
||||
} as Record<string, FieldRule | FieldRule[]>;
|
||||
|
||||
Reference in New Issue
Block a user