Compare commits

...

27 Commits

Author SHA1 Message Date
李佳航
d1c6e0cb1c Merge pull request #18 from lijiahangmax/dev
Dev
2024-05-29 13:15:30 +08:00
lijiahang
fc34b24029 📝 修改 icon. 2024-05-29 13:09:29 +08:00
lijiahang
7e2269a040 🚀 修改端口. 2024-05-29 11:57:14 +08:00
lijiahangmax
55d4d9f7e5 🐛 修复构建后抽屉 UI 显示错误. 2024-05-29 00:57:21 +08:00
lijiahangmax
06a45c9cf2 🐛 修复计划命令执行报错. 2024-05-29 00:41:57 +08:00
lijiahangmax
16dd34ef58 📝 修改文档. 2024-05-29 00:30:04 +08:00
lijiahang
aed2436ec5 🔖 升级版本. 2024-05-28 17:07:41 +08:00
lijiahang
df0ec5b3f7 Merge remote-tracking branch 'origin/dev' into dev 2024-05-28 13:13:38 +08:00
lijiahang
9c2b37ec29 🐳 设置时区. 2024-05-28 13:13:17 +08:00
fumanjiang
47fdcad370 💄 修改 logo. 2024-05-27 17:59:37 +08:00
liushaoshuaii
76295ba1e3 📝 修改文档. 2024-05-27 12:33:11 +08:00
lixy-join
4c1f0ca2c0 🐳 修改时区. 2024-05-27 11:45:58 +08:00
lijiahang
48a53bc248 📝 修改文档. 2024-05-27 10:26:55 +08:00
lijiahangmax
6d18b016c1 Merge pull request #17 from lijiahangmax/dev
📝 更新文档.
2024-05-24 11:26:13 +08:00
lijiahang
f54acf595b 📝 更新文档. 2024-05-24 11:24:37 +08:00
lijiahangmax
8acebd5ad7 Merge pull request #16 from lijiahangmax/dev
Dev
2024-05-24 11:23:04 +08:00
lijiahang
c28c12ee01 📝 修改文档. 2024-05-24 10:47:28 +08:00
lijiahang
532c4afeaa 🐛 修复资产页面时间展示错误. 2024-05-23 14:37:12 +08:00
lijiahang
c201eb301f 添加演示模式. 2024-05-23 13:56:03 +08:00
lijiahang
ca8e629e4c chrome PWA 支持. 2024-05-22 12:50:30 +08:00
lijiahang
35ee4faffc 添加预览模式. 2024-05-22 10:12:43 +08:00
lijiahang
aee2795285 🔖 升级版本. 2024-05-21 13:42:34 +08:00
lijiahangmax
0656c18e85 Merge pull request #15 from lijiahangmax/dev
Dev
2024-05-21 13:31:34 +08:00
lijiahang
cce511c4b4 cron 生成组件. 2024-05-21 13:15:25 +08:00
lijiahang
4f0f320fcd cron 生成器. 2024-05-21 11:24:27 +08:00
lijiahang
2fed2aaa34 🔖 升级版本. 2024-05-20 11:26:55 +08:00
lijiahang
4eeedb85de 🐛 修复发送消息报错. 2024-05-20 11:24:04 +08:00
182 changed files with 12120 additions and 9561 deletions

View File

