Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f6d84dab2 | ||
|
|
f64eb395a8 | ||
|
|
2e69c67de0 | ||
|
|
7747b4e52e | ||
|
|
830622aafb | ||
|
|
2919950c5b | ||
|
|
d56cfbba82 | ||
|
|
cfe1924f11 | ||
|
|
dfd2ec45f4 | ||
|
|
19c7e31f53 | ||
|
|
f618aef988 | ||
|
|
af97f752f5 | ||
|
|
bfb80afee2 |
22
README.md
22
README.md
@@ -13,27 +13,27 @@
|
|||||||
</a>
|
</a>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
style="text-decoration: none !important;"
|
style="text-decoration: none !important;"
|
||||||
href="https://github.com/lijiahangmax/orion-visor/releases">
|
href="https://github.com/dromara/orion-visor/releases">
|
||||||
<img src="https://img.shields.io/github/v/release/lijiahangmax/orion-visor" alt="release" />
|
<img src="https://img.shields.io/github/v/release/lijiahangmax/orion-visor" alt="release" />
|
||||||
</a>
|
</a>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
style="text-decoration: none !important;"
|
style="text-decoration: none !important;"
|
||||||
href="https://gitee.com/lijiahangmax/orion-visor/stargazers">
|
href="https://gitee.com/dromara/orion-visor/stargazers">
|
||||||
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/star.svg?theme=dark" alt="star" />
|
<img src="https://gitee.com/dromara/orion-visor/badge/star.svg?theme=dark" alt="star" />
|
||||||
</a>
|
</a>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
style="text-decoration: none !important;"
|
style="text-decoration: none !important;"
|
||||||
href="https://gitee.com/lijiahangmax/orion-visor/members">
|
href="https://gitee.com/dromara/orion-visor/members">
|
||||||
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/fork.svg?theme=dark" alt="fork" />
|
<img src="https://gitee.com/dromara/orion-visor/badge/fork.svg?theme=dark" alt="fork" />
|
||||||
</a>
|
</a>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
style="text-decoration: none !important;"
|
style="text-decoration: none !important;"
|
||||||
href="https://github.com/lijiahangmax/orion-visor">
|
href="https://github.com/dromara/orion-visor">
|
||||||
<img src="https://img.shields.io/github/stars/lijiahangmax/orion-visor" alt="star" />
|
<img src="https://img.shields.io/github/stars/lijiahangmax/orion-visor" alt="star" />
|
||||||
</a>
|
</a>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
style="text-decoration: none !important;"
|
style="text-decoration: none !important;"
|
||||||
href="https://github.com/lijiahangmax/orion-visor">
|
href="https://github.com/dromara/orion-visor">
|
||||||
<img src="https://img.shields.io/github/forks/lijiahangmax/orion-visor" alt="star" />
|
<img src="https://img.shields.io/github/forks/lijiahangmax/orion-visor" alt="star" />
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
* 🔗 演示地址: http://101.43.254.243:1081/
|
* 🔗 演示地址: http://101.43.254.243:1081/
|
||||||
* 🔏 演示账号: admin/admin
|
* 🔏 演示账号: admin/admin
|
||||||
* ⭐ 体验后可以点一下 `star` 这对我很重要! [github](https://github.com/lijiahangmax/orion-visor) [gitee](https://gitee.com/lijiahangmax/orion-visor)
|
* ⭐ 体验后可以点一下 `star` 这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor)
|
||||||
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
||||||
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
|
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
|
||||||
* 📛 演示环境请不要随便删除数据!
|
* 📛 演示环境请不要随便删除数据!
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# clone
|
# clone
|
||||||
git clone https://github.com/lijiahangmax/orion-visor
|
git clone https://github.com/dromara/orion-visor
|
||||||
cd orion-visor
|
cd orion-visor
|
||||||
# 启动
|
# 启动
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
@@ -131,8 +131,8 @@ docker compose up -d
|
|||||||
|
|
||||||
## 免责声明
|
## 免责声明
|
||||||
|
|
||||||
在使用本项目之前, 请确保您已经了解并同意相关的使用协议和隐私政策。[免责声明](https://github.com/lijiahangmax/orion-visor/blob/main/DISCLAIMER.md)
|
在使用本项目之前, 请确保您已经了解并同意相关的使用协议和隐私政策。[免责声明](https://github.com/dromara/orion-visor/blob/main/DISCLAIMER.md)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
本项目遵循 [Apache-2.0](https://github.com/lijiahangmax/orion-visor/blob/main/LICENSE) 开源许可证。
|
本项目遵循 [Apache-2.0](https://github.com/dromara/orion-visor/blob/main/LICENSE) 开源许可证。
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
version: '3.3'
|
version: '3.3'
|
||||||
services:
|
services:
|
||||||
orion-visor-service:
|
orion-visor-service:
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.7
|
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.9
|
||||||
|
privileged: true
|
||||||
ports:
|
ports:
|
||||||
- 1081:80
|
- 1081:80
|
||||||
environment:
|
environment:
|
||||||
@@ -20,7 +21,7 @@ services:
|
|||||||
- orion-visor-mysql
|
- orion-visor-mysql
|
||||||
- orion-visor-redis
|
- orion-visor-redis
|
||||||
orion-visor-mysql:
|
orion-visor-mysql:
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.7
|
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.9
|
||||||
privileged: true
|
privileged: true
|
||||||
ports:
|
ports:
|
||||||
- 3307:3306
|
- 3307:3306
|
||||||
@@ -34,7 +35,7 @@ services:
|
|||||||
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/var-lib-mysql-files:/var/lib/mysql-files
|
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/var-lib-mysql-files:/var/lib/mysql-files
|
||||||
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/etc-mysql:/etc/mysql
|
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/etc-mysql:/etc/mysql
|
||||||
orion-visor-redis:
|
orion-visor-redis:
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.7
|
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.9
|
||||||
privileged: true
|
privileged: true
|
||||||
ports:
|
ports:
|
||||||
- 6380:6379
|
- 6380:6379
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
docker compose down
|
docker compose down
|
||||||
sh ./pull.sh
|
|
||||||
# demo 启动
|
# demo 启动
|
||||||
if [ "$1" == "demo" ]; then
|
if [ "$1" == "demo" ]; then
|
||||||
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
|
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
version=2.0.7
|
version=2.0.9
|
||||||
cp -r ../../sql ./sql
|
cp -r ../../sql ./sql
|
||||||
docker build -t orion-visor-mysql:${version} .
|
docker build -t orion-visor-mysql:${version} .
|
||||||
rm -rf ./sql
|
rm -rf ./sql
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
version=2.0.7
|
version=2.0.9
|
||||||
docker build -t orion-visor-redis:${version} .
|
docker build -t orion-visor-redis:${version} .
|
||||||
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||||
@@ -8,6 +8,7 @@ RUN \
|
|||||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
||||||
apk update && \
|
apk update && \
|
||||||
apk add tzdata && \
|
apk add tzdata && \
|
||||||
|
apk add dmidecode && \
|
||||||
apk add openjdk8
|
apk add openjdk8
|
||||||
# 设置时区
|
# 设置时区
|
||||||
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
|
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
version=2.0.7
|
version=2.0.9
|
||||||
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
|
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
|
||||||
mv ../../orion-visor-ui/dist ./dist
|
mv ../../orion-visor-ui/dist ./dist
|
||||||
docker build -t orion-visor-service:${version} .
|
docker build -t orion-visor-service:${version} .
|
||||||
@@ -11,10 +11,10 @@
|
|||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
|
|
||||||
<description>项目所有依赖</description>
|
<description>项目所有依赖</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>2.0.7</revision>
|
<revision>2.0.9</revision>
|
||||||
<spring.boot.version>2.7.17</spring.boot.version>
|
<spring.boot.version>2.7.17</spring.boot.version>
|
||||||
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
|
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
|
||||||
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
|
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目公共基准包</description>
|
<description>项目公共基准包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,14 +14,17 @@ public interface AppConst extends OrionConst {
|
|||||||
/**
|
/**
|
||||||
* 同 ${orion.version} 迭代时候需要手动更改
|
* 同 ${orion.version} 迭代时候需要手动更改
|
||||||
*/
|
*/
|
||||||
String VERSION = "2.0.7";
|
String VERSION = "2.0.9";
|
||||||
|
|
||||||
String ORION_VISOR = "orion-visor";
|
/**
|
||||||
|
* 同 ${spring.application.name}
|
||||||
|
*/
|
||||||
|
String APP_NAME = "orion-visor";
|
||||||
|
|
||||||
String GITHUB = "https://github.com/lijiahangmax/orion-visor";
|
String GITHUB = "https://github.com/dromara/orion-visor";
|
||||||
|
|
||||||
String GITEE = "https://gitee.com/lijiahangmax/orion-visor";
|
String GITEE = "https://gitee.com/dromara/orion-visor";
|
||||||
|
|
||||||
String ISSUES = "https://github.com/lijiahangmax/orion-visor/issues";
|
String ISSUES = "https://github.com/dromara/orion-visor/issues";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,8 @@ public interface CnConst {
|
|||||||
|
|
||||||
String CN_ROLE = "角色";
|
String CN_ROLE = "角色";
|
||||||
|
|
||||||
|
String CN_UNKNOWN = "未知";
|
||||||
|
|
||||||
|
String CN_INTRANET_IP = "内网IP";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ public interface Const extends com.orion.lang.constant.Const, FieldConst, CnCons
|
|||||||
|
|
||||||
int MD5_LEN = 32;
|
int MD5_LEN = 32;
|
||||||
|
|
||||||
String UNKNOWN = "未知";
|
|
||||||
|
|
||||||
String INTRANET_IP = "内网IP";
|
|
||||||
|
|
||||||
Long ROOT_PARENT_ID = 0L;
|
Long ROOT_PARENT_ID = 0L;
|
||||||
|
|
||||||
Integer DEFAULT_SORT = 10;
|
Integer DEFAULT_SORT = 10;
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package com.orion.visor.framework.common.handler.data;
|
package com.orion.visor.framework.common.handler.data;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.orion.spring.SpringHolder;
|
import com.orion.spring.SpringHolder;
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标准数据定义
|
* 标准数据定义
|
||||||
@@ -12,45 +11,50 @@ import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/12/21 0:07
|
* @since 2023/12/21 0:07
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public interface GenericsDataDefinition {
|
public interface GenericsDataDefinition {
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取数据模型类型
|
|
||||||
*
|
|
||||||
* @return class
|
|
||||||
*/
|
|
||||||
Class<? extends GenericsDataModel> getModel();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取数据处理策略
|
* 获取数据处理策略
|
||||||
*
|
*
|
||||||
* @return class
|
* @return class
|
||||||
*/
|
*/
|
||||||
Class<? extends MapDataStrategy<? extends GenericsDataModel>> getStrategy();
|
Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> getStrategyClass();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取数据模型策略处理器
|
* 获取数据模型策略处理器
|
||||||
*
|
*
|
||||||
* @param <Model> Model
|
* @param <M> Model
|
||||||
* @param <Strategy> Strategy
|
* @param <S> Strategy
|
||||||
* @return StrategyBean
|
* @return Strategy Bean
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
default <M extends GenericsDataModel, S extends GenericsDataStrategy<M>> S getStrategy() {
|
||||||
default <Model extends GenericsDataModel, Strategy extends MapDataStrategy<Model>> Strategy getStrategyBean() {
|
return (S) SpringHolder.getBean(this.getStrategyClass());
|
||||||
return (Strategy) SpringHolder.getBean(this.getStrategy());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 反序列化对象
|
* 反序列化对象
|
||||||
*
|
*
|
||||||
* @param json json
|
* @param serialModel serialModel
|
||||||
* @param <Model> Model
|
* @param <M> Model
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
default <M extends GenericsDataModel> M parse(String serialModel) {
|
||||||
default <Model extends GenericsDataModel> Model parse(String json) {
|
return (M) this.getStrategy().parse(serialModel);
|
||||||
return (Model) JSON.parseObject(json, this.getModel());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转为视图对象
|
||||||
|
*
|
||||||
|
* @param serialModel serialModel
|
||||||
|
* @param <M> Model
|
||||||
|
* @return viewModel
|
||||||
|
*/
|
||||||
|
default <M extends GenericsDataModel> M toView(String serialModel) {
|
||||||
|
GenericsDataStrategy<GenericsDataModel> strategy = this.getStrategy();
|
||||||
|
GenericsDataModel model = strategy.parse(serialModel);
|
||||||
|
strategy.toView(model);
|
||||||
|
return (M) model;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.orion.visor.framework.common.handler.data.model;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标准数据模型
|
* 标准数据模型
|
||||||
*
|
*
|
||||||
@@ -20,4 +22,14 @@ public interface GenericsDataModel {
|
|||||||
return JSON.toJSONString(this);
|
return JSON.toJSONString(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转为 map
|
||||||
|
*
|
||||||
|
* @return map
|
||||||
|
*/
|
||||||
|
default Map<String, Object> toMap() {
|
||||||
|
return JSON.parseObject(this.serial());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.orion.visor.framework.common.handler.data.strategy;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准数据处理策略 基类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/11 21:44
|
||||||
|
*/
|
||||||
|
public abstract class AbstractGenericsDataStrategy<M extends GenericsDataModel> implements GenericsDataStrategy<M> {
|
||||||
|
|
||||||
|
protected final Class<M> modelClass;
|
||||||
|
|
||||||
|
public AbstractGenericsDataStrategy(Class<M> modelClass) {
|
||||||
|
this.modelClass = modelClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新填充
|
||||||
|
*
|
||||||
|
* @param beforeModel 修改前的配置
|
||||||
|
* @param afterModel 修改后的配置
|
||||||
|
*/
|
||||||
|
protected void updateFill(M beforeModel, M afterModel) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预校验参数
|
||||||
|
*
|
||||||
|
* @param model model
|
||||||
|
*/
|
||||||
|
protected void preValid(M model) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验参数
|
||||||
|
*
|
||||||
|
* @param model model
|
||||||
|
*/
|
||||||
|
protected void valid(M model) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doValid(M beforeModel, M afterModel) {
|
||||||
|
// 预校验参数
|
||||||
|
this.preValid(afterModel);
|
||||||
|
// 更新填充
|
||||||
|
this.updateFill(beforeModel, afterModel);
|
||||||
|
// 校验参数
|
||||||
|
this.valid(afterModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public M parse(String serialModel) {
|
||||||
|
return JSON.parseObject(serialModel, modelClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toView(M model) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,60 +9,38 @@ import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/12/20 22:09
|
* @since 2023/12/20 22:09
|
||||||
*/
|
*/
|
||||||
public interface GenericsDataStrategy<Model extends GenericsDataModel, View> {
|
public interface GenericsDataStrategy<M extends GenericsDataModel> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取默认值
|
* 获取默认值
|
||||||
*
|
*
|
||||||
* @return 默认值
|
* @return 默认值
|
||||||
*/
|
*/
|
||||||
Model getDefault();
|
M getDefault();
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新填充
|
|
||||||
*
|
|
||||||
* @param beforeModel 修改前的配置
|
|
||||||
* @param afterModel 修改后的配置
|
|
||||||
*/
|
|
||||||
void updateFill(Model beforeModel, Model afterModel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 预校验参数
|
|
||||||
*
|
|
||||||
* @param model model
|
|
||||||
*/
|
|
||||||
void preValid(Model model);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验参数
|
|
||||||
*
|
|
||||||
* @param model model
|
|
||||||
*/
|
|
||||||
void valid(Model model);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行完整验证链
|
* 执行完整验证链
|
||||||
* <p>
|
* <p>
|
||||||
* preValid > updateFill > preValid
|
* preValid > updateFill > valid
|
||||||
*
|
*
|
||||||
* @param beforeModel beforeModel
|
* @param beforeModel beforeModel
|
||||||
* @param afterModel afterModel
|
* @param afterModel afterModel
|
||||||
*/
|
*/
|
||||||
default void doValidChain(Model beforeModel, Model afterModel) {
|
void doValid(M beforeModel, M afterModel);
|
||||||
// 预校验参数
|
|
||||||
this.preValid(afterModel);
|
/**
|
||||||
// 更新填充
|
* 解析数据
|
||||||
this.updateFill(beforeModel, afterModel);
|
*
|
||||||
// 校验参数
|
* @param serialModel serialModel
|
||||||
this.valid(afterModel);
|
* @return model
|
||||||
}
|
*/
|
||||||
|
M parse(String serialModel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转为视图配置
|
* 转为视图配置
|
||||||
*
|
*
|
||||||
* @param model model
|
* @param model model
|
||||||
* @return 视图配置
|
|
||||||
*/
|
*/
|
||||||
View toView(String model);
|
void toView(M model);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.orion.visor.framework.common.handler.data.strategy;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* map 数据处理策略
|
|
||||||
*
|
|
||||||
* @author Jiahang Li
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 2023/12/20 22:11
|
|
||||||
*/
|
|
||||||
public interface MapDataStrategy<Model extends GenericsDataModel> extends GenericsDataStrategy<Model, Map<String, Object>> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default Map<String, Object> toView(String model) {
|
|
||||||
return JSONObject.parseObject(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -29,7 +29,7 @@ public class IpUtils {
|
|||||||
*/
|
*/
|
||||||
public static String getLocation(String ip) {
|
public static String getLocation(String ip) {
|
||||||
if (ip == null) {
|
if (ip == null) {
|
||||||
return Const.UNKNOWN;
|
return Const.CN_UNKNOWN;
|
||||||
}
|
}
|
||||||
// 查询缓存
|
// 查询缓存
|
||||||
return CACHE.computeIfAbsent(ip, IpUtils::queryLocation);
|
return CACHE.computeIfAbsent(ip, IpUtils::queryLocation);
|
||||||
@@ -43,21 +43,21 @@ public class IpUtils {
|
|||||||
*/
|
*/
|
||||||
private static String queryLocation(String ip) {
|
private static String queryLocation(String ip) {
|
||||||
if (ip == null) {
|
if (ip == null) {
|
||||||
return Const.UNKNOWN;
|
return Const.CN_UNKNOWN;
|
||||||
}
|
}
|
||||||
Region region;
|
Region region;
|
||||||
try {
|
try {
|
||||||
region = LocationRegions.getRegion(ip, 3);
|
region = LocationRegions.getRegion(ip, 3);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Const.UNKNOWN;
|
return Const.CN_UNKNOWN;
|
||||||
}
|
}
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
String net = region.getNet();
|
String net = region.getNet();
|
||||||
String province = region.getProvince();
|
String province = region.getProvince();
|
||||||
if (net.equals(Const.INTRANET_IP)) {
|
if (net.equals(Const.CN_INTRANET_IP)) {
|
||||||
return net;
|
return net;
|
||||||
}
|
}
|
||||||
if (province.equals(Const.UNKNOWN)) {
|
if (province.equals(Const.CN_UNKNOWN)) {
|
||||||
return province;
|
return province;
|
||||||
}
|
}
|
||||||
StringBuilder location = new StringBuilder()
|
StringBuilder location = new StringBuilder()
|
||||||
@@ -69,7 +69,7 @@ public class IpUtils {
|
|||||||
location.append(" (").append(net).append(')');
|
location.append(" (").append(net).append(')');
|
||||||
return location.toString();
|
return location.toString();
|
||||||
}
|
}
|
||||||
return Const.UNKNOWN;
|
return Const.CN_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.orion.visor.framework.common.utils;
|
||||||
|
|
||||||
|
import com.orion.lang.utils.Arrays1;
|
||||||
|
import com.orion.lang.utils.crypto.Caesars;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 混淆工具类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/17 18:27
|
||||||
|
*/
|
||||||
|
public class Mixes {
|
||||||
|
|
||||||
|
private Mixes() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 混淆
|
||||||
|
* <p>
|
||||||
|
* 此方法不可修改
|
||||||
|
*
|
||||||
|
* @param str str
|
||||||
|
* @return str
|
||||||
|
*/
|
||||||
|
public static String obfuscate(String str) {
|
||||||
|
char[] chars = str.toCharArray();
|
||||||
|
Arrays1.reverse(chars);
|
||||||
|
for (int i = 0; i < chars.length; i += 2) {
|
||||||
|
char temp = chars[i];
|
||||||
|
chars[i] = chars[i + 1];
|
||||||
|
chars[i + 1] = temp;
|
||||||
|
}
|
||||||
|
String res = new String(chars);
|
||||||
|
return new Caesars().encrypt(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -47,7 +47,7 @@ public class PathUtils {
|
|||||||
public static String getAppPath(boolean isWindows, String username) {
|
public static String getAppPath(boolean isWindows, String username) {
|
||||||
return getHomePath(isWindows, username)
|
return getHomePath(isWindows, username)
|
||||||
+ "/" + AppConst.ORION
|
+ "/" + AppConst.ORION
|
||||||
+ "/" + AppConst.ORION_VISOR;
|
+ "/" + AppConst.APP_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 banner 打印包</description>
|
<description>项目 banner 打印包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class BannerApplicationRunner implements ApplicationRunner {
|
|||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) {
|
public void run(ApplicationArguments args) {
|
||||||
AnsiAppender appender = AnsiAppender.create()
|
AnsiAppender appender = AnsiAppender.create()
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: orion-visor-launch v" + version + " 服务已启动(" + env + ") ::\n");
|
.append(AnsiForeground.BRIGHT_GREEN, ":: orion-visor v" + version + " 服务已启动(" + env + ") ::\n");
|
||||||
// swagger 地址
|
// swagger 地址
|
||||||
if (apiDocsEnabled) {
|
if (apiDocsEnabled) {
|
||||||
appender.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ")
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ")
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目操作日志包</description>
|
<description>项目操作日志包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目数据源配置包</description>
|
<description>项目数据源配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目数据脱敏包</description>
|
<description>项目数据脱敏包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目定时任务配置包</description>
|
<description>项目定时任务配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目日志配置包</description>
|
<description>项目日志配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目监控配置包</description>
|
<description>项目监控配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 mybatis 配置包</description>
|
<description>项目 mybatis 配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 redis 配置包</description>
|
<description>项目 redis 配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 security 配置包</description>
|
<description>项目 security 配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目存储层配置包</description>
|
<description>项目存储层配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 swagger 配置包</description>
|
<description>项目 swagger 配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目单元测试包</description>
|
<description>项目单元测试包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 web 包</description>
|
<description>项目 web 包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 websocket 配置包</description>
|
<description>项目 websocket 配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<description>项目组件包</description>
|
<description>项目组件包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>orion-visor-framework-common</module>
|
<module>orion-visor-framework-common</module>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>后端服务主项目容器 按需引用 orion-visor-module-xxx 依赖</description>
|
<description>后端服务主项目容器 按需引用 orion-visor-module-xxx 依赖</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- spring boot 配置所需依赖 -->
|
<!-- spring boot 配置所需依赖 -->
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ server:
|
|||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: orion-visor-launch
|
name: orion-visor
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
main:
|
main:
|
||||||
@@ -142,7 +142,7 @@ knife4j:
|
|||||||
|
|
||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
path: ${user.home}/orion/logs/orion-visor
|
path: ${user.home}/orion/logs/${spring.application.name}
|
||||||
name: ${logging.file.path}/app.log
|
name: ${logging.file.path}/app.log
|
||||||
logback:
|
logback:
|
||||||
rollingpolicy:
|
rollingpolicy:
|
||||||
@@ -220,10 +220,10 @@ orion:
|
|||||||
title: orion-visor 运维平台
|
title: orion-visor 运维平台
|
||||||
description: 一站式运维服务平台
|
description: 一站式运维服务平台
|
||||||
version: ${orion.version}
|
version: ${orion.version}
|
||||||
url: https://github.com/lijiahangmax/orion-visor
|
url: https://github.com/dromara/orion-visor
|
||||||
email: ljh1553488six@139.com
|
email: ljh1553488six@139.com
|
||||||
license: Apache-2.0
|
license: Apache-2.0
|
||||||
license-url: https://github.com/lijiahangmax/orion-visor/blob/main/LICENSE
|
license-url: https://github.com/dromara/orion-visor/blob/main/LICENSE
|
||||||
grouped-api:
|
grouped-api:
|
||||||
infra:
|
infra:
|
||||||
group: "infra - 基建模块"
|
group: "infra - 基建模块"
|
||||||
@@ -253,14 +253,14 @@ orion:
|
|||||||
timestamp-prefix: false
|
timestamp-prefix: false
|
||||||
date-directory: false
|
date-directory: false
|
||||||
storage-path: ${user.home}
|
storage-path: ${user.home}
|
||||||
base-path: /orion/orion-visor/storage
|
base-path: /orion/${spring.application.name}/storage
|
||||||
# 日志文件存储
|
# 日志文件存储
|
||||||
logs:
|
logs:
|
||||||
enabled: true
|
enabled: true
|
||||||
timestamp-prefix: false
|
timestamp-prefix: false
|
||||||
date-directory: false
|
date-directory: false
|
||||||
storage-path: ${user.home}
|
storage-path: ${user.home}
|
||||||
base-path: /orion/orion-visor/logs
|
base-path: /orion/${spring.application.name}/logs
|
||||||
security:
|
security:
|
||||||
password-encoder-length: 4
|
password-encoder-length: 4
|
||||||
# 匿名接口
|
# 匿名接口
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目资产模块</description>
|
<description>项目资产模块</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目资产模块</description>
|
<description>项目资产模块</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ package com.orion.visor.module.asset.enums;
|
|||||||
import com.orion.visor.framework.common.enums.EnableStatus;
|
import com.orion.visor.framework.common.enums.EnableStatus;
|
||||||
import com.orion.visor.framework.common.handler.data.GenericsDataDefinition;
|
import com.orion.visor.framework.common.handler.data.GenericsDataDefinition;
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||||
import com.orion.visor.module.asset.handler.host.config.model.HostSshConfigModel;
|
|
||||||
import com.orion.visor.module.asset.handler.host.config.strategy.HostSshConfigStrategy;
|
import com.orion.visor.module.asset.handler.host.config.strategy.HostSshConfigStrategy;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -24,7 +23,6 @@ public enum HostConfigTypeEnum implements GenericsDataDefinition {
|
|||||||
* SSH 配置
|
* SSH 配置
|
||||||
*/
|
*/
|
||||||
SSH("ssh",
|
SSH("ssh",
|
||||||
HostSshConfigModel.class,
|
|
||||||
HostSshConfigStrategy.class,
|
HostSshConfigStrategy.class,
|
||||||
EnableStatus.ENABLED.getValue()),
|
EnableStatus.ENABLED.getValue()),
|
||||||
|
|
||||||
@@ -32,9 +30,7 @@ public enum HostConfigTypeEnum implements GenericsDataDefinition {
|
|||||||
|
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|
||||||
private final Class<? extends GenericsDataModel> model;
|
private final Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> strategyClass;
|
||||||
|
|
||||||
private final Class<? extends MapDataStrategy<? extends GenericsDataModel>> strategy;
|
|
||||||
|
|
||||||
private final Integer defaultStatus;
|
private final Integer defaultStatus;
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package com.orion.visor.module.asset.enums;
|
|||||||
|
|
||||||
import com.orion.visor.framework.common.handler.data.GenericsDataDefinition;
|
import com.orion.visor.framework.common.handler.data.GenericsDataDefinition;
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||||
import com.orion.visor.module.asset.handler.host.extra.model.HostLabelExtraModel;
|
|
||||||
import com.orion.visor.module.asset.handler.host.extra.model.HostSshExtraModel;
|
|
||||||
import com.orion.visor.module.asset.handler.host.extra.strategy.HostLabelExtraStrategy;
|
import com.orion.visor.module.asset.handler.host.extra.strategy.HostLabelExtraStrategy;
|
||||||
import com.orion.visor.module.asset.handler.host.extra.strategy.HostSshExtraStrategy;
|
import com.orion.visor.module.asset.handler.host.extra.strategy.HostSshExtraStrategy;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -24,20 +22,18 @@ public enum HostExtraItemEnum implements GenericsDataDefinition {
|
|||||||
/**
|
/**
|
||||||
* SSH 额外配置
|
* SSH 额外配置
|
||||||
*/
|
*/
|
||||||
SSH("ssh", HostSshExtraModel.class, HostSshExtraStrategy.class),
|
SSH("ssh", HostSshExtraStrategy.class),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标签额外配置
|
* 标签额外配置
|
||||||
*/
|
*/
|
||||||
LABEL("label", HostLabelExtraModel.class, HostLabelExtraStrategy.class),
|
LABEL("label", HostLabelExtraStrategy.class),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String item;
|
private final String item;
|
||||||
|
|
||||||
private final Class<? extends GenericsDataModel> model;
|
private final Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> strategyClass;
|
||||||
|
|
||||||
private final Class<? extends MapDataStrategy<? extends GenericsDataModel>> strategy;
|
|
||||||
|
|
||||||
public static HostExtraItemEnum of(String type) {
|
public static HostExtraItemEnum of(String type) {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.config.strategy;
|
package com.orion.visor.module.asset.handler.host.config.strategy;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.orion.lang.utils.Booleans;
|
import com.orion.lang.utils.Booleans;
|
||||||
import com.orion.lang.utils.Charsets;
|
import com.orion.lang.utils.Charsets;
|
||||||
import com.orion.lang.utils.Exceptions;
|
import com.orion.lang.utils.Exceptions;
|
||||||
import com.orion.lang.utils.Strings;
|
import com.orion.lang.utils.Strings;
|
||||||
import com.orion.visor.framework.common.constant.Const;
|
import com.orion.visor.framework.common.constant.Const;
|
||||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.AbstractGenericsDataStrategy;
|
||||||
import com.orion.visor.framework.common.security.PasswordModifier;
|
import com.orion.visor.framework.common.security.PasswordModifier;
|
||||||
import com.orion.visor.framework.common.utils.Valid;
|
import com.orion.visor.framework.common.utils.Valid;
|
||||||
import com.orion.visor.module.asset.dao.HostIdentityDAO;
|
import com.orion.visor.module.asset.dao.HostIdentityDAO;
|
||||||
@@ -18,7 +17,6 @@ import com.orion.visor.module.asset.handler.host.config.model.HostSshConfigModel
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主机 SSH 配置策略
|
* 主机 SSH 配置策略
|
||||||
@@ -28,7 +26,7 @@ import java.util.Map;
|
|||||||
* @since 2023/9/19 14:26
|
* @since 2023/9/19 14:26
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel> {
|
public class HostSshConfigStrategy extends AbstractGenericsDataStrategy<HostSshConfigModel> {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private HostKeyDAO hostKeyDAO;
|
private HostKeyDAO hostKeyDAO;
|
||||||
@@ -40,6 +38,10 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
|||||||
|
|
||||||
private static final String USERNAME = "root";
|
private static final String USERNAME = "root";
|
||||||
|
|
||||||
|
public HostSshConfigStrategy() {
|
||||||
|
super(HostSshConfigModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HostSshConfigModel getDefault() {
|
public HostSshConfigModel getDefault() {
|
||||||
return HostSshConfigModel.builder()
|
return HostSshConfigModel.builder()
|
||||||
@@ -55,7 +57,7 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preValid(HostSshConfigModel model) {
|
protected void preValid(HostSshConfigModel model) {
|
||||||
// 验证认证类型
|
// 验证认证类型
|
||||||
Valid.valid(HostSshAuthTypeEnum::of, model.getAuthType());
|
Valid.valid(HostSshAuthTypeEnum::of, model.getAuthType());
|
||||||
// 验证系统版本
|
// 验证系统版本
|
||||||
@@ -77,13 +79,13 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void valid(HostSshConfigModel model) {
|
protected void valid(HostSshConfigModel model) {
|
||||||
// 验证填充后的参数
|
// 验证填充后的参数
|
||||||
Valid.valid(model);
|
Valid.valid(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateFill(HostSshConfigModel beforeModel, HostSshConfigModel afterModel) {
|
protected void updateFill(HostSshConfigModel beforeModel, HostSshConfigModel afterModel) {
|
||||||
// 加密密码
|
// 加密密码
|
||||||
this.checkEncryptPassword(beforeModel, afterModel);
|
this.checkEncryptPassword(beforeModel, afterModel);
|
||||||
afterModel.setHasPassword(null);
|
afterModel.setHasPassword(null);
|
||||||
@@ -91,14 +93,12 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> toView(String config) {
|
public void toView(HostSshConfigModel model) {
|
||||||
if (config == null) {
|
if (model == null) {
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
HostSshConfigModel model = JSON.parseObject(config, HostSshConfigModel.class);
|
|
||||||
model.setHasPassword(Strings.isNotBlank(model.getPassword()));
|
model.setHasPassword(Strings.isNotBlank(model.getPassword()));
|
||||||
model.setPassword(null);
|
model.setPassword(null);
|
||||||
return JSON.parseObject(JSON.toJSONString(model));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.extra.strategy;
|
package com.orion.visor.module.asset.handler.host.extra.strategy;
|
||||||
|
|
||||||
import com.orion.visor.framework.common.constant.Const;
|
import com.orion.visor.framework.common.constant.Const;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.AbstractGenericsDataStrategy;
|
||||||
import com.orion.visor.module.asset.handler.host.extra.model.HostLabelExtraModel;
|
import com.orion.visor.module.asset.handler.host.extra.model.HostLabelExtraModel;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -13,7 +13,11 @@ import org.springframework.stereotype.Component;
|
|||||||
* @since 2024/2/29 23:16
|
* @since 2024/2/29 23:16
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class HostLabelExtraStrategy implements MapDataStrategy<HostLabelExtraModel> {
|
public class HostLabelExtraStrategy extends AbstractGenericsDataStrategy<HostLabelExtraModel> {
|
||||||
|
|
||||||
|
public HostLabelExtraStrategy() {
|
||||||
|
super(HostLabelExtraModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HostLabelExtraModel getDefault() {
|
public HostLabelExtraModel getDefault() {
|
||||||
@@ -36,12 +40,4 @@ public class HostLabelExtraStrategy implements MapDataStrategy<HostLabelExtraMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void preValid(HostLabelExtraModel model) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void valid(HostLabelExtraModel model) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.extra.strategy;
|
package com.orion.visor.module.asset.handler.host.extra.strategy;
|
||||||
|
|
||||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.AbstractGenericsDataStrategy;
|
||||||
import com.orion.visor.framework.common.utils.Valid;
|
import com.orion.visor.framework.common.utils.Valid;
|
||||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||||
import com.orion.visor.module.asset.dao.HostIdentityDAO;
|
import com.orion.visor.module.asset.dao.HostIdentityDAO;
|
||||||
@@ -22,7 +22,7 @@ import javax.annotation.Resource;
|
|||||||
* @since 2023/12/20 22:17
|
* @since 2023/12/20 22:17
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel> {
|
public class HostSshExtraStrategy extends AbstractGenericsDataStrategy<HostSshExtraModel> {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private HostKeyDAO hostKeyDAO;
|
private HostKeyDAO hostKeyDAO;
|
||||||
@@ -33,6 +33,10 @@ public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel>
|
|||||||
@Resource
|
@Resource
|
||||||
private DataPermissionApi dataPermissionApi;
|
private DataPermissionApi dataPermissionApi;
|
||||||
|
|
||||||
|
public HostSshExtraStrategy() {
|
||||||
|
super(HostSshExtraModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HostSshExtraModel getDefault() {
|
public HostSshExtraModel getDefault() {
|
||||||
return HostSshExtraModel.builder()
|
return HostSshExtraModel.builder()
|
||||||
@@ -40,10 +44,6 @@ public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel>
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateFill(HostSshExtraModel beforeModel, HostSshExtraModel afterModel) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preValid(HostSshExtraModel model) {
|
public void preValid(HostSshExtraModel model) {
|
||||||
HostExtraSshAuthTypeEnum authType = Valid.valid(HostExtraSshAuthTypeEnum::of, model.getAuthType());
|
HostExtraSshAuthTypeEnum authType = Valid.valid(HostExtraSshAuthTypeEnum::of, model.getAuthType());
|
||||||
@@ -79,8 +79,4 @@ public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void valid(HostSshExtraModel model) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ public class CommandSnippetGroupServiceImpl implements CommandSnippetGroupServic
|
|||||||
.createWrapper()
|
.createWrapper()
|
||||||
.select(CommandSnippetDO::getUserId, CommandSnippetDO::getGroupId)
|
.select(CommandSnippetDO::getUserId, CommandSnippetDO::getGroupId)
|
||||||
.isNotNull(CommandSnippetDO::getGroupId)
|
.isNotNull(CommandSnippetDO::getGroupId)
|
||||||
|
.groupBy(CommandSnippetDO::getUserId)
|
||||||
.groupBy(CommandSnippetDO::getGroupId)
|
.groupBy(CommandSnippetDO::getGroupId)
|
||||||
.then()
|
.then()
|
||||||
.stream()
|
.stream()
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.orion.visor.framework.common.constant.ErrorMessage;
|
|||||||
import com.orion.visor.framework.common.enums.BooleanBit;
|
import com.orion.visor.framework.common.enums.BooleanBit;
|
||||||
import com.orion.visor.framework.common.enums.EnableStatus;
|
import com.orion.visor.framework.common.enums.EnableStatus;
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||||
import com.orion.visor.framework.common.utils.Valid;
|
import com.orion.visor.framework.common.utils.Valid;
|
||||||
import com.orion.visor.module.asset.convert.HostConfigConvert;
|
import com.orion.visor.module.asset.convert.HostConfigConvert;
|
||||||
import com.orion.visor.module.asset.dao.HostConfigDAO;
|
import com.orion.visor.module.asset.dao.HostConfigDAO;
|
||||||
@@ -53,7 +53,7 @@ public class HostConfigServiceImpl implements HostConfigService {
|
|||||||
// 转换
|
// 转换
|
||||||
HostConfigVO vo = HostConfigConvert.MAPPER.to(config);
|
HostConfigVO vo = HostConfigConvert.MAPPER.to(config);
|
||||||
// 获取配置
|
// 获取配置
|
||||||
Map<String, Object> configMap = configType.getStrategyBean().toView(config.getConfig());
|
Map<String, Object> configMap = configType.toView(config.getConfig()).toMap();
|
||||||
vo.setConfig(configMap);
|
vo.setConfig(configMap);
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
@@ -121,10 +121,10 @@ public class HostConfigServiceImpl implements HostConfigService {
|
|||||||
OperatorLogs.add(OperatorLogs.TYPE, type.getType());
|
OperatorLogs.add(OperatorLogs.TYPE, type.getType());
|
||||||
// 检查版本
|
// 检查版本
|
||||||
Valid.eq(record.getVersion(), request.getVersion(), ErrorMessage.DATA_MODIFIED);
|
Valid.eq(record.getVersion(), request.getVersion(), ErrorMessage.DATA_MODIFIED);
|
||||||
MapDataStrategy<GenericsDataModel> strategy = type.getStrategyBean();
|
GenericsDataStrategy<GenericsDataModel> strategy = type.getStrategy();
|
||||||
GenericsDataModel beforeConfig = type.parse(record.getConfig());
|
GenericsDataModel beforeConfig = type.parse(record.getConfig());
|
||||||
// 更新前校验
|
// 更新前校验
|
||||||
strategy.doValidChain(beforeConfig, newConfig);
|
strategy.doValid(beforeConfig, newConfig);
|
||||||
// 修改配置
|
// 修改配置
|
||||||
HostConfigDO update = new HostConfigDO();
|
HostConfigDO update = new HostConfigDO();
|
||||||
update.setId(record.getId());
|
update.setId(record.getId());
|
||||||
@@ -225,7 +225,7 @@ public class HostConfigServiceImpl implements HostConfigService {
|
|||||||
insert.setHostId(hostId);
|
insert.setHostId(hostId);
|
||||||
insert.setType(type.getType());
|
insert.setType(type.getType());
|
||||||
insert.setStatus(type.getDefaultStatus());
|
insert.setStatus(type.getDefaultStatus());
|
||||||
insert.setConfig(type.getStrategyBean().getDefault().serial());
|
insert.setConfig(type.getStrategy().getDefault().serial());
|
||||||
insert.setVersion(Const.DEFAULT_VERSION);
|
insert.setVersion(Const.DEFAULT_VERSION);
|
||||||
return insert;
|
return insert;
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ public class HostConfigServiceImpl implements HostConfigService {
|
|||||||
}
|
}
|
||||||
// 转为视图
|
// 转为视图
|
||||||
HostConfigVO vo = HostConfigConvert.MAPPER.to(row);
|
HostConfigVO vo = HostConfigConvert.MAPPER.to(row);
|
||||||
Map<String, Object> config = type.getStrategyBean().toView(row.getConfig());
|
Map<String, Object> config = type.toView(row.getConfig()).toMap();
|
||||||
vo.setConfig(config);
|
vo.setConfig(config);
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.orion.visor.module.asset.service.impl;
|
|||||||
import com.orion.lang.function.Functions;
|
import com.orion.lang.function.Functions;
|
||||||
import com.orion.lang.utils.collect.Maps;
|
import com.orion.lang.utils.collect.Maps;
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||||
import com.orion.visor.framework.common.utils.Valid;
|
import com.orion.visor.framework.common.utils.Valid;
|
||||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||||
import com.orion.visor.module.asset.entity.request.host.HostExtraQueryRequest;
|
import com.orion.visor.module.asset.entity.request.host.HostExtraQueryRequest;
|
||||||
@@ -98,7 +98,7 @@ public class HostExtraServiceImpl implements HostExtraService {
|
|||||||
Long hostId = request.getHostId();
|
Long hostId = request.getHostId();
|
||||||
Long userId = SecurityUtils.getLoginUserId();
|
Long userId = SecurityUtils.getLoginUserId();
|
||||||
HostExtraItemEnum item = Valid.valid(HostExtraItemEnum::of, request.getItem());
|
HostExtraItemEnum item = Valid.valid(HostExtraItemEnum::of, request.getItem());
|
||||||
MapDataStrategy<GenericsDataModel> strategy = item.getStrategyBean();
|
GenericsDataStrategy<GenericsDataModel> strategy = item.getStrategy();
|
||||||
// 查询原始配置
|
// 查询原始配置
|
||||||
DataExtraQueryDTO query = DataExtraQueryDTO.builder()
|
DataExtraQueryDTO query = DataExtraQueryDTO.builder()
|
||||||
.userId(userId)
|
.userId(userId)
|
||||||
@@ -114,7 +114,7 @@ public class HostExtraServiceImpl implements HostExtraService {
|
|||||||
GenericsDataModel newExtra = item.parse(request.getExtra());
|
GenericsDataModel newExtra = item.parse(request.getExtra());
|
||||||
GenericsDataModel beforeExtra = item.parse(beforeExtraItem.getValue());
|
GenericsDataModel beforeExtra = item.parse(beforeExtraItem.getValue());
|
||||||
// 更新验证
|
// 更新验证
|
||||||
strategy.doValidChain(beforeExtra, newExtra);
|
strategy.doValid(beforeExtra, newExtra);
|
||||||
// 更新配置
|
// 更新配置
|
||||||
return dataExtraApi.updateExtraValue(beforeExtraItem.getId(), newExtra.serial());
|
return dataExtraApi.updateExtraValue(beforeExtraItem.getId(), newExtra.serial());
|
||||||
}
|
}
|
||||||
@@ -129,12 +129,11 @@ public class HostExtraServiceImpl implements HostExtraService {
|
|||||||
* @return viewMap
|
* @return viewMap
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> checkItemAndToView(HostExtraItemEnum item, String extraValue, Long userId, Long hostId) {
|
private Map<String, Object> checkItemAndToView(HostExtraItemEnum item, String extraValue, Long userId, Long hostId) {
|
||||||
MapDataStrategy<GenericsDataModel> strategy = item.getStrategyBean();
|
|
||||||
if (extraValue == null) {
|
if (extraValue == null) {
|
||||||
// 初始化默认数据
|
// 初始化默认数据
|
||||||
extraValue = this.checkInitItem(item, userId, hostId);
|
extraValue = this.checkInitItem(item, userId, hostId);
|
||||||
}
|
}
|
||||||
return strategy.toView(extraValue);
|
return item.toView(extraValue).toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,7 +145,7 @@ public class HostExtraServiceImpl implements HostExtraService {
|
|||||||
* @return defaultValue
|
* @return defaultValue
|
||||||
*/
|
*/
|
||||||
private String checkInitItem(HostExtraItemEnum item, Long userId, Long hostId) {
|
private String checkInitItem(HostExtraItemEnum item, Long userId, Long hostId) {
|
||||||
MapDataStrategy<GenericsDataModel> strategy = item.getStrategyBean();
|
GenericsDataStrategy<GenericsDataModel> strategy = item.getStrategy();
|
||||||
// 初始化默认数据
|
// 初始化默认数据
|
||||||
String extraValue = strategy.getDefault().serial();
|
String extraValue = strategy.getDefault().serial();
|
||||||
// 插入默认值
|
// 插入默认值
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ public class PathBookmarkGroupServiceImpl implements PathBookmarkGroupService {
|
|||||||
.select(PathBookmarkDO::getUserId, PathBookmarkDO::getGroupId)
|
.select(PathBookmarkDO::getUserId, PathBookmarkDO::getGroupId)
|
||||||
.isNotNull(PathBookmarkDO::getGroupId)
|
.isNotNull(PathBookmarkDO::getGroupId)
|
||||||
.groupBy(PathBookmarkDO::getGroupId)
|
.groupBy(PathBookmarkDO::getGroupId)
|
||||||
|
.groupBy(PathBookmarkDO::getUserId)
|
||||||
.then()
|
.then()
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.groupingBy(PathBookmarkDO::getUserId,
|
.collect(Collectors.groupingBy(PathBookmarkDO::getUserId,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class CommandSnippetGroupAutoClearTask {
|
|||||||
@Scheduled(cron = "0 10 2 * * ?")
|
@Scheduled(cron = "0 10 2 * * ?")
|
||||||
public void clear() {
|
public void clear() {
|
||||||
log.info("CommandSnippetGroupAutoClearTask.clear start");
|
log.info("CommandSnippetGroupAutoClearTask.clear start");
|
||||||
// 获取锁并清理
|
// 获取锁并执行
|
||||||
LockerUtils.tryLock(LOCK_KEY, commandSnippetGroupService::clearUnusedGroup);
|
LockerUtils.tryLock(LOCK_KEY, commandSnippetGroupService::clearUnusedGroup);
|
||||||
log.info("CommandSnippetGroupAutoClearTask.clear finish");
|
log.info("CommandSnippetGroupAutoClearTask.clear finish");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class ExecLogFileAutoClearTask {
|
|||||||
@Scheduled(cron = "0 0 3 * * ?")
|
@Scheduled(cron = "0 0 3 * * ?")
|
||||||
public void clear() {
|
public void clear() {
|
||||||
log.info("ExecLogFileAutoClearTask.clear start");
|
log.info("ExecLogFileAutoClearTask.clear start");
|
||||||
// 获取锁并且执行
|
// 获取锁并执行
|
||||||
LockerUtils.tryLock(LOCK_KEY, this::doClearFile);
|
LockerUtils.tryLock(LOCK_KEY, this::doClearFile);
|
||||||
log.info("ExecLogFileAutoClearTask.clear finish");
|
log.info("ExecLogFileAutoClearTask.clear finish");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class PathBookmarkGroupAutoClearTask {
|
|||||||
@Scheduled(cron = "0 20 2 * * ?")
|
@Scheduled(cron = "0 20 2 * * ?")
|
||||||
public void clear() {
|
public void clear() {
|
||||||
log.info("PathBookmarkGroupAutoClearTask.clear start");
|
log.info("PathBookmarkGroupAutoClearTask.clear start");
|
||||||
// 获取锁并清理
|
// 获取锁并执行
|
||||||
LockerUtils.tryLock(LOCK_KEY, pathBookmarkGroupService::clearUnusedGroup);
|
LockerUtils.tryLock(LOCK_KEY, pathBookmarkGroupService::clearUnusedGroup);
|
||||||
log.info("PathBookmarkGroupAutoClearTask.clear finish");
|
log.info("PathBookmarkGroupAutoClearTask.clear finish");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<description>项目资产模块</description>
|
<description>项目资产模块</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>orion-visor-module-asset-provider</module>
|
<module>orion-visor-module-asset-provider</module>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目基建模块 用户 菜单 日志等</description>
|
<description>项目基建模块 用户 菜单 日志等</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
package com.orion.visor.module.infra.handler.preference.model;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.orion.lang.utils.Refs;
|
|
||||||
import com.orion.lang.utils.collect.Maps;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 偏好
|
|
||||||
*
|
|
||||||
* @author Jiahang Li
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 2023/10/8 13:54
|
|
||||||
*/
|
|
||||||
public interface PreferenceModel {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转为 map
|
|
||||||
*
|
|
||||||
* @return map
|
|
||||||
*/
|
|
||||||
default Map<String, String> toMap() {
|
|
||||||
JSONObject map = JSON.parseObject(JSON.toJSONString(this));
|
|
||||||
return Maps.map(map, Function.identity(), Refs::json);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.orion.visor.module.infra.handler.preference.strategy;
|
|
||||||
|
|
||||||
import com.orion.visor.module.infra.handler.preference.model.PreferenceModel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 偏好处理策略
|
|
||||||
*
|
|
||||||
* @author Jiahang Li
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 2023/10/8 13:49
|
|
||||||
*/
|
|
||||||
public interface IPreferenceStrategy<Model extends PreferenceModel> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取默认值
|
|
||||||
*
|
|
||||||
* @return 默认值
|
|
||||||
*/
|
|
||||||
Model getDefault();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目基建模块 用户 菜单 日志等</description>
|
<description>项目基建模块 用户 菜单 日志等</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.orion.visor.module.infra.controller;
|
package com.orion.visor.module.infra.controller;
|
||||||
|
|
||||||
|
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||||
import com.orion.visor.module.infra.entity.request.preference.PreferenceUpdatePartialRequest;
|
import com.orion.visor.module.infra.entity.request.preference.PreferenceUpdatePartialRequest;
|
||||||
import com.orion.visor.module.infra.entity.request.preference.PreferenceUpdateRequest;
|
import com.orion.visor.module.infra.entity.request.preference.PreferenceUpdateRequest;
|
||||||
@@ -56,6 +57,7 @@ public class PreferenceController {
|
|||||||
return preferenceService.getPreferenceByType(type, items);
|
return preferenceService.getPreferenceByType(type, items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@IgnoreLog
|
||||||
@GetMapping("/get-default")
|
@GetMapping("/get-default")
|
||||||
@Operation(summary = "查询默认偏好")
|
@Operation(summary = "查询默认偏好")
|
||||||
@Parameter(name = "type", description = "type", required = true)
|
@Parameter(name = "type", description = "type", required = true)
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
### 查询应用信息
|
||||||
|
GET {{baseUrl}}/infra/system-setting/app-info
|
||||||
|
Authorization: {{token}}
|
||||||
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.orion.visor.module.infra.controller;
|
||||||
|
|
||||||
|
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||||
|
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||||
|
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||||
|
import com.orion.visor.module.infra.entity.vo.AppInfoVO;
|
||||||
|
import com.orion.visor.module.infra.service.SystemSettingService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统服务
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023-7-17 11:39
|
||||||
|
*/
|
||||||
|
@Tag(name = "infra - 系统服务")
|
||||||
|
@Slf4j
|
||||||
|
@Validated
|
||||||
|
@RestWrapper
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/infra/system-setting")
|
||||||
|
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||||
|
public class SystemSettingController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SystemSettingService systemSettingService;
|
||||||
|
|
||||||
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
|
@GetMapping("/app-info")
|
||||||
|
@Operation(summary = "查询应用信息")
|
||||||
|
public AppInfoVO getAppInfo() {
|
||||||
|
return systemSettingService.getAppInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.orion.visor.module.infra.entity.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用信息 视图响应对象
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023-7-18 10:18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Schema(name = "AppInfoVO", description = "应用信息 视图响应对象")
|
||||||
|
public class AppInfoVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "系统版本")
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
@Schema(description = "机器码")
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.orion.visor.module.infra.enums;
|
package com.orion.visor.module.infra.enums;
|
||||||
|
|
||||||
import com.orion.spring.SpringHolder;
|
import com.orion.visor.framework.common.handler.data.GenericsDataDefinition;
|
||||||
import com.orion.visor.module.infra.handler.preference.model.PreferenceModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import com.orion.visor.module.infra.handler.preference.strategy.IPreferenceStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||||
|
import com.orion.visor.module.infra.handler.preference.strategy.SystemPreferenceStrategy;
|
||||||
|
import com.orion.visor.module.infra.handler.preference.strategy.TerminalPreferenceStrategy;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,32 +15,28 @@ import lombok.Getter;
|
|||||||
* @since 2023/10/8 11:31
|
* @since 2023/10/8 11:31
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum PreferenceTypeEnum {
|
public enum PreferenceTypeEnum implements GenericsDataDefinition {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统偏好
|
* 系统偏好
|
||||||
*/
|
*/
|
||||||
SYSTEM("systemPreferenceStrategy"),
|
SYSTEM(SystemPreferenceStrategy.class),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 终端偏好
|
* 终端偏好
|
||||||
*/
|
*/
|
||||||
TERMINAL("terminalPreferenceStrategy"),
|
TERMINAL(TerminalPreferenceStrategy.class),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
PreferenceTypeEnum(String beanName) {
|
PreferenceTypeEnum(Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> strategyClass) {
|
||||||
this.type = this.name();
|
this.type = this.name();
|
||||||
this.beanName = beanName;
|
this.strategyClass = strategyClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|
||||||
/**
|
private final Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> strategyClass;
|
||||||
* 策越 bean 名称
|
|
||||||
* 可能跨模块所以不用 class
|
|
||||||
*/
|
|
||||||
private final String beanName;
|
|
||||||
|
|
||||||
public static PreferenceTypeEnum of(String type) {
|
public static PreferenceTypeEnum of(String type) {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
@@ -52,15 +50,4 @@ public enum PreferenceTypeEnum {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取策略
|
|
||||||
*
|
|
||||||
* @param <M> model
|
|
||||||
* @param <T> type
|
|
||||||
* @return IPreferenceStrategy
|
|
||||||
*/
|
|
||||||
public <M extends PreferenceModel, T extends IPreferenceStrategy<M>> T getStrategy() {
|
|
||||||
return SpringHolder.getBean(beanName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.orion.visor.module.infra.handler.preference.model;
|
package com.orion.visor.module.infra.handler.preference.model;
|
||||||
|
|
||||||
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -16,7 +17,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class SystemPreferenceModel implements PreferenceModel {
|
public class SystemPreferenceModel implements GenericsDataModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否使用侧边菜单
|
* 是否使用侧边菜单
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.orion.visor.module.infra.handler.preference.model;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.orion.lang.able.IJsonObject;
|
import com.orion.lang.able.IJsonObject;
|
||||||
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -20,7 +21,7 @@ import java.util.List;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TerminalPreferenceModel implements PreferenceModel {
|
public class TerminalPreferenceModel implements GenericsDataModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建连接类型
|
* 新建连接类型
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.orion.visor.module.infra.handler.preference.strategy;
|
package com.orion.visor.module.infra.handler.preference.strategy;
|
||||||
|
|
||||||
|
import com.orion.lang.utils.Exceptions;
|
||||||
|
import com.orion.visor.framework.common.handler.data.strategy.AbstractGenericsDataStrategy;
|
||||||
import com.orion.visor.module.infra.handler.preference.model.SystemPreferenceModel;
|
import com.orion.visor.module.infra.handler.preference.model.SystemPreferenceModel;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -10,8 +12,12 @@ import org.springframework.stereotype.Component;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/10/8 13:48
|
* @since 2023/10/8 13:48
|
||||||
*/
|
*/
|
||||||
@Component("systemPreferenceStrategy")
|
@Component
|
||||||
public class SystemPreferenceStrategy implements IPreferenceStrategy<SystemPreferenceModel> {
|
public class SystemPreferenceStrategy extends AbstractGenericsDataStrategy<SystemPreferenceModel> {
|
||||||
|
|
||||||
|
public SystemPreferenceStrategy() {
|
||||||
|
super(SystemPreferenceModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SystemPreferenceModel getDefault() {
|
public SystemPreferenceModel getDefault() {
|
||||||
@@ -28,4 +34,9 @@ public class SystemPreferenceStrategy implements IPreferenceStrategy<SystemPrefe
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SystemPreferenceModel parse(String serialModel) {
|
||||||
|
throw Exceptions.unsupported();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.orion.visor.module.infra.handler.preference.strategy;
|
package com.orion.visor.module.infra.handler.preference.strategy;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.orion.lang.utils.Exceptions;
|
||||||
import com.orion.lang.utils.collect.Lists;
|
import com.orion.lang.utils.collect.Lists;
|
||||||
import com.orion.net.host.ssh.TerminalType;
|
import com.orion.net.host.ssh.TerminalType;
|
||||||
|
import com.orion.visor.framework.common.handler.data.strategy.AbstractGenericsDataStrategy;
|
||||||
import com.orion.visor.module.infra.handler.preference.model.TerminalPreferenceModel;
|
import com.orion.visor.module.infra.handler.preference.model.TerminalPreferenceModel;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -13,8 +15,12 @@ import org.springframework.stereotype.Component;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/12/8 14:46
|
* @since 2023/12/8 14:46
|
||||||
*/
|
*/
|
||||||
@Component("terminalPreferenceStrategy")
|
@Component
|
||||||
public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalPreferenceModel> {
|
public class TerminalPreferenceStrategy extends AbstractGenericsDataStrategy<TerminalPreferenceModel> {
|
||||||
|
|
||||||
|
public TerminalPreferenceStrategy() {
|
||||||
|
super(TerminalPreferenceModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TerminalPreferenceModel getDefault() {
|
public TerminalPreferenceModel getDefault() {
|
||||||
@@ -22,9 +28,9 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
|
|||||||
String defaultDisplaySetting = TerminalPreferenceModel.DisplaySettingModel
|
String defaultDisplaySetting = TerminalPreferenceModel.DisplaySettingModel
|
||||||
.builder()
|
.builder()
|
||||||
.fontFamily("_")
|
.fontFamily("_")
|
||||||
.fontSize(13)
|
.fontSize(14)
|
||||||
.lineHeight(1.12)
|
.lineHeight(1.12)
|
||||||
.letterSpacing(1)
|
.letterSpacing(0)
|
||||||
.fontWeight("normal")
|
.fontWeight("normal")
|
||||||
.fontWeightBold("bold")
|
.fontWeightBold("bold")
|
||||||
.cursorStyle("bar")
|
.cursorStyle("bar")
|
||||||
@@ -100,7 +106,7 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
|
|||||||
.selectAll(false)
|
.selectAll(false)
|
||||||
.search(true)
|
.search(true)
|
||||||
.copy(true)
|
.copy(true)
|
||||||
.paste(false)
|
.paste(true)
|
||||||
.interrupt(false)
|
.interrupt(false)
|
||||||
.enter(false)
|
.enter(false)
|
||||||
.fontSizePlus(false)
|
.fontSizePlus(false)
|
||||||
@@ -118,7 +124,7 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
|
|||||||
.theme(new JSONObject())
|
.theme(new JSONObject())
|
||||||
.displaySetting(JSONObject.parseObject(defaultDisplaySetting))
|
.displaySetting(JSONObject.parseObject(defaultDisplaySetting))
|
||||||
.actionBarSetting(JSONObject.parseObject(actionBarSetting))
|
.actionBarSetting(JSONObject.parseObject(actionBarSetting))
|
||||||
.rightMenuSetting(Lists.of("selectAll", "copy", "fontSizePlus", "fontSizeSubtract", "search", "clear"))
|
.rightMenuSetting(Lists.of("selectAll", "copy", "paste", "fontSizePlus", "fontSizeSubtract", "search", "clear"))
|
||||||
.interactSetting(JSONObject.parseObject(defaultInteractSetting))
|
.interactSetting(JSONObject.parseObject(defaultInteractSetting))
|
||||||
.pluginsSetting(JSONObject.parseObject(defaultPluginsSetting))
|
.pluginsSetting(JSONObject.parseObject(defaultPluginsSetting))
|
||||||
.sessionSetting(JSONObject.parseObject(defaultSessionSetting))
|
.sessionSetting(JSONObject.parseObject(defaultSessionSetting))
|
||||||
@@ -126,4 +132,9 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TerminalPreferenceModel parse(String serialModel) {
|
||||||
|
throw Exceptions.unsupported();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.orion.visor.module.infra.service;
|
||||||
|
|
||||||
|
import com.orion.visor.module.infra.entity.vo.AppInfoVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统服务
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/17 18:10
|
||||||
|
*/
|
||||||
|
public interface SystemSettingService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用信息
|
||||||
|
*
|
||||||
|
* @return info
|
||||||
|
*/
|
||||||
|
AppInfoVO getAppInfo();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -142,14 +142,14 @@ public class PreferenceServiceImpl implements PreferenceService {
|
|||||||
public Map<String, Object> getDefaultPreferenceByType(String type, List<String> items) {
|
public Map<String, Object> getDefaultPreferenceByType(String type, List<String> items) {
|
||||||
PreferenceTypeEnum preferenceType = Valid.valid(PreferenceTypeEnum::of, type);
|
PreferenceTypeEnum preferenceType = Valid.valid(PreferenceTypeEnum::of, type);
|
||||||
// 获取默认值
|
// 获取默认值
|
||||||
Map<String, String> defaultModel = preferenceType.getStrategy()
|
Map<String, Object> defaultModel = preferenceType.getStrategy()
|
||||||
.getDefault()
|
.getDefault()
|
||||||
.toMap();
|
.toMap();
|
||||||
Map<String, Object> result = Maps.newMap();
|
Map<String, Object> result = Maps.newMap();
|
||||||
if (Lists.isEmpty(items)) {
|
if (Lists.isEmpty(items)) {
|
||||||
defaultModel.forEach((k, v) -> result.put(k, Refs.unref(defaultModel.get(k))));
|
defaultModel.forEach((k, v) -> result.put(k, defaultModel.get(k)));
|
||||||
} else {
|
} else {
|
||||||
items.forEach(s -> result.put(s, Refs.unref(defaultModel.get(s))));
|
items.forEach(s -> result.put(s, defaultModel.get(s)));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -218,9 +218,10 @@ public class PreferenceServiceImpl implements PreferenceService {
|
|||||||
// 初始化
|
// 初始化
|
||||||
if (Maps.isEmpty(config)) {
|
if (Maps.isEmpty(config)) {
|
||||||
// 获取默认值
|
// 获取默认值
|
||||||
config = type.getStrategy()
|
Map<String, Object> defaultConfig = type.getStrategy()
|
||||||
.getDefault()
|
.getDefault()
|
||||||
.toMap();
|
.toMap();
|
||||||
|
config = Maps.map(defaultConfig, Function.identity(), Refs::json);
|
||||||
// 插入默认值
|
// 插入默认值
|
||||||
List<PreferenceDO> entities = config
|
List<PreferenceDO> entities = config
|
||||||
.entrySet()
|
.entrySet()
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.orion.visor.module.infra.service.impl;
|
||||||
|
|
||||||
|
import com.orion.ext.process.Processes;
|
||||||
|
import com.orion.lang.utils.Arrays1;
|
||||||
|
import com.orion.lang.utils.Strings;
|
||||||
|
import com.orion.visor.framework.common.constant.AppConst;
|
||||||
|
import com.orion.visor.framework.common.constant.Const;
|
||||||
|
import com.orion.visor.framework.common.utils.Mixes;
|
||||||
|
import com.orion.visor.module.infra.entity.vo.AppInfoVO;
|
||||||
|
import com.orion.visor.module.infra.service.SystemSettingService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统服务 实现类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/17 18:10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SystemSettingServiceImpl implements SystemSettingService {
|
||||||
|
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AppInfoVO getAppInfo() {
|
||||||
|
return AppInfoVO.builder()
|
||||||
|
.version(AppConst.VERSION)
|
||||||
|
.uuid(this.getSystemUuid())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取系统 uuid
|
||||||
|
*
|
||||||
|
* @return uuid
|
||||||
|
*/
|
||||||
|
private String getSystemUuid() {
|
||||||
|
if (this.uuid != null) {
|
||||||
|
return this.uuid;
|
||||||
|
}
|
||||||
|
String[] cmd = new String[]{"cat /sys/class/dmi/id/product_serial", "dmidecode -s system-uuid", "wmic csproduct get uuid"};
|
||||||
|
for (String s : cmd) {
|
||||||
|
try {
|
||||||
|
// 执行命令获取 uuid
|
||||||
|
String uuid = Processes.getOutputResultString(s);
|
||||||
|
if (Strings.isBlank(uuid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 去除符号并且转为大写
|
||||||
|
uuid = uuid.replaceAll(Const.DASHED, Const.EMPTY).toUpperCase();
|
||||||
|
// 去除特殊字符
|
||||||
|
String extraUuid = Arrays1.last(uuid.trim().split(Const.LF));
|
||||||
|
if (!Strings.isBlank(extraUuid)) {
|
||||||
|
uuid = extraUuid;
|
||||||
|
}
|
||||||
|
// 转义
|
||||||
|
return this.uuid = Mixes.obfuscate(uuid);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// IGNORED
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.uuid = Const.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -342,7 +342,7 @@ public class SystemUserServiceImpl implements SystemUserService {
|
|||||||
/**
|
/**
|
||||||
* 删除主要用户缓存 其他的缓存自动过期
|
* 删除主要用户缓存 其他的缓存自动过期
|
||||||
*
|
*
|
||||||
* @param userList
|
* @param userList userList
|
||||||
*/
|
*/
|
||||||
private void deleteUserCacheKey(List<SystemUserDO> userList) {
|
private void deleteUserCacheKey(List<SystemUserDO> userList) {
|
||||||
Set<String> deleteKeys = new HashSet<>();
|
Set<String> deleteKeys = new HashSet<>();
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class TagAutoClearTask {
|
|||||||
@Scheduled(cron = "0 0 2 * * ?")
|
@Scheduled(cron = "0 0 2 * * ?")
|
||||||
public void clear() {
|
public void clear() {
|
||||||
log.info("TagAutoClearTask.clear start");
|
log.info("TagAutoClearTask.clear start");
|
||||||
// 获取锁并清理
|
// 获取锁并执行
|
||||||
LockerUtils.tryLock(LOCK_KEY, tagService::clearUnusedTag);
|
LockerUtils.tryLock(LOCK_KEY, tagService::clearUnusedTag);
|
||||||
log.info("TagAutoClearTask.clear finish");
|
log.info("TagAutoClearTask.clear finish");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<description>项目基建模块 用户 菜单 日志等</description>
|
<description>项目基建模块 用户 菜单 日志等</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>orion-visor-module-infra-provider</module>
|
<module>orion-visor-module-infra-provider</module>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
VITE_API_BASE_URL= 'http://127.0.0.1:9200/orion-visor/api'
|
VITE_API_BASE_URL= 'http://127.0.0.1:9200/orion-visor/api'
|
||||||
VITE_WS_BASE_URL= 'ws://127.0.0.1:9200/orion-visor/keep-alive'
|
VITE_WS_BASE_URL= 'ws://127.0.0.1:9200/orion-visor/keep-alive'
|
||||||
VITE_APP_VERSION= '2.0.7'
|
VITE_APP_VERSION= '2.0.9'
|
||||||
VITE_APP_RELEASE= 'Community'
|
VITE_APP_RELEASE= 'community'
|
||||||
VITE_SFTP_PREVIEW_MB= 2
|
VITE_SFTP_PREVIEW_MB= 2
|
||||||
VITE_DEMO_MODE= false
|
VITE_DEMO_MODE= false
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
VITE_API_BASE_URL= '/orion-visor/api'
|
VITE_API_BASE_URL= '/orion-visor/api'
|
||||||
VITE_WS_BASE_URL= '/orion-visor/keep-alive'
|
VITE_WS_BASE_URL= '/orion-visor/keep-alive'
|
||||||
VITE_APP_VERSION= '2.0.7'
|
VITE_APP_VERSION= '2.0.9'
|
||||||
VITE_APP_RELEASE= 'Community'
|
VITE_APP_RELEASE= 'community'
|
||||||
VITE_SFTP_PREVIEW_MB= 2
|
VITE_SFTP_PREVIEW_MB= 2
|
||||||
VITE_DEMO_MODE= false
|
VITE_DEMO_MODE= false
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "orion-visor-ui",
|
"name": "orion-visor-ui",
|
||||||
"description": "Orion Visor UI",
|
"description": "Orion Visor UI",
|
||||||
"version": "2.0.7",
|
"version": "2.0.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"author": "Jiahang Li",
|
"author": "Jiahang Li",
|
||||||
"license": "Apache 2.0",
|
"license": "Apache 2.0",
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@arco-design/web-vue": "^2.55.0",
|
"@arco-design/web-vue": "^2.55.3",
|
||||||
"@dangojs/a-query-header": "^0.0.31",
|
"@dangojs/a-query-header": "^0.0.31",
|
||||||
"@sanqi377/arco-vue-icon-picker": "^1.0.7",
|
"@sanqi377/arco-vue-icon-picker": "^1.0.7",
|
||||||
"@vueuse/core": "^9.3.0",
|
"@vueuse/core": "^9.3.0",
|
||||||
|
|||||||
1674
orion-visor-ui/pnpm-lock.yaml
generated
1674
orion-visor-ui/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,9 @@ export interface HttpResponse<T = unknown> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
axios.defaults.timeout = 10000;
|
axios.defaults.timeout = 10000;
|
||||||
|
axios.defaults.setAuthorization = true;
|
||||||
axios.defaults.promptBizErrorMessage = true;
|
axios.defaults.promptBizErrorMessage = true;
|
||||||
|
axios.defaults.promptRequestErrorMessage = true;
|
||||||
axios.defaults.baseURL = httpBaseUrl;
|
axios.defaults.baseURL = httpBaseUrl;
|
||||||
|
|
||||||
axios.interceptors.request.use(
|
axios.interceptors.request.use(
|
||||||
@@ -24,7 +26,10 @@ axios.interceptors.request.use(
|
|||||||
if (!config.headers) {
|
if (!config.headers) {
|
||||||
config.headers = {};
|
config.headers = {};
|
||||||
}
|
}
|
||||||
config.headers.Authorization = `Bearer ${token}`;
|
// 设置 Authorization 头
|
||||||
|
if (config.setAuthorization === true) {
|
||||||
|
config.headers.Authorization = `Bearer ${token}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
@@ -46,7 +51,7 @@ axios.interceptors.response.use(
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
// 异常判断
|
// 异常判断
|
||||||
if ([401, 700, 701, 702].includes(code)) {
|
if ([401, 700, 701, 702, 1000, 1001].includes(code)) {
|
||||||
// 提示
|
// 提示
|
||||||
Message.error({
|
Message.error({
|
||||||
content: res.msg || 'Error',
|
content: res.msg || 'Error',
|
||||||
@@ -60,7 +65,10 @@ axios.interceptors.response.use(
|
|||||||
window.sessionStorage.setItem(reLoginTipsKey, res.msg);
|
window.sessionStorage.setItem(reLoginTipsKey, res.msg);
|
||||||
}
|
}
|
||||||
// 登出
|
// 登出
|
||||||
await useUserStore().logout();
|
const responseUrl = response.request?.responseURL;
|
||||||
|
if (!responseUrl || !responseUrl.includes('/logout')) {
|
||||||
|
await useUserStore().logout();
|
||||||
|
}
|
||||||
// 重新加载自动跳转登录页面
|
// 重新加载自动跳转登录页面
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
@@ -76,10 +84,13 @@ axios.interceptors.response.use(
|
|||||||
return Promise.reject(new Error(res.msg || 'Error'));
|
return Promise.reject(new Error(res.msg || 'Error'));
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
Message.error({
|
// 判断是否弹出请求错误信息
|
||||||
content: error.msg || '请求失败',
|
if (error.config.promptRequestErrorMessage) {
|
||||||
duration: 5 * 1000,
|
Message.error({
|
||||||
});
|
content: error.msg || '请求失败',
|
||||||
|
duration: 5 * 1000,
|
||||||
|
});
|
||||||
|
}
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
39
orion-visor-ui/src/api/system/setting.ts
Normal file
39
orion-visor-ui/src/api/system/setting.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用信息查询响应
|
||||||
|
*/
|
||||||
|
export interface AppInfoResponse {
|
||||||
|
version: string;
|
||||||
|
uuid: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库版本信息查询响应
|
||||||
|
*/
|
||||||
|
export interface RepoReleaseResponse {
|
||||||
|
tag_name: string;
|
||||||
|
body: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询应用信息
|
||||||
|
*/
|
||||||
|
export function getSystemAppInfo() {
|
||||||
|
return axios.get<AppInfoResponse>('/infra/system-setting/app-info');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取仓库最后版本信息
|
||||||
|
*/
|
||||||
|
export function getRepoLatestRelease() {
|
||||||
|
// return axios.get<RepoReleaseResponse>('https://gitee.com/api/v5/repos/dromara/orion-visor/releases/latest', {
|
||||||
|
return axios.get<RepoReleaseResponse>('https://lijiahangmax.github.io/open-orion/orion-visor/releases-latest.json', {
|
||||||
|
// 不添加请求头 否则会报 401
|
||||||
|
setAuthorization: false,
|
||||||
|
// 返回原始输出
|
||||||
|
unwrap: true,
|
||||||
|
// 不提示请求错误信息 可能会 403
|
||||||
|
promptRequestErrorMessage: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -548,7 +548,7 @@ body[terminal-theme='dark'] .arco-modal-container {
|
|||||||
|
|
||||||
.terminal-setting-block {
|
.terminal-setting-block {
|
||||||
color: var(--color-content-text-2);
|
color: var(--color-content-text-2);
|
||||||
margin-bottom: 24px;
|
margin-bottom: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.terminal-setting-subtitle-wrapper {
|
.terminal-setting-subtitle-wrapper {
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
<a-layout-footer class="footer">
|
<a-layout-footer class="footer">
|
||||||
<a-space direction="vertical" size="small">
|
<a-space direction="vertical" size="small">
|
||||||
<a-space size="large">
|
<a-space size="large">
|
||||||
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-visor">github</a-link>
|
<a-link target="_blank" href="https://github.com/dromara/orion-visor">github</a-link>
|
||||||
<a-link target="_blank" href="https://gitee.com/lijiahangmax/orion-visor">gitee</a-link>
|
<a-link target="_blank" href="https://gitee.com/dromara/orion-visor">gitee</a-link>
|
||||||
<a-link target="_blank" href="https://lijiahangmax.github.io/open-orion/orion-visor">文档</a-link>
|
<a-link target="_blank" href="https://lijiahangmax.github.io/open-orion/orion-visor">文档</a-link>
|
||||||
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-visor/blob/main/LICENSE">License</a-link>
|
<a-link target="_blank" href="https://github.com/dromara/orion-visor/blob/main/LICENSE">License</a-link>
|
||||||
<a-link target="_blank" :href="`https://github.com/lijiahangmax/orion-visor/releases/tag/v${version}`">v{{ version }} {{ release }}</a-link>
|
<a-link target="_blank" :href="`https://github.com/dromara/orion-visor/releases/tag/v${version}`">v{{ version }} {{ release }}</a-link>
|
||||||
</a-space>
|
</a-space>
|
||||||
<span class="copyright">
|
<span class="copyright">
|
||||||
Copyright<icon-copyright /> 2023 - {{ new Date().getFullYear() }} Li Jiahang, All rights reserved.
|
Copyright<icon-copyright /> 2023 - {{ new Date().getFullYear() }} Li Jiahang, All rights reserved.
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ export const LogAppenderOptions: ITerminalOptions & ITerminalInitOnlyOptions = {
|
|||||||
lineHeight: 1.12,
|
lineHeight: 1.12,
|
||||||
convertEol: true,
|
convertEol: true,
|
||||||
allowProposedApi: true,
|
allowProposedApi: true,
|
||||||
|
fontFamily: 'Courier New, Monaco, courier, monospace',
|
||||||
};
|
};
|
||||||
|
|
||||||
// dom 引用
|
// dom 引用
|
||||||
|
|||||||
@@ -52,8 +52,6 @@
|
|||||||
// 确定
|
// 确定
|
||||||
const handlerOk = () => {
|
const handlerOk = () => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
console.log(cronExpression.value);
|
|
||||||
console.log('ok', cronExpression.value);
|
|
||||||
emits('ok', cronExpression.value);
|
emits('ok', cronExpression.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ const SYSTEM: AppRouteRecordRaw = {
|
|||||||
path: '/dict-value',
|
path: '/dict-value',
|
||||||
component: () => import('@/views/system/dict-value/index.vue'),
|
component: () => import('@/views/system/dict-value/index.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'systemSetting',
|
||||||
|
path: '/system-setting',
|
||||||
|
component: () => import('@/views/system/setting/index.vue'),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
4
orion-visor-ui/src/types/axios.d.ts
vendored
4
orion-visor-ui/src/types/axios.d.ts
vendored
@@ -4,9 +4,13 @@ import type { AxiosRequestConfig } from 'axios';
|
|||||||
declare module 'axios' {
|
declare module 'axios' {
|
||||||
// eslint-disable-next-line no-shadow
|
// eslint-disable-next-line no-shadow
|
||||||
export interface AxiosRequestConfig {
|
export interface AxiosRequestConfig {
|
||||||
|
// 是否添加 Authorization
|
||||||
|
setAuthorization?: boolean;
|
||||||
// 是否使用原始返回
|
// 是否使用原始返回
|
||||||
unwrap?: boolean;
|
unwrap?: boolean;
|
||||||
// 是否提示业务错误信息
|
// 是否提示业务错误信息
|
||||||
promptBizErrorMessage?: boolean;
|
promptBizErrorMessage?: boolean;
|
||||||
|
// 是否提示请求错误信息
|
||||||
|
promptRequestErrorMessage?: boolean;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,16 @@
|
|||||||
:body-style="{ padding: '0px 20px 8px 20px' }">
|
:body-style="{ padding: '0px 20px 8px 20px' }">
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-visor">github</a-link>
|
<a-link target="_blank" href="https://github.com/dromara/orion-visor">github</a-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-link target="_blank" href="https://gitee.com/lijiahangmax/orion-visor">gitee</a-link>
|
<a-link target="_blank" href="https://gitee.com/dromara/orion-visor">gitee</a-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-visor/blob/main/LICENSE">License</a-link>
|
<a-link target="_blank" href="https://github.com/dromara/orion-visor/blob/main/LICENSE">License</a-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-visor/issues">上报 bug</a-link>
|
<a-link target="_blank" href="https://github.com/dromara/orion-visor/issues">上报 bug</a-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-link target="_blank" href="https://lijiahangmax.github.io/open-orion/orion-visor/operator/asset.html">操作手册</a-link>
|
<a-link target="_blank" href="https://lijiahangmax.github.io/open-orion/orion-visor/operator/asset.html">操作手册</a-link>
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
await openLogWithId(Number.parseInt(keyParam as string));
|
await openLogWithId(Number.parseInt(keyParam as string));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
126
orion-visor-ui/src/views/system/setting/components/about.vue
Normal file
126
orion-visor-ui/src/views/system/setting/components/about.vue
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<template>
|
||||||
|
<div class="main-container">
|
||||||
|
<h3>关于 Orion Visor</h3>
|
||||||
|
<!-- 不一致提示 -->
|
||||||
|
<a-alert v-if="app.version && webVersion !== app.version"
|
||||||
|
class="alert-wrapper">
|
||||||
|
当前前端版本与后端版本不一致, 请使用 Ctrl + F5 刷新页面
|
||||||
|
</a-alert>
|
||||||
|
<!-- 升级提示 -->
|
||||||
|
<a v-if="app.version && repo.tag_name && ('v' + app.version) !== repo.tag_name"
|
||||||
|
class="alert-href"
|
||||||
|
target="_blank"
|
||||||
|
:href="`https://github.com/dromara/orion-visor/releases/tag/${repo.tag_name}`">
|
||||||
|
<a-alert class="alert-wrapper">
|
||||||
|
新版本已发布, 请及时升级版本
|
||||||
|
</a-alert>
|
||||||
|
</a>
|
||||||
|
<!-- 系统信息 -->
|
||||||
|
<a-descriptions class="detail-container"
|
||||||
|
size="large"
|
||||||
|
:align="{ label: 'right', value: 'left' }"
|
||||||
|
:label-style="{ width: '134px' }"
|
||||||
|
:column="1">
|
||||||
|
<!-- 机器码 -->
|
||||||
|
<a-descriptions-item label="机器码">
|
||||||
|
<span class="text-copy span-blue uuid-wrapper" @click="copy(app.uuid, '已复制')">
|
||||||
|
{{ app.uuid }}
|
||||||
|
</span>
|
||||||
|
</a-descriptions-item>
|
||||||
|
<!-- 当前前端版本 -->
|
||||||
|
<a-descriptions-item label="当前前端版本">
|
||||||
|
{{ 'v' + webVersion }}
|
||||||
|
</a-descriptions-item>
|
||||||
|
<!-- 当前后端版本 -->
|
||||||
|
<a-descriptions-item label="当前后端版本">
|
||||||
|
{{ 'v' + app.version }}
|
||||||
|
</a-descriptions-item>
|
||||||
|
<!-- 当前后端版本 -->
|
||||||
|
<a-descriptions-item label="最新发布版本">
|
||||||
|
{{ repo.tag_name }}
|
||||||
|
</a-descriptions-item>
|
||||||
|
<!-- 当前后端版本 -->
|
||||||
|
<a-descriptions-item label="最新更新日志">
|
||||||
|
<a-textarea class="release-node"
|
||||||
|
v-model="repo.body"
|
||||||
|
:auto-size="{ minRows: 3, maxRows: 16 }"
|
||||||
|
readonly>
|
||||||
|
</a-textarea>
|
||||||
|
</a-descriptions-item>
|
||||||
|
</a-descriptions>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'systemSettingAbout',
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import type { AppInfoResponse, RepoReleaseResponse } from '@/api/system/setting';
|
||||||
|
import { onMounted, reactive } from 'vue';
|
||||||
|
import { getRepoLatestRelease, getSystemAppInfo } from '@/api/system/setting';
|
||||||
|
import { copy } from '@/hooks/copy';
|
||||||
|
import { Message } from '@arco-design/web-vue';
|
||||||
|
|
||||||
|
const webVersion = import.meta.env.VITE_APP_VERSION;
|
||||||
|
|
||||||
|
const app = reactive<AppInfoResponse>({
|
||||||
|
version: '',
|
||||||
|
uuid: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const repo = reactive<RepoReleaseResponse>({
|
||||||
|
tag_name: '',
|
||||||
|
body: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
// 加载应用信息
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
const { data } = await getSystemAppInfo();
|
||||||
|
app.version = data.version;
|
||||||
|
app.uuid = data.uuid;
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 加载仓库信息
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
const { data } = await getRepoLatestRelease();
|
||||||
|
repo.tag_name = data.tag_name;
|
||||||
|
repo.body = data.body;
|
||||||
|
} catch (e) {
|
||||||
|
Message.error('获取仓库信息失败, 请等待后重试');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
@release-node-width: 528px;
|
||||||
|
@label-width: 134px;
|
||||||
|
|
||||||
|
.main-container {
|
||||||
|
padding-left: 16px;
|
||||||
|
|
||||||
|
.alert-href {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-wrapper {
|
||||||
|
width: @release-node-width + @label-width;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uuid-wrapper {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.release-node {
|
||||||
|
width: @release-node-width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
66
orion-visor-ui/src/views/system/setting/index.vue
Normal file
66
orion-visor-ui/src/views/system/setting/index.vue
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<template>
|
||||||
|
<div class="tabs-container">
|
||||||
|
<a-tabs v-model:active-key="activeKey"
|
||||||
|
type="rounded"
|
||||||
|
size="medium"
|
||||||
|
position="left"
|
||||||
|
:lazy-load="true">
|
||||||
|
<!-- 关于 -->
|
||||||
|
<a-tab-pane key="about" title="关于">
|
||||||
|
<about />
|
||||||
|
</a-tab-pane>
|
||||||
|
</a-tabs>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'systemSetting'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { onBeforeMount, ref } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import About from './components/about.vue';
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
const activeKey = ref('about');
|
||||||
|
|
||||||
|
// 跳转到指定页
|
||||||
|
onBeforeMount(() => {
|
||||||
|
const key = route.query.key;
|
||||||
|
if (key) {
|
||||||
|
activeKey.value = key as string;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.tabs-container {
|
||||||
|
background: var(--color-bg-2);
|
||||||
|
margin: 16px;
|
||||||
|
padding: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.arco-tabs-nav-tab-list) {
|
||||||
|
width: 88px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.arco-tabs-pane) {
|
||||||
|
border-left: 1px var(--color-neutral-3) solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.arco-tabs-tab) {
|
||||||
|
user-select: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
4
pom.xml
4
pom.xml
@@ -11,7 +11,7 @@
|
|||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
|
|
||||||
<description>项目脚手架</description>
|
<description>项目脚手架</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>orion-visor-dependencies</module>
|
<module>orion-visor-dependencies</module>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>2.0.7</revision>
|
<revision>2.0.9</revision>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
<maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version>
|
<maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version>
|
||||||
|
|||||||
@@ -292,10 +292,10 @@ INSERT INTO `dict_value` VALUES (298, 44, 'messageClassify', 'TODO', '待办', '
|
|||||||
|
|
||||||
-- 菜单配置
|
-- 菜单配置
|
||||||
INSERT INTO `system_menu` VALUES (1, 0, '工作台', NULL, 1, 10, 1, 1, 1, 0, 'IconComputer', NULL, 'workplace', '2023-07-28 10:51:50', '2023-09-11 15:27:52', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (1, 0, '工作台', NULL, 1, 10, 1, 1, 1, 0, 'IconComputer', NULL, 'workplace', '2023-07-28 10:51:50', '2023-09-11 15:27:52', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (5, 0, '用户设置', NULL, 1, 700, 1, 1, 1, 0, 'icon-user', NULL, 'userModule', '2023-07-28 10:55:38', '2024-04-03 00:56:30', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (5, 0, '用户管理', NULL, 1, 700, 1, 1, 1, 0, 'icon-user', NULL, 'userModule', '2023-07-28 10:55:38', '2024-06-17 20:45:29', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (8, 0, '项目地址', NULL, 1, 1000, 1, 1, 1, 0, 'icon-link', 'https://lijiahangmax.github.io/open-orion/orion-visor', '', '2023-07-28 11:04:59', '2024-05-31 17:13:12', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (8, 0, '项目地址', NULL, 1, 1000, 1, 1, 1, 0, 'icon-link', 'https://lijiahangmax.github.io/open-orion/orion-visor', '', '2023-07-28 11:04:59', '2024-05-31 17:13:12', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (10, 5, '角色管理', NULL, 2, 10, 1, 1, 1, 0, 'IconUserGroup', '', 'role', '2023-07-28 10:55:52', '2024-03-07 19:10:13', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (10, 5, '角色管理', NULL, 2, 10, 1, 1, 1, 0, 'IconUserGroup', '', 'role', '2023-07-28 10:55:52', '2024-03-07 19:10:13', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (12, 0, '系统设置', NULL, 1, 800, 1, 1, 1, 0, 'icon-tool', NULL, 'systemModule', '2023-08-02 18:24:24', '2024-04-03 00:56:17', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (12, 0, '系统管理', NULL, 1, 800, 1, 1, 1, 0, 'icon-tool', NULL, 'systemModule', '2023-08-02 18:24:24', '2024-06-17 20:45:39', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (13, 12, '系统菜单', '', 2, 10, 1, 1, 1, 0, 'icon-menu', NULL, 'systemMenu', '2023-08-02 18:29:01', '2024-03-07 22:25:00', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (13, 12, '系统菜单', '', 2, 10, 1, 1, 1, 0, 'icon-menu', NULL, 'systemMenu', '2023-08-02 18:29:01', '2024-03-07 22:25:00', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (20, 10, '创建角色', 'infra:system-role:create', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:36:54', '2023-10-27 01:20:46', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (20, 10, '创建角色', 'infra:system-role:create', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:36:54', '2023-10-27 01:20:46', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (21, 10, '修改角色', 'infra:system-role:update', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:37:33', '2023-10-27 01:20:46', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (21, 10, '修改角色', 'infra:system-role:update', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:37:33', '2023-10-27 01:20:46', '1', '1', 0);
|
||||||
@@ -397,8 +397,8 @@ INSERT INTO `system_menu` VALUES (186, 184, '查询任务日志', 'asset:exec-jo
|
|||||||
INSERT INTO `system_menu` VALUES (187, 184, '删除任务日志', 'asset:exec-job-log:delete', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:08:23', '2024-04-12 13:51:59', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (187, 184, '删除任务日志', 'asset:exec-job-log:delete', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:08:23', '2024-04-12 13:51:59', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (189, 184, '清理任务日志', 'asset:exec-job-log:management:clear', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:08:23', '2024-04-12 13:51:58', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (189, 184, '清理任务日志', 'asset:exec-job-log:management:clear', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:08:23', '2024-04-12 13:51:58', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (190, 184, '中断计划任务', 'asset:exec-job-log:interrupt', 3, 40, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:08:23', '2024-04-12 00:00:33', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (190, 184, '中断计划任务', 'asset:exec-job-log:interrupt', 3, 40, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:08:23', '2024-04-12 00:00:33', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (191, 0, '提交bug', NULL, 1, 1020, 1, 1, 0, 1, 'IconBug', 'https://github.com/lijiahangmax/orion-visor/issues', NULL, '2024-04-26 11:30:18', '2024-05-17 12:57:29', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (191, 0, '提交bug', NULL, 1, 1020, 1, 1, 0, 1, 'IconBug', 'https://github.com/dromara/orion-visor/issues', NULL, '2024-04-26 11:30:18', '2024-06-12 14:03:29', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (192, 0, '点个赞~', NULL, 1, 1030, 1, 1, 0, 1, 'IconThumbUp', 'https://github.com/lijiahangmax/orion-visor', NULL, '2024-04-26 11:32:30', '2024-05-17 12:57:32', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (192, 0, '点个赞~', NULL, 1, 1030, 1, 1, 0, 1, 'IconThumbUp', 'https://github.com/dromara/orion-visor', NULL, '2024-04-26 11:32:30', '2024-06-12 14:03:25', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (193, 0, '计划任务', NULL, 1, 430, 1, 1, 1, 0, 'IconCalendarClock', NULL, 'jobModule', '2024-04-28 15:31:24', '2024-04-28 15:32:56', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (193, 0, '计划任务', NULL, 1, 430, 1, 1, 1, 0, 'IconCalendarClock', NULL, 'jobModule', '2024-04-28 15:31:24', '2024-04-28 15:32:56', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (194, 152, '在线会话', NULL, 2, 20, 1, 1, 1, 0, 'IconUserGroup', NULL, 'connectSession', '2024-05-07 11:12:17', '2024-05-07 11:12:35', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (194, 152, '在线会话', NULL, 2, 20, 1, 1, 1, 0, 'IconUserGroup', NULL, 'connectSession', '2024-05-07 11:12:17', '2024-05-07 11:12:35', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (195, 194, '查询在线会话', 'asset:host-connect-session:management:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2024-05-07 11:13:16', '2024-05-07 11:13:16', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (195, 194, '查询在线会话', 'asset:host-connect-session:management:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2024-05-07 11:13:16', '2024-05-07 11:13:16', '1', '1', 0);
|
||||||
@@ -409,3 +409,4 @@ INSERT INTO `system_menu` VALUES (199, 197, '上传文件', 'asset:upload-task:u
|
|||||||
INSERT INTO `system_menu` VALUES (200, 198, '查询上传日志', 'asset:upload-task:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2024-05-08 22:20:01', '2024-05-08 22:20:01', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (200, 198, '查询上传日志', 'asset:upload-task:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2024-05-08 22:20:01', '2024-05-08 22:20:01', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (201, 198, '删除上传日志', 'asset:upload-task:delete', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-05-08 22:20:26', '2024-05-08 22:20:26', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (201, 198, '删除上传日志', 'asset:upload-task:delete', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-05-08 22:20:26', '2024-05-08 22:20:26', '1', '1', 0);
|
||||||
INSERT INTO `system_menu` VALUES (202, 198, '清理上传日志', 'asset:upload-task:management:clear', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2024-05-08 22:20:37', '2024-05-08 22:20:37', '1', '1', 0);
|
INSERT INTO `system_menu` VALUES (202, 198, '清理上传日志', 'asset:upload-task:management:clear', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2024-05-08 22:20:37', '2024-05-08 22:20:37', '1', '1', 0);
|
||||||
|
INSERT INTO `system_menu` VALUES (203, 12, '系统设置', NULL, 2, 40, 1, 1, 1, 0, 'IconSettings', NULL, 'systemSetting', '2024-06-17 20:46:15', '2024-06-17 20:46:15', '1', '1', 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user