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 1c4ed9d5..5b718a7d 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 @@ -10,7 +10,6 @@ import com.orion.ops.framework.mybatis.core.generator.template.Table; import com.orion.ops.framework.mybatis.core.generator.template.Template; import java.io.File; -import java.util.concurrent.TimeUnit; /** * 代码生成器 @@ -45,10 +44,28 @@ public class CodeGenerators { // .color("blue", "gray", "red", "green", "white") // .valueUseFields() // .build(), - Template.create("exec_host_log", "批量执行主机日志", "exec") + Template.create("exec_log", "执行记录", "exec") .disableUnitTest() - .vue("exec", "exec-log-exec") - .enableDrawerForm() + .vue("exec", "exec-log") + .enableRowSelection() + .dict("execLogStatus", "status") + .keyName("execStatus") + .field("execStatus") + .fields("WAITING", "RUNNING", "COMPLETED", "FAILED") + .labels("等待中", "运行中", "执行完成", "执行失败") + .color("gray", "green", "arcoblue", "red") + .valueUseFields() + .build(), + Template.create("exec_host_log", "主机执行记录", "exec") + .disableUnitTest() + .vue("exec", "exec-host-log") + .dict("execHostLogStatus", "status") + .keyName("execHostStatus") + .field("execHostStatus") + .fields("WAITING", "RUNNING", "COMPLETED", "FAILED", "INTERRUPTED") + .labels("等待中", "运行中", "执行完成", "执行失败", "已中断") + .color("gray", "green", "arcoblue", "red", "purple") + .valueUseFields() .build(), }; // jdbc 配置 - 使用配置文件 diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-vue-views-components-table.vue.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-vue-views-components-table.vue.vm index 4f71ad93..ac025abf 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-vue-views-components-table.vue.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-vue-views-components-table.vue.vm @@ -8,7 +8,7 @@ @keyup.enter="() => fetchTableData()"> #foreach($field in ${table.fields}) - + #if(${dictMap.containsKey(${field.propertyName})}) #end #end diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/define/operator/ExecOperatorType.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/define/operator/ExecOperatorType.java index b7682240..73da8498 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/define/operator/ExecOperatorType.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/define/operator/ExecOperatorType.java @@ -8,7 +8,7 @@ import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLe import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.M; /** - * 批量执行 操作日志类型 + * 批量执行 操作记录类型 * * @author Jiahang Li * @version 1.0.1 @@ -35,9 +35,9 @@ public class ExecOperatorType extends InitializingOperatorTypes { new OperatorType(M, EXEC_COMMAND, "执行主机命令"), new OperatorType(M, INTERRUPT_EXEC, "中断执行命令"), new OperatorType(M, INTERRUPT_HOST, "中断主机执行命令 ${logId} ${hostName}"), - new OperatorType(H, DELETE_HOST_LOG, "删除主机执行日志 ${logId} ${hostName}"), - new OperatorType(H, DELETE_LOG, "删除执行日志 ${count} 条"), - new OperatorType(H, CLEAR_LOG, "清理执行日志 ${count} 条"), + new OperatorType(H, DELETE_HOST_LOG, "删除主机执行记录 ${logId} ${hostName}"), + new OperatorType(H, DELETE_LOG, "删除执行记录 ${count} 条"), + new OperatorType(H, CLEAR_LOG, "清理执行记录 ${count} 条"), }; } diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecLogServiceImpl.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecLogServiceImpl.java index a7be646e..e2d3d2b9 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecLogServiceImpl.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecLogServiceImpl.java @@ -72,7 +72,10 @@ public class ExecLogServiceImpl implements ExecLogService { // 查询执行状态 List logList = execLogDAO.of() .createWrapper() - .select(ExecLogDO::getId, ExecLogDO::getStatus, ExecLogDO::getFinishTime) + .select(ExecLogDO::getId, + ExecLogDO::getStatus, + ExecLogDO::getStartTime, + ExecLogDO::getFinishTime) .in(ExecLogDO::getId, idList) .then() .list(ExecLogConvert.MAPPER::to); @@ -81,6 +84,7 @@ public class ExecLogServiceImpl implements ExecLogService { .createWrapper() .select(ExecHostLogDO::getId, ExecHostLogDO::getStatus, + ExecHostLogDO::getStartTime, ExecHostLogDO::getFinishTime, ExecHostLogDO::getExitStatus, ExecHostLogDO::getErrorMessage) @@ -167,8 +171,8 @@ public class ExecLogServiceImpl implements ExecLogService { .eq(ExecLogDO::getUsername, request.getUsername()) .eq(ExecLogDO::getSource, request.getSource()) .eq(ExecLogDO::getSourceId, request.getSourceId()) - .eq(ExecLogDO::getDescription, request.getDescription()) - .eq(ExecLogDO::getCommand, request.getCommand()) + .like(ExecLogDO::getDescription, request.getDescription()) + .like(ExecLogDO::getCommand, request.getCommand()) .eq(ExecLogDO::getStatus, request.getStatus()) .ge(ExecLogDO::getStartTime, Arrays1.getIfPresent(request.getStartTimeRange(), 0)) .le(ExecLogDO::getStartTime, Arrays1.getIfPresent(request.getStartTimeRange(), 1)) diff --git a/orion-ops-ui/src/components/system/message-box/list.vue b/orion-ops-ui/src/components/system/message-box/list.vue index 95706f94..4742e16f 100644 --- a/orion-ops-ui/src/components/system/message-box/list.vue +++ b/orion-ops-ui/src/components/system/message-box/list.vue @@ -32,17 +32,13 @@ diff --git a/orion-ops-ui/src/utils/index.ts b/orion-ops-ui/src/utils/index.ts index 954bd95b..58995bcd 100644 --- a/orion-ops-ui/src/utils/index.ts +++ b/orion-ops-ui/src/utils/index.ts @@ -98,6 +98,31 @@ export function formatSecond(second: number, p = 'HH:mm') { return dateFormat(new Date(~~second * 1000), p); } +/** + * 格式化持续时间 + * @param start + * @param end + */ +export function formatDuration(start: number, end?: number): string { + if (!end) { + return ''; + } + const duration = (end - start) / 1000; + const minutes = Math.floor(duration / 60); + const seconds = Math.floor(duration % 60); + let result = ''; + if (minutes > 0) { + result += `${minutes}min`; + if (seconds > 0) { + result += ' '; + } + } + if (seconds > 0) { + result += `${seconds}s`; + } + return result; +} + /** * 格式化数字为 ,分割 */ @@ -163,7 +188,7 @@ export const resetObject = (obj: any, ignore: string[] = []) => { export const objectTruthKeyCount = (obj: any, ignore: string[] = []) => { return Object.keys(obj) .filter(s => !ignore.includes(s)) - .reduce(function (acc, curr) { + .reduce(function(acc, curr) { const currVal = obj[curr]; return acc + ~~(currVal !== undefined && currVal !== null && currVal?.length !== 0 && currVal !== ''); }, 0); @@ -196,7 +221,7 @@ export function detectZoom() { * 获取唯一的 UUID */ export function getUUID() { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { const r = Math.random() * 16 | 0; const v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); diff --git a/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-clear-modal.vue b/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-clear-modal.vue index 49ea7b3d..d017a995 100644 --- a/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-clear-modal.vue +++ b/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-clear-modal.vue @@ -52,7 +52,6 @@ diff --git a/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-table.vue b/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-table.vue index 6645f5c0..2de5fbfe 100644 --- a/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-table.vue +++ b/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-table.vue @@ -8,39 +8,38 @@ @reset="fetchTableData" @keyup.enter="() => fetchTableData()"> - + - + - + - + - + - + diff --git a/orion-ops-ui/src/views/asset-audit/sftp-log/components/sftp-log-table.vue b/orion-ops-ui/src/views/asset-audit/sftp-log/components/sftp-log-table.vue index 808ac222..13c22520 100644 --- a/orion-ops-ui/src/views/asset-audit/sftp-log/components/sftp-log-table.vue +++ b/orion-ops-ui/src/views/asset-audit/sftp-log/components/sftp-log-table.vue @@ -8,35 +8,34 @@ @reset="fetchTableData" @keyup.enter="() => fetchTableData()"> - + - + - + - + - + diff --git a/orion-ops-ui/src/views/asset/host-identity/components/host-identity-table.vue b/orion-ops-ui/src/views/asset/host-identity/components/host-identity-table.vue index ba989497..6dc73621 100644 --- a/orion-ops-ui/src/views/asset/host-identity/components/host-identity-table.vue +++ b/orion-ops-ui/src/views/asset/host-identity/components/host-identity-table.vue @@ -7,22 +7,22 @@ @reset="fetchTableData" @keyup.enter="() => fetchTableData()"> - + - + - + - + diff --git a/orion-ops-ui/src/views/asset/host-key/components/host-key-table.vue b/orion-ops-ui/src/views/asset/host-key/components/host-key-table.vue index c9f6b2d8..534aaef0 100644 --- a/orion-ops-ui/src/views/asset/host-key/components/host-key-table.vue +++ b/orion-ops-ui/src/views/asset/host-key/components/host-key-table.vue @@ -7,14 +7,14 @@ @reset="fetchTableData" @keyup.enter="() => fetchTableData()"> - + - + diff --git a/orion-ops-ui/src/views/asset/host-list/components/host-table.vue b/orion-ops-ui/src/views/asset/host-list/components/host-table.vue index a95054b6..c59abb66 100644 --- a/orion-ops-ui/src/views/asset/host-list/components/host-table.vue +++ b/orion-ops-ui/src/views/asset/host-list/components/host-table.vue @@ -7,26 +7,26 @@ @reset="fetchTableData" @keyup.enter="() => fetchTableData()"> - + - + - + - + - + - + - + - + diff --git a/orion-ops-ui/src/views/system/dict-key/components/dict-key-table.vue b/orion-ops-ui/src/views/system/dict-key/components/dict-key-table.vue index ef3cdace..844a6f19 100644 --- a/orion-ops-ui/src/views/system/dict-key/components/dict-key-table.vue +++ b/orion-ops-ui/src/views/system/dict-key/components/dict-key-table.vue @@ -7,12 +7,16 @@ @reset="fetchTableData" @keyup.enter="() => fetchTableData()"> - - + + - - + + diff --git a/orion-ops-ui/src/views/system/dict-value/components/dict-value-table.vue b/orion-ops-ui/src/views/system/dict-value/components/dict-value-table.vue index 49b0f8c3..d62e0785 100644 --- a/orion-ops-ui/src/views/system/dict-value/components/dict-value-table.vue +++ b/orion-ops-ui/src/views/system/dict-value/components/dict-value-table.vue @@ -7,18 +7,18 @@ @reset="resetForm" @keyup.enter="() => fetchTableData()"> - + - + - + diff --git a/orion-ops-ui/src/views/user/operator-log/components/operator-log-clear-modal.vue b/orion-ops-ui/src/views/user/operator-log/components/operator-log-clear-modal.vue index af3afc1e..84c656d9 100644 --- a/orion-ops-ui/src/views/user/operator-log/components/operator-log-clear-modal.vue +++ b/orion-ops-ui/src/views/user/operator-log/components/operator-log-clear-modal.vue @@ -18,9 +18,7 @@ :label-col-props="{ span: 5 }" :wrapper-col-props="{ span: 18 }"> - + @@ -60,7 +58,6 @@ diff --git a/orion-ops-ui/src/views/user/operator-log/components/operator-log-query-header.vue b/orion-ops-ui/src/views/user/operator-log/components/operator-log-query-header.vue index 5ee2c3b5..b1fb93b4 100644 --- a/orion-ops-ui/src/views/user/operator-log/components/operator-log-query-header.vue +++ b/orion-ops-ui/src/views/user/operator-log/components/operator-log-query-header.vue @@ -8,14 +8,13 @@ + label="操作用户"> - + - + - + - + - + diff --git a/orion-ops-ui/src/views/user/role/components/role-table.vue b/orion-ops-ui/src/views/user/role/components/role-table.vue index 9753404b..3c2e472f 100644 --- a/orion-ops-ui/src/views/user/role/components/role-table.vue +++ b/orion-ops-ui/src/views/user/role/components/role-table.vue @@ -7,15 +7,19 @@ @reset="fetchTableData" @keyup.enter="() => fetchTableData()"> - - + + - - + + - + - + - + - + - + - + - +