Compare commits

..

21 Commits
v2.5.5 ... dev

Author SHA1 Message Date
lijiahangmax
b207c5d253 :pencli2: 修改文档. 2025-12-22 18:23:03 +08:00
lijiahangmax
5335a8d008 🔨 替换换行符. 2025-12-21 15:55:21 +08:00
lijiahangmax
1e74659f15 🔨 优化安装逻辑. 2025-12-19 00:32:53 +08:00
lijiahangmax
58a1a7abd4 🔨 替换换行符. 2025-12-17 23:06:25 +08:00
lijiahangmax
6c125a1c0d :pencli2: 修改文档. 2025-12-16 17:52:38 +08:00
lijiahangmax
263436405c 🔨 移除无用字段. 2025-12-14 10:04:02 +08:00
lijiahangmax
2296ca46a4 🔖 升级版本. 2025-12-12 11:01:15 +08:00
lijiahangmax
ffcb3baf44 🔨 优化缓存删除逻辑. 2025-12-11 10:00:12 +08:00
lijiahangmax
501755231a 🔨 优化缓存删除逻辑. 2025-12-10 09:49:35 +08:00
lijiahangmax
f4ddeb3e6c 🔨 对外服务 api 配置. 2025-12-09 10:06:24 +08:00
lijiahangmax
40afc03203 🔨 调整列宽. 2025-12-08 16:25:55 +08:00
lijiahangmax
7c479b1720 🔨 优化保存逻辑. 2025-12-07 22:10:55 +08:00
lijiahangmax
6c6f69ae24 🔨 优化异常处理逻辑. 2025-12-04 15:31:40 +08:00
lijiahangmax
d1cb056adf 🔨 优化异常处理逻辑. 2025-12-04 15:31:11 +08:00
lijiahangmax
14dc8e0407 🔨 优化异常处理逻辑. 2025-12-03 09:45:21 +08:00
lijiahangmax
528cfc90f2 🔨 优化异常处理逻辑. 2025-12-03 09:42:21 +08:00
lijiahangmax
327bb72659 🔨 优化异常处理逻辑. 2025-12-02 10:09:26 +08:00
lijiahangmax
c6b248ab6f 🔨 优化异常处理逻辑. 2025-12-01 09:59:48 +08:00
lijiahangmax
0ece84bdf1 🔨 优化异常处理逻辑. 2025-11-28 10:27:02 +08:00
lijiahangmax
61fa7a6e32 🔨 全局异常处理. 2025-11-27 09:44:20 +08:00
lijiahangmax
21e7d29077 🔨 修改 sftp 样式. 2025-11-26 10:25:59 +08:00
187 changed files with 533 additions and 636 deletions

View File

@@ -6,6 +6,8 @@ SPRING_PROFILES_ACTIVE=prod
DEMO_MODE=false
API_CORS=true
API_HOST=0.0.0.0
# API_URL=http://127.0.0.1:9200/orion-visor/api
API_IP_HEADERS=X-Forwarded-For,X-Real-IP
API_EXPOSE_TOKEN=pmqeHOyZaumHm0Wt
SECRET_KEY=uQeacXV8b3isvKLK

View File

