Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbf4299a61 | ||
|
|
d9c8923b6d | ||
|
|
d8818c3ec2 | ||
|
|
b3daacbd8f | ||
|
|
bd76eb255d | ||
|
|
876e763fcc | ||
|
|
6774376418 | ||
|
|
cb59390fed | ||
|
|
670e40f6f0 | ||
|
|
a8de5ab713 | ||
|
|
8d46e1d44d | ||
|
|
ca4ec20e49 | ||
|
|
a0a7240191 | ||
|
|
2b52697cdc | ||
|
|
5ab3f168d8 | ||
|
|
e214fbde5c | ||
|
|
0d0eadc3bf | ||
|
|
edcc2cf0c8 | ||
|
|
7d35f839df | ||
|
|
f1a4e049ca | ||
|
|
3895476ff8 | ||
|
|
964c1daa2c | ||
|
|
9d06f0ae87 |
@@ -6,8 +6,6 @@ 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
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
@@ -17,8 +17,6 @@ body:
|
||||
required: true
|
||||
- label: 我已搜索 [issue](https://github.com/dromara/orion-visor/issues) 并没有找到相关问题
|
||||
required: true
|
||||
- label: 我已 star 了此项目, 否则可能会被自动关闭
|
||||
required: true
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
</a>
|
||||
<a target="_blank"
|
||||
style="text-decoration: none !important;"
|
||||
href="https://atomgit.com/dromara/orion-visor">
|
||||
<img src="https://atomgit.com/dromara/orion-visor/star/2025top.svg" alt="star" />
|
||||
href="https://gitcode.com/dromara/orion-visor">
|
||||
<img src="https://gitcode.com/dromara/orion-visor/star/badge.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) [atomgit](https://atomgit.com/dromara/orion-visor)
|
||||
这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor) [gitcode](https://gitcode.com/dromara/orion-visor)
|
||||
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
||||
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
|
||||
|
||||
@@ -171,6 +171,6 @@ QQ群: 755242157
|
||||
|
||||

|
||||
|
||||
## AtomGit 最有影响力的开源项目 G-Star
|
||||
## GitCode 最有影响力的开源项目 G-Star
|
||||
|
||||

|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# latest = 2.5.6
|
||||
version: '3.3'
|
||||
|
||||
# latest = 2.5.5
|
||||
|
||||
# 支持以下源
|
||||
# lijiahangmax/*
|
||||
@@ -48,10 +50,6 @@ 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:
|
||||
|
||||
@@ -7,7 +7,7 @@ set -e
|
||||
source ./project-build.sh "$@"
|
||||
|
||||
# 版本号
|
||||
version=2.5.6
|
||||
version=2.5.5
|
||||
# 是否推送镜像
|
||||
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
|
||||
|
||||
@@ -4,7 +4,7 @@ set -e
|
||||
# DockerContext: orion-visor
|
||||
|
||||
# 版本号
|
||||
version=2.5.6
|
||||
version=2.5.5
|
||||
# 是否构建 service
|
||||
export build_service=false
|
||||
# 是否构建 ui
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface AppConst extends OrionConst {
|
||||
/**
|
||||
* 同 ${orion.version} 迭代时候需要手动更改
|
||||
*/
|
||||
String VERSION = "2.5.6";
|
||||
String VERSION = "2.5.5";
|
||||
|
||||
/**
|
||||
* 同 ${spring.application.name}
|
||||
|
||||
@@ -55,6 +55,4 @@ public interface Const extends cn.orionsec.kit.lang.constant.Const, FieldConst,
|
||||
|
||||
int BATCH_COUNT = 500;
|
||||
|
||||
String IP_0000 = "0.0.0.0";
|
||||
|
||||
}
|
||||
|
||||
@@ -210,10 +210,6 @@ public interface ErrorMessage {
|
||||
|
||||
String PLEASE_SELECT_SUFFIX_FILE = "请选择 {} 类型的文件";
|
||||
|
||||
String SPEC_FORMAT_INCORRECT = "规格格式不正确";
|
||||
|
||||
String INFLUXDB_UNSUPPORTED = "InfluxDB 服务未开启";
|
||||
|
||||
/**
|
||||
* 是否为业务异常
|
||||
*
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<properties>
|
||||
<revision>2.5.6</revision>
|
||||
<revision>2.5.5</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>
|
||||
|
||||
@@ -30,9 +30,7 @@ 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;
|
||||
@@ -68,7 +66,6 @@ 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);
|
||||
@@ -82,7 +79,6 @@ public class InfluxdbUtils {
|
||||
* @return points
|
||||
*/
|
||||
public static List<FluxTable> queryTable(String query) {
|
||||
Assert.notNull(client, ErrorMessage.INFLUXDB_UNSUPPORTED);
|
||||
return client.getQueryApi().query(query);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ 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})
|
||||
@@ -77,7 +76,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
log.info("${type}Service-create${type} id: {}, effect: {}", id, effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return id;
|
||||
}
|
||||
@@ -99,7 +98,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
log.info("${type}Service-update${type}ById effect: {}", effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
@@ -117,7 +116,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
log.info("${type}Service.update${type} effect: {}", effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
@@ -238,7 +237,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
log.info("${type}Service.delete${type} effect: {}", effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -169,6 +169,7 @@
|
||||
Message.success('删除成功');
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -199,6 +200,7 @@
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -135,6 +135,8 @@
|
||||
}
|
||||
handleClose();
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -139,6 +139,8 @@
|
||||
}
|
||||
handleClose();
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -202,6 +202,7 @@
|
||||
selectedKeys.value = [];
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -219,6 +220,7 @@
|
||||
Message.success('删除成功');
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -244,6 +246,7 @@
|
||||
#if($vue.enableRowSelection)
|
||||
selectedKeys.value = [];
|
||||
#end
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ 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;
|
||||
@@ -72,7 +71,7 @@ import java.util.List;
|
||||
@DependsOn({"executorContext"})
|
||||
@AutoConfiguration
|
||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_WEB)
|
||||
@EnableConfigurationProperties({ExposeApiConfig.class, OrionApiConfig.class})
|
||||
@EnableConfigurationProperties(ExposeApiConfig.class)
|
||||
public class OrionWebAutoConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@Value("${orion.prefix}")
|
||||
|
||||
@@ -36,11 +36,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@ConfigurationProperties("orion.api.expose")
|
||||
public class ExposeApiConfig {
|
||||
|
||||
/**
|
||||
* 对外服务地址
|
||||
*/
|
||||
private String host;
|
||||
|
||||
/**
|
||||
* 对外服务请求头
|
||||
*/
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,16 +33,6 @@
|
||||
"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",
|
||||
|
||||
@@ -74,10 +74,6 @@ 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}
|
||||
# 对外服务
|
||||
|
||||
@@ -175,10 +175,6 @@ orion:
|
||||
prefix: ${orion.prefix}/api
|
||||
# 是否允许跨域
|
||||
cors: true
|
||||
# 服务端主机地址
|
||||
host: 0.0.0.0
|
||||
# 服务端接口地址 默认自动生成
|
||||
url:
|
||||
# 获取 IP 的请求头
|
||||
ip-headers: X-Forwarded-For,X-Real-IP
|
||||
# 对外服务
|
||||
|
||||
@@ -39,9 +39,9 @@ import java.util.function.Function;
|
||||
*/
|
||||
public class ReplaceVersion {
|
||||
|
||||
private static final String TARGET_VERSION = "2.5.5";
|
||||
private static final String TARGET_VERSION = "2.5.4";
|
||||
|
||||
private static final String REPLACE_VERSION = "2.5.6";
|
||||
private static final String REPLACE_VERSION = "2.5.5";
|
||||
|
||||
private static final String PATH = new File("").getAbsolutePath();
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 主机探针端点 api
|
||||
@@ -91,8 +90,9 @@ public class HostAgentController {
|
||||
@PostMapping("/install")
|
||||
@Operation(summary = "安装主机探针")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:install-agent')")
|
||||
public Map<String, Long> installAgent(@Validated @RequestBody HostAgentInstallRequest request) {
|
||||
return hostAgentService.installAgent(request);
|
||||
public Boolean installAgent(@Validated @RequestBody HostAgentInstallRequest request) {
|
||||
hostAgentService.installAgent(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.dromara.visor.module.asset.entity.vo.HostAgentStatusVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 主机探针 服务类
|
||||
@@ -50,9 +49,8 @@ public interface HostAgentService {
|
||||
* 安装探针
|
||||
*
|
||||
* @param request request
|
||||
* @return agentKey:installId
|
||||
*/
|
||||
Map<String, Long> installAgent(HostAgentInstallRequest request);
|
||||
void installAgent(HostAgentInstallRequest request);
|
||||
|
||||
/**
|
||||
* 上传探针发布包
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -32,6 +31,7 @@ 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,8 +41,6 @@ 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;
|
||||
@@ -55,6 +53,7 @@ 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;
|
||||
|
||||
@@ -78,11 +77,8 @@ public class HostAgentServiceImpl implements HostAgentService {
|
||||
|
||||
private String localVersion;
|
||||
|
||||
@Resource
|
||||
private OrionApiConfig orionApiConfig;
|
||||
|
||||
@Resource
|
||||
private ExposeApiConfig exposeApiConfig;
|
||||
@Value("${orion.api.expose.token}")
|
||||
private String exposeToken;
|
||||
|
||||
@Resource
|
||||
private HostDAO hostDAO;
|
||||
@@ -134,7 +130,7 @@ public class HostAgentServiceImpl implements HostAgentService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Long> installAgent(HostAgentInstallRequest request) {
|
||||
public void installAgent(HostAgentInstallRequest request) {
|
||||
// 查询主机信息
|
||||
List<Long> idList = request.getIdList();
|
||||
List<HostDO> hosts = hostDAO.selectBatchIds(idList);
|
||||
@@ -182,12 +178,6 @@ public class HostAgentServiceImpl implements HostAgentService {
|
||||
// 执行任务
|
||||
AgentInstaller.start(params);
|
||||
}
|
||||
|
||||
// 返回
|
||||
return agentLogs.stream()
|
||||
.collect(Collectors.toMap(HostAgentLogDO::getAgentKey,
|
||||
HostAgentLogDO::getId,
|
||||
Functions.right()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -312,8 +302,8 @@ public class HostAgentServiceImpl implements HostAgentService {
|
||||
*/
|
||||
private Map<String, String> getReplaceVars() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("SERVER_URL", orionApiConfig.getUrl());
|
||||
map.put("SERVER_TOKEN", exposeApiConfig.getToken());
|
||||
map.put("SERVER_HOST", IPs.IP);
|
||||
map.put("SERVER_TOKEN", exposeToken);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,13 +22,10 @@
|
||||
*/
|
||||
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;
|
||||
@@ -47,7 +44,6 @@ 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;
|
||||
@@ -59,7 +55,6 @@ import java.util.stream.Collectors;
|
||||
* @version 1.0.0
|
||||
* @since 2023/12/20 12:11
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class HostExtraServiceImpl implements HostExtraService {
|
||||
|
||||
@@ -161,57 +156,40 @@ public class HostExtraServiceImpl implements HostExtraService {
|
||||
|
||||
@Override
|
||||
public void syncHostSpec(String key, String taskId, JSONObject spec) {
|
||||
// 查询主机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;
|
||||
}
|
||||
}
|
||||
// 不存在则覆盖
|
||||
if (!present && v != null) {
|
||||
beforeSpecValue.put(k, v);
|
||||
}
|
||||
});
|
||||
newSpec = beforeSpecValue.toJSONString();
|
||||
}
|
||||
// 检查是否能反解析 防止格式错误导致其他地方报错
|
||||
try {
|
||||
JSON.parseObject(newSpec, HostSpecExtraModel.class);
|
||||
// 查询主机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);
|
||||
}
|
||||
});
|
||||
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) {
|
||||
log.error("HostExtraService-setHostSpec error: {}, spec: {}", e.getMessage(), newSpec, e);
|
||||
throw Exceptions.app(ErrorMessage.SPEC_FORMAT_INCORRECT, e);
|
||||
// 回调失败
|
||||
throw 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -110,7 +110,7 @@ public class HostIdentityServiceImpl implements HostIdentityService {
|
||||
int effect = hostIdentityDAO.insert(record);
|
||||
log.info("HostIdentityService-createHostIdentity effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(HostCacheKeyDefine.HOST_IDENTITY);
|
||||
RedisMaps.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);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(HostCacheKeyDefine.HOST_IDENTITY);
|
||||
RedisMaps.delete(HostCacheKeyDefine.HOST_IDENTITY);
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ public class HostKeyServiceImpl implements HostKeyService {
|
||||
log.info("HostKeyService-createHostKey effect: {}", effect);
|
||||
Long id = record.getId();
|
||||
// 删除缓存
|
||||
RedisUtils.delete(HostCacheKeyDefine.HOST_KEY);
|
||||
RedisMaps.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())) {
|
||||
RedisUtils.delete(HostCacheKeyDefine.HOST_KEY);
|
||||
RedisMaps.delete(HostCacheKeyDefine.HOST_KEY);
|
||||
}
|
||||
log.info("HostKeyService-updateHostKeyById effect: {}", effect);
|
||||
return effect;
|
||||
|
||||
@@ -39,7 +39,6 @@ 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;
|
||||
@@ -377,7 +376,7 @@ public class HostServiceImpl implements HostService {
|
||||
|
||||
@Override
|
||||
public void clearCache() {
|
||||
RedisUtils.scanKeysDelete(HostCacheKeyDefine.HOST_INFO.format("*"));
|
||||
RedisMaps.scanKeysDelete(HostCacheKeyDefine.HOST_INFO.format("*"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
@@ -42,7 +42,6 @@ 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;
|
||||
@@ -421,7 +420,7 @@ public class AuthenticationServiceImpl implements AuthenticationService {
|
||||
}
|
||||
// 删除续签信息
|
||||
if (Booleans.isTrue(appLoginConfig.getAllowRefresh())) {
|
||||
RedisUtils.scanKeysDelete(UserCacheKeyDefine.LOGIN_REFRESH.format(id, "*"));
|
||||
RedisStrings.scanKeysDelete(UserCacheKeyDefine.LOGIN_REFRESH.format(id, "*"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ 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;
|
||||
@@ -93,7 +92,7 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
insert.setValue(request.getValue());
|
||||
dataExtraDAO.insert(insert);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(request.getUserId(), request.getType(), request.getItem()));
|
||||
RedisMaps.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(request.getUserId(), request.getType(), request.getItem()));
|
||||
return insert.getId();
|
||||
}
|
||||
|
||||
@@ -115,7 +114,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());
|
||||
RedisUtils.delete(keys);
|
||||
RedisMaps.delete(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,7 +133,7 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
// 更新
|
||||
int effect = dataExtraDAO.updateById(update);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(data.getUserId(), data.getType(), data.getItem()));
|
||||
RedisMaps.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(data.getUserId(), data.getType(), data.getItem()));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -316,7 +315,7 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
.map(s -> DataExtraCacheKeyDefine.DATA_EXTRA.format(s.getUserId(), s.getType(), s.getItem()))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
RedisUtils.delete(keys);
|
||||
RedisMaps.delete(keys);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -346,7 +346,7 @@ public class DataPermissionServiceImpl implements DataPermissionService {
|
||||
.map(s -> DataPermissionCacheKeyDefine.DATA_PERMISSION_USER.format(value, s))
|
||||
.forEach(keys::add);
|
||||
}
|
||||
RedisUtils.delete(keys);
|
||||
RedisLists.delete(keys);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ 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;
|
||||
@@ -80,7 +79,7 @@ public class FavoriteServiceImpl implements FavoriteService {
|
||||
// 插入
|
||||
favoriteDAO.insert(record);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
RedisLists.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
return record.getId();
|
||||
}
|
||||
|
||||
@@ -92,7 +91,7 @@ public class FavoriteServiceImpl implements FavoriteService {
|
||||
// 删除库
|
||||
int effect = favoriteDAO.deleteFavorite(type, userId, relId);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
RedisLists.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ 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;
|
||||
@@ -117,7 +116,7 @@ public class TagServiceImpl implements TagService {
|
||||
int effect = tagDAO.updateById(updateRecord);
|
||||
log.info("HostProxyService-updateHostProxyById effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(TagCacheKeyDefine.TAG_NAME.format(record.getType()));
|
||||
RedisLists.delete(TagCacheKeyDefine.TAG_NAME.format(record.getType()));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -202,7 +201,7 @@ public class TagServiceImpl implements TagService {
|
||||
.distinct()
|
||||
.map(TagCacheKeyDefine.TAG_NAME::format)
|
||||
.collect(Collectors.toList());
|
||||
RedisUtils.delete(deleteKeys);
|
||||
RedisLists.delete(deleteKeys);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -226,7 +225,7 @@ public class TagServiceImpl implements TagService {
|
||||
.distinct()
|
||||
.map(TagCacheKeyDefine.TAG_NAME::format)
|
||||
.collect(Collectors.toList());
|
||||
RedisUtils.delete(cacheKeys);
|
||||
RedisLists.delete(cacheKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,6 @@ 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;
|
||||
@@ -115,7 +114,7 @@ public class AlarmPolicyServiceImpl implements AlarmPolicyService {
|
||||
// 重新加载上下文
|
||||
alarmEngineContext.reloadPolicy(id);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
|
||||
RedisMaps.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
|
||||
AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(Const.ALL));
|
||||
// 设置日志参数
|
||||
OperatorLogs.add(OperatorLogs.ID, id);
|
||||
@@ -138,7 +137,7 @@ public class AlarmPolicyServiceImpl implements AlarmPolicyService {
|
||||
// 重新加载上下文
|
||||
alarmEngineContext.reloadPolicy(id);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
|
||||
RedisMaps.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
|
||||
AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(Const.ALL));
|
||||
return newId;
|
||||
}
|
||||
@@ -166,7 +165,7 @@ public class AlarmPolicyServiceImpl implements AlarmPolicyService {
|
||||
// 重新加载上下文
|
||||
alarmEngineContext.reloadPolicy(id);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
|
||||
RedisMaps.delete(AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(record.getType()),
|
||||
AlarmPolicyCacheKeyDefine.ALARM_POLICY.format(Const.ALL));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ 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;
|
||||
@@ -85,7 +84,7 @@ public class MonitorMetricsServiceImpl implements MonitorMetricsService {
|
||||
int effect = monitorMetricsDAO.insert(record);
|
||||
Long id = record.getId();
|
||||
// 删除缓存
|
||||
RedisUtils.delete(MonitorMetricsCacheKeyDefine.MONITOR_METRICS);
|
||||
RedisMaps.delete(MonitorMetricsCacheKeyDefine.MONITOR_METRICS);
|
||||
// 设置日志参数
|
||||
OperatorLogs.add(OperatorLogs.ID, id);
|
||||
// 重新加载本地缓存
|
||||
@@ -111,7 +110,7 @@ public class MonitorMetricsServiceImpl implements MonitorMetricsService {
|
||||
int effect = monitorMetricsDAO.updateById(updateRecord);
|
||||
log.info("MonitorMetricsService-updateMonitorMetricsById effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(MonitorMetricsCacheKeyDefine.MONITOR_METRICS);
|
||||
RedisMaps.delete(MonitorMetricsCacheKeyDefine.MONITOR_METRICS);
|
||||
// 重新加载本地缓存
|
||||
monitorMetricsContext.reloadMonitorMetrics(id);
|
||||
return effect;
|
||||
|
||||
@@ -30,7 +30,6 @@ 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;
|
||||
@@ -85,7 +84,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
Long id = record.getId();
|
||||
log.info("CommandSnippetService-createCommandSnippet id: {}, effect: {}", id, effect);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -110,7 +109,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
int effect = commandSnippetDAO.update(null, update);
|
||||
log.info("CommandSnippetService-updateCommandSnippetById effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -170,7 +169,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
public Integer setGroupNull(Long userId, Long groupId) {
|
||||
int effect = commandSnippetDAO.setGroupIdWithNull(groupId);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -193,7 +192,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
public Integer deleteByGroupId(Long userId, Long groupId) {
|
||||
int effect = commandSnippetDAO.deleteByGroupId(groupId);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ 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;
|
||||
@@ -85,7 +84,7 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
|
||||
Long id = record.getId();
|
||||
log.info("PathBookmarkService-createPathBookmark id: {}, effect: {}", id, effect);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -110,7 +109,7 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
|
||||
int effect = pathBookmarkDAO.update(null, update);
|
||||
log.info("PathBookmarkService-updatePathBookmarkById effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -170,7 +169,7 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
|
||||
public Integer setGroupNull(Long userId, Long groupId) {
|
||||
int effect = pathBookmarkDAO.setGroupIdWithNull(groupId);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -193,7 +192,7 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
|
||||
public Integer deleteByGroupId(Long userId, Long groupId) {
|
||||
int effect = pathBookmarkDAO.deleteByGroupId(groupId);
|
||||
// 删除缓存
|
||||
RedisUtils.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.6
|
||||
VITE_APP_VERSION=2.5.5
|
||||
|
||||
@@ -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.6
|
||||
VITE_APP_VERSION=2.5.5
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "orion-visor-ui",
|
||||
"description": "Orion Visor UI",
|
||||
"version": "2.5.6",
|
||||
"version": "2.5.5",
|
||||
"private": true,
|
||||
"author": "Jiahang Li",
|
||||
"license": "Apache 2.0",
|
||||
|
||||
@@ -50,7 +50,7 @@ export interface HostAgentInstallStatusUpdateRequest {
|
||||
* 安装主机探针
|
||||
*/
|
||||
export function installHostAgent(request: HostInstallAgentRequest) {
|
||||
return axios.post<Record<string, number>>('/asset/host-agent/install', request);
|
||||
return axios.post('/asset/host-agent/install', request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,13 +58,15 @@
|
||||
// 修改配置
|
||||
appStore.updateSettings({ [key]: value });
|
||||
// 同步偏好
|
||||
await updatePreference({
|
||||
type: 'SYSTEM',
|
||||
item: key,
|
||||
value
|
||||
});
|
||||
try {
|
||||
await updatePreference({
|
||||
type: 'SYSTEM',
|
||||
item: key,
|
||||
value
|
||||
});
|
||||
} catch (e) {
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
setLoading(true);
|
||||
try {
|
||||
treeData.value = await cacheStore.loadHostGroupTree();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
} finally {
|
||||
emits('setLoading', false);
|
||||
}
|
||||
@@ -299,6 +300,7 @@
|
||||
});
|
||||
// 移动分组
|
||||
moveNode(treeData.value, dragNode, dropNode, dropPosition);
|
||||
} catch (e) {
|
||||
} finally {
|
||||
emits('setLoading', false);
|
||||
}
|
||||
@@ -310,6 +312,7 @@
|
||||
emits('setLoading', true);
|
||||
const groups = await cacheStore.loadHostGroupTree(force);
|
||||
treeData.value = groups || [];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
emits('setLoading', false);
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
username: s.username,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
value: s.id,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
hosts.value = data;
|
||||
// 设置主机搜索选项
|
||||
filterOptions.value = getAuthorizedHostOptions(data.hostList);
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
value: s.id,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
value: s.id,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -284,7 +284,6 @@ export default class LogAppender implements ILogAppender {
|
||||
this.client.close();
|
||||
}
|
||||
} catch (e) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,7 @@
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
setVisible(false);
|
||||
Message.error('cron 表达式错误');
|
||||
}
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
Message.success('回滚成功');
|
||||
emits('updated');
|
||||
handleClear();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -143,6 +144,7 @@
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
}
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
value: s.id,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
value: s.agentKey,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
value: s.id,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
origin: s
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
title: '根目录',
|
||||
children: render([...menus])
|
||||
}];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -96,16 +96,10 @@
|
||||
const reloadAllMessage = async () => {
|
||||
hasMore.value = true;
|
||||
messageList.value = [];
|
||||
try {
|
||||
await Promise.all([
|
||||
// 查询数量
|
||||
queryMessageCount(),
|
||||
// 加载列表
|
||||
loadMessage()
|
||||
]);
|
||||
} catch (e) {
|
||||
console.error('load message error', e);
|
||||
}
|
||||
// 查询数量
|
||||
queryMessageCount();
|
||||
// 加载列表
|
||||
await loadMessage();
|
||||
};
|
||||
|
||||
// 获取数量
|
||||
@@ -114,6 +108,7 @@
|
||||
try {
|
||||
const { data } = await getSystemMessageCount(queryUnread.value);
|
||||
classifyCount.value = data;
|
||||
} catch (ex) {
|
||||
} finally {
|
||||
setFetchLoading(false);
|
||||
}
|
||||
@@ -140,16 +135,17 @@
|
||||
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);
|
||||
}
|
||||
@@ -163,6 +159,7 @@
|
||||
await updateSystemMessageReadAll(currentClassify.value);
|
||||
// 修改状态
|
||||
messageList.value.forEach(s => s.status = MessageStatus.READ);
|
||||
} catch (ex) {
|
||||
} finally {
|
||||
setMessageLoading(false);
|
||||
}
|
||||
@@ -174,6 +171,7 @@
|
||||
try {
|
||||
// 清理消息
|
||||
await clearSystemMessage(currentClassify.value);
|
||||
} catch (ex) {
|
||||
} finally {
|
||||
setMessageLoading(false);
|
||||
}
|
||||
@@ -206,6 +204,7 @@
|
||||
// 移除
|
||||
const index = messageList.value.findIndex(s => s.id === message.id);
|
||||
messageList.value.splice(index, 1);
|
||||
} catch (ex) {
|
||||
} finally {
|
||||
setMessageLoading(false);
|
||||
}
|
||||
@@ -238,7 +237,7 @@
|
||||
onUnmounted(() => {
|
||||
localStorage.setItem(MESSAGE_CONFIG_KEY, JSON.stringify({
|
||||
currentClassify: currentClassify.value,
|
||||
queryUnread: queryUnread.value
|
||||
queryUnread: queryUnread.value,
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
value: s.id,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
value: s.id,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
value: s.id,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
value: s.id,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
value: s.id,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -127,6 +127,8 @@
|
||||
// 清空
|
||||
handlerClear();
|
||||
emits('updated');
|
||||
} catch (e) {
|
||||
return false;
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@ export const useCardFieldConfig = (table: string, originFieldConfig: CardFieldCo
|
||||
try {
|
||||
preferConfig = JSON.parse(localConfig as string);
|
||||
} catch (e) {
|
||||
preferConfig = {};
|
||||
}
|
||||
}
|
||||
// 解析配置
|
||||
@@ -93,7 +92,6 @@ export const useCardFieldConfig = (table: string, originFieldConfig: CardFieldCo
|
||||
try {
|
||||
preferConfig = JSON.parse(localConfig as string);
|
||||
} catch (e) {
|
||||
preferConfig = {};
|
||||
}
|
||||
}
|
||||
// 设置缓存
|
||||
|
||||
@@ -23,6 +23,7 @@ export default function useFavorite(type: FavoriteType) {
|
||||
await addFavorite(request);
|
||||
record.favorite = true;
|
||||
}
|
||||
} catch (e) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ export const useQueryOrder = (table: string, defaultSort: number = ASC): QueryOr
|
||||
try {
|
||||
preferConfig = JSON.parse(localConfig as string);
|
||||
} catch (e) {
|
||||
preferConfig = {};
|
||||
}
|
||||
}
|
||||
// 解析配置
|
||||
@@ -58,7 +57,6 @@ export const useQueryOrder = (table: string, defaultSort: number = ASC): QueryOr
|
||||
try {
|
||||
preferConfig = JSON.parse(localConfig as string);
|
||||
} catch (e) {
|
||||
preferConfig = {};
|
||||
}
|
||||
}
|
||||
// 设置缓存
|
||||
|
||||
@@ -78,7 +78,6 @@ export const useTableColumns = (table: string, originColumns: Array<TableColumnD
|
||||
try {
|
||||
preferConfig = JSON.parse(localConfig as string);
|
||||
} catch (e) {
|
||||
preferConfig = {}
|
||||
}
|
||||
}
|
||||
// 解析配置
|
||||
@@ -101,7 +100,6 @@ export const useTableColumns = (table: string, originColumns: Array<TableColumnD
|
||||
try {
|
||||
preferConfig = JSON.parse(localConfig as string);
|
||||
} catch (e) {
|
||||
preferConfig = {}
|
||||
}
|
||||
}
|
||||
// 设置缓存
|
||||
|
||||
@@ -14,7 +14,6 @@ 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);
|
||||
|
||||
@@ -27,9 +26,6 @@ app.use(i18n);
|
||||
app.use(globalComponents);
|
||||
app.use(directive);
|
||||
|
||||
// 全局异常处理
|
||||
globalErrorHandler(app);
|
||||
|
||||
app.mount('#app');
|
||||
|
||||
// 监听 PWA 注册事件
|
||||
|
||||
@@ -42,7 +42,7 @@ export default defineStore('dict', {
|
||||
const { data } = await getDictValueList(unloadKeys);
|
||||
this.$patch(data as object);
|
||||
} catch (e) {
|
||||
console.error('load dict error', e);
|
||||
} finally {
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ export default defineStore('tips', {
|
||||
await setTipsTipped(key);
|
||||
this.tippedKeys.push(key);
|
||||
} catch (e) {
|
||||
console.error('set tipped error', e);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -113,7 +113,6 @@ export default defineStore('user', {
|
||||
try {
|
||||
await userLogout();
|
||||
} catch (e) {
|
||||
console.error('logout error', e);
|
||||
} finally {
|
||||
// 登出回调
|
||||
this.logoutCallBack();
|
||||
|
||||
@@ -40,6 +40,5 @@ export const playBellHz = (frequency: number = 400, duration: number = .15) => {
|
||||
source.connect(audioCtx.destination);
|
||||
source.start();
|
||||
} catch (e) {
|
||||
// ignored
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
import type { App, ComponentPublicInstance } from 'vue';
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 全局异常处理
|
||||
*/
|
||||
export default function globalErrorHandler(Vue: App) {
|
||||
export default function handleError(Vue: App, baseUrl: string) {
|
||||
if (!baseUrl) {
|
||||
return;
|
||||
}
|
||||
Vue.config.errorHandler = (
|
||||
err: unknown,
|
||||
instance: ComponentPublicInstance | null,
|
||||
info: string
|
||||
) => {
|
||||
console.error(info, err);
|
||||
// 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
|
||||
// ...
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
// 无数据
|
||||
Message.warning('当前条件未查询到数据');
|
||||
}
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -158,6 +159,7 @@
|
||||
// 清空
|
||||
setVisible(false);
|
||||
handlerClear();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -264,6 +264,7 @@
|
||||
selectedKeys.value = [];
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -279,6 +280,7 @@
|
||||
selectedKeys.value = [];
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -302,6 +304,7 @@
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
selectedKeys.value = [];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -325,6 +328,7 @@
|
||||
record.status = HostConnectStatus.FORCE_OFFLINE;
|
||||
record.endTime = Date.now();
|
||||
Message.success('已下线');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ export const logColumns = [
|
||||
title: '连接主机',
|
||||
dataIndex: 'hostName',
|
||||
slotName: 'hostName',
|
||||
minWidth: 218,
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
default: true,
|
||||
|
||||
@@ -162,6 +162,7 @@
|
||||
setLoading(true);
|
||||
const { data } = await getTerminalConnectSessions(formModel);
|
||||
tableRenderData.value = data;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -176,6 +177,7 @@
|
||||
Message.success('已下线');
|
||||
// 移除行
|
||||
tableRenderData.value.splice(tableRenderData.value.findIndex(s => s.id === record.id), 1);
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ const columns = [
|
||||
title: '连接主机',
|
||||
dataIndex: 'hostName',
|
||||
slotName: 'hostName',
|
||||
minWidth: 218,
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
}, {
|
||||
|
||||
@@ -239,6 +239,7 @@
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
selectedKeys.value = [];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -259,6 +260,7 @@
|
||||
selectedKeys.value = [];
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -274,6 +276,7 @@
|
||||
selectedKeys.value = [];
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
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);
|
||||
}
|
||||
@@ -119,6 +120,7 @@
|
||||
const { data } = await getAuthorizedHostGroup(request);
|
||||
authorizedGroups.value = data;
|
||||
checkedGroups.value = data;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -136,6 +138,7 @@
|
||||
Message.success('授权成功');
|
||||
// 清空缓存
|
||||
cacheStore.reset('authorizedHost_ALL', 'authorizedHost_SSH');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
try {
|
||||
const { data } = await getAuthorizedHostIdentity(request);
|
||||
selectedKeys.value = data;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -98,6 +99,7 @@
|
||||
Message.success('授权成功');
|
||||
// 清空缓存
|
||||
cacheStore.reset('authorizedHostIdentities');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -134,6 +136,7 @@
|
||||
hostIdentities.value = await cacheStore.loadHostIdentities();
|
||||
// 加载主机密钥
|
||||
hostKeys.value = await cacheStore.loadHostKeys();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
try {
|
||||
const { data } = await getAuthorizedHostKey(request);
|
||||
selectedKeys.value = data;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -74,6 +75,7 @@
|
||||
Message.success('授权成功');
|
||||
// 清空缓存
|
||||
cacheStore.reset('authorizedHostKeys');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -107,6 +109,7 @@
|
||||
setLoading(true);
|
||||
try {
|
||||
hostKeys.value = await cacheStore.loadHostKeys();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@
|
||||
emits('loading', true);
|
||||
const { data } = await getHostGroupRelList(groupId as number);
|
||||
value.value = data.map(String);
|
||||
} catch (e) {
|
||||
} finally {
|
||||
emits('loading', false);
|
||||
}
|
||||
|
||||
@@ -109,16 +109,14 @@
|
||||
|
||||
// 保存主机
|
||||
const saveHost = async () => {
|
||||
if (!currentGroup.value?.key) {
|
||||
return false;
|
||||
}
|
||||
setLoading(true);
|
||||
try {
|
||||
await updateHostGroupRel({
|
||||
groupId: currentGroup.value?.key,
|
||||
groupId: currentGroup.value?.key as number,
|
||||
hostIdList: currentGroupHost.value
|
||||
});
|
||||
Message.success('保存成功');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -221,6 +221,7 @@
|
||||
Message.success('删除成功');
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -253,6 +254,7 @@
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -182,6 +182,8 @@
|
||||
}
|
||||
// 清空
|
||||
handlerClear();
|
||||
} catch (e) {
|
||||
return false;
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -240,6 +240,7 @@
|
||||
Message.success('删除成功');
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -255,6 +256,7 @@
|
||||
selectedKeys.value = [];
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -280,6 +282,7 @@
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
selectedKeys.value = [];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
Message.success('删除成功');
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -159,6 +160,7 @@
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -232,6 +232,8 @@
|
||||
}
|
||||
// 清空
|
||||
handlerClear();
|
||||
} catch (e) {
|
||||
return false;
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -189,6 +189,7 @@
|
||||
Message.success('删除成功');
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -204,6 +205,7 @@
|
||||
selectedKeys.value = [];
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -229,6 +231,7 @@
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
selectedKeys.value = [];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -351,6 +351,7 @@
|
||||
});
|
||||
record.status = newStatus;
|
||||
Message.success(`已${dict.label}`);
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -373,6 +374,7 @@
|
||||
Message.success('删除成功');
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -406,6 +408,7 @@
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -155,6 +155,7 @@
|
||||
renderForm({ ...detail, tags });
|
||||
// 响应类型
|
||||
emits('changeType', data.types);
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -208,6 +209,7 @@
|
||||
emits('updated', formModel.value.id);
|
||||
}
|
||||
emits('changeType', formModel.value.types);
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -307,6 +307,7 @@
|
||||
// 查询规格信息
|
||||
const { data } = await getHostExtraItem<HostSpecExtraModel>({ hostId: props.hostId, item: 'SPEC' });
|
||||
formModel.value = data;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -342,6 +343,7 @@
|
||||
});
|
||||
toggleEditing();
|
||||
emits('updated');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@
|
||||
// 测试连接
|
||||
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
Reference in New Issue
Block a user