Merge pull request #101 from dromara/dev

Dev
This commit is contained in:
李佳航
2025-04-06 21:44:08 +08:00
committed by GitHub
26 changed files with 102 additions and 42 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -36,7 +36,7 @@ public interface AppConst extends OrionConst {
/**
* 同 ${orion.version} 迭代时候需要手动更改
*/
String VERSION = "2.3.7";
String VERSION = "2.3.8";
/**
* 同 ${spring.application.name}

View File

@@ -14,7 +14,7 @@
<url>https://github.com/dromara/orion-visor</url>
<properties>
<revision>2.3.7</revision>
<revision>2.3.8</revision>
<spring.boot.version>2.7.17</spring.boot.version>
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>

View File

@@ -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();

View File

@@ -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 查询主机")

View File

@@ -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);
}

View File

@@ -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, "删除主机 <sb>${count}</sb> 条"),
new OperatorType(M, UPDATE_STATUS, "修改主机状态 <sb>${name}</sb> - <sb>${status}</sb>"),
new OperatorType(M, UPDATE_CONFIG, "修改主机配置 <sb>${name}</sb>"),
new OperatorType(M, UPDATE_SPEC, "修改主机规格信息 <sb>${name}</sb>"),
};
}

View File

@@ -49,7 +49,6 @@ public class HostExtraUpdateRequest {
@Schema(description = "主机id")
private Long hostId;
@NotNull
@Schema(description = "配置项")
private String item;

View File

@@ -122,14 +122,12 @@ public class HostSshConfigStrategy extends AbstractGenericsDataStrategy<HostSshC
* @param after after
*/
private void checkEncryptPassword(HostSshConfigModel before, HostSshConfigModel after) {
// 非密码认证则直接赋值
if (!HostSshAuthTypeEnum.PASSWORD.name().equals(after.getAuthType())) {
after.setPassword(before.getPassword());
return;
}
// 使用原始密码
if (!Booleans.isTrue(after.getUseNewPassword())) {
after.setPassword(before.getPassword());
// 非密码认证/使用原始密码则直接赋值
if (!HostSshAuthTypeEnum.PASSWORD.name().equals(after.getAuthType())
|| !Booleans.isTrue(after.getUseNewPassword())) {
if (before != null) {
after.setPassword(before.getPassword());
}
return;
}
// 检查新密码

View File

@@ -25,10 +25,7 @@ package org.dromara.visor.module.asset.service;
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.dromara.visor.module.asset.entity.domain.HostDO;
import org.dromara.visor.module.asset.entity.request.host.HostCreateRequest;
import org.dromara.visor.module.asset.entity.request.host.HostQueryRequest;
import org.dromara.visor.module.asset.entity.request.host.HostUpdateRequest;
import org.dromara.visor.module.asset.entity.request.host.HostUpdateStatusRequest;
import org.dromara.visor.module.asset.entity.request.host.*;
import org.dromara.visor.module.asset.entity.vo.HostVO;
import java.util.List;
@@ -66,6 +63,14 @@ public interface HostService {
*/
Integer updateHostStatus(HostUpdateStatusRequest request);
/**
* 修改主机规格
*
* @param request request
* @return effect
*/
Integer updateHostSpec(HostExtraUpdateRequest request);
/**
* 通过 id 查询主机
*

View File

@@ -44,11 +44,9 @@ import org.dromara.visor.module.asset.dao.HostDAO;
import org.dromara.visor.module.asset.define.cache.HostCacheKeyDefine;
import org.dromara.visor.module.asset.entity.domain.HostDO;
import org.dromara.visor.module.asset.entity.dto.HostCacheDTO;
import org.dromara.visor.module.asset.entity.request.host.HostCreateRequest;
import org.dromara.visor.module.asset.entity.request.host.HostQueryRequest;
import org.dromara.visor.module.asset.entity.request.host.HostUpdateRequest;
import org.dromara.visor.module.asset.entity.request.host.HostUpdateStatusRequest;
import org.dromara.visor.module.asset.entity.request.host.*;
import org.dromara.visor.module.asset.entity.vo.HostVO;
import org.dromara.visor.module.asset.enums.HostExtraItemEnum;
import org.dromara.visor.module.asset.enums.HostStatusEnum;
import org.dromara.visor.module.asset.handler.host.extra.model.HostSpecExtraModel;
import org.dromara.visor.module.asset.service.ExecJobHostService;
@@ -192,6 +190,19 @@ public class HostServiceImpl implements HostService {
return effect;
}
@Override
public Integer updateHostSpec(HostExtraUpdateRequest request) {
log.info("HostService-updateHostSpec request: {}", JSON.toJSONString(request));
// 查询主机
HostDO record = hostDAO.selectById(request.getHostId());
Valid.notNull(record, ErrorMessage.HOST_ABSENT);
// 设置日志参数
OperatorLogs.add(OperatorLogs.NAME, record.getName());
// 更新
request.setItem(HostExtraItemEnum.SPEC.name());
return hostExtraService.updateHostExtra(request);
}
@Override
@SneakyThrows
public HostVO getHostById(Long id) {

View File

@@ -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

View File

@@ -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

View File

@@ -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",

View File

@@ -1,4 +1,4 @@
import type { HostSpecExtraModel } from './host-extra';
import type { HostSpecExtraModel, HostExtraUpdateRequest } from './host-extra';
import type { TableData } from '@arco-design/web-vue';
import type { DataGrid, OrderDirection, Pagination } from '@/types/global';
import axios from 'axios';
@@ -121,6 +121,13 @@ export function updateHostStatus(request: HostUpdateStatusRequest) {
return axios.put('/asset/host/update-status', request);
}
/**
* 修改主机规格信息
*/
export function updateHostSpec(request: Partial<HostExtraUpdateRequest>) {
return axios.put('/asset/host/update-spec', request);
}
/**
* 查询主机
*/

View File

@@ -252,10 +252,11 @@
<script lang="ts" setup>
import type { HostSpecExtraModel } from '@/api/asset/host-extra';
import { onMounted, ref } from 'vue';
import { updateHostSpec } from '@/api/asset/host';
import { getHostExtraItem } from '@/api/asset/host-extra';
import { addSuffix, dateFormat } from '@/utils';
import { useToggle } from '@vueuse/core';
import useLoading from '@/hooks/loading';
import { getHostExtraItem, updateHostExtra } from '@/api/asset/host-extra';
const props = defineProps<{
hostId: number;
@@ -297,9 +298,8 @@
const saveSpec = async () => {
setLoading(true);
try {
await updateHostExtra({
await updateHostSpec({
hostId: props.hostId,
item: 'SPEC',
extra: JSON.stringify(formModel.value)
});
toggleEditing();

View File

@@ -14,7 +14,7 @@ const columns = [
title: '主机信息',
dataIndex: 'hostInfo',
slotName: 'hostInfo',
minWidth: 328,
minWidth: 344,
align: 'left',
fixed: 'left',
default: true,

View File

@@ -42,7 +42,7 @@
<script lang="ts" setup>
import type { ISshSession, TerminalPanelTabItem } from '../../types/define';
import { onMounted, onUnmounted, ref } from 'vue';
import { useDictStore, useTerminalStore } from '@/store';
import { useTerminalStore } from '@/store';
import SshHeader from './ssh-header.vue';
import ShellEditorModal from '@/components/view/shell-editor/modal/index.vue';
import SshContextMenu from './ssh-context-menu.vue';
@@ -53,7 +53,6 @@
tab: TerminalPanelTabItem;
}>();
const { getDictValue } = useDictStore();
const { preference, sessionManager } = useTerminalStore();
const editorModal = ref();

View File

@@ -22,7 +22,7 @@
</modules>
<properties>
<revision>2.3.7</revision>
<revision>2.3.8</revision>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version>

View File

@@ -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
-- ----------------------------

View File

@@ -349,6 +349,7 @@ INSERT INTO `dict_value` VALUES (443, 21, 'terminalFontFamily', 'Cascadia Mono',
INSERT INTO `dict_value` VALUES (448, 65, 'hostArchType', 'AMD64', 'amd64', '{}', 10, '2025-03-26 16:33:07', '2025-03-26 16:33:07', 'admin', 'admin', 0);
INSERT INTO `dict_value` VALUES (449, 65, 'hostArchType', 'ARM64', 'arm64', '{}', 20, '2025-03-26 16:33:23', '2025-03-26 16:33:23', 'admin', 'admin', 0);
INSERT INTO `dict_value` VALUES (452, 38, 'hostOsType', 'DRAWIN', 'Drawin', '{}', 30, '2024-04-16 22:19:25', '2025-03-26 22:46:23', 'admin', 'admin', 0);
INSERT INTO `dict_value` VALUES (458, 2, 'operatorLogType', 'host:update-spec', '修改主机规格', '{}', 60, '2025-04-06 12:02:13', '2025-04-06 12:02:13', 'admin', 'admin', 0);
-- 菜单配置
INSERT INTO `system_menu` VALUES (1, 0, '工作台', NULL, 1, 10, 1, 1, 1, 0, 'IconComputer', NULL, 'workplace', '2023-07-28 10:51:50', '2024-08-11 00:05:44', 'admin', 'admin', 0);