@@ -17,6 +17,8 @@ body:
required: true
- label: 我已搜索 [issue](https://github.com/dromara/orion-visor/issues) 并没有找到相关问题
required: true
- label: 我已 star 了此项目, 否则可能会被自动关闭
required: true
- type: input
id: version
attributes:

View File

@@ -38,8 +38,8 @@
</a>
<a target="_blank"
style="text-decoration: none !important;"
href="https://gitcode.com/dromara/orion-visor">
<img src="https://gitcode.com/dromara/orion-visor/star/badge.svg" alt="star"/>
href="https://atomgit.com/dromara/orion-visor">
<img src="https://atomgit.com/dromara/orion-visor/star/2025top.svg" alt="star" />
</a>
</p>
@@ -60,7 +60,7 @@
* 🔗 演示地址: [https://dv.orionsec.cn/](https://dv.orionsec.cn/)
* 🔏 演示账号: admin/admin
* ⭐ 体验后可以点一下 `star`
这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor) [gitcode](https://gitcode.com/dromara/orion-visor)
这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor) [atomgit](https://atomgit.com/dromara/orion-visor)
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
@@ -171,6 +171,6 @@ QQ群: 755242157
![GVP](docs/assets/gvp.jpg?time=20250627 "GVP")
## GitCode 最有影响力的开源项目 G-Star
## AtomGit 最有影响力的开源项目 G-Star
![GSTAR](docs/assets/gstar.jpg?time=20250627 "GSTAR")

View File

@@ -1,6 +1,4 @@
version: '3.3'
# latest = 2.5.5
# latest = 2.5.6
# 支持以下源
# lijiahangmax/*
@@ -50,6 +48,10 @@ services:
SECRET_KEY: ${SECRET_KEY:-uQeacXV8b3isvKLK}
API_EXPOSE_TOKEN: ${API_EXPOSE_TOKEN:-pmqeHOyZaumHm0Wt}
API_IP_HEADERS: ${API_IP_HEADERS:-X-Forwarded-For,X-Real-IP}
# 这里需要改为具体的服务地址 (宿主机ip)
API_HOST: ${API_HOST:-0.0.0.0}
# 若 API_HOST 不满足, 可以修改这里 http://<ip>:<port>/orion-visor/api
API_URL: ${API_URL:-}
API_CORS: ${API_CORS:-true}
DEMO_MODE: ${DEMO_MODE:-false}
volumes:

View File

@@ -7,7 +7,7 @@ set -e
source ./project-build.sh "$@"
# 版本号
version=2.5.5
version=2.5.6
# 是否推送镜像
push_image=false
# 是否构建 latest
@@ -140,7 +140,7 @@ function modify_dockerfiles() {
if [ -f "$file" ]; then
echo "备份并修改: $file"
cp "$file" "$file$backup_suffix"
sed -i 's/--platform=\TARGETPLATFORM//g' "$file"
sed -i "s/--platform=\$TARGETPLATFORM//g" "$file"
else
echo "文件不存在 -> $file"
fi
@@ -189,7 +189,7 @@ function push_image_to_registry() {
# 推送版本
docker push "${namespace}/${image_name}:${version}"
# 推送 latest
if [ "latest_image" = true ]; then
if [ "$latest_image" = true ]; then
docker push "${namespace}/${image_name}:latest"
fi
done

View File

@@ -4,7 +4,7 @@ set -e
# DockerContext: orion-visor
# 版本号
version=2.5.5
version=2.5.6
# 是否构建 service
export build_service=false
# 是否构建 ui

View File

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

View File

@@ -55,4 +55,6 @@ public interface Const extends cn.orionsec.kit.lang.constant.Const, FieldConst,
int BATCH_COUNT = 500;
String IP_0000 = "0.0.0.0";
}

View File

@@ -210,6 +210,10 @@ public interface ErrorMessage {
String PLEASE_SELECT_SUFFIX_FILE = "请选择 {} 类型的文件";
String SPEC_FORMAT_INCORRECT = "规格格式不正确";
String INFLUXDB_UNSUPPORTED = "InfluxDB 服务未开启";
/**
* 是否为业务异常
*

View File

@@ -14,7 +14,7 @@
<url>https://github.com/dromara/orion-visor</url>
<properties>
<revision>2.5.5</revision>
<revision>2.5.6</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

@@ -30,7 +30,9 @@ import com.influxdb.client.write.Point;
import com.influxdb.query.FluxRecord;
import com.influxdb.query.FluxTable;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.entity.chart.TimeChartSeries;
import org.dromara.visor.common.utils.Assert;
import org.dromara.visor.framework.influxdb.core.query.FluxQueryBuilder;
import java.time.Instant;
@@ -66,6 +68,7 @@ public class InfluxdbUtils {
* @param points points
*/
public static void writePoints(List<Point> points) {
Assert.notNull(client, ErrorMessage.INFLUXDB_UNSUPPORTED);
try (WriteApi api = client.makeWriteApi()) {
// 写入指标
api.writePoints(points);
@@ -79,6 +82,7 @@ public class InfluxdbUtils {
* @return points
*/
public static List<FluxTable> queryTable(String query) {
Assert.notNull(client, ErrorMessage.INFLUXDB_UNSUPPORTED);
return client.getQueryApi().query(query);
}

View File

@@ -32,6 +32,7 @@ import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.utils.Assert;
#if($meta.enableCache)
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
#end
#foreach($pkg in ${customModuleFilePackages})
@@ -76,7 +77,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
log.info("${type}Service-create${type} id: {}, effect: {}", id, effect);
#if($meta.enableCache)
// 删除缓存
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
#end
return id;
}
@@ -98,7 +99,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
log.info("${type}Service-update${type}ById effect: {}", effect);
#if($meta.enableCache)
// 删除缓存
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
#end
return effect;
}
@@ -116,7 +117,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
log.info("${type}Service.update${type} effect: {}", effect);
#if($meta.enableCache)
// 删除缓存
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
#end
return effect;
}
@@ -237,7 +238,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
log.info("${type}Service.delete${type} effect: {}", effect);
#if($meta.enableCache)
// 删除缓存
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
#end
return effect;
}

View File

@@ -169,7 +169,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -200,7 +199,6 @@
pagination.total = data.total;
pagination.current = request.page;
pagination.pageSize = request.limit;
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -135,8 +135,6 @@
}
handleClose();
return true;
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -139,8 +139,6 @@
}
handleClose();
return true;
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -202,7 +202,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -220,7 +219,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -246,7 +244,6 @@
#if($vue.enableRowSelection)
selectedKeys.value = [];
#end
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -29,6 +29,7 @@ import org.dromara.visor.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.common.constant.FilterOrderConst;
import org.dromara.visor.common.web.WebFilterCreator;
import org.dromara.visor.framework.web.configuration.config.ExposeApiConfig;
import org.dromara.visor.framework.web.configuration.config.OrionApiConfig;
import org.dromara.visor.framework.web.core.aspect.DemoDisableApiAspect;
import org.dromara.visor.framework.web.core.aspect.ExposeApiAspect;
import org.dromara.visor.framework.web.core.filter.TraceIdFilter;
@@ -71,7 +72,7 @@ import java.util.List;
@DependsOn({"executorContext"})
@AutoConfiguration
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_WEB)
@EnableConfigurationProperties(ExposeApiConfig.class)
@EnableConfigurationProperties({ExposeApiConfig.class, OrionApiConfig.class})
public class OrionWebAutoConfiguration implements WebMvcConfigurer {
@Value("${orion.prefix}")

View File

@@ -36,6 +36,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties("orion.api.expose")
public class ExposeApiConfig {
/**
* 对外服务地址
*/
private String host;
/**
* 对外服务请求头
*/

View File

@@ -0,0 +1,83 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.framework.web.configuration.config;
import cn.orionsec.kit.lang.utils.Strings;
import cn.orionsec.kit.lang.utils.net.IPs;
import lombok.Data;
import org.dromara.visor.common.constant.Const;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* api 配置属性
*
* @author Jiahang Li
* @version 1.0.0
* @since 2025/12/8 14:00
*/
@Data
@ConfigurationProperties("orion.api")
public class OrionApiConfig {
private static final String URL_TEMPLATE = "http://{}:{}{}";
/**
* 公共 api 前缀
*/
private String prefix;
/**
* 服务端主机地址
*/
private String host;
/**
* 服务端口
*/
@Value("${server.port}")
private Integer port;
/**
* 服务端 url
*/
private String url;
public String getHost() {
if (Const.IP_0000.equalsIgnoreCase(host)) {
// 本机
return IPs.IP;
} else {
return host;
}
}
public String getUrl() {
if (!Strings.isBlank(url)) {
return url;
}
// 构建
return Strings.format(URL_TEMPLATE, this.getHost(), port, prefix);
}
}

View File

@@ -33,6 +33,16 @@
"type": "java.lang.Boolean",
"description": "是否开启 cors 过滤器."
},
{
"name": "orion.api.host",
"type": "java.lang.String",
"description": "服务端主机地址."
},
{
"name": "orion.api.url",
"type": "java.lang.String",
"description": "服务端接口地址."
},
{
"name": "orion.api.ip-headers",
"type": "java.lang.String",

View File

@@ -74,6 +74,10 @@ orion:
api:
# 是否允许跨域
cors: ${API_CORS:true}
# 服务端主机地址
host: ${API_HOST:0.0.0.0}
# 服务端接口地址 默认自动生成
url: ${API_URL:}
# 获取 IP 的请求头
ip-headers: ${API_IP_HEADERS:X-Forwarded-For,X-Real-IP}
# 对外服务

View File

@@ -175,6 +175,10 @@ orion:
prefix: ${orion.prefix}/api
# 是否允许跨域
cors: true
# 服务端主机地址
host: 0.0.0.0
# 服务端接口地址 默认自动生成
url:
# 获取 IP 的请求头
ip-headers: X-Forwarded-For,X-Real-IP
# 对外服务

View File

@@ -39,9 +39,9 @@ import java.util.function.Function;
*/
public class ReplaceVersion {
private static final String TARGET_VERSION = "2.5.4";
private static final String TARGET_VERSION = "2.5.5";
private static final String REPLACE_VERSION = "2.5.5";
private static final String REPLACE_VERSION = "2.5.6";
private static final String PATH = new File("").getAbsolutePath();

View File

@@ -45,6 +45,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 主机探针端点 api
@@ -90,9 +91,8 @@ public class HostAgentController {
@PostMapping("/install")
@Operation(summary = "安装主机探针")
@PreAuthorize("@ss.hasPermission('asset:host:install-agent')")
public Boolean installAgent(@Validated @RequestBody HostAgentInstallRequest request) {
hostAgentService.installAgent(request);
return true;
public Map<String, Long> installAgent(@Validated @RequestBody HostAgentInstallRequest request) {
return hostAgentService.installAgent(request);
}
@DemoDisableApi

View File

@@ -27,6 +27,7 @@ import org.dromara.visor.module.asset.entity.vo.HostAgentStatusVO;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* 主机探针 服务类
@@ -49,8 +50,9 @@ public interface HostAgentService {
* 安装探针
*
* @param request request
* @return agentKey:installId
*/
void installAgent(HostAgentInstallRequest request);
Map<String, Long> installAgent(HostAgentInstallRequest request);
/**
* 上传探针发布包

View File

@@ -22,6 +22,7 @@
*/
package org.dromara.visor.module.asset.service.impl;
import cn.orionsec.kit.lang.function.Functions;
import cn.orionsec.kit.lang.utils.Exceptions;
import cn.orionsec.kit.lang.utils.Strings;
import cn.orionsec.kit.lang.utils.collect.Lists;
@@ -31,7 +32,6 @@ import cn.orionsec.kit.lang.utils.io.FileReaders;
import cn.orionsec.kit.lang.utils.io.Files1;
import cn.orionsec.kit.lang.utils.io.compress.CompressTypeEnum;
import cn.orionsec.kit.lang.utils.io.compress.FileDecompressor;
import cn.orionsec.kit.lang.utils.net.IPs;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.constant.ErrorMessage;
@@ -41,6 +41,8 @@ import org.dromara.visor.common.utils.Assert;
import org.dromara.visor.common.utils.PathUtils;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.framework.redis.core.utils.RedisStrings;
import org.dromara.visor.framework.web.configuration.config.ExposeApiConfig;
import org.dromara.visor.framework.web.configuration.config.OrionApiConfig;
import org.dromara.visor.module.asset.convert.HostConvert;
import org.dromara.visor.module.asset.dao.HostAgentLogDAO;
import org.dromara.visor.module.asset.dao.HostDAO;
@@ -53,7 +55,6 @@ import org.dromara.visor.module.asset.enums.*;
import org.dromara.visor.module.asset.handler.agent.intstall.AgentInstaller;
import org.dromara.visor.module.asset.handler.agent.model.AgentInstallParams;
import org.dromara.visor.module.asset.service.HostAgentService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@@ -77,8 +78,11 @@ public class HostAgentServiceImpl implements HostAgentService {
private String localVersion;
@Value("${orion.api.expose.token}")
private String exposeToken;
@Resource
private OrionApiConfig orionApiConfig;
@Resource
private ExposeApiConfig exposeApiConfig;
@Resource
private HostDAO hostDAO;
@@ -130,7 +134,7 @@ public class HostAgentServiceImpl implements HostAgentService {
}
@Override
public void installAgent(HostAgentInstallRequest request) {
public Map<String, Long> installAgent(HostAgentInstallRequest request) {
// 查询主机信息
List<Long> idList = request.getIdList();
List<HostDO> hosts = hostDAO.selectBatchIds(idList);
@@ -178,6 +182,12 @@ public class HostAgentServiceImpl implements HostAgentService {
// 执行任务
AgentInstaller.start(params);
}
// 返回
return agentLogs.stream()
.collect(Collectors.toMap(HostAgentLogDO::getAgentKey,
HostAgentLogDO::getId,
Functions.right()));
}
@Override
@@ -302,8 +312,8 @@ public class HostAgentServiceImpl implements HostAgentService {
*/
private Map<String, String> getReplaceVars() {
Map<String, String> map = new HashMap<>();
map.put("SERVER_HOST", IPs.IP);
map.put("SERVER_TOKEN", exposeToken);
map.put("SERVER_URL", orionApiConfig.getUrl());
map.put("SERVER_TOKEN", exposeApiConfig.getToken());
return map;
}

View File

@@ -22,10 +22,13 @@
*/
package org.dromara.visor.module.asset.service.impl;
import cn.orionsec.kit.lang.utils.Exceptions;
import cn.orionsec.kit.lang.utils.Strings;
import cn.orionsec.kit.lang.utils.collect.Lists;
import cn.orionsec.kit.lang.utils.collect.Maps;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.handler.data.model.GenericsDataModel;
@@ -44,6 +47,7 @@ import org.dromara.visor.module.infra.enums.DataExtraTypeEnum;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -55,6 +59,7 @@ import java.util.stream.Collectors;
* @version 1.0.0
* @since 2023/12/20 12:11
*/
@Slf4j
@Service
public class HostExtraServiceImpl implements HostExtraService {
@@ -156,40 +161,57 @@ public class HostExtraServiceImpl implements HostExtraService {
@Override
public void syncHostSpec(String key, String taskId, JSONObject spec) {
try {
// 查询主机id
Long id = hostDAO.selectIdByAgentKey(key);
Assert.notNull(id, ErrorMessage.HOST_ABSENT);
// 设置已同步标识
spec.put(Const.SYNCED, true);
// 查询配置信息
String newSpec;
HostSpecExtraModel beforeSpec = this.getHostSpecMap(Lists.singleton(id)).get(id);
if (beforeSpec == null) {
// 新增
newSpec = spec.toString();
} else {
// 合并
JSONObject beforeSpecValue = JSON.parseObject(beforeSpec.serial());
spec.forEach((k, v) -> {
if (v != null) {
beforeSpecValue.put(k, v);
// 查询主机id
Long id = hostDAO.selectIdByAgentKey(key);
Assert.notNull(id, ErrorMessage.HOST_ABSENT);
// 设置已同步标识
spec.put(Const.SYNCED, true);
// 查询配置信息
String newSpec;
HostSpecExtraModel beforeSpec = this.getHostSpecMap(Lists.singleton(id)).get(id);
if (beforeSpec == null) {
// 新增
newSpec = spec.toString();
} else {
// 合并
JSONObject beforeSpecValue = JSON.parseObject(beforeSpec.serial());
spec.forEach((k, v) -> {
// 获取原数据
Object beforeValue = beforeSpecValue.get(k);
// 检查是否存在
boolean present = false;
if (beforeValue != null) {
if (beforeValue instanceof String) {
present = !Strings.isBlank((String) beforeValue);
} else if (beforeValue instanceof Collection) {
present = !Lists.isEmpty((Collection<?>) beforeValue);
} else if (beforeValue instanceof Map) {
present = !Maps.isEmpty((Map<?, ?>) beforeValue);
} else {
present = true;
}
});
newSpec = beforeSpecValue.toJSONString();
}
// 修改规格
DataExtraSetDTO update = new DataExtraSetDTO();
update.setUserId(Const.SYSTEM_USER_ID);
update.setRelId(id);
update.setItem(HostExtraItemEnum.SPEC.name());
update.setValue(newSpec);
dataExtraApi.setExtraItem(update, DataExtraTypeEnum.HOST);
// 回调成功
} catch (Exception e) {
// 回调失败
throw e;
}
// 不存在则覆盖
if (!present && v != null) {
beforeSpecValue.put(k, v);
}
});
newSpec = beforeSpecValue.toJSONString();
}
// 检查是否能反解析 防止格式错误导致其他地方报错
try {
JSON.parseObject(newSpec, HostSpecExtraModel.class);
} catch (Exception e) {
log.error("HostExtraService-setHostSpec error: {}, spec: {}", e.getMessage(), newSpec, e);
throw Exceptions.app(ErrorMessage.SPEC_FORMAT_INCORRECT, e);
}
// 修改规格
DataExtraSetDTO update = new DataExtraSetDTO();
update.setUserId(Const.SYSTEM_USER_ID);
update.setRelId(id);
update.setItem(HostExtraItemEnum.SPEC.name());
update.setValue(newSpec);
dataExtraApi.setExtraItem(update, DataExtraTypeEnum.HOST);
}
/**

View File

@@ -110,7 +110,7 @@ public class HostIdentityServiceImpl implements HostIdentityService {
int effect = hostIdentityDAO.insert(record);
log.info("HostIdentityService-createHostIdentity effect: {}", effect);
// 删除缓存
RedisMaps.delete(HostCacheKeyDefine.HOST_IDENTITY);
RedisUtils.delete(HostCacheKeyDefine.HOST_IDENTITY);
return record.getId();
}
@@ -143,7 +143,7 @@ public class HostIdentityServiceImpl implements HostIdentityService {
int effect = hostIdentityDAO.update(updateRecord, wrapper);
log.info("HostIdentityService-updateHostIdentityById effect: {}", effect);
// 删除缓存
RedisMaps.delete(HostCacheKeyDefine.HOST_IDENTITY);
RedisUtils.delete(HostCacheKeyDefine.HOST_IDENTITY);
return effect;
}

View File

@@ -104,7 +104,7 @@ public class HostKeyServiceImpl implements HostKeyService {
log.info("HostKeyService-createHostKey effect: {}", effect);
Long id = record.getId();
// 删除缓存
RedisMaps.delete(HostCacheKeyDefine.HOST_KEY);
RedisUtils.delete(HostCacheKeyDefine.HOST_KEY);
return id;
}
@@ -128,7 +128,7 @@ public class HostKeyServiceImpl implements HostKeyService {
int effect = hostKeyDAO.updateById(updateRecord);
// 删除缓存
if (!record.getName().equals(updateRecord.getName())) {
RedisMaps.delete(HostCacheKeyDefine.HOST_KEY);
RedisUtils.delete(HostCacheKeyDefine.HOST_KEY);
}
log.info("HostKeyService-updateHostKeyById effect: {}", effect);
return effect;

View File

@@ -39,6 +39,7 @@ import org.dromara.visor.common.utils.Assert;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.framework.mybatis.core.query.DataQuery;
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
import org.dromara.visor.module.asset.convert.HostConvert;
import org.dromara.visor.module.asset.dao.HostConfigDAO;
@@ -376,7 +377,7 @@ public class HostServiceImpl implements HostService {
@Override
public void clearCache() {
RedisMaps.scanKeysDelete(HostCacheKeyDefine.HOST_INFO.format("*"));
RedisUtils.scanKeysDelete(HostCacheKeyDefine.HOST_INFO.format("*"));
}
/**

View File

@@ -1,3 +1,25 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.infra.entity.dto;
import lombok.AllArgsConstructor;

View File

@@ -42,6 +42,7 @@ import org.dromara.visor.common.utils.Assert;
import org.dromara.visor.common.utils.Requests;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.framework.redis.core.utils.RedisStrings;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
import org.dromara.visor.module.common.config.AppLoginConfig;
import org.dromara.visor.module.infra.api.SystemMessageApi;
@@ -420,7 +421,7 @@ public class AuthenticationServiceImpl implements AuthenticationService {
}
// 删除续签信息
if (Booleans.isTrue(appLoginConfig.getAllowRefresh())) {
RedisStrings.scanKeysDelete(UserCacheKeyDefine.LOGIN_REFRESH.format(id, "*"));
RedisUtils.scanKeysDelete(UserCacheKeyDefine.LOGIN_REFRESH.format(id, "*"));
}
}

View File

@@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.framework.mybatis.core.query.ThenLambdaWrapper;
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
import org.dromara.visor.module.infra.dao.DataExtraDAO;
import org.dromara.visor.module.infra.define.cache.DataExtraCacheKeyDefine;
@@ -92,7 +93,7 @@ public class DataExtraServiceImpl implements DataExtraService {
insert.setValue(request.getValue());
dataExtraDAO.insert(insert);
// 删除缓存
RedisMaps.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(request.getUserId(), request.getType(), request.getItem()));
RedisUtils.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(request.getUserId(), request.getType(), request.getItem()));
return insert.getId();
}
@@ -114,7 +115,7 @@ public class DataExtraServiceImpl implements DataExtraService {
Set<String> keys = rows.stream()
.map(s -> DataExtraCacheKeyDefine.DATA_EXTRA.format(s.getUserId(), s.getType(), s.getItem()))
.collect(Collectors.toSet());
RedisMaps.delete(keys);
RedisUtils.delete(keys);
}
@Override
@@ -133,7 +134,7 @@ public class DataExtraServiceImpl implements DataExtraService {
// 更新
int effect = dataExtraDAO.updateById(update);
// 删除缓存
RedisMaps.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(data.getUserId(), data.getType(), data.getItem()));
RedisUtils.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(data.getUserId(), data.getType(), data.getItem()));
return effect;
}
@@ -315,7 +316,7 @@ public class DataExtraServiceImpl implements DataExtraService {
.map(s -> DataExtraCacheKeyDefine.DATA_EXTRA.format(s.getUserId(), s.getType(), s.getItem()))
.distinct()
.collect(Collectors.toList());
RedisMaps.delete(keys);
RedisUtils.delete(keys);
}
/**

View File

@@ -346,7 +346,7 @@ public class DataPermissionServiceImpl implements DataPermissionService {
.map(s -> DataPermissionCacheKeyDefine.DATA_PERMISSION_USER.format(value, s))
.forEach(keys::add);
}
RedisLists.delete(keys);
RedisUtils.delete(keys);
}
}

View File

@@ -27,6 +27,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.utils.Assert;
import org.dromara.visor.framework.redis.core.utils.RedisLists;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
import org.dromara.visor.module.infra.convert.FavoriteConvert;
@@ -79,7 +80,7 @@ public class FavoriteServiceImpl implements FavoriteService {
// 插入
favoriteDAO.insert(record);
// 删除缓存
RedisLists.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
RedisUtils.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
return record.getId();
}
@@ -91,7 +92,7 @@ public class FavoriteServiceImpl implements FavoriteService {
// 删除库
int effect = favoriteDAO.deleteFavorite(type, userId, relId);
// 删除缓存
RedisLists.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
RedisUtils.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
return effect;
}

View File

@@ -34,6 +34,7 @@ import org.dromara.visor.common.utils.Assert;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.framework.mybatis.core.query.Conditions;
import org.dromara.visor.framework.redis.core.utils.RedisLists;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
import org.dromara.visor.module.infra.convert.TagConvert;
import org.dromara.visor.module.infra.dao.TagDAO;
@@ -116,7 +117,7 @@ public class TagServiceImpl implements TagService {
int effect = tagDAO.updateById(updateRecord);
log.info("HostProxyService-updateHostProxyById effect: {}", effect);
// 删除缓存
RedisLists.delete(TagCacheKeyDefine.TAG_NAME.format(record.getType()));
RedisUtils.delete(TagCacheKeyDefine.TAG_NAME.format(record.getType()));
return effect;
}
@@ -201,7 +202,7 @@ public class TagServiceImpl implements TagService {
.distinct()
.map(TagCacheKeyDefine.TAG_NAME::format)
.collect(Collectors.toList());
RedisLists.delete(deleteKeys);
RedisUtils.delete(deleteKeys);
return effect;
}
@@ -225,7 +226,7 @@ public class TagServiceImpl implements TagService {
.distinct()
.map(TagCacheKeyDefine.TAG_NAME::format)
.collect(Collectors.toList());
RedisLists.delete(cacheKeys);
RedisUtils.delete(cacheKeys);
}
/**

View File

@@ -32,6 +32,7 @@ import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.utils.Assert;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
import org.dromara.visor.module.monitor.convert.AlarmPolicyConvert;
import org.dromara.visor.module.monitor.dao.AlarmPolicyDAO;
@@ -114,7 +115,7 @@ public class AlarmPolicyServiceImpl implements AlarmPolicyService {
// 重新加载上下文
alarmEngineContext.reloadPolicy(id);
// 删除缓存
RedisMaps.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
RedisUtils.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(Const.ALL));
// 设置日志参数
OperatorLogs.add(OperatorLogs.ID, id);
@@ -137,7 +138,7 @@ public class AlarmPolicyServiceImpl implements AlarmPolicyService {
// 重新加载上下文
alarmEngineContext.reloadPolicy(id);
// 删除缓存
RedisMaps.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
RedisUtils.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(Const.ALL));
return newId;
}
@@ -165,7 +166,7 @@ public class AlarmPolicyServiceImpl implements AlarmPolicyService {
// 重新加载上下文
alarmEngineContext.reloadPolicy(id);
// 删除缓存
RedisMaps.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
RedisUtils.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(Const.ALL));
return effect;
}

View File

@@ -30,6 +30,7 @@ import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.utils.Assert;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
import org.dromara.visor.module.monitor.context.MonitorMetricsContext;
import org.dromara.visor.module.monitor.convert.MonitorMetricsConvert;
@@ -84,7 +85,7 @@ public class MonitorMetricsServiceImpl implements MonitorMetricsService {
int effect = monitorMetricsDAO.insert(record);
Long id = record.getId();
// 删除缓存
RedisMaps.delete(MonitorMetricsCacheKeyDefine.MONITOR_METRICS);
RedisUtils.delete(MonitorMetricsCacheKeyDefine.MONITOR_METRICS);
// 设置日志参数
OperatorLogs.add(OperatorLogs.ID, id);
// 重新加载本地缓存
@@ -110,7 +111,7 @@ public class MonitorMetricsServiceImpl implements MonitorMetricsService {
int effect = monitorMetricsDAO.updateById(updateRecord);
log.info("MonitorMetricsService-updateMonitorMetricsById effect: {}", effect);
// 删除缓存
RedisMaps.delete(MonitorMetricsCacheKeyDefine.MONITOR_METRICS);
RedisUtils.delete(MonitorMetricsCacheKeyDefine.MONITOR_METRICS);
// 重新加载本地缓存
monitorMetricsContext.reloadMonitorMetrics(id);
return effect;

View File

@@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.utils.Assert;
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
import org.dromara.visor.module.terminal.convert.CommandSnippetConvert;
@@ -84,7 +85,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
Long id = record.getId();
log.info("CommandSnippetService-createCommandSnippet id: {}, effect: {}", id, effect);
// 删除缓存
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
RedisUtils.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
return id;
}
@@ -109,7 +110,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
int effect = commandSnippetDAO.update(null, update);
log.info("CommandSnippetService-updateCommandSnippetById effect: {}", effect);
// 删除缓存
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
RedisUtils.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
return effect;
}
@@ -169,7 +170,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
public Integer setGroupNull(Long userId, Long groupId) {
int effect = commandSnippetDAO.setGroupIdWithNull(groupId);
// 删除缓存
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
RedisUtils.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
return effect;
}
@@ -192,7 +193,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
public Integer deleteByGroupId(Long userId, Long groupId) {
int effect = commandSnippetDAO.deleteByGroupId(groupId);
// 删除缓存
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
RedisUtils.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
return effect;
}

View File

@@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.utils.Assert;
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
import org.dromara.visor.module.terminal.convert.PathBookmarkConvert;
@@ -84,7 +85,7 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
Long id = record.getId();
log.info("PathBookmarkService-createPathBookmark id: {}, effect: {}", id, effect);
// 删除缓存
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
RedisUtils.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
return id;
}
@@ -109,7 +110,7 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
int effect = pathBookmarkDAO.update(null, update);
log.info("PathBookmarkService-updatePathBookmarkById effect: {}", effect);
// 删除缓存
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
RedisUtils.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
return effect;
}
@@ -169,7 +170,7 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
public Integer setGroupNull(Long userId, Long groupId) {
int effect = pathBookmarkDAO.setGroupIdWithNull(groupId);
// 删除缓存
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
RedisUtils.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
return effect;
}
@@ -192,7 +193,7 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
public Integer deleteByGroupId(Long userId, Long groupId) {
int effect = pathBookmarkDAO.deleteByGroupId(groupId);
// 删除缓存
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
RedisUtils.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
return effect;
}

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.5.5
VITE_APP_VERSION=2.5.6

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.5.5
VITE_APP_VERSION=2.5.6

View File

@@ -1,7 +1,7 @@
{
"name": "orion-visor-ui",
"description": "Orion Visor UI",
"version": "2.5.5",
"version": "2.5.6",
"private": true,
"author": "Jiahang Li",
"license": "Apache 2.0",

View File

@@ -50,7 +50,7 @@ export interface HostAgentInstallStatusUpdateRequest {
* 安装主机探针
*/
export function installHostAgent(request: HostInstallAgentRequest) {
return axios.post('/asset/host-agent/install', request);
return axios.post<Record<string, number>>('/asset/host-agent/install', request);
}
/**

View File

@@ -58,15 +58,13 @@
// 修改配置
appStore.updateSettings({ [key]: value });
// 同步偏好
try {
await updatePreference({
type: 'SYSTEM',
item: key,
value
});
} catch (e) {
}
await updatePreference({
type: 'SYSTEM',
item: key,
value
});
};
</script>
<style lang="less" scoped>

View File

@@ -48,7 +48,6 @@
setLoading(true);
try {
treeData.value = await cacheStore.loadHostGroupTree();
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -163,7 +163,6 @@
}
}
}
} catch (e) {
} finally {
emits('setLoading', false);
}
@@ -300,7 +299,6 @@
});
// 移动分组
moveNode(treeData.value, dragNode, dropNode, dropPosition);
} catch (e) {
} finally {
emits('setLoading', false);
}
@@ -312,7 +310,6 @@
emits('setLoading', true);
const groups = await cacheStore.loadHostGroupTree(force);
treeData.value = groups || [];
} catch (e) {
} finally {
emits('setLoading', false);
}

View File

@@ -75,7 +75,6 @@
username: s.username,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -57,7 +57,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -160,7 +160,6 @@
hosts.value = data;
// 设置主机搜索选项
filterOptions.value = getAuthorizedHostOptions(data.hostList);
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -62,7 +62,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -67,7 +67,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -284,6 +284,7 @@ export default class LogAppender implements ILogAppender {
this.client.close();
}
} catch (e) {
// ignored
}
}

View File

@@ -139,7 +139,6 @@
pagination.total = data.total;
pagination.current = request.page;
pagination.pageSize = request.limit;
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -66,7 +66,6 @@
setVisible(false);
Message.error('cron 表达式错误');
}
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -125,7 +125,6 @@
Message.success('回滚成功');
emits('updated');
handleClear();
} catch (e) {
} finally {
setLoading(false);
}
@@ -144,7 +143,6 @@
pagination.total = data.total;
pagination.current = request.page;
pagination.pageSize = request.limit;
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -126,7 +126,6 @@
}
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -43,7 +43,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -48,7 +48,6 @@
value: s.agentKey,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -37,7 +37,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -70,7 +70,6 @@
origin: s
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -78,7 +78,6 @@
title: '根目录',
children: render([...menus])
}];
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -96,10 +96,16 @@
const reloadAllMessage = async () => {
hasMore.value = true;
messageList.value = [];
// 查询数量
queryMessageCount();
// 加载列表
await loadMessage();
try {
await Promise.all([
// 查询数量
queryMessageCount(),
// 加载列表
loadMessage()
]);
} catch (e) {
console.error('load message error', e);
}
};
// 获取数量
@@ -108,7 +114,6 @@
try {
const { data } = await getSystemMessageCount(queryUnread.value);
classifyCount.value = data;
} catch (ex) {
} finally {
setFetchLoading(false);
}
@@ -135,17 +140,16 @@
limit: messageLimit,
classify: currentClassify.value,
queryUnread: queryUnread.value,
maxId,
maxId
});
data.forEach(s => {
messageList.value.push({
...s,
content: clearHtmlTag(s.content),
contentHtml: replaceHtmlTag(s.content),
contentHtml: replaceHtmlTag(s.content)
});
});
hasMore.value = data.length === messageLimit;
} catch (ex) {
} finally {
setFetchLoading(false);
}
@@ -159,7 +163,6 @@
await updateSystemMessageReadAll(currentClassify.value);
// 修改状态
messageList.value.forEach(s => s.status = MessageStatus.READ);
} catch (ex) {
} finally {
setMessageLoading(false);
}
@@ -171,7 +174,6 @@
try {
// 清理消息
await clearSystemMessage(currentClassify.value);
} catch (ex) {
} finally {
setMessageLoading(false);
}
@@ -204,7 +206,6 @@
// 移除
const index = messageList.value.findIndex(s => s.id === message.id);
messageList.value.splice(index, 1);
} catch (ex) {
} finally {
setMessageLoading(false);
}
@@ -237,7 +238,7 @@
onUnmounted(() => {
localStorage.setItem(MESSAGE_CONFIG_KEY, JSON.stringify({
currentClassify: currentClassify.value,
queryUnread: queryUnread.value,
queryUnread: queryUnread.value
}));
});

View File

@@ -45,7 +45,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -94,7 +94,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -94,7 +94,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -65,7 +65,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -64,7 +64,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -127,8 +127,6 @@
// 清空
handlerClear();
emits('updated');
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -70,6 +70,7 @@ export const useCardFieldConfig = (table: string, originFieldConfig: CardFieldCo
try {
preferConfig = JSON.parse(localConfig as string);
} catch (e) {
preferConfig = {};
}
}
// 解析配置
@@ -92,6 +93,7 @@ export const useCardFieldConfig = (table: string, originFieldConfig: CardFieldCo
try {
preferConfig = JSON.parse(localConfig as string);
} catch (e) {
preferConfig = {};
}
}
// 设置缓存

View File

@@ -23,7 +23,6 @@ export default function useFavorite(type: FavoriteType) {
await addFavorite(request);
record.favorite = true;
}
} catch (e) {
} finally {
loading.value = false;
}

View File

@@ -33,6 +33,7 @@ export const useQueryOrder = (table: string, defaultSort: number = ASC): QueryOr
try {
preferConfig = JSON.parse(localConfig as string);
} catch (e) {
preferConfig = {};
}
}
// 解析配置
@@ -57,6 +58,7 @@ export const useQueryOrder = (table: string, defaultSort: number = ASC): QueryOr
try {
preferConfig = JSON.parse(localConfig as string);
} catch (e) {
preferConfig = {};
}
}
// 设置缓存

View File

@@ -78,6 +78,7 @@ export const useTableColumns = (table: string, originColumns: Array<TableColumnD
try {
preferConfig = JSON.parse(localConfig as string);
} catch (e) {
preferConfig = {}
}
}
// 解析配置
@@ -100,6 +101,7 @@ export const useTableColumns = (table: string, originColumns: Array<TableColumnD
try {
preferConfig = JSON.parse(localConfig as string);
} catch (e) {
preferConfig = {}
}
}
// 设置缓存

View File

@@ -14,6 +14,7 @@ import '@/assets/style/chart.less';
import '@/assets/style/arco-extends.less';
import '@/api/interceptor';
import App from './App.vue';
import globalErrorHandler from '@/utils/monitor';
const app = createApp(App);
@@ -26,6 +27,9 @@ app.use(i18n);
app.use(globalComponents);
app.use(directive);
// 全局异常处理
globalErrorHandler(app);
app.mount('#app');
// 监听 PWA 注册事件

View File

@@ -42,7 +42,7 @@ export default defineStore('dict', {
const { data } = await getDictValueList(unloadKeys);
this.$patch(data as object);
} catch (e) {
} finally {
console.error('load dict error', e);
}
},

View File

@@ -22,6 +22,7 @@ export default defineStore('tips', {
await setTipsTipped(key);
this.tippedKeys.push(key);
} catch (e) {
console.error('set tipped error', e);
}
}
},

View File

@@ -113,6 +113,7 @@ export default defineStore('user', {
try {
await userLogout();
} catch (e) {
console.error('logout error', e);
} finally {
// 登出回调
this.logoutCallBack();

View File

@@ -40,5 +40,6 @@ export const playBellHz = (frequency: number = 400, duration: number = .15) => {
source.connect(audioCtx.destination);
source.start();
} catch (e) {
// ignored
}
};

View File

@@ -1,28 +1,14 @@
import type { App, ComponentPublicInstance } from 'vue';
import axios from 'axios';
export default function handleError(Vue: App, baseUrl: string) {
if (!baseUrl) {
return;
}
/**
* 全局异常处理
*/
export default function globalErrorHandler(Vue: App) {
Vue.config.errorHandler = (
err: unknown,
instance: ComponentPublicInstance | null,
info: string
) => {
// send error info
axios.post(`${baseUrl}/report-error`, {
err,
instance,
info,
// location: window.location.href,
// message: err.message,
// stack: err.stack,
// browserInfo: getBrowserInfo(),
// user info
// dom info
// url info
// ...
});
console.error(info, err);
};
}

View File

@@ -137,7 +137,6 @@
// 无数据
Message.warning('当前条件未查询到数据');
}
} catch (e) {
} finally {
setLoading(false);
}
@@ -159,7 +158,6 @@
// 清空
setVisible(false);
handlerClear();
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -264,7 +264,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -280,7 +279,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -304,7 +302,6 @@
pagination.current = request.page;
pagination.pageSize = request.limit;
selectedKeys.value = [];
} catch (e) {
} finally {
setLoading(false);
}
@@ -328,7 +325,6 @@
record.status = HostConnectStatus.FORCE_OFFLINE;
record.endTime = Date.now();
Message.success('已下线');
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -22,6 +22,7 @@ export const logColumns = [
title: '连接主机',
dataIndex: 'hostName',
slotName: 'hostName',
minWidth: 218,
align: 'left',
ellipsis: true,
default: true,

View File

@@ -162,7 +162,6 @@
setLoading(true);
const { data } = await getTerminalConnectSessions(formModel);
tableRenderData.value = data;
} catch (e) {
} finally {
setLoading(false);
}
@@ -177,7 +176,6 @@
Message.success('已下线');
// 移除行
tableRenderData.value.splice(tableRenderData.value.findIndex(s => s.id === record.id), 1);
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -20,6 +20,7 @@ const columns = [
title: '连接主机',
dataIndex: 'hostName',
slotName: 'hostName',
minWidth: 218,
align: 'left',
ellipsis: true,
}, {

View File

@@ -239,7 +239,6 @@
pagination.current = request.page;
pagination.pageSize = request.limit;
selectedKeys.value = [];
} catch (e) {
} finally {
setLoading(false);
}
@@ -260,7 +259,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -276,7 +274,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -94,7 +94,6 @@
const hosts = await cacheStore.loadHosts();
selectedGroupHosts.value = data.map(s => hosts.find(h => h.id === s) as HostQueryResponse)
.filter(Boolean);
} catch (e) {
} finally {
setLoading(false);
}
@@ -120,7 +119,6 @@
const { data } = await getAuthorizedHostGroup(request);
authorizedGroups.value = data;
checkedGroups.value = data;
} catch (e) {
} finally {
setLoading(false);
}
@@ -138,7 +136,6 @@
Message.success('授权成功');
// 清空缓存
cacheStore.reset('authorizedHost_ALL', 'authorizedHost_SSH');
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -81,7 +81,6 @@
try {
const { data } = await getAuthorizedHostIdentity(request);
selectedKeys.value = data;
} catch (e) {
} finally {
setLoading(false);
}
@@ -99,7 +98,6 @@
Message.success('授权成功');
// 清空缓存
cacheStore.reset('authorizedHostIdentities');
} catch (e) {
} finally {
setLoading(false);
}
@@ -136,7 +134,6 @@
hostIdentities.value = await cacheStore.loadHostIdentities();
// 加载主机密钥
hostKeys.value = await cacheStore.loadHostKeys();
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -57,7 +57,6 @@
try {
const { data } = await getAuthorizedHostKey(request);
selectedKeys.value = data;
} catch (e) {
} finally {
setLoading(false);
}
@@ -75,7 +74,6 @@
Message.success('授权成功');
// 清空缓存
cacheStore.reset('authorizedHostKeys');
} catch (e) {
} finally {
setLoading(false);
}
@@ -109,7 +107,6 @@
setLoading(true);
try {
hostKeys.value = await cacheStore.loadHostKeys();
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -101,7 +101,6 @@
emits('loading', true);
const { data } = await getHostGroupRelList(groupId as number);
value.value = data.map(String);
} catch (e) {
} finally {
emits('loading', false);
}

View File

@@ -109,14 +109,16 @@
// 保存主机
const saveHost = async () => {
if (!currentGroup.value?.key) {
return false;
}
setLoading(true);
try {
await updateHostGroupRel({
groupId: currentGroup.value?.key as number,
groupId: currentGroup.value?.key,
hostIdList: currentGroupHost.value
});
Message.success('保存成功');
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -221,7 +221,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -254,7 +253,6 @@
pagination.total = data.total;
pagination.current = request.page;
pagination.pageSize = request.limit;
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -182,8 +182,6 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -240,7 +240,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -256,7 +255,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -282,7 +280,6 @@
pagination.current = request.page;
pagination.pageSize = request.limit;
selectedKeys.value = [];
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -127,7 +127,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -160,7 +159,6 @@
pagination.total = data.total;
pagination.current = request.page;
pagination.pageSize = request.limit;
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -232,8 +232,6 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -189,7 +189,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -205,7 +204,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -231,7 +229,6 @@
pagination.current = request.page;
pagination.pageSize = request.limit;
selectedKeys.value = [];
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -351,7 +351,6 @@
});
record.status = newStatus;
Message.success(`${dict.label}`);
} catch (e) {
} finally {
setLoading(false);
}
@@ -374,7 +373,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -408,7 +406,6 @@
pagination.total = data.total;
pagination.current = request.page;
pagination.pageSize = request.limit;
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -155,7 +155,6 @@
renderForm({ ...detail, tags });
// 响应类型
emits('changeType', data.types);
} catch (e) {
} finally {
setLoading(false);
}
@@ -209,7 +208,6 @@
emits('updated', formModel.value.id);
}
emits('changeType', formModel.value.types);
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -307,7 +307,6 @@
// 查询规格信息
const { data } = await getHostExtraItem<HostSpecExtraModel>({ hostId: props.hostId, item: 'SPEC' });
formModel.value = data;
} catch (e) {
} finally {
setLoading(false);
}
@@ -343,7 +342,6 @@
});
toggleEditing();
emits('updated');
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -166,7 +166,6 @@
// 测试连接
await testHostConnect({ id: props.hostId, type: HostType.SSH.value });
Message.success('连接成功');
} catch (e) {
} finally {
setLoading(false);
}

Some files were not shown because too many files have changed in this diff Show More