diff --git a/docs/about/change-log.md b/docs/about/change-log.md index f3fbe728..5188ac09 100644 --- a/docs/about/change-log.md +++ b/docs/about/change-log.md @@ -4,14 +4,16 @@ `2024-03-` `release` -🐞 修复 SFTP 加载失败后一直 loading -🐞 修复 SSH 配置未启用还可以连接 -🐞 修复 主机配置保存后无法修改状态 -🐞 修复 添加快捷命令时编辑器无代码提示 -🔨 修改 菜单路由命名逻辑修改 -🔨 优化 前端组件命名规范化 -🌈 新增 双击终端会话 Tab 快速复制 -🌈 新增 执行模板功能 +* 🐞 修复 SFTP 加载失败后一直 loading +* 🐞 修复 SSH 配置未启用还可以连接 +* 🐞 修复 主机配置保存后无法修改状态 +* 🐞 修复 添加快捷命令时编辑器无代码提示 +* 🔨 修改 菜单路由命名逻辑修改 +* 🔨 优化 前端组件命名规范化 +* 🌈 新增 双击终端会话 Tab 快速复制 +* 🌈 新增 批量执行命令 +* 🌈 新增 命令执行日志 +* 🌈 新增 执行模板功能 [如何升级](/about/update.md?id=_v102) @@ -19,14 +21,14 @@ `2024-03-06` `release` -🐞 修复 用户操作日志条件重置后类型框数据不正常的问题 -🩰 修改 主机连接日志 UI -🌈 新增 SFTP 使用日志列表 -🌈 新增 主机连接日志强制下线会话 -🌈 新增 主机连接日志删除/清理 -🌈 新增 用户操作日志日志删除/清理 -🌈 新增 用户操作日志日志删除/清理 -🔨 优化 用户锁定次数/时间可配置 +* 🐞 修复 用户操作日志条件重置后类型框数据不正常的问题 +* 🩰 修改 主机连接日志 UI +* 🌈 新增 SFTP 使用日志列表 +* 🌈 新增 主机连接日志强制下线会话 +* 🌈 新增 主机连接日志删除/清理 +* 🌈 新增 用户操作日志日志删除/清理 +* 🌈 新增 用户操作日志日志删除/清理 +* 🔨 优化 用户锁定次数/时间可配置 [如何升级](/about/update.md?id=_v101) @@ -34,8 +36,8 @@ `2024-03-01` `release` -🌈 新增 用户自定义终端标签颜色 -🔨 拓展数据模块添加缓存 +* 🌈 新增 用户自定义终端标签颜色 +* 🔨 拓展数据模块添加缓存 [如何升级](/about/update.md?id=_v100) @@ -43,15 +45,15 @@ `2024-02-28` `preview` -🌈 主机管理 -🌈 主机秘钥 -🌈 主机身份 -🌈 资产授权 -🌈 主机终端 -🌈 连接日志 -🌈 角色管理 -🌈 用户管理 -🌈 操作日志 -🌈 系统菜单 -🌈 数据字典项 -🌈 数据字典值 +* 🌈 主机管理 +* 🌈 主机秘钥 +* 🌈 主机身份 +* 🌈 资产授权 +* 🌈 主机终端 +* 🌈 连接日志 +* 🌈 角色管理 +* 🌈 用户管理 +* 🌈 操作日志 +* 🌈 系统菜单 +* 🌈 数据字典项 +* 🌈 数据字典值 diff --git a/orion-ops-ui/src/api/exec/exec-log.ts b/orion-ops-ui/src/api/exec/exec-log.ts index 534f336a..f6d10d1f 100644 --- a/orion-ops-ui/src/api/exec/exec-log.ts +++ b/orion-ops-ui/src/api/exec/exec-log.ts @@ -24,6 +24,7 @@ export interface ExecLogQueryResponse extends TableData, ExecLogQueryExtraRespon username: string; description: string; command: string; + parameterSchema: string; timeout: number; status: string; startTime: number; diff --git a/orion-ops-ui/src/components/exec/template/modal/table.columns.ts b/orion-ops-ui/src/components/exec/template/modal/table.columns.ts index e4468d08..33697fef 100644 --- a/orion-ops-ui/src/components/exec/template/modal/table.columns.ts +++ b/orion-ops-ui/src/components/exec/template/modal/table.columns.ts @@ -1,5 +1,4 @@ import type { TableColumnData } from '@arco-design/web-vue/es/table/interface'; -import { dateFormat } from '@/utils'; const columns = [ { @@ -14,7 +13,7 @@ const columns = [ dataIndex: 'name', slotName: 'name', align: 'left', - width: 200, + width: 250, ellipsis: true, }, { title: '模板命令', @@ -22,15 +21,6 @@ const columns = [ slotName: 'command', align: 'left', ellipsis: true, - }, { - title: '修改时间', - dataIndex: 'updateTime', - slotName: 'updateTime', - align: 'center', - width: 180, - render: ({ record }) => { - return dateFormat(new Date(record.updateTime)); - }, }, { title: '操作', slotName: 'handle', diff --git a/orion-ops-ui/src/views/exec/exec-command/components/exec-panel-editor.vue b/orion-ops-ui/src/views/exec/exec-command/components/exec-panel-editor.vue new file mode 100644 index 00000000..e52d6f37 --- /dev/null +++ b/orion-ops-ui/src/views/exec/exec-command/components/exec-panel-editor.vue @@ -0,0 +1,60 @@ + + + + + + + diff --git a/orion-ops-ui/src/views/exec/exec-command/components/exec-panel-form.vue b/orion-ops-ui/src/views/exec/exec-command/components/exec-panel-form.vue new file mode 100644 index 00000000..a7287ccb --- /dev/null +++ b/orion-ops-ui/src/views/exec/exec-command/components/exec-panel-form.vue @@ -0,0 +1,41 @@ + + + + + + + diff --git a/orion-ops-ui/src/views/exec/exec-command/components/exec-panel-history.vue b/orion-ops-ui/src/views/exec/exec-command/components/exec-panel-history.vue new file mode 100644 index 00000000..43900912 --- /dev/null +++ b/orion-ops-ui/src/views/exec/exec-command/components/exec-panel-history.vue @@ -0,0 +1,104 @@ + + + + + + + diff --git a/orion-ops-ui/src/views/exec/exec-command/components/exec-panel.vue b/orion-ops-ui/src/views/exec/exec-command/components/exec-panel.vue index e0ec6d6c..da393a04 100644 --- a/orion-ops-ui/src/views/exec/exec-command/components/exec-panel.vue +++ b/orion-ops-ui/src/views/exec/exec-command/components/exec-panel.vue @@ -2,125 +2,85 @@ -
- -
-

执行参数

- - - 重置 - 执行 - -
+ - - - -
- - - 已选择{{ formModel.hostIdList?.length }}台主机 - - - {{ formModel.hostIdList?.length ? '重新选择' : '选择主机' }} - -
-
- - - - - - - - - - -
- - - 命令参数 - - - - - - - -
- -
- -
-

执行命令

- 从模板中选择 -
- -
- -
- -
- 使用 @{{ xxx }} 来替换参数, 输入_可以获取全部变量 -
-
- -
-
- -
-
-
- - - {{ record.hostIdList?.length || 0 }} - + + + + + + + + + + - - @@ -135,50 +95,38 @@ import type { TemplateParam } from '@/components/view/exec-editor/const'; import type { ExecTemplateQueryResponse } from '@/api/exec/exec-template'; import type { ExecLogQueryResponse } from '@/api/exec/exec-log'; - import { onMounted, ref } from 'vue'; + import { ref } from 'vue'; import formRules from '../types/form.rules'; import useLoading from '@/hooks/loading'; import { batchExecCommand } from '@/api/exec/exec'; - import { historyCount } from '../types/const'; - import { getExecLogHistory } from '@/api/exec/exec-log'; 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'; - import ExecTemplateModal from '@/components/exec/template/modal/index.vue'; + import ExecPanelForm from './exec-panel-form.vue'; + import ExecPanelHistory from './exec-panel-history.vue'; + import ExecPanelEditor from './exec-panel-editor.vue'; const defaultForm = (): ExecCommandRequest => { return { - timeout: 0 + timeout: 0, + command: '' }; }; const { loading, setLoading } = useLoading(); const hostModal = ref(); - const templateModal = ref(); const formRef = ref(); const parameterFormRef = ref(); const formModel = ref({ ...defaultForm() }); const parameterFormModel = ref>({}); const parameterSchema = ref>([]); - const historyLogs = ref>([]); - - // 加载执行记录 - const fetchExecHistory = async () => { - const { data } = await getExecLogHistory(historyCount); - historyLogs.value = data; - }; // 打开选择主机 const openSelectHost = () => { hostModal.value.open(formModel.value.hostIdList); }; - // 打开模板 - const openTemplate = () => { - templateModal.value.open(); - }; - // 设置选中主机 const setSelectedHost = (hosts: Array) => { formModel.value.hostIdList = hosts; @@ -197,12 +145,27 @@ }; // 从执行日志设置 - const setWithExecLog = () => { - // TODO + const setWithExecLog = (record: ExecLogQueryResponse) => { + formModel.value = { + ...formModel.value, + command: record.command, + description: record.description, + timeout: record.timeout, + hostIdList: record.hostIdList + }; + parameterSchema.value = record.parameterSchema ? JSON.parse(record.parameterSchema) : []; + if (parameterSchema.value.length) { + parameterFormModel.value = parameterSchema.value.reduce((acc, cur) => ({ + ...acc, + [cur.name as string]: cur.value + }), {}); + } else { + parameterFormModel.value = {}; + } }; // 执行 - const exec = async () => { + const execCommand = async () => { setLoading(true); try { // 验证参数 @@ -236,16 +199,12 @@ }; // 重置 - const reset = () => { + const resetForm = () => { formModel.value = Object.assign({}, { ...defaultForm() }); parameterFormModel.value = {}; parameterSchema.value = []; }; - - // 加载执行记录 - onMounted(fetchExecHistory); -