From f64c15a01bc31e345605fbd5f1161614f72d4107 Mon Sep 17 00:00:00 2001 From: lijiahangmax Date: Sun, 6 Apr 2025 10:56:28 +0800 Subject: [PATCH 1/4] =?UTF-8?q?:bookmark:=20=E5=8D=87=E7=BA=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/adminer/build.sh | 2 +- docker/mysql/build.sh | 2 +- docker/push.sh | 2 +- docker/redis/build.sh | 2 +- docker/service/build.sh | 2 +- docker/ui/build.sh | 2 +- .../main/java/org/dromara/visor/common/constant/AppConst.java | 2 +- orion-visor-dependencies/pom.xml | 2 +- .../test/java/org/dromara/visor/launch/ReplaceVersion.java | 4 ++-- orion-visor-ui/.env.development | 2 +- orion-visor-ui/.env.production | 2 +- orion-visor-ui/package.json | 2 +- pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docker/adminer/build.sh b/docker/adminer/build.sh index ca18dcb1..0e499258 100644 --- a/docker/adminer/build.sh +++ b/docker/adminer/build.sh @@ -1,6 +1,6 @@ #/bin/bash set -e -version=2.3.7 +version=2.3.8 docker build -t orion-visor-adminer:${version} . docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:${version} docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:latest diff --git a/docker/mysql/build.sh b/docker/mysql/build.sh index b125a668..925c0fa2 100644 --- a/docker/mysql/build.sh +++ b/docker/mysql/build.sh @@ -1,6 +1,6 @@ #/bin/bash set -e -version=2.3.7 +version=2.3.8 cp -r ../../sql ./sql docker build -t orion-visor-mysql:${version} . rm -rf ./sql diff --git a/docker/push.sh b/docker/push.sh index 71a7c7dd..39812f79 100644 --- a/docker/push.sh +++ b/docker/push.sh @@ -1,6 +1,6 @@ #/bin/bash set -e -version=2.3.7 +version=2.3.8 docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:${version} docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-mysql:${version} docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:${version} diff --git a/docker/redis/build.sh b/docker/redis/build.sh index f451baf1..d0c84beb 100644 --- a/docker/redis/build.sh +++ b/docker/redis/build.sh @@ -1,6 +1,6 @@ #/bin/bash set -e -version=2.3.7 +version=2.3.8 docker build -t orion-visor-redis:${version} . docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:${version} docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:latest diff --git a/docker/service/build.sh b/docker/service/build.sh index 38e2cf35..d77b26af 100644 --- a/docker/service/build.sh +++ b/docker/service/build.sh @@ -1,6 +1,6 @@ #/bin/bash set -e -version=2.3.7 +version=2.3.8 mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar docker build -t orion-visor-service:${version} . rm -rf ./orion-visor-launch.jar diff --git a/docker/ui/build.sh b/docker/ui/build.sh index c1b5fdb1..cca3e365 100644 --- a/docker/ui/build.sh +++ b/docker/ui/build.sh @@ -1,6 +1,6 @@ #/bin/bash set -e -version=2.3.7 +version=2.3.8 mv ../../orion-visor-ui/dist ./dist docker build -t orion-visor-ui:${version} . rm -rf ./orion-visor-launch.jar diff --git a/orion-visor-common/src/main/java/org/dromara/visor/common/constant/AppConst.java b/orion-visor-common/src/main/java/org/dromara/visor/common/constant/AppConst.java index f0fe57f7..a93a53c7 100644 --- a/orion-visor-common/src/main/java/org/dromara/visor/common/constant/AppConst.java +++ b/orion-visor-common/src/main/java/org/dromara/visor/common/constant/AppConst.java @@ -36,7 +36,7 @@ public interface AppConst extends OrionConst { /** * 同 ${orion.version} 迭代时候需要手动更改 */ - String VERSION = "2.3.7"; + String VERSION = "2.3.8"; /** * 同 ${spring.application.name} diff --git a/orion-visor-dependencies/pom.xml b/orion-visor-dependencies/pom.xml index 09ab2d89..37c0db2f 100644 --- a/orion-visor-dependencies/pom.xml +++ b/orion-visor-dependencies/pom.xml @@ -14,7 +14,7 @@ https://github.com/dromara/orion-visor - 2.3.7 + 2.3.8 2.7.17 2.7.15 1.5.0 diff --git a/orion-visor-launch/src/test/java/org/dromara/visor/launch/ReplaceVersion.java b/orion-visor-launch/src/test/java/org/dromara/visor/launch/ReplaceVersion.java index 4a487986..b0de9f73 100644 --- a/orion-visor-launch/src/test/java/org/dromara/visor/launch/ReplaceVersion.java +++ b/orion-visor-launch/src/test/java/org/dromara/visor/launch/ReplaceVersion.java @@ -39,9 +39,9 @@ import java.util.function.Function; */ public class ReplaceVersion { - private static final String TARGET_VERSION = "2.3.6"; + private static final String TARGET_VERSION = "2.3.7"; - private static final String REPLACE_VERSION = "2.3.7"; + private static final String REPLACE_VERSION = "2.3.8"; private static final String PATH = new File("").getAbsolutePath(); diff --git a/orion-visor-ui/.env.development b/orion-visor-ui/.env.development index f706f9b9..4ca0c29a 100644 --- a/orion-visor-ui/.env.development +++ b/orion-visor-ui/.env.development @@ -3,4 +3,4 @@ VITE_API_BASE_URL=http://127.0.0.1:9200/orion-visor/api # websocket 路径 VITE_WS_BASE_URL=ws://127.0.0.1:9200/orion-visor/keep-alive # 版本号 -VITE_APP_VERSION=2.3.7 +VITE_APP_VERSION=2.3.8 diff --git a/orion-visor-ui/.env.production b/orion-visor-ui/.env.production index 3c33c589..5826dcf8 100644 --- a/orion-visor-ui/.env.production +++ b/orion-visor-ui/.env.production @@ -3,4 +3,4 @@ VITE_API_BASE_URL=/orion-visor/api # websocket 路径 VITE_WS_BASE_URL=/orion-visor/keep-alive # 版本号 -VITE_APP_VERSION=2.3.7 +VITE_APP_VERSION=2.3.8 diff --git a/orion-visor-ui/package.json b/orion-visor-ui/package.json index 70782b34..dafffbea 100644 --- a/orion-visor-ui/package.json +++ b/orion-visor-ui/package.json @@ -1,7 +1,7 @@ { "name": "orion-visor-ui", "description": "Orion Visor UI", - "version": "2.3.7", + "version": "2.3.8", "private": true, "author": "Jiahang Li", "license": "Apache 2.0", diff --git a/pom.xml b/pom.xml index 3bc7746a..313eff19 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ - 2.3.7 + 2.3.8 8 8 3.0.0-M5 From 86914321a6247bef227d4ec392835c8975077605 Mon Sep 17 00:00:00 2001 From: lijiahangmax Date: Sun, 6 Apr 2025 11:11:39 +0800 Subject: [PATCH 2/4] =?UTF-8?q?:bookmark:=20=E4=BF=AE=E6=94=B9=20sql=20?= =?UTF-8?q?=E8=84=9A=E6=9C=AC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/init-2-schema-tables.sql | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/sql/init-2-schema-tables.sql b/sql/init-2-schema-tables.sql index ec32ed7d..8832b52f 100644 --- a/sql/init-2-schema-tables.sql +++ b/sql/init-2-schema-tables.sql @@ -414,14 +414,13 @@ DROP TABLE IF EXISTS `host`; CREATE TABLE `host` ( `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT 'id', - `type` char(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主机类型', + `types` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主机类型', `os_type` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '系统类型', + `arch_type` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '系统架构', `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主机名称', `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主机编码', `address` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主机地址', - `port` int(0) NULL DEFAULT NULL COMMENT '主机端口', `status` char(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主机状态', - `config` json NULL COMMENT '主机配置', `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主机描述', `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', @@ -429,13 +428,37 @@ CREATE TABLE `host` `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新人', `deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除', PRIMARY KEY (`id`) USING BTREE, - INDEX `idx_type_address` (`type`, `address`) USING BTREE + INDEX `idx_name` (`name`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '主机' ROW_FORMAT = Dynamic; +-- ---------------------------- +-- Table structure for host_config +-- ---------------------------- +DROP TABLE IF EXISTS `host_config`; +CREATE TABLE `host_config` +( + `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT 'id', + `host_id` bigint(0) NULL DEFAULT NULL COMMENT '主机id', + `type` char(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '配置类型', + `status` char(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '配置状态', + `config` json NULL COMMENT '配置值', + `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新人', + `deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除', + PRIMARY KEY (`id`) USING BTREE, + INDEX `host_type_idx` (`host_id`, `type`) USING BTREE +) ENGINE = InnoDB + AUTO_INCREMENT = 1 + CHARACTER SET = utf8mb4 + COLLATE = utf8mb4_unicode_ci COMMENT = '主机配置表' + ROW_FORMAT = Dynamic; + -- ---------------------------- -- Table structure for host_identity -- ---------------------------- From 2c07551b8854a88ae8942faf38113b6cf01f3f41 Mon Sep 17 00:00:00 2001 From: lijiahangmax Date: Sun, 6 Apr 2025 21:17:50 +0800 Subject: [PATCH 3/4] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BB=E6=9C=BA=E9=85=8D=E7=BD=AE=E6=8A=A5=E9=94=99?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../asset/controller/HostController.java | 9 +++++++++ .../asset/controller/HostExtraController.java | 5 +++++ .../define/operator/HostOperatorType.java | 3 +++ .../request/host/HostExtraUpdateRequest.java | 1 - .../strategy/HostSshConfigStrategy.java | 14 ++++++-------- .../module/asset/service/HostService.java | 13 +++++++++---- .../asset/service/impl/HostServiceImpl.java | 19 +++++++++++++++---- orion-visor-ui/src/api/asset/host.ts | 9 ++++++++- .../host-list/components/host-form-spec.vue | 6 +++--- .../host/terminal/components/ssh/ssh-view.vue | 3 +-- sql/init-4-data.sql | 1 + 11 files changed, 60 insertions(+), 23 deletions(-) diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/HostController.java b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/HostController.java index 165455ae..3b7629f7 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/HostController.java +++ b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/HostController.java @@ -93,6 +93,15 @@ public class HostController { return hostService.updateHostStatus(request); } + @DemoDisableApi + @OperatorLog(HostOperatorType.UPDATE_SPEC) + @PutMapping("/update-spec") + @Operation(summary = "修改主机规格信息") + @PreAuthorize("@ss.hasPermission('asset:host:update')") + public Integer updateHostSpec(@Validated @RequestBody HostExtraUpdateRequest request) { + return hostService.updateHostSpec(request); + } + @IgnoreLog(IgnoreLogMode.RET) @GetMapping("/get") @Operation(summary = "通过 id 查询主机") diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/HostExtraController.java b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/HostExtraController.java index 336f004d..2e0e44e3 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/HostExtraController.java +++ b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/HostExtraController.java @@ -26,10 +26,13 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; +import org.dromara.visor.common.constant.ErrorMessage; +import org.dromara.visor.common.utils.Valid; import org.dromara.visor.framework.log.core.annotation.IgnoreLog; import org.dromara.visor.framework.log.core.enums.IgnoreLogMode; import org.dromara.visor.framework.web.core.annotation.RestWrapper; import org.dromara.visor.module.asset.entity.request.host.HostExtraUpdateRequest; +import org.dromara.visor.module.asset.enums.HostExtraItemEnum; import org.dromara.visor.module.asset.service.HostExtraService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -67,6 +70,8 @@ public class HostExtraController { @PutMapping("/update") @Operation(summary = "修改主机拓展信息") public Integer updateHostExtra(@Validated @RequestBody HostExtraUpdateRequest request) { + HostExtraItemEnum item = Valid.valid(HostExtraItemEnum::of, request.getItem()); + Valid.isTrue(item.isUserExtra(), ErrorMessage.PARAM_ERROR); return hostExtraService.updateHostExtra(request); } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/HostOperatorType.java b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/HostOperatorType.java index f9621213..72890501 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/HostOperatorType.java +++ b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/HostOperatorType.java @@ -48,6 +48,8 @@ public class HostOperatorType extends InitializingOperatorTypes { public static final String UPDATE_CONFIG = "host:update-config"; + public static final String UPDATE_SPEC = "host:update-spec"; + @Override public OperatorType[] types() { return new OperatorType[]{ @@ -56,6 +58,7 @@ public class HostOperatorType extends InitializingOperatorTypes { new OperatorType(H, DELETE, "删除主机 ${count} 条"), new OperatorType(M, UPDATE_STATUS, "修改主机状态 ${name} - ${status}"), new OperatorType(M, UPDATE_CONFIG, "修改主机配置 ${name}"), + new OperatorType(M, UPDATE_SPEC, "修改主机规格信息 ${name}"), }; } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/host/HostExtraUpdateRequest.java b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/host/HostExtraUpdateRequest.java index 33ac0cb2..2847aff1 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/host/HostExtraUpdateRequest.java +++ b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/host/HostExtraUpdateRequest.java @@ -49,7 +49,6 @@ public class HostExtraUpdateRequest { @Schema(description = "主机id") private Long hostId; - @NotNull @Schema(description = "配置项") private String item; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/config/strategy/HostSshConfigStrategy.java b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/config/strategy/HostSshConfigStrategy.java index 7dfa8863..d54668ca 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/config/strategy/HostSshConfigStrategy.java +++ b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/config/strategy/HostSshConfigStrategy.java @@ -122,14 +122,12 @@ public class HostSshConfigStrategy extends AbstractGenericsDataStrategy) { + return axios.put('/asset/host/update-spec', request); +} + /** * 查询主机 */ diff --git a/orion-visor-ui/src/views/asset/host-list/components/host-form-spec.vue b/orion-visor-ui/src/views/asset/host-list/components/host-form-spec.vue index c8d750bd..b1e5e085 100644 --- a/orion-visor-ui/src/views/asset/host-list/components/host-form-spec.vue +++ b/orion-visor-ui/src/views/asset/host-list/components/host-form-spec.vue @@ -252,10 +252,11 @@