@@ -1,4 +1,4 @@
<div align="center"><img src="https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/2/27/8c687ef1-5711-4a93-9db0-79c010af7902.png" alt="logo" width="32" /></div>
<div align="center"><img src="https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/29/cec03bbd-0eab-464d-9caf-d0b5a7ffc5a6.png" alt="logo" width="32" /></div>
<p style="margin-top: 12px" align="center"><b>一款高颜值、现代化的智能运维&轻量堡垒机平台。</b></p>
<p align="center">
<a target="_blank"
@@ -43,7 +43,8 @@
**`orion-visor`** 提供一站式服务器运维解决方案。
* **资产管理**:支持对资产进行分组,实现对主机、密钥和身份的统一管理和授权。
* **在线终端**:提供在线 Terminal 服务,支持快捷命令、大文件上传、在线编辑等操作
* **在线终端**:提供在线终端 SSH 服务,支持快捷命令、自定义快捷键和主题风格
* **文件管理**:支持远程主机 SFTP 大文件的批量上传、下载和在线编辑等操作。
* **批量操作**:支持批量执行主机命令、多主机文件分发等功能。
* **计划任务**:支持配置 cron 表达式,定时执行主机命令。
* **安全可靠**:动态配置权限,记录用户操作日志,提供简单的审计功能。
@@ -55,9 +56,20 @@
⭐ 体验后可以点一下 `star` 这对我很重要!
🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
[github](https://github.com/lijiahangmax/orion-visor) [gitee](https://gitee.com/lijiahangmax/orion-visor)
## 快速开始
```bash
# clone
git clone https://github.com/lijiahangmax/orion-visor
cd orion-visor
# 启动
docker compose up -d
```
## 项目文档
* [文档地址](https://lijiahangmax.github.io/orion-visor/#/)
* [docker安装](https://lijiahangmax.github.io/orion-visor/#/quickstart/docker-install)
* [普通安装](https://lijiahangmax.github.io/orion-visor/#/quickstart/install)
@@ -77,22 +89,22 @@
#### 主机终端
![新建连接](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/17/19288b64-cdb2-4073-8df9-ecd642d4077f.png "新建连接")
![主机终端](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/17/41d9deb5-aede-48a5-a6f3-5522cfff9a9f.png "主机终端")
![sftp](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/17/366db511-0c1d-4680-9200-4da8f22b028b.png "sftp")
![主题设置](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/17/a3e4c2fb-11f5-4387-998e-6f454e336472.png "主题设置")
![新建连接](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/29/aa7efb14-f2cc-4a6f-b96b-a47964ed8f79.png "新建连接")
![主机终端](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/29/66f121de-69b6-49f6-adc4-701a22d481c4.png "主机终端")
![sftp](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/29/f7a0d141-0ee0-484e-8ddb-24cad9ed2c03.png "sftp")
![主题设置](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/29/d6f37ab3-62d2-4c5e-a503-e76a1d5ddc8e.png "主题设置")
#### 批量执行
![批量执行](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/17/99839bab-9f0e-45ea-b03d-a4c992203e95.png "批量执行")
![批量执行](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/29/3effc2fc-56a5-498d-8dfb-0f4f3b8a4056.png "批量执行")
#### 批量上传
![批量上传任务](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/17/04ccd627-8a46-43a1-acd9-740f75dbf386.png "批量上传任务")
![批量上传任务](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/29/98240fa9-4056-4520-9034-290d1aa47d80.png "批量上传任务")
#### 计划任务
![计划任务详情](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/17/0c4342fc-9fde-4fc1-b886-104a4d22c0b2.png "计划任务详情")
![计划任务详情](https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/29/d5ee6f04-7b2c-42ba-a3b3-642587f40cce.png "计划任务详情")
## Star History

View File

@@ -1,7 +1,7 @@
version: '3.3'
services:
orion-visor-service:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.0
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.3
ports:
- 1081:80
environment:
@@ -13,13 +13,14 @@ services:
- REDIS_HOST=orion-visor-redis
- REDIS_PASSWORD=Data@123456
- SECRET_KEY=uQeacXV8b3isvKLK
- DEMO_MODE=false
volumes:
- /data/orion-visor-space/docker-volumes/orion-visor-service/root-orion:/root/orion
depends_on:
- orion-visor-mysql
- orion-visor-redis
orion-visor-mysql:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.0
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.3
privileged: true
ports:
- 3307:3306
@@ -33,7 +34,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/etc-mysql:/etc/mysql
orion-visor-redis:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.0
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.3
privileged: true
ports:
- 6380:6379

View File

@@ -1,4 +1,8 @@
#/bin/bash
docker compose down
sh ./pull.sh
# demo 启动
if [ "$1" == "demo" ]; then
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
fi
docker compose up -d

View File

@@ -1,9 +1,17 @@
FROM mysql:8.0.28
# 系统时区
ARG TZ=Asia/Shanghai
# 设置时区
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo '${TZ}' > /etc/timezone
# 复制配置
COPY ./my.cnf /etc/mysql/conf.d/my.cnf
# 复制初始化脚本
COPY ./sql/init-1-schema-databases.sql /tmp
COPY ./sql/init-2-schema-tables.sql /tmp
COPY ./sql/init-3-schema-quartz.sql /tmp
COPY ./sql/init-4-data.sql /tmp
COPY ./my.cnf /etc/mysql/conf.d/my.cnf
# 设置初始化脚本
RUN cat /tmp/init-1-schema-databases.sql >> /tmp/init.sql && \
cat /tmp/init-2-schema-tables.sql >> /tmp/init.sql && \
cat /tmp/init-3-schema-quartz.sql >> /tmp/init.sql && \

View File

@@ -1,5 +1,5 @@
#/bin/bash
version=2.0.0
version=2.0.3
cp -r ../../sql ./sql
docker build -t orion-visor-mysql:${version} .
rm -rf ./sql

View File

@@ -1,4 +1,15 @@
FROM redis:6.0.16-alpine
WORKDIR /data
# 系统时区
ARG TZ=Asia/Shanghai
# 添加包
RUN \
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk update && \
apk add tzdata
# 设置时区
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo '${TZ}' > /etc/timezone
# redis 配置
COPY ./redis.conf /tmp
RUN cat /tmp/redis.conf > /usr/local/redis.conf

View File

@@ -1,5 +1,5 @@
#/bin/bash
version=2.0.0
version=2.0.3
docker build -t 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}

View File

@@ -1,15 +1,23 @@
FROM nginx:alpine
USER root
RUN \
echo "" > /etc/apk/repositories && \
echo "http://mirrors.aliyun.com/alpine/v3.8/main" >> /etc/apk/repositories &&\
echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories && \
apk update
RUN apk add openjdk8
RUN rm -rf /etc/nginx/conf.d/*
WORKDIR /app
# 系统时区
ARG TZ=Asia/Shanghai
# 添加包
RUN \
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk update && \
apk add tzdata && \
apk add openjdk8
# 设置时区
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo '${TZ}' > /etc/timezone
# 删除原 nginx 配置
RUN rm -rf /etc/nginx/conf.d/*
# 复制包
COPY ./orion-visor-launch.jar /app/app.jar
COPY ./dist /usr/share/nginx/html
COPY ./entrypoint.sh /app/entrypoint.sh
COPY ./nginx.conf /etc/nginx/conf.d
# 启动
ENTRYPOINT [ "sh", "/app/entrypoint.sh" ]

View File

@@ -1,9 +1,9 @@
#/bin/bash
version=2.0.0
version=2.0.3
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
mv ../../orion-visor-ui/dist ./dist
docker build -t orion-visor-service:${version} .
rm -f ./orion-visor-launch.jar
rm -rf ./orion-visor-launch.jar
rm -rf ./dist
docker tag orion-visor-service:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:${version}
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:${version}

View File

@@ -43,7 +43,8 @@
**`orion-visor`** 提供一站式服务器运维解决方案。
* **资产管理**:支持对资产进行分组,实现对主机、密钥和身份的统一管理和授权。
* **在线终端**:提供在线 Terminal 服务,支持快捷命令、大文件上传、在线编辑等操作
* **在线终端**:提供在线终端 SSH 服务,支持快捷命令、自定义快捷键和主题风格
* **文件管理**:支持远程主机 SFTP 大文件的批量上传、下载和在线编辑等操作。
* **批量操作**:支持批量执行主机命令、多主机文件分发等功能。
* **计划任务**:支持配置 cron 表达式,定时执行主机命令。
* **安全可靠**:动态配置权限,记录用户操作日志,提供简单的审计功能。
@@ -55,9 +56,20 @@
⭐ 体验后可以点一下 `star` 这对我很重要!
🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
[github](https://github.com/lijiahangmax/orion-visor) [gitee](https://gitee.com/lijiahangmax/orion-visor)
## 快速开始
```bash
# clone
git clone https://github.com/lijiahangmax/orion-visor
cd orion-visor
# 启动
docker compose up -d
```
## 项目文档
* [文档地址](https://lijiahangmax.github.io/orion-visor/#/)
* [docker安装](/quickstart/docker-install)
* [普通安装](/quickstart/install)

View File

@@ -1,6 +1,6 @@
# orion-visor <small>2.0.0</small>
# orion-visor <small>2.0.3</small>
> 一款开箱即用的运维平台。
> 一款高颜值、现代化的智能运维&轻量堡垒机平台。
- 友好 易用
- 安全 稳定

View File

@@ -14,6 +14,32 @@
* 执行 升级的 `bash` 脚本
* 进入 代码目录执行 `sh docker-upgrade.sh` 进行容器升级 `down` > `pull` > `up -d`
### v2.0.3
`2024-05-29` `release`
* 🐞 修复 部分 ui 显示错误
* 🐞 修复 计划任务编辑时报错
* 🐞 修复 计划任务手动触发时报错
* 🩰 修改 logo
* 🔨 修改 docker 时区
### v2.0.2
`2024-05-24` `release`
* 🐞 修复 资产授权密钥时间显示错误
* 🌈 添加 演示模式
* ⭐ 支持 Chrome PWA
### v2.0.1
`2024-05-21` `release`
* ⭐ 添加 cron 组件
* 🐞 修复 批量执行后日志偶尔不展示的问题
* 🐞 修复 批量上传进度条显示异常的问题
### v2.0.0
`2024-05-17` `release`

View File

@@ -2,12 +2,10 @@
* 终端背景图片
* 资产授权 UI 改版
* RDP 远程桌面
* 接入 config 后端动态配置
* 文档中巡检模板
* 导入快捷命令
* 导入命令模板
* 使用 vite press 开发文档
## 已知问题

BIN
docs/assert/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

View File

@@ -1,17 +1,22 @@
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs>
<style>.cls-1{fill:url(#未命名的渐变_4);}.cls-2{fill:url(#未命名的渐变_6);}</style>
<linearGradient id="未命名的渐变_4" x1="0.32" y1="15.03" x2="20.16" y2="15.03" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#23b6b6"/>
<stop offset="1" stop-color="#189c98"/>
</linearGradient>
<linearGradient id="未命名的渐变_6" x1="11.84" y1="16.97" x2="31.68" y2="16.97" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#08589b"/>
<stop offset="1" stop-color="#2167b2"/>
</linearGradient>
</defs>
<path class="cls-1"
d="M20,17.37a1.56,1.56,0,0,0-2.13-.65l-7.56,4.07A4.65,4.65,0,0,1,4,18.91H4a4.65,4.65,0,0,1,1.88-6.3L13.6,8.44a1.56,1.56,0,0,0,.64-2.1h0a1.56,1.56,0,0,0-2.13-.65l-8,4.3a7.24,7.24,0,0,0-2.94,9.82l.51.94a7.24,7.24,0,0,0,9.82,2.94l7.81-4.22a1.56,1.56,0,0,0,.65-2.1Z"/>
<path class="cls-2"
d="M12,14.63a1.56,1.56,0,0,0,2.13.65l7.56-4.07A4.65,4.65,0,0,1,28,13.09h0a4.65,4.65,0,0,1-1.88,6.3L18.4,23.56a1.56,1.56,0,0,0-.64,2.1h0a1.56,1.56,0,0,0,2.13.65l8-4.3a7.24,7.24,0,0,0,2.94-9.82l-.51-.94a7.24,7.24,0,0,0-9.82-2.94l-7.81,4.22a1.56,1.56,0,0,0-.65,2.1Z"/>
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
<style type="text/css">
.st0{fill:url(#SVGID_1_);}
.st1{fill:#3B28CC;}
</style>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="27.1802" y1="7.7935" x2="15.2269" y2="25.137">
<stop offset="0" style="stop-color:#ADD7F6"/>
<stop offset="0.2512" style="stop-color:#AAD5F6"/>
<stop offset="0.4195" style="stop-color:#A1CDF7"/>
<stop offset="0.5636" style="stop-color:#92C1F8"/>
<stop offset="0.694" style="stop-color:#7DAFF9"/>
<stop offset="0.8152" style="stop-color:#6198FB"/>
<stop offset="0.9279" style="stop-color:#407CFD"/>
<stop offset="1" style="stop-color:#2667FF"/>
</linearGradient>
<path class="st0" d="M31.41,4.01h-8.04c-0.27,0-0.51,0.18-0.57,0.44c-0.64,2.56-4.19,15.45-11.86,20.81c0,0,9.5,13.77,21.03-20.47
C32.1,4.4,31.81,4.01,31.41,4.01z"/>
<path class="st1" d="M0.62,3.98h8.02c0.28,0,0.52,0.18,0.59,0.45c0.69,2.58,4.47,15.52,12.14,20.88c0,0-10.88,13.73-21.34-20.54
C-0.09,4.37,0.2,3.98,0.62,3.98z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -2,10 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>关于 orion-visor</title>
<title>orion-visor</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="description" content="Description">
<link rel="icon" href="./assert/logo.svg">
<link rel="icon" href="./assert/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<!-- Theme: Defaults -->
<link rel="stylesheet" href="./assert/font.css">

View File

@@ -34,7 +34,3 @@
### 资产授权
给用户/角色授权资产数据, 若无授权则无法访问资产。
给用户授权时: 若当前选择的用户有管理员角色(admin)则无需配置, 管理员拥有全部权限。
给角色授权时: 无需给管理员(admin)配置, 管理员拥有全部权限。

View File

@@ -21,7 +21,7 @@
* 命令: 查看执行时的命令
* 参数: 查看执行时的参数
* 中断: 中断命令执行
* 日志: 查看执行日志, ctrl + 左键点击会用新页面打开
* 日志: 查看执行日志 `ctrl + 左键` 点击会用新页面打开
* 下载: 下载执行日志
### 批量上传
@@ -65,14 +65,14 @@
### 日志面板快捷键
* 回车: `Enter`
* 向上滚动一行: `↑`
* 向上滚动一页: `Home`
* 向下滚动一行: `↓`
* 向下滚动一页: `End`
* 全选: `ctrl` `A`
* 复制: `ctrl` `C`
* 搜索: `ctrl` `F`
* 清空: `ctrl` `L`
* 向上滚动一行: `↑`
* 向上滚动一页: `Home`
* 向下滚动一行: `↓`
* 向下滚动一页: `End`
### 命令内置参数

View File

@@ -24,6 +24,7 @@
> 右侧状态栏
* 命令片段: 自定义快速执行的命令片段, 双击直接执行
* 路径书签: 自定义快速进入的目录
* 传输列表: 打开文件传输列表, 当前会话下, 所有的文件上传下载传输都会显示在这里
* 截图: 截屏终端并且自动下载

View File

@@ -1,6 +1,6 @@
### 任务列表
⚡ 内置参数同 `批量执行 > 命令执行` [查看](/operator/exec.md?id=命令内置参数)
⚡ 内置参数同 `批量执行` > `命令执行` [查看](/operator/exec.md?id=命令内置参数)
维护计划任务, 定时执行命令。
@@ -22,5 +22,5 @@
* 命令: 查看执行时的命令
* 参数: 查看执行时的参数
* 中断: 中断命令执行
* 日志: 查看执行日志, ctrl + 左键点击会用新页面打开
* 日志: 查看执行日志 `ctrl + 左键` 点击会用新页面打开
* 下载: 下载执行日志

View File

@@ -13,7 +13,7 @@
* 新增: 添加一个字典项
* 刷新缓存: 强制刷新服务器缓存, 一般是手动修改了数据库后需要点击此按钮
* 查看: 查看字典值的json
* 查看: 查看字典值的 json
* 修改: 修改字典项
* 删除: 删除字典项以及字典值

View File

@@ -1,17 +1,17 @@
### 所需环境
* JDK 1.8
* Mysql 8.0(+)
* Redis 5.0.5(+)
* Node 16.16.0(+)
* Maven 3.5.4(+)
* jdk 1.8
* mysql 8.0.+
* redis 6.0.+
* maven 3.5.+
* node 18.12.+
* pnpm 9.1.+
⚡ maven 推荐使用阿里云 mirror
⚡ npm 建议使用淘宝镜像 `npm config set registry https://registry.npmmirror.com/`
⚡ pnpm 建议使用淘宝镜像 `pnpm config set registry https://registry.npmmirror.com/`
### 配置
1. 拉取代码
### 拉取代码
```
# github
@@ -20,7 +20,7 @@ git clone https://github.com/lijiahangmax/orion-visor
git clone https://gitee.com/lijiahangmax/orion-visor
```
2. 初始化数据库
### 初始化数据库
```
# 执行脚本
@@ -30,7 +30,7 @@ orion-visor/sql/init-3-schema-quartz.sql
orion-visor/sql/init-4-data.sql
```
3. 修改后端配置
### 修改后端配置
```
# 修改配置文件 (mysql, redis, secret-key)
@@ -44,9 +44,9 @@ mvn -U clean install -DskipTests
com.orion.visor.launch.LaunchApplication
```
4. 修改前端配置
### 修改前端配置
```
```shell
# 进入代码目录
cd orion-visor/orion-visor-ui
# 下载 pnpm

View File

@@ -19,7 +19,7 @@ Dashboard 修改)
### 拉取代码
```
```shell
# github
git clone https://github.com/lijiahangmax/orion-visor
# gitee
@@ -37,24 +37,22 @@ cd orion-visor
# MYSQL_ROOT_PASSWORD mysql root 密码
# REDIS_PASSWORD redis 密码
# SECRET_KEY 加密密钥
# 构建
docker compose build
```
### 启动
```
```shell
docker compose up -d
```
### 连接 mysql (如果需要在 navicat 中连接)
### 修改加密方式
```
访问 adminer: http://localhost:8081
服务器: orion-visor-mysql
用户名: root
密码: Data@123456
数据库: orion-visor
码: Data@123456
数据库: orion_visor
点击左侧 SQL命令 输入:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Data@123456';
@@ -64,5 +62,5 @@ ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Data@123456';
### 测试访问
在浏览器中输入 http://localhost:1081/ 访问
账号: admin
密码: admin
账号: `admin`
密码: `admin`

View File

@@ -1,27 +1,42 @@
> ##### 1. 数据误删除怎么办?
### 日志文件在哪?
```shell
# 宿主机
tail -f -n 200 /data/orion-visor-space/docker-volumes/orion-visor-service/root-orion/logs/orion-visor/app.log
# 容器内
tail -f -n 200 /root/orion/logs/orion-visor/app.log
# 滚动日志 .../logs/orion-visor/rolling/*
```
### 数据误删除怎么办?
数据库的数据都采用了逻辑删除, 可以将已删除的数据中的 `deleted` 字段改为 `0`
如果不知道数据是哪一条, 可以查询用户操作日志, 点击 `参数` 寻找操作的id
> ##### 2. 执行命令时为什么会找不到环境变量?
### 执行命令时为什么会找不到环境变量?
可以在执行命令的第一行设置 `source /etc/profile` 来加载环境变量
> ##### 3. 命令中途执行失败如何设置中断执行?
### 命令中途执行失败如何设置中断执行?
可以在执行命令的第一行设置 `set -e`
作用是: 当执行出现意料之外的情况时, 立即退出
> ##### 4. 在调度任务、批量执行 命令执行成功的依据是什么?
### 在调度任务、批量执行 命令执行成功的依据是什么?
是获取命令的 `exitcode` 判断是否为 `0` 如果非0则代表命令执行失败
同理, 在命令的最后一行设置 `exit 1` 结果将会是失败, 可以用此来中断后续流程
> ##### 5. 调度任务、批量执行 的日志文件中如何只保存原始输出?
### 调度任务、批量执行 的日志文件中如何只保存原始输出?
修改 `application.yaml` `app.exec-log.append-ansi``false`
> ##### 6. 为什么使用密钥认证还是无法连接机器?
### SFTP 为什么有些文件无法编辑?
只有普通文件可以在线编辑, 也就是 attr 为 `-` 开头的文件, 且文件大小不超过 `2MB` (默认)
修改 `.env.production` `VITE_SFTP_PREVIEW_MB` 改为一个合适的大小(MB) 重新构建
### 为什么使用密钥认证还是无法连接机器?
```
# 升级 openssh
@@ -41,9 +56,3 @@ AuthorizedKeysFile .ssh/authorized_keys
# 重启 sshd 服务
service sshd restart
```
<br/>
⚡ 详细使用请参考操作手册~
<br/>

View File

@@ -1,18 +1,18 @@
### 所需环境
* JDK 1.8
* Mysql 8.0(+)
* Redis 5.0.5(+)
* Node 16.16.0(+)
* Maven 3.5.4(+)
* Nginx
* jdk 1.8
* mysql 8.0.+
* redis 6.0.+
* maven 3.5.+
* node 18.12.+
* pnpm 9.1.+
* nginx
⚡ maven 推荐使用阿里云 mirror
⚡ npm 建议使用淘宝镜像 `npm config set registry https://registry.npmmirror.com/`
⚡ npm 建议使用淘宝镜像 `npm config set registry https://registry.npmmirror.com/`
⚡ pnpm 建议使用淘宝镜像 `pnpm config set registry https://registry.npmmirror.com/`
### 构建
1. 拉取代码
### 拉取代码
```
# github
@@ -21,7 +21,7 @@ git clone https://github.com/lijiahangmax/orion-visor
git clone https://gitee.com/lijiahangmax/orion-visor
```
2. 初始化数据库
### 初始化数据库
```
# 执行脚本
@@ -31,7 +31,7 @@ orion-visor/sql/init-3-schema-quartz.sql
orion-visor/sql/init-4-data.sql
```
3. 构建后端代码
### 构建后端代码
```
# 修改配置文件 (mysql, redis, secret-key)
@@ -43,7 +43,7 @@ cd orion-visor
mvn -U clean install -DskipTests
```
4. 构建前端代码
### 构建前端代码
```
# 进入代码目录
@@ -120,7 +120,7 @@ server {
```
复制 orion-visor/orion-visor-ui/dist 到 /usr/share/nginx/html
复制 orion-visor/orion-visor-launch/target/orion-visor-launch.jar 到 /data/orion
复制 orion-visor/orion-visor-launch/target/orion-visor-launch.jar 到 /data/orion-visor-space
# 启动后台服务
nohup java -jar orion-visor-launch.jar --spring.profiles.active=prod 2>&1 &
# 启动 nginx

View File

@@ -1,6 +1,6 @@
## v1.0.0
### v1.0.0
> sql 脚本 - DML
### sql 脚本 - DML
```sql
-- 字典配置项

View File

@@ -1,13 +1,13 @@
## v1.0.1
### v1.0.1
> sql 脚本 - DDL
### sql 脚本 - DDL
```sql
DROP TABLE IF EXISTS `command_template`;
ALTER TABLE `operator_log` ADD INDEX `idx_type`(`type`);
```
> sql 脚本 - DML
### sql 脚本 - DML
```sql
-- 菜单配置

View File

@@ -1,6 +1,6 @@
## v1.0.2
### v1.0.2
> sql 脚本 - DDL
### sql 脚本 - DDL
```sql
ALTER TABLE `host_connect_log`
@@ -83,7 +83,7 @@ CREATE TABLE `exec_template`
ROW_FORMAT = Dynamic;
```
> sql 脚本 - DML
### sql 脚本 - DML
```sql
-- 菜单配置

View File

@@ -1,6 +1,6 @@
## v1.0.3
### v1.0.3
> sql 脚本 - DML
### sql 脚本 - DML
```sql
DELETE FROM preference WHERE type = 'TERMINAL';

View File

@@ -1,6 +1,6 @@
## v1.0.4
### v1.0.4
> sql 脚本 - DDL
### sql 脚本 - DDL
```sql
-- 修改字段
@@ -260,7 +260,7 @@ CREATE TABLE `QRTZ_SCHEDULER_STATE`
ROW_FORMAT = Dynamic;
```
> sql 脚本 - DML
### sql 脚本 - DML
```sql
-- 操作日志修改

View File

@@ -1,6 +1,6 @@
## v1.0.5
### v1.0.5
> sql 脚本 - DDL
### sql 脚本 - DDL
```sql
ALTER TABLE `system_user`
@@ -22,7 +22,7 @@ ALTER TABLE `exec_host_log`
ADD COLUMN `script_path` varchar(512) NULL COMMENT '脚本路径' AFTER `log_path`;
```
> sql 脚本 - DML
### sql 脚本 - DML
```sql
-- 初始化主机身份类型

View File

@@ -1,6 +1,6 @@
## v1.0.6
### v1.0.6
> sql 脚本 - DDL
### sql 脚本 - DDL
```sql
-- 数据分组添加 userId
@@ -58,10 +58,9 @@ CREATE TABLE `path_bookmark`
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '路径书签'
ROW_FORMAT = Dynamic;
```
> sql 脚本 - DML
### sql 脚本 - DML
```sql
-- 设置数据分组 user_id
@@ -88,7 +87,7 @@ INSERT INTO `dict_value` VALUES (274, 39, 'pathBookmarkType', 'FILE', '文件',
INSERT INTO `dict_value` VALUES (275, 39, 'pathBookmarkType', 'DIR', '文件夹', '{}', 20, '2024-04-24 13:43:39', '2024-04-24 13:43:39', '1', '1', 0);
```
> sql 脚本 - 命令分组初始化
### sql 脚本 - 命令分组初始化
```sql
-- 插入命令片段分组

View File

@@ -1,6 +1,6 @@
## v1.0.7
### v1.0.7
> sql 脚本 - DDL
### sql 脚本 - DDL
```sql
ALTER TABLE `data_permission` COMMENT = '数据权限表';
@@ -57,7 +57,7 @@ CREATE TABLE `upload_task_file`
ROW_FORMAT = Dynamic;
```
> sql 脚本 - DML
### sql 脚本 - DML
```sql
-- 字典项

View File

@@ -1,6 +1,6 @@
## v1.0.8
### v1.0.8
> sql 脚本 - DDL
### sql 脚本 - DDL
```sql
-- 修改字段名称
@@ -32,7 +32,7 @@ CREATE TABLE `system_message`
ROW_FORMAT = Dynamic;
```
> sql 脚本 - DML
### sql 脚本 - DML
```sql
-- 菜单

View File

@@ -1,22 +1,20 @@
## v2.0.0
### v2.0.0
### ⚡ **本次升级提示 本次更新较大 请仔细查阅** ⚡
##### 本次升级思路:
* 先执行以下 **`7`** 个脚本
* 容器下线 `docker compose down`
* 删除原代码目录 `rm -rf orion-ops-pro`
* 克隆改名后的项目 `git clone https://github.com/lijiahangmax/orion-visor.git` or `gitee`
* 启动容器 `docker compose up -d`
```readme
```text
sql 在 adminer/navicat 中执行, bash 脚本直接修改后粘贴执行 不要保存为文件执行否则会出错
本次升级包含数据库重命名操作。#3 创建新数据库, #4 进行数据迁移, #5 删除旧数据库。
[不推荐] 如果不想重命名可以修改 docker-compose.yml, 将 MYSQL_DATABASE 改为 orion-ops-pro 并且跳过步骤 #3 #4 #5
```
> #1 sql 脚本 - DDL
### 1. sql 脚本 - DDL
```sql
-- 修改默认值
@@ -29,7 +27,7 @@ MODIFY COLUMN `key_id` bigint(0) NULL DEFAULT NULL COMMENT '密钥id' AFTER `pas
ALTER TABLE `host_key` COMMENT = '主机密钥';
```
> #2 sql 脚本 - DML
### 2. sql 脚本 - DML
```sql
-- 删除 quartz 配置
@@ -70,14 +68,14 @@ INSERT INTO `dict_value` VALUES (174, 26, 'hostExtraSshAuthType', 'CUSTOM_KEY',
INSERT INTO `dict_value` VALUES (271, 37, 'hostIdentityType', 'KEY', '密钥', '{\"color\": \"arcoblue\"}', 20, '2024-04-16 17:18:12', '2024-05-17 12:49:16', '2', '2', 0);
```
> #3 sql 脚本 - 创建数据库 orion_visor
### 3. sql 脚本 - 创建数据库 orion_visor
```sql
-- 创建数据库
CREATE DATABASE IF NOT EXISTS `orion_visor` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
```
> #4 bash 脚本 - 数据迁移
### 4. bash 脚本 - 数据迁移
```bash
# 可以使用 navicat 的数据迁移功能, 下面描述的是 bash 中执行, 注意下面的变量替换
@@ -97,14 +95,14 @@ rm -f /tmp/orion-ops-pro_dump.sql
exit
```
> #5 sql 脚本 - 删除数据库
### 5. sql 脚本 - 删除数据库
```sql
-- 删除数据库
DROP DATABASE `orion-ops-pro`;
```
> #6 bash 脚本 - 修改 nginx 配置
### 6. bash 脚本 - 修改 nginx 配置
```bash
pro_container_id=41dfd6aff736;
@@ -118,7 +116,7 @@ nginx -s reload
exit
```
> #7 bash 脚本 - 工作空间迁移
### 7. bash 脚本 - 工作空间迁移
```bash
# 迁移工作空间

View File

@@ -1,11 +0,0 @@
## v2.0.1
> sql 脚本 - DDL
```sql
```
> sql 脚本 - DML
```sql
```

View File

@@ -1,11 +0,0 @@
## v2.0.2
> sql 脚本 - DDL
```sql
```
> sql 脚本 - DML
```sql
```

11
docs/update/v2.0.x.md Normal file
View File

@@ -0,0 +1,11 @@
### v2.0.x
### sql 脚本 - DDL
```sql
```
### sql 脚本 - DML
```sql
```

View File

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

View File

@@ -14,7 +14,7 @@ public interface AppConst extends OrionConst {
/**
* 同 ${orion.version} 迭代时候需要手动更改
*/
String VERSION = "2.0.0";
String VERSION = "2.0.3";
String ORION_VISOR = "orion-visor";

View File

@@ -0,0 +1,32 @@
package com.orion.visor.framework.common.constant;
/**
* bean 排序常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/29 16:09
*/
public interface BeanOrderConst {
/**
* 公共返回值包装处理器
*/
int RESPONSE_ADVICE_WRAPPER = Integer.MIN_VALUE + 1000;
/**
* 演示模式切面
*/
int DEMO_DISABLE_API_ASPECT = Integer.MIN_VALUE + 10;
/**
* 全局日志打印
*/
int LOG_PRINT_ASPECT = Integer.MIN_VALUE + 20;
/**
* 操作日志切面
*/
int OPERATOR_LOG_ASPECT = Integer.MIN_VALUE + 30;
}

View File

@@ -86,6 +86,8 @@ public enum ErrorCode implements CodeInfo {
UNSUPPOETED(915, "不支持此操作"),
DEMO_DISABLE_API(916, "演示模式不支持此功能"),
;
ErrorCode(int code, String message) {

View File

@@ -1,14 +0,0 @@
package com.orion.visor.framework.common.constant;
/**
* 拦截器排序常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/16 18:15
*/
public interface InterceptorOrderConst {
int LOG_FILTER = Integer.MIN_VALUE;
}

View File

@@ -1,14 +0,0 @@
package com.orion.visor.framework.common.constant;
/**
* 结果增强器 排序常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/29 16:09
*/
public interface ResponseAdviceOrderConst {
int WRAPPER = Integer.MIN_VALUE + 1000;
}

View File

@@ -72,7 +72,7 @@ public class OrionOperatorLogAutoConfiguration {
OperatorLogs.setSerializeFilters(serializeFilters);
OperatorLogFiller.setSerializeFilters(serializeFilters);
OperatorLogFiller.setOperatorLogConfig(operatorLogConfig);
return new OperatorLogAspect(operatorLogConfig, service, serializeFilters);
return new OperatorLogAspect(service);
}
}

View File

@@ -1,10 +1,8 @@
package com.orion.visor.framework.biz.operator.log.core.aspect;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.orion.lang.define.thread.ExecutorBuilder;
import com.orion.lang.utils.Arrays1;
import com.orion.lang.utils.Strings;
import com.orion.visor.framework.biz.operator.log.configuration.config.OperatorLogConfig;
import com.orion.visor.framework.biz.operator.log.core.annotation.IgnoreParameter;
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import com.orion.visor.framework.biz.operator.log.core.factory.OperatorTypeHolder;
@@ -13,6 +11,7 @@ import com.orion.visor.framework.biz.operator.log.core.model.OperatorType;
import com.orion.visor.framework.biz.operator.log.core.service.OperatorLogFrameworkService;
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogFiller;
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import com.orion.visor.framework.common.constant.BeanOrderConst;
import com.orion.visor.framework.common.security.LoginUser;
import com.orion.visor.framework.common.security.SecurityHolder;
import lombok.extern.slf4j.Slf4j;
@@ -20,6 +19,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
@@ -43,6 +43,7 @@ import java.util.concurrent.ExecutorService;
*/
@Aspect
@Slf4j
@Order(BeanOrderConst.OPERATOR_LOG_ASPECT)
public class OperatorLogAspect {
private static final ExecutorService LOG_SAVER = ExecutorBuilder.create()
@@ -53,21 +54,13 @@ public class OperatorLogAspect {
.useLinkedBlockingQueue()
.build();
private final OperatorLogConfig operatorLogConfig;
private final OperatorLogFrameworkService operatorLogFrameworkService;
private final SerializeFilter[] serializeFilters;
@Resource
private SecurityHolder securityHolder;
public OperatorLogAspect(OperatorLogConfig operatorLogConfig,
OperatorLogFrameworkService operatorLogFrameworkService,
SerializeFilter[] serializeFilters) {
this.operatorLogConfig = operatorLogConfig;
public OperatorLogAspect(OperatorLogFrameworkService operatorLogFrameworkService) {
this.operatorLogFrameworkService = operatorLogFrameworkService;
this.serializeFilters = serializeFilters;
}
@Around("@annotation(o)")

View File

@@ -1,7 +1,7 @@
package com.orion.visor.framework.log.configuration;
import com.orion.visor.framework.common.constant.AutoConfigureOrderConst;
import com.orion.visor.framework.common.constant.InterceptorOrderConst;
import com.orion.visor.framework.common.constant.BeanOrderConst;
import com.orion.visor.framework.log.configuration.config.LogPrinterConfig;
import com.orion.visor.framework.log.core.interceptor.LogPrinterInterceptor;
import com.orion.visor.framework.log.core.interceptor.PrettyLogPrinterInterceptor;
@@ -59,7 +59,7 @@ public class OrionLogPrinterConfiguration {
AspectJExpressionPointcutAdvisor advisor = new AspectJExpressionPointcutAdvisor();
advisor.setExpression(config.getExpression());
advisor.setAdvice(logPrinterInterceptor);
advisor.setOrder(InterceptorOrderConst.LOG_FILTER);
advisor.setOrder(BeanOrderConst.LOG_PRINT_ASPECT);
return advisor;
}

View File

@@ -27,6 +27,7 @@ public class ServerTemplate extends Template {
table.bizPackage = bizPackage;
table.enableUnitTest = true;
table.enableOperatorLog = true;
table.enableDemoApi = true;
}
/**
@@ -102,6 +103,16 @@ public class ServerTemplate extends Template {
return this;
}
/**
* 是否生成演示模式 api 注解
*
* @return this
*/
public ServerTemplate disableDemoApi() {
table.enableDemoApi = false;
return this;
}
/**
* 设置 cache
*

View File

@@ -58,6 +58,11 @@ public class Table {
*/
protected boolean enableOperatorLog;
/**
* 是否生成演示模式 api 注解
*/
protected boolean enableDemoApi;
/**
* 缓存的 key
*/

View File

@@ -6,6 +6,9 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
#end
import com.orion.visor.framework.common.validator.group.Page;
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
#if($meta.enableDemoApi)
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
#end
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import ${package.Service}.*;
@@ -51,6 +54,9 @@ public class ${table.controllerName} {
@Resource
private ${type}Service ${typeLower}Service;
#if($meta.enableDemoApi)
@DemoDisableApi
#end
#if($meta.enableOperatorLog)
@OperatorLog(${type}OperatorType.CREATE)
#end
@@ -61,6 +67,9 @@ public class ${table.controllerName} {
return ${typeLower}Service.create${type}(request);
}
#if($meta.enableDemoApi)
@DemoDisableApi
#end
#if($meta.enableOperatorLog)
@OperatorLog(${type}OperatorType.UPDATE)
#end
@@ -105,6 +114,9 @@ public class ${table.controllerName} {
return ${typeLower}Service.get${type}Page(request);
}
#if($meta.enableDemoApi)
@DemoDisableApi
#end
#if($meta.enableOperatorLog)
@OperatorLog(${type}OperatorType.DELETE)
#end
@@ -116,6 +128,9 @@ public class ${table.controllerName} {
return ${typeLower}Service.delete${type}ById(id);
}
#if($meta.enableDemoApi)
@DemoDisableApi
#end
#if($meta.enableOperatorLog)
@OperatorLog(${type}OperatorType.DELETE)
#end

View File

@@ -8,7 +8,7 @@
:cancel-button-props="{ disabled: loading }"
:on-before-ok="handlerOk"
@cancel="handleClose">
<a-spin class="full modal-form-small" :loading="loading">
<a-spin class="full drawer-form-small" :loading="loading">
<a-form :model="formModel"
ref="formRef"
label-align="right"

View File

@@ -126,9 +126,11 @@ public class OrionSecurityAutoConfiguration {
}
/**
* @return security holder 代理用于内部 framework 调用
* <p>
* - mybatis fill
* - operator log
* - log printer
*
* @return security holder 代理用于内部 framework 调用
*/
@Bean
public SecurityHolderDelegate securityHolder() {

View File

@@ -6,6 +6,7 @@ import com.orion.lang.utils.collect.Lists;
import com.orion.visor.framework.common.constant.AutoConfigureOrderConst;
import com.orion.visor.framework.common.constant.FilterOrderConst;
import com.orion.visor.framework.common.web.filter.FilterCreator;
import com.orion.visor.framework.web.core.aspect.DemoDisableApiAspect;
import com.orion.visor.framework.web.core.filter.TraceIdFilter;
import com.orion.visor.framework.web.core.handler.GlobalExceptionHandler;
import com.orion.visor.framework.web.core.handler.WrapperResultHandler;
@@ -139,4 +140,13 @@ public class OrionWebAutoConfiguration implements WebMvcConfigurer {
return FilterCreator.create(new TraceIdFilter(), FilterOrderConst.TRICE_ID_FILTER);
}
/**
* @return 演示模式禁用 api 切面
*/
@Bean
@ConditionalOnProperty(value = "orion.demo", havingValue = "true")
public DemoDisableApiAspect demoDisableApiAspect() {
return new DemoDisableApiAspect();
}
}

View File

@@ -0,0 +1,16 @@
package com.orion.visor.framework.web.core.annotation;
import java.lang.annotation.*;
/**
* 演示模式禁用 api
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/5/21 16:44
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DemoDisableApi {
}

View File

@@ -0,0 +1,33 @@
package com.orion.visor.framework.web.core.aspect;
import com.orion.visor.framework.common.constant.BeanOrderConst;
import com.orion.visor.framework.common.constant.ErrorCode;
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
/**
* 演示模式禁用 api 切面
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/5/21 16:52
*/
@Aspect
@Slf4j
@Order(BeanOrderConst.DEMO_DISABLE_API_ASPECT)
public class DemoDisableApiAspect {
@Pointcut("@annotation(e)")
public void disableApi(DemoDisableApi e) {
}
@Before(value = "disableApi(e)", argNames = "e")
public void beforeDisableApi(DemoDisableApi e) {
throw ErrorCode.DEMO_DISABLE_API.exception();
}
}

View File

@@ -3,7 +3,7 @@ package com.orion.visor.framework.web.core.handler;
import com.orion.lang.constant.StandardContentType;
import com.orion.lang.define.wrapper.HttpWrapper;
import com.orion.lang.define.wrapper.RpcWrapper;
import com.orion.visor.framework.common.constant.ResponseAdviceOrderConst;
import com.orion.visor.framework.common.constant.BeanOrderConst;
import com.orion.visor.framework.web.core.annotation.IgnoreWrapper;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import org.jetbrains.annotations.NotNull;
@@ -23,7 +23,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
* @version 1.0.0
* @since 2023/6/15 17:38
*/
@Order(ResponseAdviceOrderConst.WRAPPER)
@Order(BeanOrderConst.RESPONSE_ADVICE_WRAPPER)
@ControllerAdvice
public class WrapperResultHandler implements ResponseBodyAdvice<Object> {

View File

@@ -5,6 +5,12 @@
"type": "java.lang.String",
"description": "项目版本."
},
{
"name": "orion.demo",
"type": "java.lang.Boolean",
"description": "是否为演示模式.",
"defaultValue": false
},
{
"name": "orion.api.prefix",
"type": "java.lang.String",

View File

@@ -0,0 +1,118 @@
package com.orion.visor.framework.websocket.core.session;
import org.springframework.http.HttpHeaders;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.WebSocketExtension;
import org.springframework.web.socket.WebSocketMessage;
import org.springframework.web.socket.WebSocketSession;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.URI;
import java.security.Principal;
import java.util.List;
import java.util.Map;
/**
* web socket 同步会话
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/5/20 10:12
*/
public class WebSocketSyncSession implements WebSocketSession {
private final WebSocketSession delegate;
public WebSocketSyncSession(WebSocketSession delegate) {
this.delegate = delegate;
}
@Override
public String getId() {
return this.delegate.getId();
}
@Override
public URI getUri() {
return this.delegate.getUri();
}
@Override
public HttpHeaders getHandshakeHeaders() {
return this.delegate.getHandshakeHeaders();
}
@Override
public Map<String, Object> getAttributes() {
return this.delegate.getAttributes();
}
@Override
public Principal getPrincipal() {
return this.delegate.getPrincipal();
}
@Override
public InetSocketAddress getLocalAddress() {
return this.delegate.getLocalAddress();
}
@Override
public InetSocketAddress getRemoteAddress() {
return this.delegate.getRemoteAddress();
}
@Override
public String getAcceptedProtocol() {
return this.delegate.getAcceptedProtocol();
}
@Override
public void setTextMessageSizeLimit(int messageSizeLimit) {
this.delegate.setTextMessageSizeLimit(messageSizeLimit);
}
@Override
public int getTextMessageSizeLimit() {
return this.delegate.getTextMessageSizeLimit();
}
@Override
public void setBinaryMessageSizeLimit(int messageSizeLimit) {
this.delegate.setBinaryMessageSizeLimit(messageSizeLimit);
}
@Override
public int getBinaryMessageSizeLimit() {
return this.delegate.getBinaryMessageSizeLimit();
}
@Override
public List<WebSocketExtension> getExtensions() {
return this.delegate.getExtensions();
}
@Override
public void sendMessage(WebSocketMessage<?> message) throws IOException {
synchronized (this.delegate) {
this.delegate.sendMessage(message);
}
}
@Override
public boolean isOpen() {
return this.delegate.isOpen();
}
@Override
public void close() throws IOException {
this.delegate.close();
}
@Override
public void close(CloseStatus status) throws IOException {
this.delegate.close(status);
}
}

View File

@@ -3,7 +3,9 @@ package com.orion.visor.framework.websocket.core.utils;
import com.alibaba.fastjson.JSON;
import com.orion.lang.utils.Exceptions;
import com.orion.lang.utils.Threads;
import com.orion.visor.framework.common.constant.Const;
import com.orion.visor.framework.websocket.core.constant.WsCloseCode;
import com.orion.visor.framework.websocket.core.session.WebSocketSyncSession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
@@ -24,6 +26,16 @@ public class WebSockets {
private WebSockets() {
}
/**
* 创建同步会话
*
* @param session session
* @return session
*/
public static WebSocketSession createSyncSession(WebSocketSession session) {
return new WebSocketSyncSession(session);
}
/**
* 获取属性
*
@@ -58,13 +70,20 @@ public class WebSockets {
return;
}
try {
// 发重消息
session.sendMessage(new TextMessage(message));
if (session instanceof WebSocketSyncSession) {
// 发送消息
session.sendMessage(new TextMessage(message));
} else {
synchronized (session) {
// 发送消息
session.sendMessage(new TextMessage(message));
}
}
} catch (IllegalStateException e) {
// 并发异常
log.error("发送消息失败, 准备进行重试 {}", Exceptions.getDigest(e));
// 并发重试
retrySendText(session, message, 50);
retrySendText(session, message, Const.MS_100);
} catch (IOException e) {
throw Exceptions.ioRuntime(e);
}

View File

@@ -41,6 +41,8 @@ knife4j:
enable: false
orion:
# 是否为演示模式
demo: ${DEMO_MODE:false}
logging:
printer:
mode: ROW

View File

@@ -190,6 +190,8 @@ app:
orion:
# 版本
version: @revision@
# 是否为演示模式
demo: false
api:
# 公共 api 前缀
prefix: /orion-visor/api
@@ -206,7 +208,7 @@ orion:
session-idle-timeout: 1800000
swagger:
# swagger 配置
author: lijiahang
author: Jiahang Li
title: orion-visor 运维平台
description: 一站式运维服务平台
version: ${orion.version}

View File

@@ -3,6 +3,7 @@ package com.orion.visor.module.asset.controller;
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.asset.define.operator.HostOperatorType;
import com.orion.visor.module.asset.entity.request.host.HostConfigUpdateRequest;
@@ -59,6 +60,7 @@ public class HostConfigController {
return hostConfigService.getHostConfigList(hostId);
}
@DemoDisableApi
@OperatorLog(HostOperatorType.UPDATE_CONFIG)
@PutMapping("/update")
@Operation(summary = "更新主机配置")
@@ -67,6 +69,7 @@ public class HostConfigController {
return hostConfigService.updateHostConfig(request);
}
@DemoDisableApi
@OperatorLog(HostOperatorType.UPDATE_CONFIG_STATUS)
@PutMapping("/update-status")
@Operation(summary = "更新主机配置状态/动态初始化配置")

View File

@@ -6,6 +6,7 @@ import com.orion.visor.framework.common.validator.group.Id;
import com.orion.visor.framework.common.validator.group.Page;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.asset.define.operator.HostConnectLogOperatorType;
import com.orion.visor.module.asset.entity.request.host.HostConnectLogQueryRequest;
@@ -88,6 +89,7 @@ public class HostConnectLogController {
return hostConnectLogService.clearHostConnectLog(request);
}
@DemoDisableApi
@OperatorLog(HostConnectLogOperatorType.FORCE_OFFLINE)
@PutMapping("/force-offline")
@Operation(summary = "强制断开主机连接")

View File

@@ -5,6 +5,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import com.orion.visor.framework.common.validator.group.Page;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.asset.define.operator.HostOperatorType;
import com.orion.visor.module.asset.entity.request.host.HostCreateRequest;
@@ -42,6 +43,7 @@ public class HostController {
@Resource
private HostService hostService;
@DemoDisableApi
@OperatorLog(HostOperatorType.CREATE)
@PostMapping("/create")
@Operation(summary = "创建主机")
@@ -50,6 +52,7 @@ public class HostController {
return hostService.createHost(request);
}
@DemoDisableApi
@OperatorLog(HostOperatorType.UPDATE)
@PutMapping("/update")
@Operation(summary = "通过 id 更新主机")
@@ -83,6 +86,7 @@ public class HostController {
return hostService.getHostPage(request);
}
@DemoDisableApi
@OperatorLog(HostOperatorType.DELETE)
@DeleteMapping("/delete")
@Operation(summary = "通过 id 删除主机")

View File

@@ -3,6 +3,7 @@ package com.orion.visor.module.asset.controller;
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.asset.define.operator.HostGroupOperatorType;
import com.orion.visor.module.asset.entity.request.host.HostGroupRelUpdateRequest;
@@ -42,6 +43,7 @@ public class HostGroupController {
@Resource
private HostGroupService hostGroupService;
@DemoDisableApi
@OperatorLog(HostGroupOperatorType.CREATE)
@PostMapping("/create")
@Operation(summary = "创建主机分组")
@@ -58,6 +60,7 @@ public class HostGroupController {
return hostGroupService.queryHostGroupTree();
}
@DemoDisableApi
@OperatorLog(HostGroupOperatorType.RENAME)
@PutMapping("/rename")
@Operation(summary = "修改名称")
@@ -66,6 +69,7 @@ public class HostGroupController {
return hostGroupService.updateHostGroupName(request);
}
@DemoDisableApi
@OperatorLog(HostGroupOperatorType.MOVE)
@PutMapping("/move")
@Operation(summary = "移动位置")
@@ -74,6 +78,7 @@ public class HostGroupController {
return hostGroupService.moveHostGroup(request);
}
@DemoDisableApi
@OperatorLog(HostGroupOperatorType.DELETE)
@DeleteMapping("/delete")
@Operation(summary = "删除主机分组")
@@ -91,6 +96,7 @@ public class HostGroupController {
return hostGroupService.queryHostGroupRel(groupId);
}
@DemoDisableApi
@OperatorLog(HostGroupOperatorType.UPDATE_REL)
@PutMapping("/update-rel")
@Operation(summary = "修改分组内主机")

View File

@@ -5,6 +5,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import com.orion.visor.framework.common.validator.group.Page;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.asset.define.operator.HostIdentityOperatorType;
import com.orion.visor.module.asset.entity.request.host.HostIdentityCreateRequest;
@@ -42,6 +43,7 @@ public class HostIdentityController {
@Resource
private HostIdentityService hostIdentityService;
@DemoDisableApi
@OperatorLog(HostIdentityOperatorType.CREATE)
@PostMapping("/create")
@Operation(summary = "创建主机身份")
@@ -50,6 +52,7 @@ public class HostIdentityController {
return hostIdentityService.createHostIdentity(request);
}
@DemoDisableApi
@OperatorLog(HostIdentityOperatorType.UPDATE)
@PutMapping("/update")
@Operation(summary = "通过 id 更新主机身份")
@@ -84,6 +87,7 @@ public class HostIdentityController {
return hostIdentityService.getHostIdentityPage(request);
}
@DemoDisableApi
@OperatorLog(HostIdentityOperatorType.DELETE)
@DeleteMapping("/delete")
@Operation(summary = "通过 id 删除主机身份")

View File

@@ -5,6 +5,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import com.orion.visor.framework.common.validator.group.Page;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.asset.define.operator.HostKeyOperatorType;
import com.orion.visor.module.asset.entity.request.host.HostKeyCreateRequest;
@@ -42,6 +43,7 @@ public class HostKeyController {
@Resource
private HostKeyService hostKeyService;
@DemoDisableApi
@OperatorLog(HostKeyOperatorType.CREATE)
@PostMapping("/create")
@Operation(summary = "创建主机密钥")
@@ -50,6 +52,7 @@ public class HostKeyController {
return hostKeyService.createHostKey(request);
}
@DemoDisableApi
@OperatorLog(HostKeyOperatorType.UPDATE)
@PutMapping("/update")
@Operation(summary = "通过 id 更新主机密钥")
@@ -83,6 +86,7 @@ public class HostKeyController {
return hostKeyService.getHostKeyPage(request);
}
@DemoDisableApi
@OperatorLog(HostKeyOperatorType.DELETE)
@DeleteMapping("/delete")
@Operation(summary = "通过 id 删除主机密钥")

View File

@@ -8,6 +8,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* 主机身份缓存
@@ -38,4 +39,16 @@ public class HostIdentityCacheDTO implements LongCacheIdModel, Serializable {
@Schema(description = "密钥id")
private Long keyId;
/**
* 资产页面展示
*/
@Schema(description = "创建时间")
private Date createTime;
/**
* 资产页面展示
*/
@Schema(description = "修改时间")
private Date updateTime;
}

View File

@@ -8,6 +8,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* 主机密钥缓存
@@ -29,4 +30,16 @@ public class HostKeyCacheDTO implements LongCacheIdModel, Serializable {
@Schema(description = "名称")
private String name;
/**
* 资产页面展示
*/
@Schema(description = "创建时间")
private Date createTime;
/**
* 资产页面展示
*/
@Schema(description = "修改时间")
private Date updateTime;
}

View File

@@ -46,7 +46,10 @@ public class ExecLogTailHandler extends AbstractWebSocketHandler {
String trackerId = this.getTrackerId(id, info, host);
String absolutePath = logsFileClient.getAbsolutePath(host.getPath());
// 追踪器
ExecLogTracker tracker = new ExecLogTracker(trackerId, absolutePath, session, host);
ExecLogTracker tracker = new ExecLogTracker(trackerId,
absolutePath,
WebSockets.createSyncSession(session),
host);
// 执行
AssetThreadPools.EXEC_LOG.execute(tracker);
// 添加追踪器

View File

@@ -79,7 +79,13 @@ public class ExecLogTracker implements IExecLogTracker {
@Override
public void read(byte[] bytes, int len, Tracker tracker) {
WebSockets.sendText(session, config.getId() + LogConst.SEPARATOR + new String(bytes, 0, len));
// 发送消息
String message = config.getId() + LogConst.SEPARATOR + new String(bytes, 0, len);
try {
WebSockets.sendText(session, message);
} catch (Exception e) {
log.error("ExecLogTracker.send error", e);
}
}
@Override

View File

@@ -330,7 +330,16 @@ public class ExecCommandServiceImpl implements ExecCommandService {
// 解析参数
return schemaList.stream()
.collect(Collectors.toMap(ExecParameterSchemaDTO::getName,
ExecParameterSchemaDTO::getValue,
s -> {
Object value = s.getValue();
if (value == null) {
value = s.getDefaultValue();
}
if (value == null) {
value = Const.EMPTY;
}
return value;
},
Functions.right()));
}

View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.orion.lang.define.wrapper.DataGrid;
import com.orion.lang.utils.Booleans;
import com.orion.lang.utils.Strings;
import com.orion.lang.utils.collect.Lists;
import com.orion.lang.utils.time.cron.Cron;
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import com.orion.visor.framework.common.constant.ErrorMessage;
@@ -163,8 +164,12 @@ public class ExecJobServiceImpl implements ExecJobService {
List<Long> hostIdList = execJobHostService.getHostIdByJobId(id);
vo.setHostIdList(hostIdList);
// 查询主机列表
List<HostDO> hostList = hostDAO.selectBatchIds(hostIdList);
vo.setHostList(HostConvert.MAPPER.toList(hostList));
if (!Lists.isEmpty(hostIdList)) {
List<HostDO> hostList = hostDAO.selectBatchIds(hostIdList);
vo.setHostList(HostConvert.MAPPER.toList(hostList));
} else {
vo.setHostList(Lists.empty());
}
return vo;
}

View File

@@ -4,10 +4,10 @@ Content-Type: application/json
Authorization: {{token}}
{
"key": "",
"valueType": "",
"extraSchema": "",
"description": ""
"keyName": "operatorLogType",
"valueType": "1",
"extraSchema": "{}",
"description": "1"
}
@@ -18,7 +18,7 @@ Authorization: {{token}}
{
"id": "",
"key": "",
"keyName": "",
"valueType": "",
"extraSchema": "",
"description": ""

View File

@@ -4,6 +4,7 @@ import com.orion.lang.define.wrapper.DataGrid;
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.infra.define.operator.DictKeyOperatorType;
import com.orion.visor.module.infra.entity.request.dict.DictKeyCreateRequest;
@@ -41,6 +42,7 @@ public class DictKeyController {
@Resource
private DictKeyService dictKeyService;
@DemoDisableApi
@OperatorLog(DictKeyOperatorType.CREATE)
@PostMapping("/create")
@Operation(summary = "创建字典配置项")
@@ -49,6 +51,7 @@ public class DictKeyController {
return dictKeyService.createDictKey(request);
}
@DemoDisableApi
@OperatorLog(DictKeyOperatorType.UPDATE)
@PutMapping("/update")
@Operation(summary = "更新字典配置项")
@@ -80,6 +83,7 @@ public class DictKeyController {
return true;
}
@DemoDisableApi
@OperatorLog(DictKeyOperatorType.DELETE)
@DeleteMapping("/delete")
@Operation(summary = "删除字典配置项")
@@ -89,6 +93,7 @@ public class DictKeyController {
return dictKeyService.deleteDictKeyById(id);
}
@DemoDisableApi
@OperatorLog(DictKeyOperatorType.DELETE)
@DeleteMapping("/batch-delete")
@Operation(summary = "批量删除字典配置项")

View File

@@ -6,6 +6,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import com.orion.visor.framework.common.validator.group.Page;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.infra.define.operator.DictValueOperatorType;
import com.orion.visor.module.infra.entity.request.dict.DictValueCreateRequest;
@@ -45,6 +46,7 @@ public class DictValueController {
@Resource
private DictValueService dictValueService;
@DemoDisableApi
@OperatorLog(DictValueOperatorType.CREATE)
@PostMapping("/create")
@Operation(summary = "创建字典配置值")
@@ -53,6 +55,7 @@ public class DictValueController {
return dictValueService.createDictValue(request);
}
@DemoDisableApi
@OperatorLog(DictValueOperatorType.UPDATE)
@PutMapping("/update")
@Operation(summary = "更新字典配置值")
@@ -61,6 +64,7 @@ public class DictValueController {
return dictValueService.updateDictValueById(request);
}
@DemoDisableApi
@OperatorLog(DictValueOperatorType.UPDATE)
@PutMapping("/rollback")
@Operation(summary = "回滚字典配置值")
@@ -84,6 +88,7 @@ public class DictValueController {
return dictValueService.getDictValuePage(request);
}
@DemoDisableApi
@OperatorLog(DictValueOperatorType.DELETE)
@DeleteMapping("/delete")
@Operation(summary = "删除字典配置值")
@@ -93,6 +98,7 @@ public class DictValueController {
return dictValueService.deleteDictValueById(id);
}
@DemoDisableApi
@OperatorLog(DictValueOperatorType.DELETE)
@DeleteMapping("/batch-delete")
@Operation(summary = "批量删除字典配置值")

View File

@@ -5,6 +5,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import com.orion.visor.framework.common.validator.group.Page;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.infra.define.operator.AuthenticationOperatorType;
import com.orion.visor.module.infra.entity.request.operator.OperatorLogQueryRequest;
@@ -57,6 +58,7 @@ public class MineController {
return mineService.updateCurrentUser(request);
}
@DemoDisableApi
@OperatorLog(AuthenticationOperatorType.UPDATE_PASSWORD)
@Operation(summary = "修改当前用户密码")
@PutMapping("/update-password")
@@ -79,6 +81,7 @@ public class MineController {
return mineService.getCurrentUserSessionList();
}
@DemoDisableApi
@PutMapping("/offline-session")
@Operation(summary = "下线当前用户会话")
public Boolean offlineCurrentUserSession(@Validated @RequestBody UserSessionOfflineRequest request) {

View File

@@ -3,6 +3,7 @@ package com.orion.visor.module.infra.controller;
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.infra.define.operator.SystemMenuOperatorType;
import com.orion.visor.module.infra.entity.request.menu.SystemMenuCreateRequest;
@@ -41,6 +42,7 @@ public class SystemMenuController {
@Resource
private SystemMenuService systemMenuService;
@DemoDisableApi
@OperatorLog(SystemMenuOperatorType.CREATE)
@PostMapping("/create")
@Operation(summary = "创建菜单")
@@ -49,6 +51,7 @@ public class SystemMenuController {
return systemMenuService.createSystemMenu(request);
}
@DemoDisableApi
@OperatorLog(SystemMenuOperatorType.UPDATE)
@PutMapping("/update")
@Operation(summary = "通过 id 更新菜单")
@@ -57,6 +60,7 @@ public class SystemMenuController {
return systemMenuService.updateSystemMenuById(request);
}
@DemoDisableApi
@OperatorLog(SystemMenuOperatorType.UPDATE_STATUS)
@PutMapping("/update-status")
@Operation(summary = "通过 id 级联更新菜单状态")
@@ -82,6 +86,7 @@ public class SystemMenuController {
return systemMenuService.getSystemMenuByIdList(request);
}
@DemoDisableApi
@OperatorLog(SystemMenuOperatorType.DELETE)
@DeleteMapping("/delete")
@Operation(summary = "通过 id 级联删除菜单")

View File

@@ -5,6 +5,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import com.orion.visor.framework.common.validator.group.Page;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.infra.define.operator.SystemRoleOperatorType;
import com.orion.visor.module.infra.entity.request.menu.SystemRoleGrantMenuRequest;
@@ -64,6 +65,7 @@ public class SystemRoleController {
return systemRoleService.updateSystemRoleById(request);
}
@DemoDisableApi
@OperatorLog(SystemRoleOperatorType.UPDATE_STATUS)
@PutMapping("/update-status")
@Operation(summary = "通过 id 更新角色状态")
@@ -105,6 +107,7 @@ public class SystemRoleController {
return systemRoleMenuService.getRoleMenuIdList(roleId);
}
@DemoDisableApi
@OperatorLog(SystemRoleOperatorType.DELETE)
@DeleteMapping("/delete")
@Operation(summary = "通过 id 删除角色")

View File

@@ -6,6 +6,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import com.orion.visor.framework.common.validator.group.Page;
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.DemoDisableApi;
import com.orion.visor.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.infra.define.operator.SystemUserOperatorType;
import com.orion.visor.module.infra.entity.request.user.*;
@@ -73,6 +74,7 @@ public class SystemUserController {
// TODO 修改头像 最后再说 可有可无的功能 要是有 http 文件需求就写
@DemoDisableApi
@OperatorLog(SystemUserOperatorType.UPDATE_STATUS)
@PutMapping("/update-status")
@Operation(summary = "修改用户状态")
@@ -95,6 +97,7 @@ public class SystemUserController {
}
}
@DemoDisableApi
@OperatorLog(SystemUserOperatorType.RESET_PASSWORD)
@PutMapping("/reset-password")
@Operation(summary = "重置用户密码")
@@ -137,6 +140,7 @@ public class SystemUserController {
return systemUserService.getSystemUserPage(request);
}
@DemoDisableApi
@OperatorLog(SystemUserOperatorType.DELETE)
@DeleteMapping("/delete")
@Operation(summary = "通过 id 删除用户")
@@ -154,6 +158,7 @@ public class SystemUserController {
return systemUserManagementService.getUserSessionList(id);
}
@DemoDisableApi
@OperatorLog(SystemUserOperatorType.OFFLINE)
@PutMapping("/session/offline")
@Operation(summary = "下线用户会话")

View File

@@ -1,4 +1,5 @@
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_APP_VERSION= '2.0.0'
VITE_APP_VERSION= '2.0.3'
VITE_SFTP_PREVIEW_MB= 2
VITE_DEMO_MODE= false

View File

@@ -1,4 +1,5 @@
VITE_API_BASE_URL= '/orion-visor/api'
VITE_WS_BASE_URL= '/orion-visor/keep-alive'
VITE_APP_VERSION= '2.0.0'
VITE_APP_VERSION= '2.0.3'
VITE_SFTP_PREVIEW_MB= 2
VITE_DEMO_MODE= false

View File

@@ -1,5 +1,6 @@
node_modules
.DS_Store
dist
dev-dist
dist-ssr
*.local

View File

@@ -5,7 +5,7 @@ import { ArcoResolver } from 'unplugin-vue-components/resolvers';
* 按需引入
* https://github.com/antfu/unplugin-vue-components
* https://arco.design/vue/docs/start
* 虽然Pro项目中是全量引入组件但此插件会默认使用
* 虽然Pro项目中是全量引入组件, 但此插件会默认使用
*/
export default function configArcoResolverPlugin() {
const arcoResolverPlugin = Components({

View File

@@ -0,0 +1,131 @@
import type { VitePWAOptions } from 'vite-plugin-pwa';
import { VitePWA } from 'vite-plugin-pwa';
import { isProductionMode } from '../utils';
/**
* 配置 pwa
*/
export default function configPwaPlugin() {
if (isProductionMode()) {
// 生产启用
return VitePWA(enabled());
} else {
// 本地禁用
return VitePWA(disabled());
}
}
// 禁用
const disabled = (): Partial<VitePWAOptions> => {
return {
disable: true,
manifest: false,
selfDestroying: true,
devOptions: {
enabled: false,
disableRuntimeConfig: true,
},
};
};
// 启用
const enabled = (): Partial<VitePWAOptions> => {
return {
manifest: {
name: 'Orion Visor Community',
short_name: 'Orion Visor',
description: '一款高颜值、现代化的智能运维&轻量堡垒机平台。',
theme_color: '#212529',
icons: [{
src: 'manifest_logo_267.png',
sizes: '267x267',
type: 'image/png',
}],
},
registerType: 'autoUpdate',
workbox: {
// 缓存相关静态资源
globPatterns: ['**/*.{js,css,html,ico,png,jpg,svg}'],
// 配置自定义运行时缓存
runtimeCaching: [
isProductionMode()
? {
urlPattern: ({ url }) => url.origin === 'https://app-api.id',
handler: 'NetworkFirst',
options: {
cacheName: 'wisbayar-api',
cacheableResponse: {
statuses: [200]
}
}
} : {
urlPattern: ({ url }) => url.origin === 'https://app-api-0.com',
handler: 'NetworkFirst',
options: {
cacheName: 'wisbayar-api',
cacheableResponse: {
statuses: [200]
}
}
},
{
urlPattern: /\.(?:png|jpg|jpeg|svg)$/,
handler: 'CacheFirst',
options: {
cacheName: 'wisbayar-images',
expiration: {
// 最多30个图
maxEntries: 30
}
}
},
{
urlPattern: /.*\.js.*/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'wisbayar-js',
// 最多缓存30个, 超过的按照LRU原则删除
expiration: {
maxEntries: 30,
maxAgeSeconds: 7 * 24 * 60 * 60
},
cacheableResponse: {
statuses: [200]
}
}
},
{
urlPattern: /.*\.css.*/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'wisbayar-css',
expiration: {
maxEntries: 20,
maxAgeSeconds: 7 * 24 * 60 * 60
},
cacheableResponse: {
statuses: [200]
}
}
},
{
urlPattern: /.*\.html.*/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'wisbayar-html',
expiration: {
maxEntries: 20,
maxAgeSeconds: 7 * 24 * 60 * 60
},
cacheableResponse: {
statuses: [200]
}
}
}
]
},
devOptions: {
enabled: true,
},
};
};

View File

@@ -1,8 +1,15 @@
export default {};
/**
* 是否生成打包报告
*/
export default {};
export function isReportMode(): boolean {
return process.env.REPORT === 'true';
}
/**
* 是否为生产模式
*/
export function isProductionMode(): boolean {
return process.env.NODE_ENV === 'production';
}

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