diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/core/CodeGeneratorEngine.java b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/core/CodeGeneratorEngine.java index f81f2ea7..3e6d1506 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/core/CodeGeneratorEngine.java +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/core/CodeGeneratorEngine.java @@ -97,7 +97,7 @@ public class CodeGeneratorEngine extends VelocityTemplateEngine { // http 注释标识 objectMap.put("httpComment", "###"); // 版本 - objectMap.put("since", OrionOpsProConst.VERSION); + objectMap.put("version", OrionOpsProConst.VERSION); // api 注释 Map apiComment = new HashMap<>(12); String comment = tableInfo.getComment(); diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-cache-dto.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-cache-dto.java.vm index 771f8e88..3d86b457 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-cache-dto.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-cache-dto.java.vm @@ -12,7 +12,7 @@ import java.math.*; * $!{table.comment} 缓存对象 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Data diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-cache-key-define.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-cache-key-define.java.vm index 699d5af0..11584b8d 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-cache-key-define.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-cache-key-define.java.vm @@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit; * $!{table.comment}缓存 key * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ public interface ${type}CacheKeyDefine { diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-controller.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-controller.java.vm index 35611c56..291e3b50 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-controller.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-controller.java.vm @@ -32,7 +32,7 @@ import java.util.List; * $!{table.comment} api * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Tag(name = "${package.ModuleName} - $!{table.comment}服务") diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-convert.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-convert.java.vm index 2c815ac6..f4fb8c3a 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-convert.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-convert.java.vm @@ -13,7 +13,7 @@ import java.util.List; * $!{table.comment} 内部对象转换器 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Mapper diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-do.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-do.java.vm index a2057425..b3aa2d5a 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-do.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-do.java.vm @@ -12,7 +12,7 @@ import java.math.*; * $!{table.comment} 实体对象 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Data diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-export.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-export.java.vm index 64adece0..0ddc30ed 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-export.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-export.java.vm @@ -15,7 +15,7 @@ import java.math.*; * $!{table.comment} 导出对象 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Data diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-create.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-create.java.vm index 99ac467a..f58ffba9 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-create.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-create.java.vm @@ -18,7 +18,7 @@ import java.math.*; * $!{table.comment} 创建请求对象 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Data diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-query.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-query.java.vm index f4a3cbd6..51da4ef1 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-query.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-query.java.vm @@ -13,7 +13,7 @@ import java.math.*; * $!{table.comment} 查询请求对象 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Data diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-update.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-update.java.vm index 8e2e91d1..07990061 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-update.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-request-update.java.vm @@ -18,7 +18,7 @@ import java.math.*; * $!{table.comment} 更新请求对象 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Data diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-vo.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-vo.java.vm index c64f48c4..acce9e4c 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-vo.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-entity-vo.java.vm @@ -11,7 +11,7 @@ import java.math.*; * $!{table.comment} 视图响应对象 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Data diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-mapper.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-mapper.java.vm index 8119cac1..770e9abe 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-mapper.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-mapper.java.vm @@ -11,7 +11,7 @@ import ${mapperAnnotationClass.name}; * $!{table.comment} Mapper 接口 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ #if(${mapperAnnotationClass}) diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-operator-key-define.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-operator-key-define.java.vm index a15138a9..fcd023c0 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-operator-key-define.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-operator-key-define.java.vm @@ -10,7 +10,7 @@ import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLe * $!{table.comment} 操作日志类型 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Module("${package.ModuleName}:${typeHyphen}") diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-service-impl.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-service-impl.java.vm index 457805c3..e4a93487 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-service-impl.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-service-impl.java.vm @@ -43,7 +43,7 @@ import java.util.stream.Collectors; * $!{table.comment} 服务实现类 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Slf4j diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-service.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-service.java.vm index 4b0328e7..09325bf2 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-service.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-module-service.java.vm @@ -13,7 +13,7 @@ import java.util.List; * $!{table.comment} 服务类 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ public interface ${table.serviceName} { diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-api-impl.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-api-impl.java.vm index aff13a6d..b2c9e3c9 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-api-impl.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-api-impl.java.vm @@ -26,7 +26,7 @@ import java.util.stream.Collectors; * $!{table.comment} 对外服务实现类 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Slf4j diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-api.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-api.java.vm index efaf4f90..fc139baf 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-api.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-api.java.vm @@ -10,7 +10,7 @@ import java.util.List; * $!{table.comment} 对外服务类 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ public interface ${type}Api { diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-convert.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-convert.java.vm index ba1a8c3b..cf59ae28 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-convert.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-convert.java.vm @@ -16,7 +16,7 @@ import java.util.List; * $!{table.comment} 对外服务对象转换器 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Mapper diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-create.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-create.java.vm index 4610872a..114d6da7 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-create.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-create.java.vm @@ -17,7 +17,7 @@ import java.math.*; * $!{table.comment} 创建请求业务对象 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Data diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-query.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-query.java.vm index b2fa3549..3c874142 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-query.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-query.java.vm @@ -15,7 +15,7 @@ import java.math.*; * $!{table.comment} 查询请求业务对象 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Data diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-update.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-update.java.vm index 4f555dc0..56fb99da 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-update.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto-update.java.vm @@ -17,7 +17,7 @@ import java.math.*; * $!{table.comment} 更新请求业务对象 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Data diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto.java.vm index 86a21838..1e43b43d 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-provider-entity-dto.java.vm @@ -11,7 +11,7 @@ import java.math.*; * $!{table.comment} 业务对象 * * @author ${author} - * @version ${since} + * @version ${version} * @since ${date} */ @Data diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-test-api-impl-tests.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-test-api-impl-tests.java.vm index fa06a360..9363ef7e 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-test-api-impl-tests.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-test-api-impl-tests.java.vm @@ -20,9 +20,9 @@ import static org.junit.jupiter.api.Assertions.*; /** * $!{table.comment} 对外服务单元测试 * - * @author Jiahang Li - * @version 1.0.0 - * @since 2023/8/23 10:36 + * @author ${author} + * @version ${version} + * @since ${date} */ @Slf4j @Import({${type}ApiImpl.class, ${type}ServiceImpl.class}) diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-test-service-impl-tests.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-test-service-impl-tests.java.vm index 826d4642..4bb0728c 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-test-service-impl-tests.java.vm +++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-server-test-service-impl-tests.java.vm @@ -21,9 +21,9 @@ import static org.junit.jupiter.api.Assertions.*; /** * $!{table.comment} 服务单元测试 * - * @author Jiahang Li - * @version 1.0.0 - * @since 2023/8/23 10:36 + * @author ${author} + * @version ${version} + * @since ${date} */ @Slf4j @Import(${type}ServiceImpl.class) diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/controller/ExecController.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/controller/ExecController.java index 287a5cc3..135c6718 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/controller/ExecController.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/controller/ExecController.java @@ -2,6 +2,7 @@ package com.orion.ops.module.asset.controller; import com.orion.lang.define.wrapper.HttpWrapper; import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog; +import com.orion.ops.framework.biz.operator.log.core.enums.ReturnType; import com.orion.ops.framework.common.utils.Valid; import com.orion.ops.framework.web.core.annotation.RestWrapper; import com.orion.ops.module.asset.define.operator.ExecOperatorType; @@ -40,7 +41,7 @@ public class ExecController { @Resource private ExecService execService; - @OperatorLog(ExecOperatorType.EXEC_COMMAND) + @OperatorLog(value = ExecOperatorType.EXEC_COMMAND, ret = ReturnType.IGNORE) @PostMapping("/exec-command") @Operation(summary = "批量执行命令") @PreAuthorize("@ss.hasPermission('asset:exec:exec-command')") @@ -48,7 +49,7 @@ public class ExecController { return execService.execCommand(request); } - @OperatorLog(ExecOperatorType.EXEC_COMMAND) + @OperatorLog(value = ExecOperatorType.EXEC_COMMAND, ret = ReturnType.IGNORE) @PostMapping("/re-exec-command") @Operation(summary = "重新执行命令") @PreAuthorize("@ss.hasPermission('asset:exec:exec-command')") 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 c3b1e696..9e56aa67 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 @@ -35,11 +35,11 @@ public class ExecOperatorType extends InitializingOperatorTypes { return new OperatorType[]{ new OperatorType(M, EXEC_COMMAND, "执行主机命令"), new OperatorType(M, INTERRUPT_EXEC, "中断执行命令"), - new OperatorType(M, INTERRUPT_HOST, "中断主机执行命令 ${logId} ${hostName}"), - new OperatorType(H, DELETE_LOG, "删除执行记录 ${count} 条"), - new OperatorType(H, CLEAR_LOG, "清理执行记录 ${count} 条"), - new OperatorType(H, DELETE_HOST_LOG, "删除主机执行记录 ${logId} ${hostName}"), - new OperatorType(L, DOWNLOAD_HOST_LOG, "下载主机执行日志 ${logId} ${hostName}"), + new OperatorType(M, INTERRUPT_HOST, "中断主机执行命令 ${logId} ${hostName}"), + new OperatorType(H, DELETE_LOG, "删除执行记录 ${count} 条"), + new OperatorType(H, CLEAR_LOG, "清理执行记录 ${count} 条"), + new OperatorType(H, DELETE_HOST_LOG, "删除主机执行记录 ${logId} ${hostName}"), + new OperatorType(L, DOWNLOAD_HOST_LOG, "下载主机执行日志 ${logId} ${hostName}"), }; } diff --git a/orion-ops-ui/src/components/exec/log/panel/log-appender.ts b/orion-ops-ui/src/components/exec/log/panel/log-appender.ts index 4d53b18f..7aa7c4bf 100644 --- a/orion-ops-ui/src/components/exec/log/panel/log-appender.ts +++ b/orion-ops-ui/src/components/exec/log/panel/log-appender.ts @@ -124,11 +124,13 @@ export default class LogAppender implements ILogAppender { // 获取 token const { data } = await getExecLogTailToken(this.config); // 打开会话 - this.client = await createWebSocket(`${webSocketBaseUrl}/exec/log/${data}`); - this.client.onerror = event => { + try { + this.client = await createWebSocket(`${webSocketBaseUrl}/exec/log/${data}`); + } catch (e) { Message.error('连接失败'); - console.error('log error', event); - }; + console.error('log error', e); + return; + } this.client.onclose = event => { console.warn('log close', event); }; diff --git a/orion-ops-ui/src/utils/index.ts b/orion-ops-ui/src/utils/index.ts index c133c73d..077ffaaa 100644 --- a/orion-ops-ui/src/utils/index.ts +++ b/orion-ops-ui/src/utils/index.ts @@ -191,7 +191,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); @@ -204,13 +204,13 @@ export const createWebSocket = async (url: string) => { return new Promise((resolve, reject) => { const socket = new WebSocket(url); - socket.addEventListener('open', () => { + socket.onopen = () => { resolve(socket); - }); + }; - socket.addEventListener('error', (error) => { - reject(error); - }); + socket.onerror = e => { + reject(e); + }; }); }; @@ -241,7 +241,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/exec/exec-command/components/exec-panel-editor.vue b/orion-ops-ui/src/views/exec/exec-command/components/exec-panel-editor.vue index eb6e18a5..5c9b7f11 100644 --- 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 @@ -3,7 +3,11 @@

执行命令

- 从模板中选择 + + 从模板中选择 +
diff --git a/orion-ops-ui/src/views/host/terminal/handler/sftp-transfer-manager.ts b/orion-ops-ui/src/views/host/terminal/handler/sftp-transfer-manager.ts index c4308f78..ec26b22e 100644 --- a/orion-ops-ui/src/views/host/terminal/handler/sftp-transfer-manager.ts +++ b/orion-ops-ui/src/views/host/terminal/handler/sftp-transfer-manager.ts @@ -98,11 +98,12 @@ export default class SftpTransferManager implements ISftpTransferManager { // 获取 access const { data: accessToken } = await getTerminalAccessToken(); // 打开会话 - this.client = await createWebSocket(`${webSocketBaseUrl}/host/transfer/${accessToken}`); - this.client.onerror = event => { + try { + this.client = await createWebSocket(`${webSocketBaseUrl}/host/transfer/${accessToken}`); + } catch (e) { // 打开失败将传输列表置为失效 Message.error('会话打开失败'); - console.error('transfer error', event); + console.error('transfer error', e); // 将等待中和传输中任务修改为失败状态 this.transferList.filter(s => { return s.status === TransferStatus.WAITING @@ -110,17 +111,18 @@ export default class SftpTransferManager implements ISftpTransferManager { }).forEach(s => { s.status = TransferStatus.ERROR; }); - }; + // 关闭会话重置 run + this.run = false; + return; + } this.client.onclose = event => { // 关闭会话重置 run this.run = false; console.warn('transfer close', event); }; - this.client.onopen = () => { - // 打开后自动传输下一个任务 - this.transferNextItem(); - }; this.client.onmessage = this.resolveMessage.bind(this); + // 打开后自动传输下一个任务 + this.transferNextItem(); } // 传输下一条任务 diff --git a/orion-ops-ui/src/views/host/terminal/handler/terminal-channel.ts b/orion-ops-ui/src/views/host/terminal/handler/terminal-channel.ts index deabddbd..de2881d5 100644 --- a/orion-ops-ui/src/views/host/terminal/handler/terminal-channel.ts +++ b/orion-ops-ui/src/views/host/terminal/handler/terminal-channel.ts @@ -22,11 +22,13 @@ export default class TerminalChannel implements ITerminalChannel { // 获取 access const { data: accessToken } = await getTerminalAccessToken(); // 打开会话 - this.client = await createWebSocket(`${webSocketBaseUrl}/host/terminal/${accessToken}`); - this.client.onerror = event => { + try { + this.client = await createWebSocket(`${webSocketBaseUrl}/host/terminal/${accessToken}`); + } catch (e) { Message.error('无法连接至服务器'); - console.error('terminal error', event); - }; + console.error('terminal error', e); + throw e; + } this.client.onclose = event => { console.warn('terminal close', event); }; diff --git a/orion-ops-ui/src/views/system/dict-value/components/dict-value-form-modal.vue b/orion-ops-ui/src/views/system/dict-value/components/dict-value-form-modal.vue index 3218b911..3c6584b0 100644 --- a/orion-ops-ui/src/views/system/dict-value/components/dict-value-form-modal.vue +++ b/orion-ops-ui/src/views/system/dict-value/components/dict-value-form-modal.vue @@ -65,12 +65,15 @@ @@ -223,12 +226,22 @@