Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20a6457c2b | ||
|
|
e43843d087 | ||
|
|
b4ecad4356 | ||
|
|
5d9fcf7265 | ||
|
|
1e9805c99f | ||
|
|
5609f320da | ||
|
|
c7e520d34b | ||
|
|
31971b4e06 | ||
|
|
2a144cfa57 | ||
|
|
eb9e184d79 | ||
|
|
386e440f02 | ||
|
|
b8bd1d4b22 | ||
|
|
198dcd944c | ||
|
|
8a7976a4dd | ||
|
|
3d853eb7d4 | ||
|
|
30349cb362 | ||
|
|
d4039501b2 | ||
|
|
29e3565af9 | ||
|
|
f8ea51eb8c | ||
|
|
2aaf3ee907 | ||
|
|
6c0f20a6de | ||
|
|
2451f4af82 | ||
|
|
127f4df302 | ||
|
|
2819df9c31 | ||
|
|
2abf5bcf08 | ||
|
|
03c334a507 | ||
|
|
87bbcfa845 | ||
|
|
8caf8de9f6 | ||
|
|
6bd2640af7 | ||
|
|
e98bace51b | ||
|
|
b0afc8f80a | ||
|
|
149e5bc40c | ||
|
|
81ae46c181 | ||
|
|
97778f336f | ||
|
|
0ea7593c8f | ||
|
|
2c025c800f | ||
|
|
779a84ae25 | ||
|
|
5349237fb3 | ||
|
|
f885ae7599 | ||
|
|
67e434dc2f | ||
|
|
f4c5517f9f | ||
|
|
54ae18987c | ||
|
|
b392ddf0e7 | ||
|
|
4cef9b358e | ||
|
|
2fd069e1d5 | ||
|
|
13d883c223 | ||
|
|
8b0f5f9664 | ||
|
|
7413b7e932 | ||
|
|
6a7615e294 | ||
|
|
079622d776 | ||
|
|
201956855f |
60
README.md
@@ -2,8 +2,8 @@
|
||||
<img style="margin-right: 8px;" src="https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/2/27/8c687ef1-5711-4a93-9db0-79c010af7902.png" width="32px" height="32px"/> orion-ops-pro 是什么
|
||||
</h1>
|
||||
|
||||
`orion-ops-pro` 一款开箱即用的一站式智能运维平台, 提供了资产管理、资产授权、Web终端、WebSftp、角色管理、系统管理等功能。致力于简化运维团队的治理工作。它是根据 `orion-ops`
|
||||
的产品思路完全重构的一套系统, 重新设计了架构并优化交互逻辑, 操作更快捷友好。
|
||||
`orion-ops-pro` 是一款现代化、高颜值的一站式智能运维管理平台,集资产管理、资产授权、批量执行、Web终端、WebSftp、角色管理、系统管理等功能于一体,致力于简化运维团队的治理工作。它是基于 `orion-ops`
|
||||
的产品思路进行重构,技术架构升级,并优化了交互逻辑,让操作更快捷更友好。
|
||||
|
||||
<p style="text-align: left">
|
||||
<a target="_blank" style="text-decoration: none" href="https://app.codacy.com/gh/lijiahangmax/orion-ops-pro/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade">
|
||||
@@ -28,32 +28,31 @@
|
||||
|
||||
<br/>
|
||||
|
||||
当前版本: **1.0.1**
|
||||
当前版本: **1.0.2**
|
||||
github: https://github.com/lijiahangmax/orion-ops-pro
|
||||
gitee: https://gitee.com/lijiahangmax/orion-ops-pro
|
||||
文档: https://lijiahangmax.gitee.io/orion-ops-pro/#/
|
||||
demo: http://101.43.254.243:1081/#/
|
||||
demo: http://101.43.254.243:1081/
|
||||
|
||||
演示账号: `admin`
|
||||
演示密码: `admin`
|
||||
留个小星星再走吧⭐
|
||||
⭐ 体验后可以点一下 `star` 这对我很重要
|
||||
📞 合作/功能定制请联系底部 备注: '定制'
|
||||
|
||||
## 特性
|
||||
|
||||
* 易用便捷: 极简配置, 开箱即用, 支持 Docker 部署方式。
|
||||
* 资产管理: 支持灵活配置主机分组, 统一管理主机、秘钥和身份。
|
||||
* 资产授权: 可将资产数据授权给指定角色和用户。
|
||||
* 资产管理: 支持灵活配置主机分组, 实现对主机、秘钥和身份的统一管理。
|
||||
* 资产授权: 可将资产数据授权给指定角色和用户, 确保数据安全性。
|
||||
* 权限控制: 全面管理用户角色, 支持动态菜单配置和强制下线等功能。
|
||||
* 在线终端: 提供便捷的在线 Web 终端服务, 支持快捷命令、自定义快捷键和主题风格。
|
||||
* 文件管理: 实现远程主机大文件的批量上传、下载和在线编辑等操作。
|
||||
* 可扩展性: 前后端代码规范统一, 代码质量高、健壮且易于阅读和扩展。
|
||||
|
||||
[comment]: <> ( FIXME * 批量操作: 支持远程主机批量执行命令 以及 批量执行上传文件)
|
||||
* 批量操作: 支持远程主机批量执行 shell 命令。
|
||||
* 操作日志: 记录用户操作日志,确保操作可追溯, 提高系统安全性。
|
||||
* 可扩展性: 前后端代码规范统一、代码质量高、健壮且易于阅读和扩展。
|
||||
|
||||
[comment]: <> ( FIXME * 调度任务: 维护 cron 表达式, 定时执行主机命令)
|
||||
|
||||
[comment]: <> ( FIXME * 功能强大: 命令批量执行, 任务定时调度, 远程日志查看, 操作日志全记录等)
|
||||
|
||||
## 快速开始
|
||||
|
||||
docker安装: https://lijiahangmax.gitee.io/orion-ops-pro/#/quickstart/docker-install
|
||||
@@ -78,32 +77,38 @@ roadmap: https://lijiahangmax.gitee.io/orion-ops-pro/#/about/roadmap
|
||||
|
||||
> 工作台
|
||||
|
||||

|
||||

|
||||
|
||||
> 资产管理
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
> 主机终端
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
> 批量执行
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
> 用户管理
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
> 系统管理
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## 联系我
|
||||
|
||||
@@ -112,7 +117,8 @@ roadmap: https://lijiahangmax.gitee.io/orion-ops-pro/#/about/roadmap
|
||||
<img src="https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/2/27/4f1c4e77-8e36-45a3-8be6-9da5387bb96e.jpg" alt="wx" width="298px" height="398px"/>
|
||||
</div>
|
||||
|
||||
📧 微信添加备注: ops
|
||||
📧 咨询问题微信备注: ops
|
||||
📧 合作/功能定制备注: 合作
|
||||
|
||||
## 支持一下
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
version: '3.3'
|
||||
services:
|
||||
orion-ops-pro:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-ops-pro:1.0.1
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-ops-pro:1.0.2
|
||||
ports:
|
||||
- 1081:80
|
||||
environment:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
mv ../../orion-ops-launch/target/orion-ops-launch.jar ./
|
||||
mv ../../orion-ops-ui/dist ./dist
|
||||
docker build -t orion-ops-pro:1.0.1 .
|
||||
docker build -t orion-ops-pro:1.0.2 .
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
<img style="margin-right: 8px;" src="./assert/logo.svg" width="32px" height="32px"/> orion-ops-pro 是什么
|
||||
</h1>
|
||||
|
||||
`orion-ops-pro` 一款开箱即用的一站式智能运维平台, 提供了资产管理、资产授权、Web终端、WebSftp、角色管理、系统管理等功能。致力于简化运维团队的治理工作。它是根据 `orion-ops`
|
||||
的产品思路完全重构的一套系统, 重新设计了架构并优化交互逻辑, 操作更快捷友好。
|
||||
`orion-ops-pro`
|
||||
是一款现代化、高颜值的一站式智能运维管理平台,集资产管理、资产授权、批量执行、Web终端、WebSftp、角色管理、系统管理等功能于一体,致力于简化运维团队的治理工作。它是基于 `orion-ops`
|
||||
的产品思路进行重构,技术架构升级,并优化了交互逻辑,让操作更快捷更友好。
|
||||
|
||||
<p style="text-align: left">
|
||||
<a target="_blank" style="text-decoration: none" href="https://app.codacy.com/gh/lijiahangmax/orion-ops-pro/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade">
|
||||
@@ -28,31 +29,28 @@
|
||||
|
||||
<br/>
|
||||
|
||||
当前版本: **1.0.1**
|
||||
当前版本: **1.0.2**
|
||||
github: https://github.com/lijiahangmax/orion-ops-pro
|
||||
gitee: https://gitee.com/lijiahangmax/orion-ops-pro
|
||||
文档: https://lijiahangmax.gitee.io/orion-ops-pro/#/
|
||||
demo: http://101.43.254.243:1081/#/
|
||||
demo: http://101.43.254.243:1081/
|
||||
|
||||
演示账号: `admin`
|
||||
演示密码: `admin`
|
||||
留个小星星再走吧⭐
|
||||
⭐ 体验后可以点一下 `star` 这对我很重要
|
||||
📞 合作/功能定制请联系底部 备注: '合作'
|
||||
|
||||
## 特性
|
||||
|
||||
* 易用便捷: 极简配置, 开箱即用, 支持 Docker 部署方式。
|
||||
* 资产管理: 支持灵活配置主机分组, 统一管理主机、秘钥和身份。
|
||||
* 资产授权: 可将资产数据授权给指定角色和用户。
|
||||
* 资产管理: 支持灵活配置主机分组, 实现对主机、秘钥和身份的统一管理。
|
||||
* 资产授权: 可将资产数据授权给指定角色和用户, 确保数据安全性。
|
||||
* 权限控制: 全面管理用户角色, 支持动态菜单配置和强制下线等功能。
|
||||
* 在线终端: 提供便捷的在线 Web 终端服务, 支持快捷命令、自定义快捷键和主题风格。
|
||||
* 文件管理: 实现远程主机大文件的批量上传、下载和在线编辑等操作。
|
||||
* 可扩展性: 前后端代码规范统一, 代码质量高、健壮且易于阅读和扩展。
|
||||
|
||||
[comment]: <> ( FIXME * 批量操作: 支持远程主机批量执行命令 以及 批量执行上传文件)
|
||||
|
||||
[comment]: <> ( FIXME * 调度任务: 维护 cron 表达式, 定时执行主机命令)
|
||||
|
||||
[comment]: <> ( FIXME * 功能强大: 命令批量执行, 任务定时调度, 远程日志查看, 操作日志全记录等)
|
||||
* 批量操作: 支持远程主机批量执行 shell 命令。
|
||||
* 操作日志: 记录用户操作日志,确保操作可追溯, 提高系统安全性。
|
||||
* 可扩展性: 前后端代码规范统一、代码质量高、健壮且易于阅读和扩展。
|
||||
|
||||
## 快速开始
|
||||
|
||||
@@ -94,6 +92,12 @@ roadmap: https://lijiahangmax.gitee.io/orion-ops-pro/#/about/roadmap
|
||||

|
||||

|
||||
|
||||
> 批量执行
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
> 用户管理
|
||||
|
||||

|
||||
@@ -112,7 +116,8 @@ roadmap: https://lijiahangmax.gitee.io/orion-ops-pro/#/about/roadmap
|
||||
<img src="./assert/img/wx.jpg" alt="wx" width="298px" height="398px"/>
|
||||
</div>
|
||||
|
||||
📧 微信添加备注: ops
|
||||
📧 咨询问题微信备注: ops
|
||||
📧 合作/功能定制备注: 合作
|
||||
|
||||
## 支持一下
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# orion-ops-pro <small>1.0.1</small>
|
||||
# orion-ops-pro <small>1.0.2</small>
|
||||
|
||||
> 一款开箱即用的运维平台。
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* [常见问题](quickstart/faq.md)
|
||||
* 操作手册
|
||||
* [资产管理](operator/asset.md)
|
||||
* [主机运维](operator/host_ops.md)
|
||||
* [运维审计](operator/host_audit.md)
|
||||
* [主机运维](operator/host-ops.md)
|
||||
* [运维审计](operator/asset-audit.md)
|
||||
* [用户管理](operator/user.md)
|
||||
* [系统管理](operator/system.md)
|
||||
|
||||
@@ -1,17 +1,36 @@
|
||||
> 版本号严格遵循 Semver 规范。
|
||||
|
||||
## v1.0.2
|
||||
|
||||
`2024-03-22` `release`
|
||||
|
||||
* 🐞 修复 SFTP 加载失败后一直 loading
|
||||
* 🐞 修复 主机终端搜索框报错
|
||||
* 🐞 修复 SSH 配置未启用还可以连接
|
||||
* 🐞 修复 主机配置保存后无法修改状态
|
||||
* 🐞 修复 添加快捷命令时编辑器无代码提示
|
||||
* 🔨 修改 菜单路由命名逻辑修改
|
||||
* 🔨 优化 前端组件命名规范化
|
||||
* 🔨 优化 前端 emit 命名规范化
|
||||
* 🌈 新增 双击终端会话 Tab 快速复制
|
||||
* 🌈 新增 批量执行命令
|
||||
* 🌈 新增 命令执行日志
|
||||
* 🌈 新增 执行模板功能
|
||||
|
||||
[如何升级](/about/update.md?id=_v102)
|
||||
|
||||
## v1.0.1
|
||||
|
||||
`2024-03-06` `release`
|
||||
|
||||
🐞 修复 用户操作日志条件重置后类型框数据不正常的问题
|
||||
🩰 修改 主机连接日志 UI
|
||||
🌈 新增 SFTP 使用日志列表
|
||||
🌈 新增 主机连接日志强制下线会话
|
||||
🌈 新增 主机连接日志删除/清理
|
||||
🌈 新增 用户操作日志日志删除/清理
|
||||
🌈 新增 用户操作日志日志删除/清理
|
||||
🔨 优化 用户锁定次数/时间可配置
|
||||
* 🐞 修复 用户操作日志条件重置后类型框数据不正常的问题
|
||||
* 🩰 修改 主机连接日志 UI
|
||||
* 🌈 新增 SFTP 使用日志列表
|
||||
* 🌈 新增 主机连接日志强制下线会话
|
||||
* 🌈 新增 主机连接日志删除/清理
|
||||
* 🌈 新增 用户操作日志日志删除/清理
|
||||
* 🌈 新增 用户操作日志日志删除/清理
|
||||
* 🔨 优化 用户锁定次数/时间可配置
|
||||
|
||||
[如何升级](/about/update.md?id=_v101)
|
||||
|
||||
@@ -19,8 +38,8 @@
|
||||
|
||||
`2024-03-01` `release`
|
||||
|
||||
🌈 新增 用户自定义终端标签颜色
|
||||
🔨 拓展数据模块添加缓存
|
||||
* 🌈 新增 用户自定义终端标签颜色
|
||||
* 🔨 拓展数据模块添加缓存
|
||||
|
||||
[如何升级](/about/update.md?id=_v100)
|
||||
|
||||
@@ -28,15 +47,15 @@
|
||||
|
||||
`2024-02-28` `preview`
|
||||
|
||||
🌈 主机管理
|
||||
🌈 主机秘钥
|
||||
🌈 主机身份
|
||||
🌈 资产授权
|
||||
🌈 主机终端
|
||||
🌈 连接日志
|
||||
🌈 角色管理
|
||||
🌈 用户管理
|
||||
🌈 操作日志
|
||||
🌈 系统菜单
|
||||
🌈 数据字典项
|
||||
🌈 数据字典值
|
||||
* 🌈 主机管理
|
||||
* 🌈 主机秘钥
|
||||
* 🌈 主机身份
|
||||
* 🌈 资产授权
|
||||
* 🌈 主机终端
|
||||
* 🌈 连接日志
|
||||
* 🌈 角色管理
|
||||
* 🌈 用户管理
|
||||
* 🌈 操作日志
|
||||
* 🌈 系统菜单
|
||||
* 🌈 数据字典项
|
||||
* 🌈 数据字典值
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
## 已完成 ✅
|
||||
## 功能排期 ⏳
|
||||
|
||||
## 开发中 ⏱
|
||||
|
||||
## 未开始 ⏳
|
||||
|
||||
* 资产管理表结构优化
|
||||
* 批量执行
|
||||
* 定时执行
|
||||
* 文件夹书签
|
||||
* 文件重复删除/重命名 可配置
|
||||
* tracker 可配置
|
||||
* 断开连接后回车重新连接
|
||||
* template 配置默认主机
|
||||
* 批量上传
|
||||
* 站内消息
|
||||
* 终端背景图片
|
||||
* 资产授权 UI 改版
|
||||
|
||||
@@ -1,5 +1,218 @@
|
||||
⚡ 注意: 应用不支持跨版本升级, 可以进行多次升级
|
||||
|
||||
## v1.0.2
|
||||
|
||||
> sql 脚本
|
||||
|
||||
```sql
|
||||
-- 表结构
|
||||
ALTER TABLE `host_connect_log`
|
||||
MODIFY COLUMN `start_time` datetime(3) NULL DEFAULT NULL COMMENT '开始时间' AFTER `token`,
|
||||
MODIFY COLUMN `end_time` datetime(3) NULL DEFAULT NULL COMMENT '结束时间' AFTER `start_time`;
|
||||
|
||||
CREATE TABLE `exec_host_log`
|
||||
(
|
||||
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`log_id` bigint(0) NULL DEFAULT NULL COMMENT '执行日志id',
|
||||
`host_id` bigint(0) NULL DEFAULT NULL COMMENT '主机id',
|
||||
`host_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主机名称',
|
||||
`host_address` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主机地址',
|
||||
`status` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '执行状态',
|
||||
`command` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '执行命令',
|
||||
`parameter` json NULL COMMENT '执行参数',
|
||||
`exit_status` int(0) NULL DEFAULT NULL COMMENT '退出码',
|
||||
`log_path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日志路径',
|
||||
`error_message` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '错误信息',
|
||||
`start_time` datetime(3) NULL DEFAULT NULL COMMENT '执行开始时间',
|
||||
`finish_time` datetime(3) NULL DEFAULT NULL COMMENT '执行结束时间',
|
||||
`create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_log_id` (`log_id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
CHARACTER SET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '批量执行主机日志'
|
||||
ROW_FORMAT = Dynamic;
|
||||
|
||||
CREATE TABLE `exec_log`
|
||||
(
|
||||
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`user_id` bigint(0) NULL DEFAULT NULL COMMENT '执行用户id',
|
||||
`username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '执行用户名',
|
||||
`source` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '执行来源',
|
||||
`source_id` bigint(0) NULL DEFAULT NULL COMMENT '执行来源id',
|
||||
`description` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '执行描述',
|
||||
`command` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '执行命令',
|
||||
`parameter_schema` json NULL COMMENT '参数 schema',
|
||||
`timeout` int(0) NULL DEFAULT NULL COMMENT '超时时间',
|
||||
`status` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '执行状态',
|
||||
`start_time` datetime(3) NULL DEFAULT NULL COMMENT '执行开始时间',
|
||||
`finish_time` datetime(3) NULL DEFAULT NULL COMMENT '执行完成时间',
|
||||
`create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_user_id` (`user_id`) USING BTREE,
|
||||
INDEX `idx_source` (`source`, `source_id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
CHARACTER SET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '批量执行日志'
|
||||
ROW_FORMAT = Dynamic;
|
||||
|
||||
CREATE TABLE `exec_template`
|
||||
(
|
||||
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称',
|
||||
`command` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '命令',
|
||||
`timeout` int(0) NULL DEFAULT 0 COMMENT '超时时间秒 0不超时',
|
||||
`parameter` json NULL COMMENT '参数',
|
||||
`create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
CHARACTER SET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '执行模板'
|
||||
ROW_FORMAT = Dynamic;
|
||||
|
||||
-- 菜单配置
|
||||
TRUNCATE `system_menu`;
|
||||
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, '', '2023-07-28 10:55:38', '2024-03-07 19:03:52', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (8, 0, '项目地址 github', NULL, 1, 1000, 1, 1, 1, 0, 'icon-github', 'https://github.com/lijiahangmax/orion-ops-pro', '', '2023-07-28 11:04:59', '2023-10-12 15:21:22', '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 (11, 0, '项目地址 gitee', NULL, 1, 1010, 1, 1, 1, 0, 'icon-gitlab', 'https://gitee.com/lijiahangmax/orion-ops-pro', '', '2023-08-02 18:08:07', '2023-08-11 18:11:34', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (12, 0, '系统设置', NULL, 1, 800, 1, 1, 1, 0, 'icon-tool', NULL, '', '2023-08-02 18:24:24', '2024-03-07 19:03:57', '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 (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 (22, 10, '更新状态', 'infra:system-role:update-status', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:37:58', '2023-10-27 01:20:46', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (23, 10, '查询角色', 'infra:system-role:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:38:26', '2023-10-27 01:20:46', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (24, 10, '分配菜单', 'infra:system-role:grant-menu', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:39:41', '2023-10-27 01:20:46', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (25, 10, '删除角色', 'infra:system-role:delete', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:40:45', '2023-10-27 01:20:46', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (26, 13, '创建菜单', 'infra:system-menu:create', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:41:30', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (27, 13, '修改菜单', 'infra:system-menu:update', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:41:55', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (28, 13, '修改状态', 'infra:system-menu:update-status', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:42:41', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (29, 13, '查询菜单', 'infra:system-menu:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:42:57', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (30, 13, '删除菜单', 'infra:system-menu:delete', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-15 16:43:16', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (48, 5, '用户管理', NULL, 2, 10, 1, 1, 1, 0, 'IconUserAdd', NULL, 'user', '2023-08-16 10:19:24', '2024-03-07 19:10:21', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (49, 48, '创建用户', 'infra:system-user:create', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-16 10:19:24', '2023-10-27 01:20:46', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (50, 48, '修改用户', 'infra:system-user:update', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-16 10:19:24', '2023-10-27 01:20:46', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (51, 48, '查询用户', 'infra:system-user:query', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-16 10:19:24', '2023-10-27 01:20:46', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (52, 48, '删除用户', 'infra:system-user:delete', 3, 40, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-16 10:19:24', '2023-10-27 01:20:46', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (53, 13, '刷新缓存', 'infra:system-menu:management:refresh-cache', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-16 10:29:10', '2023-12-27 12:39:48', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (60, 48, '修改用户状态', 'infra:system-user:update-status', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-16 11:49:04', '2023-10-27 01:20:46', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (61, 48, '分配用户角色', 'infra:system-user:grant-role', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-16 11:49:23', '2023-10-27 01:20:46', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (62, 48, '重置用户密码', 'infra:system-user:management:reset-password', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-08-16 11:49:50', '2023-12-27 12:42:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (63, 0, '资产管理', NULL, 1, 300, 1, 1, 1, 0, 'IconStorage', NULL, '', '2023-09-11 14:17:31', '2024-03-07 19:03:39', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (64, 63, '主机管理', NULL, 2, 40, 1, 1, 1, 0, 'IconDesktop', NULL, 'hostList', '2023-09-11 14:17:31', '2024-03-07 19:09:20', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (65, 64, '查询主机', 'asset:host:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-11 14:17:31', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (66, 64, '创建主机', 'asset:host:create', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-11 14:17:31', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (67, 64, '修改主机', 'asset:host:update', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-11 14:17:31', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (68, 64, '删除主机', 'asset:host:delete', 3, 40, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-11 14:17:31', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (70, 64, '修改配置', 'asset:host:update-config', 3, 60, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-14 16:27:18', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (72, 63, '主机身份', NULL, 2, 60, 1, 1, 1, 0, 'IconIdcard', NULL, 'hostIdentity', '2023-09-20 11:47:18', '2024-03-07 19:09:31', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (73, 72, '查询主机身份', 'asset:host-identity:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-20 11:47:18', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (74, 72, '创建主机身份', 'asset:host-identity:create', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-20 11:47:18', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (75, 72, '修改主机身份', 'asset:host-identity:update', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-20 11:47:18', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (76, 72, '删除主机身份', 'asset:host-identity:delete', 3, 40, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-20 11:47:18', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (79, 63, '主机秘钥', NULL, 2, 50, 1, 1, 1, 0, 'IconLock', NULL, 'hostKey', '2023-09-20 11:47:18', '2024-03-07 19:09:26', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (80, 79, '查询主机秘钥', 'asset:host-key:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-20 11:47:18', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (81, 79, '创建主机秘钥', 'asset:host-key:create', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-20 11:47:18', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (82, 79, '修改主机秘钥', 'asset:host-key:update', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-20 11:47:18', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (83, 79, '删除主机秘钥', 'asset:host-key:delete', 3, 40, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-20 11:47:18', '2023-10-27 01:15:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (84, 79, '查询主机秘钥详情', 'asset:host-key:query-detail', 3, 50, 1, 1, 1, 0, NULL, NULL, NULL, '2023-09-20 11:47:18', '2023-11-09 15:52:57', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (94, 5, '个人中心', NULL, 2, 20, 0, 1, 0, 0, 'IconUser', NULL, 'userInfo', '2023-10-08 18:53:01', '2023-11-02 11:47:34', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (97, 12, '数据字典项', NULL, 2, 20, 1, 1, 1, 0, 'IconBook', NULL, 'dictKey', '2023-10-17 11:38:13', '2024-03-07 19:10:45', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (99, 97, '创建字典配置项', 'infra:dict-key:create', 3, 110, 1, 1, 1, 0, NULL, NULL, NULL, '2023-10-17 11:38:13', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (100, 97, '修改字典配置项', 'infra:dict-key:update', 3, 120, 1, 1, 1, 0, NULL, NULL, NULL, '2023-10-17 11:38:13', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (101, 97, '删除字典配置项', 'infra:dict-key:delete', 3, 130, 1, 1, 1, 0, NULL, NULL, NULL, '2023-10-17 11:38:13', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (105, 12, '数据字典值', NULL, 2, 30, 1, 1, 1, 0, 'IconNav', NULL, 'dictValue', '2023-10-17 11:38:13', '2024-03-07 19:10:49', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (106, 105, '查询字典配置值', 'infra:dict-value:query', 3, 210, 1, 1, 1, 0, NULL, NULL, NULL, '2023-10-17 11:38:18', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (107, 105, '创建字典配置值', 'infra:dict-value:create', 3, 220, 1, 1, 1, 0, NULL, NULL, NULL, '2023-10-17 11:38:18', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (108, 105, '修改字典配置值', 'infra:dict-value:update', 3, 230, 1, 1, 1, 0, NULL, NULL, NULL, '2023-10-17 11:38:18', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (109, 105, '删除字典配置值', 'infra:dict-value:delete', 3, 240, 1, 1, 1, 0, NULL, NULL, NULL, '2023-10-17 11:38:18', '2023-10-27 01:16:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (120, 97, '查询字典配置项', 'infra:dict-key:query', 3, 100, 1, 1, 1, 0, NULL, NULL, NULL, '2023-10-20 11:27:12', '2023-12-27 18:39:22', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (121, 97, '刷新缓存', 'infra:dict-key:management:refresh-cache', 3, 140, 1, 1, 1, 0, NULL, NULL, NULL, '2023-10-27 15:50:04', '2023-12-27 12:40:12', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (122, 5, '操作日志', NULL, 2, 30, 1, 1, 1, 0, 'IconCalendarClock', NULL, 'operatorLog', '2023-11-01 14:09:36', '2024-03-07 19:10:30', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (123, 122, '查询操作日志', 'infra:operator-log:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-11-02 11:22:54', '2023-11-02 11:22:54', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (124, 48, '查询用户会话', 'infra:system-user:query-session', 3, 50, 1, 1, 1, 0, NULL, NULL, NULL, '2023-11-02 11:24:14', '2023-11-02 11:24:14', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (125, 48, '下线用户会话', 'infra:system-user:management:offline-session', 3, 60, 1, 1, 1, 0, NULL, NULL, NULL, '2023-11-02 11:24:37', '2023-12-27 12:39:17', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (126, 48, '查询用户登录日志', 'infra:system-user:login-history', 3, 70, 1, 1, 1, 0, NULL, NULL, NULL, '2023-12-27 15:05:37', '2023-12-27 15:07:19', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (129, 64, '编辑主机分组', 'asset:host-group:update', 3, 100, 1, 1, 1, 0, NULL, NULL, NULL, '2023-11-13 18:16:32', '2023-12-01 01:47:58', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (133, 144, '主机分组授权', 'asset:host-group:grant', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-11-23 18:08:57', '2023-11-30 22:39:53', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (142, 144, '主机秘钥授权', 'asset:host-key:grant', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2023-11-30 21:06:13', '2023-11-30 22:39:47', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (143, 144, '主机身份授权', 'asset:host-identity:grant', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2023-11-30 21:06:26', '2023-11-30 22:40:11', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (144, 63, '资产授权', NULL, 2, 70, 1, 1, 1, 0, 'icon-safe', NULL, 'assetGrant', '2023-11-30 22:38:57', '2023-11-30 22:39:06', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (145, 0, '主机运维', NULL, 1, 400, 1, 1, 1, 1, 'IconDesktop', NULL, '', '2023-12-04 23:33:25', '2024-03-07 19:03:46', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (146, 145, '主机终端', NULL, 2, 10, 1, 1, 1, 1, 'icon-code-square', NULL, 'terminal', '2023-12-04 23:38:01', '2024-03-07 19:09:44', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (148, 152, '连接日志', NULL, 2, 10, 1, 1, 1, 0, 'IconLink', NULL, 'connectLog', '2023-12-26 22:53:07', '2024-03-07 19:09:59', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (149, 148, '查询连接日志', 'asset:host-connect-log:management:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-12-26 22:53:08', '2024-03-04 13:40:42', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (151, 146, '连接终端', 'asset:host-terminal:access', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-12-27 18:56:33', '2023-12-27 18:56:33', '2', '2', 0);
|
||||
INSERT INTO `system_menu` VALUES (152, 0, '运维审计', NULL, 1, 410, 1, 1, 1, 0, 'IconSafe', NULL, '', '2024-01-04 17:54:56', '2024-03-07 19:02:28', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (153, 148, '删除连接日志', 'asset:host-connect-log:management:delete', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-04 13:39:46', '2024-03-04 13:40:29', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (154, 148, '清空连接日志', 'asset:host-connect-log:management:clear', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-04 13:40:05', '2024-03-04 13:40:34', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (155, 148, '强制断开连接', 'asset:host-connect-log:management:force-offline', 3, 40, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-04 13:41:02', '2024-03-05 23:32:01', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (156, 122, '删除操作日志', 'infra:operator-log:delete', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-04 17:06:55', '2024-03-04 17:08:22', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (157, 122, '清空操作日志', 'infra:operator-log:clear', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-04 17:07:25', '2024-03-04 17:08:27', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (158, 152, 'SFTP 操作日志', NULL, 2, 20, 1, 1, 1, 0, 'IconFile', NULL, 'sftpLog', '2024-03-05 15:30:13', '2024-03-07 19:10:05', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (159, 158, '查询 SFTP 操作日志', 'asset:host-sftp-log:management:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-05 15:31:02', '2024-03-05 15:57:20', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (160, 158, '删除 SFTP 操作日志', 'asset:host-sftp-log:management:delete', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-05 15:31:17', '2024-03-05 15:57:30', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (161, 145, '执行模板', NULL, 2, 50, 1, 1, 1, 0, 'IconBookmark', NULL, 'execTemplate', '2024-03-07 18:32:41', '2024-03-21 14:03:17', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (162, 161, '查询执行模板', 'asset:exec-template:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-07 18:32:41', '2024-03-07 18:32:41', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (163, 161, '创建执行模板', 'asset:exec-template:create', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-07 18:32:41', '2024-03-07 18:32:41', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (164, 161, '修改执行模板', 'asset:exec-template:update', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-07 18:32:41', '2024-03-07 18:32:41', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (165, 161, '删除执行模板', 'asset:exec-template:delete', 3, 40, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-07 18:32:41', '2024-03-07 18:32:41', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (167, 145, '执行记录', NULL, 2, 30, 1, 1, 1, 0, 'icon-history', NULL, 'execLog', '2024-03-13 15:08:23', '2024-03-13 15:28:29', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (168, 167, '查询执行记录', 'asset:exec-log:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:08:23', '2024-03-13 15:14:32', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (169, 167, '删除执行记录', 'asset:exec-log:delete', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:08:23', '2024-03-13 15:32:09', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (170, 167, '清理执行记录', 'asset:exec-log:management:clear', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:08:23', '2024-03-13 15:30:09', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (172, 145, '批量执行', NULL, 2, 20, 1, 1, 1, 0, 'icon-thunderbolt', NULL, 'execCommand', '2024-03-13 15:08:23', '2024-03-13 15:29:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (173, 172, '执行命令', 'asset:exec:exec-command', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:08:23', '2024-03-13 15:25:41', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (174, 172, '中断执行', 'asset:exec:interrupt-exec', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:25:36', '2024-03-13 15:25:57', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (175, 145, '执行日志新页面', NULL, 2, 40, 0, 1, 0, 1, 'IconUnorderedList', NULL, 'execLogView', '2024-03-21 14:03:10', '2024-03-21 14:03:10', '1', '1', 0);
|
||||
|
||||
-- 字典配置项
|
||||
DELETE FROM `dict_key` WHERE `id` >= 34;
|
||||
INSERT INTO `dict_key` VALUES (34, 'execStatus', 'STRING', '[{\"name\": \"color\", \"type\": \"STRING\"}]', '批量执行状态', '2024-03-13 15:08:43', '2024-03-13 15:39:46', '1', '1', 0);
|
||||
INSERT INTO `dict_key` VALUES (35, 'execHostStatus', 'STRING', '[{\"name\": \"color\", \"type\": \"COLOR\"}, {\"name\": \"execColor\", \"type\": \"COLOR\"}]', '主机执行状态', '2024-03-13 15:09:10', '2024-03-17 20:31:07', '1', '1', 0);
|
||||
|
||||
-- 字典配置值
|
||||
DELETE FROM `dict_value` WHERE `id` >= 232;
|
||||
INSERT INTO `dict_value` VALUES (232, 1, 'operatorLogModule', 'asset:exec-template', '执行模板', '{}', 2070, '2024-03-07 18:32:41', '2024-03-07 18:32:41', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (233, 2, 'operatorLogType', 'exec-template:create', '创建执行模板', '{}', 110, '2024-03-07 18:32:41', '2024-03-07 18:32:41', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (234, 2, 'operatorLogType', 'exec-template:update', '更新执行模板', '{}', 120, '2024-03-07 18:32:41', '2024-03-07 18:32:41', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (235, 2, 'operatorLogType', 'exec-template:delete', '删除执行模板', '{}', 130, '2024-03-07 18:32:41', '2024-03-07 18:32:41', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (236, 1, 'operatorLogModule', 'asset:exec', '批量执行', '{}', 2080, '2024-03-13 15:08:43', '2024-03-13 15:21:20', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (237, 2, 'operatorLogType', 'exec:delete-log', '删除执行记录', '{}', 40, '2024-03-13 15:08:43', '2024-03-18 17:26:43', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (238, 2, 'operatorLogType', 'exec:clear-log', '清理执行记录', '{}', 50, '2024-03-13 15:08:43', '2024-03-18 17:26:44', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (239, 2, 'operatorLogType', 'exec:delete-host-log', '删除主机执行记录', '{}', 60, '2024-03-13 15:08:43', '2024-03-18 17:26:47', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (240, 34, 'execStatus', 'WAITING', '等待中', '{\"color\": \"gray\"}', 10, '2024-03-13 15:08:43', '2024-03-13 15:53:55', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (241, 34, 'execStatus', 'RUNNING', '运行中', '{\"color\": \"green\"}', 20, '2024-03-13 15:08:43', '2024-03-13 15:53:55', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (242, 34, 'execStatus', 'COMPLETED', '执行完成', '{\"color\": \"arcoblue\"}', 30, '2024-03-13 15:08:43', '2024-03-13 15:53:55', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (243, 34, 'execStatus', 'FAILED', '执行失败', '{\"color\": \"red\"}', 40, '2024-03-13 15:08:43', '2024-03-13 15:53:55', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (244, 35, 'execHostStatus', 'WAITING', '等待中', '{\"color\": \"gray\", \"execColor\": \"#94D82D\"}', 10, '2024-03-13 15:09:11', '2024-03-19 19:09:53', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (245, 35, 'execHostStatus', 'RUNNING', '运行中', '{\"color\": \"green\", \"execColor\": \"#339AF0\"}', 20, '2024-03-13 15:09:11', '2024-03-17 20:50:53', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (246, 35, 'execHostStatus', 'COMPLETED', '执行完成', '{\"color\": \"arcoblue\", \"execColor\": \"#5C7CFA\"}', 30, '2024-03-13 15:09:11', '2024-03-17 20:42:17', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (247, 35, 'execHostStatus', 'FAILED', '执行失败', '{\"color\": \"red\", \"execColor\": \"#FF6B6B\"}', 40, '2024-03-13 15:09:11', '2024-03-17 20:42:39', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (248, 35, 'execHostStatus', 'INTERRUPTED', '已中断', '{\"color\": \"purple\", \"execColor\": \"#845EF7\"}', 60, '2024-03-13 15:09:11', '2024-03-19 19:05:03', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (249, 2, 'operatorLogType', 'exec:exec-command', '执行主机命令', '{}', 10, '2024-03-13 15:08:43', '2024-03-18 17:26:31', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (250, 2, 'operatorLogType', 'exec:interrupt-exec', '中断执行命令', '{}', 20, '2024-03-13 15:08:43', '2024-03-18 17:26:33', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (251, 2, 'operatorLogType', 'exec:interrupt-host', '中断主机命令', '{}', 30, '2024-03-13 15:08:43', '2024-03-18 17:26:34', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (252, 2, 'operatorLogType', 'exec:download-host-log', '下载执行日志', '{}', 70, '2024-03-18 17:25:44', '2024-03-18 17:26:49', '1', '1', 0);
|
||||
INSERT INTO `dict_value` VALUES (253, 35, 'execHostStatus', 'TIMEOUT', '执行超时', '{\"color\": \"orangered\", \"execColor\": \"#fA8C16\"}', 50, '2024-03-19 19:05:56', '2024-03-19 19:08:14', '1', '1', 0);
|
||||
```
|
||||
|
||||
## v1.0.1
|
||||
|
||||
> sql 脚本
|
||||
@@ -9,8 +222,8 @@ DROP TABLE IF EXISTS `command_template`;
|
||||
ALTER TABLE `operator_log` ADD INDEX `idx_type`(`type`);
|
||||
-- 菜单配置
|
||||
DELETE FROM `system_menu` WHERE id IN (148, 149);
|
||||
INSERT INTO `system_menu` VALUES (148, 152, '连接日志', NULL, 2, 10, 1, 1, 1, 0, 'IconLink', NULL, 'assetAuditConnectLog', '2023-12-26 22:53:07', '2024-03-05 23:31:23', NULL, '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (149, 148, '查询连接日志', 'asset:host-connect-log:management:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-12-26 22:53:08', '2024-03-04 13:40:42', NULL, '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (148, 152, '连接日志', NULL, 2, 10, 1, 1, 1, 0, 'IconLink', NULL, 'assetAuditConnectLog', '2023-12-26 22:53:07', '2024-03-05 23:31:23', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (149, 148, '查询连接日志', 'asset:host-connect-log:management:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-12-26 22:53:08', '2024-03-04 13:40:42', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (152, 0, '运维审计', NULL, 1, 410, 1, 1, 1, 0, 'IconSafe', NULL, 'assetAudit', '2024-01-04 17:54:56', '2024-03-05 23:31:10', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (153, 148, '删除连接日志', 'asset:host-connect-log:management:delete', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-04 13:39:46', '2024-03-04 13:40:29', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (154, 148, '清空连接日志', 'asset:host-connect-log:management:clear', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-04 13:40:05', '2024-03-04 13:40:34', '1', '1', 0);
|
||||
|
||||
|
Before Width: | Height: | Size: 561 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 584 KiB After Width: | Height: | Size: 100 KiB |
BIN
docs/assert/img/batch_exec.png
Normal file
|
After Width: | Height: | Size: 120 KiB |
BIN
docs/assert/img/batch_exec_log.png
Normal file
|
After Width: | Height: | Size: 108 KiB |
BIN
docs/assert/img/batch_exec_record.png
Normal file
|
After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 605 KiB After Width: | Height: | Size: 156 KiB |
|
Before Width: | Height: | Size: 530 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 609 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 509 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 504 KiB After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 563 KiB After Width: | Height: | Size: 147 KiB |
|
Before Width: | Height: | Size: 524 KiB After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 582 KiB After Width: | Height: | Size: 158 KiB |
|
Before Width: | Height: | Size: 552 KiB After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 554 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 613 KiB After Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 606 KiB After Width: | Height: | Size: 136 KiB |
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>关于orion-ops-pro</title>
|
||||
<title>关于 orion-ops-pro</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<meta name="description" content="Description">
|
||||
<link rel="icon" href="./assert/logo.svg">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
在主机终端页面打开的 `SSH` `SFTP` 连接都会记录下来。
|
||||
|
||||
* 详情: 查看连接详情
|
||||
* 断开: 断开连接
|
||||
* 断开: 断开会话连接
|
||||
* 删除: 删除连接记录
|
||||
* 清理: 根据条件清理数据
|
||||
|
||||
111
docs/operator/host-ops.md
Normal file
@@ -0,0 +1,111 @@
|
||||
### 主机终端
|
||||
|
||||
主机终端页面 支持 SSH, SFTP。
|
||||
打开后默认会进入新建连接页面, 页面的主机数据是用户授权的资产数据。
|
||||
鼠标移入列表内的主机上时, 右侧会出现 `打开 SSH` `打开 SFTP` `主机设置` `收藏` 的按钮。
|
||||
|
||||
> 主机设置
|
||||
|
||||
* SSH 配置: 可以自定义配置连接主机的 密码/秘钥/身份, 仅对自己生效, 不会修改全局配置, `秘钥` `身份` 数据是用户授权的资产数据
|
||||
* 标签颜色: 自定义配置标签的颜色, 可以用来区分环境等
|
||||
|
||||
> 顶部状态栏
|
||||
|
||||
* 全屏: 开启或关闭全屏
|
||||
|
||||
> 左侧状态栏
|
||||
|
||||
* 新建连接: 新建主机连接 `SSH` `SFTP`
|
||||
* 快捷键设置: 配置 `全局` `会话` `终端` 的快捷键
|
||||
* 显示设置: 配置终端 `显示偏好` `操作栏按钮` `右键菜单` 设置
|
||||
* 主题设置: 修改终端主题配色
|
||||
* 终端设置: 配置终端 `交互` `插件` `会话` 设置
|
||||
|
||||
> 右侧状态栏
|
||||
|
||||
* 命令片段: 自定义快速执行的命令片段, 双击直接执行
|
||||
* 传输列表: 打开文件传输列表, 当前会话下, 所有的文件上传下载传输都会显示在这里
|
||||
* 截图: 截屏终端并且自动下载
|
||||
|
||||
> 文件传输
|
||||
|
||||
点击上传或者下载后会自动添加到传输列表。
|
||||
|
||||
* 上传: 关闭页面自动清除
|
||||
* 下载: 下载完成后自动下载, 关闭页面自动清除
|
||||
|
||||
> SFTP
|
||||
|
||||
* 预览: 默认只能预览 2MB 以内的普通文件, 这个大小可以在前端 env 文件中修改 `VITE_SFTP_PREVIEW_MB`
|
||||
* 上传: 如果文件已存在则自动重命名之前的文件
|
||||
|
||||
> 终端面板
|
||||
|
||||
⭐ 双击终端标签可快速复制会话
|
||||
|
||||
### 批量执行
|
||||
|
||||
批量执行 ssh 主机 shell 脚本。
|
||||
|
||||
##### 日志面板中有几个内置的快捷键
|
||||
|
||||
* 回车: `Enter`
|
||||
* 向上滚动一行: `↑`
|
||||
* 向上滚动一页: `Home`
|
||||
* 向下滚动一行: `↓`
|
||||
* 向下滚动一页: `End`
|
||||
* 全选: `ctrl` `A`
|
||||
* 复制: `ctrl` `C`
|
||||
* 搜索: `ctrl` `F`
|
||||
* 清空: `ctrl` `L`
|
||||
|
||||
⭐ 内置参数同执行模板参数
|
||||
|
||||
* 重置: 重置全部参数
|
||||
* 执行: 执行所输入的命令
|
||||
* 返回: 返回到执行命令页面
|
||||
* 从模板中选择: 从模板中选择需要执行的命令
|
||||
* 执行历史: 点击历史命令可以快速填入
|
||||
|
||||
### 执行记录
|
||||
|
||||
查看批量执行任务记录。
|
||||
|
||||
* 执行命令: 跳转到批量执行页面
|
||||
* 清空: 清空执行记录
|
||||
* 删除: 删除执行记录
|
||||
* 重新执行: 重新执行此命令
|
||||
* 命令: 查看执行时的命令
|
||||
* 参数: 查看执行时的参数
|
||||
* 日志: 查看执行日志, ctrl + 左键点击会用新页面打开
|
||||
* 下载: 下载执行日志
|
||||
|
||||
### 执行模板
|
||||
|
||||
用来维护批量执行的命令模板, 支持动态参数, 使用 `@{{ xxx }}` 来替换命令参数。
|
||||
|
||||
* 新增: 新增执行模板
|
||||
* 执行: 打开命令执行框并且带入模板参数
|
||||
* 修改: 修改执行模板
|
||||
* 删除: 删除执行模板
|
||||
|
||||
> 内置参数
|
||||
|
||||
| 参数 | 描述 |
|
||||
|:----------------|:-------------------------|
|
||||
| execId | 执行记录id |
|
||||
| hostId | 执行主机id |
|
||||
| hostName | 执行主机名称 |
|
||||
| hostCode | 执行主机编码 |
|
||||
| hostAddress | 执行主机地址 |
|
||||
| userId | 执行用户id |
|
||||
| username | 执行用户名 |
|
||||
| uuid | 生成任务维度 uuid |
|
||||
| uuidShort | 生成任务维度 uuid 无 '-' |
|
||||
| hostUuid | 生成机器维度 uuid |
|
||||
| hostUuidShort | 生成机器维度 uuid 无 '-' |
|
||||
| timestampMillis | 时间戳毫秒 |
|
||||
| timestamp | 时间戳 |
|
||||
| date | 执行时间 yyyy-MM-dd |
|
||||
| datetime | 执行时间 yyyy-MM-dd HH:mm:ss |
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
### 主机终端
|
||||
|
||||
主机终端页面 支持 SSH, SFTP。
|
||||
打开后默认会进入新建连接页面, 页面的主机数据是用户授权的资产数据。
|
||||
鼠标移入列表内的主机上时, 右侧会出现 `打开 SSH` `打开 SFTP` `主机设置` `收藏` 的按钮。
|
||||
|
||||
> 主机设置
|
||||
|
||||
* SSH 配置: 可以自定义配置连接主机的 密码/秘钥/身份, 仅对自己生效, 不会修改全局配置, `秘钥` `身份` 数据是用户授权的资产数据
|
||||
* 标签颜色: 自定义配置标签的颜色, 可以用来区分环境等
|
||||
|
||||
> 顶部状态栏
|
||||
|
||||
* 全屏: 开启或关闭全屏
|
||||
|
||||
> 左侧状态栏
|
||||
|
||||
* 新建连接: 新建主机连接 `SSH` `SFTP`
|
||||
* 快捷键设置: 配置 `全局` `会话` `终端` 的快捷键
|
||||
* 显示设置: 配置终端 `显示偏好` `操作栏按钮` `右键菜单` 设置
|
||||
* 主题设置: 修改终端主题配色
|
||||
* 终端设置: 配置终端 `交互` `插件` `会话` 设置
|
||||
|
||||
> 右侧状态栏
|
||||
|
||||
* 命令片段: 自定义快速执行的命令片段, 双击直接执行
|
||||
* 传输列表: 打开文件传输列表, 当前会话下, 所有的文件上传下载传输都会显示在这里
|
||||
* 截图: 截屏终端并且自动下载
|
||||
|
||||
> 文件传输
|
||||
|
||||
点击上传或者下载后会自动添加到传输列表。
|
||||
|
||||
* 上传: 关闭页面自动清除
|
||||
* 下载: 下载完成后自动下载, 关闭页面自动清除
|
||||
|
||||
> SFTP
|
||||
|
||||
* 预览: 默认只能预览 2MB 以内的普通文件, 这个大小可以在前端 env 文件中修改 `VITE_SFTP_PREVIEW_MB`
|
||||
@@ -14,7 +14,7 @@
|
||||
<url>https://github.com/lijiahangmax/orion-ops-pro</url>
|
||||
|
||||
<properties>
|
||||
<revision>1.0.1</revision>
|
||||
<revision>1.0.2</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>
|
||||
|
||||
@@ -31,4 +31,6 @@ public interface Const extends com.orion.lang.constant.Const, FieldConst, CnCons
|
||||
|
||||
Integer DEFAULT_VERSION = 1;
|
||||
|
||||
String ERROR_LOG = "error.log";
|
||||
|
||||
}
|
||||
|
||||
@@ -75,8 +75,6 @@ public interface ErrorMessage {
|
||||
|
||||
String SESSION_ABSENT = "会话不存在";
|
||||
|
||||
String CONNECT_ERROR = "连接失败";
|
||||
|
||||
String PATH_NOT_NORMALIZE = "路径不合法";
|
||||
|
||||
String OPERATE_ERROR = "操作失败";
|
||||
@@ -89,4 +87,8 @@ public interface ErrorMessage {
|
||||
|
||||
String ILLEGAL_STATUS = "当前状态不支持此操作";
|
||||
|
||||
String CHECK_AUTHORIZED_HOST = "请选择已授权的主机";
|
||||
|
||||
String FILE_READ_ERROR = "文件读取失败";
|
||||
|
||||
}
|
||||
|
||||
@@ -41,4 +41,6 @@ public interface ExtraFieldConst extends FieldConst {
|
||||
|
||||
String HOST_NAME = "hostName";
|
||||
|
||||
String LOG_ID = "logId";
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ public interface FieldConst {
|
||||
|
||||
String STATUS = "status";
|
||||
|
||||
String INFO = "info";
|
||||
|
||||
String REL_ID = "relId";
|
||||
|
||||
String BEFORE = "before";
|
||||
@@ -39,6 +41,8 @@ public interface FieldConst {
|
||||
|
||||
String TARGET = "target";
|
||||
|
||||
String CHARSET = "charset";
|
||||
|
||||
String TOKEN = "token";
|
||||
|
||||
String PATH = "path";
|
||||
|
||||
@@ -12,7 +12,7 @@ public interface OrionOpsProConst {
|
||||
/**
|
||||
* 同 ${orion.version} 迭代时候需要手动更改
|
||||
*/
|
||||
String VERSION = "1.0.1";
|
||||
String VERSION = "1.0.2";
|
||||
|
||||
String GITHUB = "https://github.com/lijiahangmax/orion-ops-pro";
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.orion.ops.framework.common.file;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* 文件客户端
|
||||
@@ -65,8 +66,6 @@ public interface FileClient {
|
||||
*/
|
||||
String upload(String path, InputStream in, boolean autoClose, boolean overrideIfExist) throws Exception;
|
||||
|
||||
// TODO getOutputStream
|
||||
|
||||
/**
|
||||
* 检查文件是否存在
|
||||
*
|
||||
@@ -102,4 +101,39 @@ public interface FileClient {
|
||||
*/
|
||||
InputStream getContentInputStream(String path) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取文件输出流
|
||||
*
|
||||
* @param path path
|
||||
* @return stream
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
OutputStream getContentOutputStream(String path) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取文件输出流
|
||||
*
|
||||
* @param path path
|
||||
* @param append append
|
||||
* @return stream
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
OutputStream getContentOutputStream(String path, boolean append) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取返回路径 用于客户端返回
|
||||
*
|
||||
* @param path path
|
||||
* @return returnPath
|
||||
*/
|
||||
String getReturnPath(String path);
|
||||
|
||||
/**
|
||||
* 获取实际存储路径 用于服务端的存储
|
||||
*
|
||||
* @param returnPath returnPath
|
||||
* @return absolutePath
|
||||
*/
|
||||
String getAbsolutePath(String returnPath);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.orion.lang.utils.Exceptions;
|
||||
import com.orion.ops.framework.common.file.FileClient;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* 文件客户端工具
|
||||
@@ -85,8 +86,6 @@ public class FileClientUtils {
|
||||
return delegate.upload(path, in, autoClose, overrideIfExist);
|
||||
}
|
||||
|
||||
// TODO getOutputStream
|
||||
|
||||
/**
|
||||
* 检查文件是否存在
|
||||
*
|
||||
@@ -130,6 +129,49 @@ public class FileClientUtils {
|
||||
return delegate.getContentInputStream(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件输出流
|
||||
*
|
||||
* @param path path
|
||||
* @return stream
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static OutputStream getContentOutputStream(String path) throws Exception {
|
||||
return delegate.getContentOutputStream(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件输出流
|
||||
*
|
||||
* @param path path
|
||||
* @param append append
|
||||
* @return stream
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static OutputStream getContentOutputStream(String path, boolean append) throws Exception {
|
||||
return delegate.getContentOutputStream(path, append);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取返回路径 用于客户端返回
|
||||
*
|
||||
* @param path path
|
||||
* @return returnPath
|
||||
*/
|
||||
public static String getReturnPath(String path) {
|
||||
return delegate.getReturnPath(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实际存储路径 用于服务端的存储
|
||||
*
|
||||
* @param returnPath returnPath
|
||||
* @return absolutePath
|
||||
*/
|
||||
public static String getAbsolutePath(String returnPath) {
|
||||
return delegate.getAbsolutePath(returnPath);
|
||||
}
|
||||
|
||||
public static void setDelegate(FileClient delegate) {
|
||||
if (FileClientUtils.delegate != null) {
|
||||
// unmodified
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.orion.ops.framework.mybatis.core.generator.template.Table;
|
||||
import com.orion.ops.framework.mybatis.core.generator.template.Template;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 代码生成器
|
||||
@@ -45,12 +44,28 @@ public class CodeGenerators {
|
||||
// .color("blue", "gray", "red", "green", "white")
|
||||
// .valueUseFields()
|
||||
// .build(),
|
||||
Template.create("command_snippet", "命令片段", "command")
|
||||
Template.create("exec_log", "执行记录", "exec")
|
||||
.disableUnitTest()
|
||||
.cache("command:snippet:group:{}", "命令片段 ${userId}")
|
||||
.expire(1, TimeUnit.DAYS)
|
||||
.vue("asset", "command-snippet")
|
||||
.enableDrawerForm()
|
||||
.vue("exec", "exec-log")
|
||||
.enableRowSelection()
|
||||
.dict("execLogStatus", "status")
|
||||
.keyName("execStatus")
|
||||
.field("execStatus")
|
||||
.fields("WAITING", "RUNNING", "COMPLETED", "FAILED")
|
||||
.labels("等待中", "运行中", "执行完成", "执行失败")
|
||||
.color("gray", "green", "arcoblue", "red")
|
||||
.valueUseFields()
|
||||
.build(),
|
||||
Template.create("exec_host_log", "主机执行记录", "exec")
|
||||
.disableUnitTest()
|
||||
.vue("exec", "exec-host-log")
|
||||
.dict("execHostLogStatus", "status")
|
||||
.keyName("execHostStatus")
|
||||
.field("execHostStatus")
|
||||
.fields("WAITING", "RUNNING", "COMPLETED", "FAILED", "INTERRUPTED")
|
||||
.labels("等待中", "运行中", "执行完成", "执行失败", "已中断")
|
||||
.color("gray", "green", "arcoblue", "red", "purple")
|
||||
.valueUseFields()
|
||||
.build(),
|
||||
};
|
||||
// jdbc 配置 - 使用配置文件
|
||||
|
||||
@@ -346,7 +346,7 @@ public class CodeGenerator implements Executable {
|
||||
// api 文件
|
||||
new String[]{"/templates/orion-vue-api.ts.vm", "${feature}.ts", "vue/api/${module}"},
|
||||
// router 文件
|
||||
new String[]{"/templates/orion-vue-router.ts.vm", "${module}.${feature}.ts", "vue/router/routes/modules"},
|
||||
new String[]{"/templates/orion-vue-router.ts.vm", "${feature}.ts", "vue/router/routes/modules"},
|
||||
// views index.ts 文件
|
||||
new String[]{"/templates/orion-vue-views-index.vue.vm", "index.vue", "vue/views/${module}/${feature}"},
|
||||
// form-modal.vue 文件
|
||||
|
||||
@@ -97,7 +97,7 @@ public class CodeGeneratorEngine extends VelocityTemplateEngine {
|
||||
// http 注释标识
|
||||
objectMap.put("httpComment", "###");
|
||||
// 版本
|
||||
objectMap.put("since", OrionOpsProConst.VERSION);
|
||||
objectMap.put("version", OrionOpsProConst.VERSION);
|
||||
// api 注释
|
||||
Map<String, String> apiComment = new HashMap<>(12);
|
||||
String comment = tableInfo.getComment();
|
||||
|
||||
@@ -106,6 +106,10 @@ public class DataQuery<T> {
|
||||
return then;
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(IPageRequest page) {
|
||||
return this.last(Pager.of(page).getSql());
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(int limit) {
|
||||
return this.last(Const.LIMIT + Const.SPACE + limit);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.math.*;
|
||||
* $!{table.comment} 缓存对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* $!{table.comment}缓存 key
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
public interface ${type}CacheKeyDefine {
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
* $!{table.comment} api
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Tag(name = "${package.ModuleName} - $!{table.comment}服务")
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
* $!{table.comment} 内部对象转换器
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Mapper
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.math.*;
|
||||
* $!{table.comment} 实体对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.math.*;
|
||||
* $!{table.comment} 导出对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.math.*;
|
||||
* $!{table.comment} 创建请求对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.math.*;
|
||||
* $!{table.comment} 查询请求对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.math.*;
|
||||
* $!{table.comment} 更新请求对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.math.*;
|
||||
* $!{table.comment} 视图响应对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -11,7 +11,7 @@ import ${mapperAnnotationClass.name};
|
||||
* $!{table.comment} Mapper 接口
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
#if(${mapperAnnotationClass})
|
||||
|
||||
@@ -10,7 +10,7 @@ import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLe
|
||||
* $!{table.comment} 操作日志类型
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Module("${package.ModuleName}:${typeHyphen}")
|
||||
|
||||
@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
#end
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -42,7 +43,7 @@ import java.util.stream.Collectors;
|
||||
* $!{table.comment} 服务实现类
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Slf4j
|
||||
@@ -154,6 +155,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
// 转换
|
||||
return list.stream()
|
||||
.map(${type}Convert.MAPPER::to)
|
||||
.sorted(Comparator.comparing(${type}VO::getId).reversed())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -276,7 +278,8 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
#foreach($field in ${table.fields})
|
||||
.eq(${type}DO::get${field.capitalName}, searchValue)#if($foreach.hasNext).or()#end
|
||||
#end
|
||||
);
|
||||
)
|
||||
.orderByDesc(${type}DO::getId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
* $!{table.comment} 服务类
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
public interface ${table.serviceName} {
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.stream.Collectors;
|
||||
* $!{table.comment} 对外服务实现类
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Slf4j
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
* $!{table.comment} 对外服务类
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
public interface ${type}Api {
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
* $!{table.comment} 对外服务对象转换器
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Mapper
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.math.*;
|
||||
* $!{table.comment} 创建请求业务对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.math.*;
|
||||
* $!{table.comment} 查询请求业务对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.math.*;
|
||||
* $!{table.comment} 更新请求业务对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.math.*;
|
||||
* $!{table.comment} 业务对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -20,9 +20,9 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
/**
|
||||
* $!{table.comment} 对外服务单元测试
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/8/23 10:36
|
||||
* @author ${author}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Slf4j
|
||||
@Import({${type}ApiImpl.class, ${type}ServiceImpl.class})
|
||||
|
||||
@@ -21,9 +21,9 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
/**
|
||||
* $!{table.comment} 服务单元测试
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/8/23 10:36
|
||||
* @author ${author}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Slf4j
|
||||
@Import(${type}ServiceImpl.class)
|
||||
|
||||
@@ -2,31 +2,31 @@
|
||||
|
||||
-- 父菜单
|
||||
INSERT INTO system_menu
|
||||
(parent_id, name, type, sort, visible, status, cache, component)
|
||||
(parent_id, name, type, sort, visible, status, cache, creator, updater, deleted)
|
||||
VALUES
|
||||
(0, '${table.comment}管理', 1, 10, 1, 1, 1, '$vue.moduleEntityFirstLower');
|
||||
(0, '${table.comment}管理', 1, 10, 1, 1, 1, '1', '1', 0);
|
||||
|
||||
-- 设置临时父菜单id
|
||||
SELECT @TMP_PARENT_ID:=LAST_INSERT_ID();
|
||||
|
||||
-- 子菜单
|
||||
INSERT INTO system_menu
|
||||
(parent_id, name, type, sort, visible, status, cache, component)
|
||||
(parent_id, name, type, sort, visible, status, cache, component, creator, updater, deleted)
|
||||
VALUES
|
||||
(@TMP_PARENT_ID, '$table.comment', 2, 10, 1, 1, 1, '$vue.moduleEntityFirstLower$vue.featureEntity');
|
||||
(@TMP_PARENT_ID, '$table.comment', 2, 10, 1, 1, 1, '$vue.featureEntityFirstLower', '1', '1', 0);
|
||||
|
||||
-- 设置临时子菜单id
|
||||
SELECT @TMP_SUB_ID:=LAST_INSERT_ID();
|
||||
|
||||
-- 功能
|
||||
INSERT INTO system_menu
|
||||
(parent_id, name, permission, type, sort)
|
||||
(parent_id, name, permission, type, sort, creator, updater, deleted)
|
||||
VALUES
|
||||
(@TMP_SUB_ID, '查询$table.comment', '${package.ModuleName}:${typeHyphen}:query', 3, 10),
|
||||
(@TMP_SUB_ID, '创建$table.comment', '${package.ModuleName}:${typeHyphen}:create', 3, 20),
|
||||
(@TMP_SUB_ID, '修改$table.comment', '${package.ModuleName}:${typeHyphen}:update', 3, 30),
|
||||
(@TMP_SUB_ID, '删除$table.comment', '${package.ModuleName}:${typeHyphen}:delete', 3, 40);
|
||||
(@TMP_SUB_ID, '查询$table.comment', '${package.ModuleName}:${typeHyphen}:query', 3, 10, '1', '1', 0),
|
||||
(@TMP_SUB_ID, '创建$table.comment', '${package.ModuleName}:${typeHyphen}:create', 3, 20, '1', '1', 0),
|
||||
(@TMP_SUB_ID, '修改$table.comment', '${package.ModuleName}:${typeHyphen}:update', 3, 30, '1', '1', 0),
|
||||
(@TMP_SUB_ID, '删除$table.comment', '${package.ModuleName}:${typeHyphen}:delete', 3, 40, '1', '1', 0);
|
||||
#if(false)
|
||||
(@TMP_SUB_ID, '导出$table.comment', '${package.ModuleName}:${typeHyphen}:export', 3, 50),
|
||||
(@TMP_SUB_ID, '导入$table.comment', '${package.ModuleName}:${typeHyphen}:import', 3, 60);
|
||||
(@TMP_SUB_ID, '导出$table.comment', '${package.ModuleName}:${typeHyphen}:export', 3, 50, '1', '1', 0),
|
||||
(@TMP_SUB_ID, '导入$table.comment', '${package.ModuleName}:${typeHyphen}:import', 3, 60, '1', '1', 0);
|
||||
#end
|
||||
|
||||
@@ -2,13 +2,13 @@ import type { AppRouteRecordRaw } from '../types';
|
||||
import { DEFAULT_LAYOUT } from '../base';
|
||||
|
||||
const $vue.moduleConst: AppRouteRecordRaw = {
|
||||
name: '$vue.moduleEntityFirstLower',
|
||||
path: '/$vue.module',
|
||||
name: '${vue.moduleEntityFirstLower}Module',
|
||||
path: '/${vue.moduleEntityFirstLower}-module',
|
||||
component: DEFAULT_LAYOUT,
|
||||
children: [
|
||||
{
|
||||
name: '$vue.moduleEntityFirstLower$vue.featureEntity',
|
||||
path: '/$vue.module/$vue.feature',
|
||||
name: '$vue.featureEntityFirstLower',
|
||||
path: '/$vue.feature',
|
||||
component: () => import('@/views/$vue.module/$vue.feature/index.vue'),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
size="small"
|
||||
ref="formRef"
|
||||
label-align="right"
|
||||
:style="{ width: '320px' }"
|
||||
:label-col-props="{ span: 6 }"
|
||||
:wrapper-col-props="{ span: 18 }"
|
||||
@keyup.enter="() => fetchCardData()">
|
||||
@@ -111,7 +110,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: '${vue.moduleEntityFirstLower}${vue.featureEntity}CardList'
|
||||
name: '${vue.featureEntityFirstLower}CardList'
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -135,8 +134,6 @@
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate']);
|
||||
|
||||
const list = ref<${vue.featureEntity}QueryResponse[]>([]);
|
||||
|
||||
const cardColLayout = useColLayout();
|
||||
const pagination = usePagination();
|
||||
const { loading, setLoading } = useLoading();
|
||||
@@ -144,6 +141,7 @@
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
#end
|
||||
|
||||
const list = ref<${vue.featureEntity}QueryResponse[]>([]);
|
||||
const formRef = ref();
|
||||
const formModel = reactive<${vue.featureEntity}QueryRequest>({
|
||||
searchValue: undefined,
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
<template>
|
||||
<a-drawer v-model:visible="visible"
|
||||
:title="title"
|
||||
:width="430"
|
||||
:width="470"
|
||||
:mask-closable="false"
|
||||
:unmount-on-close="true"
|
||||
:ok-button-props="{ disabled: loading }"
|
||||
:cancel-button-props="{ disabled: loading }"
|
||||
:on-before-ok="handlerOk"
|
||||
@cancel="handleClose">
|
||||
<a-spin class="full" :loading="loading">
|
||||
<a-spin class="full modal-form" :loading="loading">
|
||||
<a-form :model="formModel"
|
||||
ref="formRef"
|
||||
label-align="right"
|
||||
:style="{ width: '380px' }"
|
||||
:label-col-props="{ span: 6 }"
|
||||
:label-col-props="{ span: 5 }"
|
||||
:wrapper-col-props="{ span: 18 }"
|
||||
:rules="formRules">
|
||||
#foreach($field in ${table.fields})
|
||||
@@ -37,7 +36,7 @@
|
||||
#else
|
||||
<a-input v-model="formModel.${field.propertyName}"
|
||||
placeholder="请输入${field.comment}"
|
||||
allow-clear/>
|
||||
allow-clear />
|
||||
#end
|
||||
#end
|
||||
</a-form-item>
|
||||
@@ -50,7 +49,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: '${vue.moduleEntityFirstLower}${vue.featureEntity}FormDrawer'
|
||||
name: '${vue.featureEntityFirstLower}FormDrawer'
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -71,6 +70,8 @@
|
||||
import { useDictStore } from '@/store';
|
||||
#end
|
||||
|
||||
const emits = defineEmits(['added', 'updated']);
|
||||
|
||||
const { visible, setVisible } = useVisible();
|
||||
const { loading, setLoading } = useLoading();
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
@@ -79,6 +80,8 @@
|
||||
|
||||
const title = ref<string>();
|
||||
const isAddHandle = ref<boolean>(true);
|
||||
const formRef = ref<any>();
|
||||
const formModel = ref<${vue.featureEntity}UpdateRequest>({});
|
||||
|
||||
const defaultForm = (): ${vue.featureEntity}UpdateRequest => {
|
||||
return {
|
||||
@@ -88,11 +91,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
const formRef = ref<any>();
|
||||
const formModel = ref<${vue.featureEntity}UpdateRequest>({});
|
||||
|
||||
const emits = defineEmits(['added', 'updated']);
|
||||
|
||||
// 打开新增
|
||||
const openAdd = () => {
|
||||
title.value = '添加${table.comment}';
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
<a-form :model="formModel"
|
||||
ref="formRef"
|
||||
label-align="right"
|
||||
:style="{ width: '460px' }"
|
||||
:label-col-props="{ span: 6 }"
|
||||
:label-col-props="{ span: 5 }"
|
||||
:wrapper-col-props="{ span: 18 }"
|
||||
:rules="formRules">
|
||||
#foreach($field in ${table.fields})
|
||||
@@ -54,7 +53,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: '${vue.moduleEntityFirstLower}${vue.featureEntity}FormModal'
|
||||
name: '${vue.featureEntityFirstLower}FormModal'
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -75,6 +74,8 @@
|
||||
import { useDictStore } from '@/store';
|
||||
#end
|
||||
|
||||
const emits = defineEmits(['added', 'updated']);
|
||||
|
||||
const { visible, setVisible } = useVisible();
|
||||
const { loading, setLoading } = useLoading();
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
@@ -83,6 +84,8 @@
|
||||
|
||||
const title = ref<string>();
|
||||
const isAddHandle = ref<boolean>(true);
|
||||
const formRef = ref<any>();
|
||||
const formModel = ref<${vue.featureEntity}UpdateRequest>({});
|
||||
|
||||
const defaultForm = (): ${vue.featureEntity}UpdateRequest => {
|
||||
return {
|
||||
@@ -92,11 +95,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
const formRef = ref<any>();
|
||||
const formModel = ref<${vue.featureEntity}UpdateRequest>({});
|
||||
|
||||
const emits = defineEmits(['added', 'updated']);
|
||||
|
||||
// 打开新增
|
||||
const openAdd = () => {
|
||||
title.value = '添加${table.comment}';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
@keyup.enter="() => fetchTableData()">
|
||||
#foreach($field in ${table.fields})
|
||||
<!-- $field.comment -->
|
||||
<a-form-item field="${field.propertyName}" label="${field.comment}" label-col-flex="50px">
|
||||
<a-form-item field="${field.propertyName}" label="${field.comment}">
|
||||
#if(${dictMap.containsKey(${field.propertyName})})
|
||||
<a-select v-model="formModel.${field.propertyName}"
|
||||
:options="toOptions($dictMap.get(${field.propertyName}).keyField)"
|
||||
@@ -89,14 +89,14 @@
|
||||
#end
|
||||
:data="tableRenderData"
|
||||
:pagination="pagination"
|
||||
:bordered="false"
|
||||
@page-change="(page) => fetchTableData(page, pagination.pageSize)"
|
||||
@page-size-change="(size) => fetchTableData(1, size)"
|
||||
:bordered="false">
|
||||
@page-size-change="(size) => fetchTableData(1, size)">
|
||||
#foreach($field in ${table.fields})
|
||||
#if(${dictMap.containsKey(${field.propertyName})})
|
||||
<!-- $field.comment -->
|
||||
<template #${field.propertyName}="{ record }">
|
||||
{{ getDictValue($dictMap.get(${field.propertyName}).keyField, record.${field.propertyName}}) }}
|
||||
{{ getDictValue($dictMap.get(${field.propertyName}).keyField, record.${field.propertyName}) }}
|
||||
</template>
|
||||
#end
|
||||
#end
|
||||
@@ -130,7 +130,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: '${vue.moduleEntityFirstLower}${vue.featureEntity}Table'
|
||||
name: '${vue.featureEntityFirstLower}Table'
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -157,11 +157,6 @@
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate']);
|
||||
|
||||
#if($vue.enableRowSelection)
|
||||
const selectedKeys = ref<number[]>([]);
|
||||
#end
|
||||
const tableRenderData = ref<${vue.featureEntity}QueryResponse[]>([]);
|
||||
|
||||
const pagination = usePagination();
|
||||
#if($vue.enableRowSelection)
|
||||
const rowSelection = useRowSelection();
|
||||
@@ -171,6 +166,10 @@
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
#end
|
||||
|
||||
#if($vue.enableRowSelection)
|
||||
const selectedKeys = ref<number[]>([]);
|
||||
#end
|
||||
const tableRenderData = ref<${vue.featureEntity}QueryResponse[]>([]);
|
||||
const formModel = reactive<${vue.featureEntity}QueryRequest>({
|
||||
#foreach($field in ${table.fields})
|
||||
${field.propertyName}: undefined,
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<!-- 列表-表格 -->
|
||||
<${vue.feature}-table v-if="renderTable"
|
||||
ref="table"
|
||||
@openAdd="() =>#if($vue.enableDrawerForm) drawer#else modal#end.openAdd()"
|
||||
@openUpdate="(e) =>#if($vue.enableDrawerForm) drawer#else modal#end.openUpdate(e)" />
|
||||
@open-add="() =>#if($vue.enableDrawerForm) drawer#else modal#end.openAdd()"
|
||||
@open-update="(e) =>#if($vue.enableDrawerForm) drawer#else modal#end.openUpdate(e)" />
|
||||
<!-- 列表-卡片 -->
|
||||
<${vue.feature}-card-list v-else
|
||||
ref="card"
|
||||
@openAdd="() =>#if($vue.enableDrawerForm) drawer#else modal#end.openAdd()"
|
||||
@openUpdate="(e) =>#if($vue.enableDrawerForm) drawer#else modal#end.openUpdate(e)" />
|
||||
@open-add="() =>#if($vue.enableDrawerForm) drawer#else modal#end.openAdd()"
|
||||
@open-update="(e) =>#if($vue.enableDrawerForm) drawer#else modal#end.openUpdate(e)" />
|
||||
#else
|
||||
<!-- 列表-表格 -->
|
||||
<${vue.feature}-table ref="table"
|
||||
@openAdd="() =>#if($vue.enableDrawerForm) drawer#else modal#end.openAdd()"
|
||||
@openUpdate="(e) =>#if($vue.enableDrawerForm) drawer#else modal#end.openUpdate(e)" />
|
||||
@open-add="() =>#if($vue.enableDrawerForm) drawer#else modal#end.openAdd()"
|
||||
@open-update="(e) =>#if($vue.enableDrawerForm) drawer#else modal#end.openUpdate(e)" />
|
||||
#end
|
||||
#if($vue.enableDrawerForm)
|
||||
<!-- 添加修改模态框 -->
|
||||
@@ -33,20 +33,11 @@
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: '${vue.moduleEntityFirstLower}${vue.featureEntity}'
|
||||
name: '${vue.featureEntityFirstLower}'
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
#if($vue.enableCardView)
|
||||
import ${vue.featureEntity}CardList from './components/${vue.feature}-card-list.vue';
|
||||
#end
|
||||
import ${vue.featureEntity}Table from './components/${vue.feature}-table.vue';
|
||||
#if($vue.enableDrawerForm)
|
||||
import ${vue.featureEntity}FormDrawer from './components/${vue.feature}-form-drawer.vue';
|
||||
#else
|
||||
import ${vue.featureEntity}FormModal from './components/${vue.feature}-form-modal.vue';
|
||||
#end
|
||||
#if($vue.enableCardView)
|
||||
import { computed, ref, onBeforeMount } from 'vue';
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
@@ -62,6 +53,22 @@
|
||||
import { dictKeys } from './types/const';
|
||||
#end
|
||||
#end
|
||||
#if($vue.enableCardView)
|
||||
import ${vue.featureEntity}CardList from './components/${vue.feature}-card-list.vue';
|
||||
#end
|
||||
import ${vue.featureEntity}Table from './components/${vue.feature}-table.vue';
|
||||
#if($vue.enableDrawerForm)
|
||||
import ${vue.featureEntity}FormDrawer from './components/${vue.feature}-form-drawer.vue';
|
||||
#else
|
||||
import ${vue.featureEntity}FormModal from './components/${vue.feature}-form-modal.vue';
|
||||
#end
|
||||
#if($vue.enableCardView)
|
||||
|
||||
const appStore = useAppStore();
|
||||
|
||||
// FIXME 这里需要修改一下字段名称 并且在 appStore 定义该字段
|
||||
const renderTable = computed(() => appStore.${vue.featureEntityFirstLower}View === 'table');
|
||||
#end
|
||||
|
||||
const render = ref(false);
|
||||
const table = ref();
|
||||
@@ -73,12 +80,6 @@
|
||||
#else
|
||||
const modal = ref();
|
||||
#end
|
||||
#if($vue.enableCardView)
|
||||
const appStore = useAppStore();
|
||||
|
||||
// FIXME 这里需要修改一下字段名称 并且在 appStore 定义该字段
|
||||
const renderTable = computed(() => appStore.${vue.featureEntityFirstLower}View === 'table');
|
||||
#end
|
||||
|
||||
// 添加回调
|
||||
const modalAddCallback = () => {
|
||||
|
||||
@@ -48,4 +48,13 @@ public class OrionStorageAutoConfiguration {
|
||||
return new LocalFileClient(config.getLocal());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 日志文件客户端
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "orion.storage.logs.enabled", havingValue = "true")
|
||||
public FileClient logsFileClient() {
|
||||
return new LocalFileClient(config.getLogs());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,4 +20,9 @@ public class StorageConfig {
|
||||
*/
|
||||
private LocalFileClientConfig local;
|
||||
|
||||
/**
|
||||
* 日志文件客户端 配置
|
||||
*/
|
||||
private LocalFileClientConfig logs;
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.orion.ops.framework.common.file.FileClient;
|
||||
import com.orion.ops.framework.common.utils.FileClientUtils;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -57,14 +58,14 @@ public abstract class AbstractFileClient<Config extends FileClientConfig> implem
|
||||
|
||||
@Override
|
||||
public byte[] getContent(String path) throws Exception {
|
||||
try (InputStream in = this.doDownload(path)) {
|
||||
try (InputStream in = this.getContentInputStream(path)) {
|
||||
return Streams.toByteArray(in);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getContentInputStream(String path) throws Exception {
|
||||
return this.doDownload(path);
|
||||
public OutputStream getContentOutputStream(String path) throws Exception {
|
||||
return this.getContentOutputStream(path, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,31 +80,6 @@ public abstract class AbstractFileClient<Config extends FileClientConfig> implem
|
||||
*/
|
||||
protected abstract String doUpload(String path, InputStream in, boolean autoClose, boolean overrideIfExist) throws Exception;
|
||||
|
||||
/**
|
||||
* 执行下载操作
|
||||
*
|
||||
* @param path path
|
||||
* @return stream
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
protected abstract InputStream doDownload(String path) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取返回路径 用于客户端返回
|
||||
*
|
||||
* @param path path
|
||||
* @return returnPath
|
||||
*/
|
||||
protected abstract String getReturnPath(String path);
|
||||
|
||||
/**
|
||||
* 获取实际存储路径 用于服务端的存储
|
||||
*
|
||||
* @param returnPath returnPath
|
||||
* @return absolutePath
|
||||
*/
|
||||
protected abstract String getAbsolutePath(String returnPath);
|
||||
|
||||
/**
|
||||
* 获取文件路径 拼接前缀
|
||||
*
|
||||
|
||||
@@ -31,11 +31,15 @@ public class FileClientConfig {
|
||||
/**
|
||||
* 是否拼接时间作为文件夹
|
||||
*/
|
||||
protected boolean dateDirectory = true;
|
||||
protected boolean dateDirectory;
|
||||
|
||||
/**
|
||||
* 时间文件夹格式
|
||||
*/
|
||||
protected String datePattern = Dates.YMD;
|
||||
protected String datePattern;
|
||||
|
||||
public FileClientConfig() {
|
||||
this.datePattern = Dates.YMD;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.orion.lang.utils.Exceptions;
|
||||
import com.orion.ops.framework.common.file.FileClient;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* 默认文件客户端
|
||||
@@ -61,6 +62,26 @@ public class PrimaryFileClient implements FileClient {
|
||||
return delegate.getContentInputStream(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutputStream getContentOutputStream(String path) throws Exception {
|
||||
return delegate.getContentOutputStream(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutputStream getContentOutputStream(String path, boolean append) throws Exception {
|
||||
return delegate.getContentOutputStream(path, append);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturnPath(String path) {
|
||||
return delegate.getReturnPath(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAbsolutePath(String returnPath) {
|
||||
return delegate.getAbsolutePath(returnPath);
|
||||
}
|
||||
|
||||
public static void setDelegate(FileClient delegate) {
|
||||
if (PrimaryFileClient.delegate != null) {
|
||||
// unmodified
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.orion.ops.framework.common.constant.Const;
|
||||
import com.orion.ops.framework.storage.core.client.AbstractFileClient;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* 本地文件客户端
|
||||
@@ -20,6 +21,16 @@ public class LocalFileClient extends AbstractFileClient<LocalFileClientConfig> {
|
||||
super(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getContentInputStream(String path) throws Exception {
|
||||
return Files1.openInputStreamFast(this.getAbsolutePath(path));
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutputStream getContentOutputStream(String path, boolean append) throws Exception {
|
||||
return Files1.openOutputStreamFast(this.getAbsolutePath(path), append);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doUpload(String path, InputStream in, boolean autoClose, boolean overrideIfExist) {
|
||||
// 获取返回文件路径
|
||||
@@ -35,11 +46,6 @@ public class LocalFileClient extends AbstractFileClient<LocalFileClientConfig> {
|
||||
return returnPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputStream doDownload(String path) throws Exception {
|
||||
return Files1.openInputStreamFast(this.getAbsolutePath(path));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExists(String path) {
|
||||
return Files1.isFile(this.getAbsolutePath(path));
|
||||
@@ -51,13 +57,13 @@ public class LocalFileClient extends AbstractFileClient<LocalFileClientConfig> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getReturnPath(String path) {
|
||||
public String getReturnPath(String path) {
|
||||
// 拼接公共路径
|
||||
return Files1.getPath(config.getBasePath() + Const.SLASH + this.getFilePath(path));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAbsolutePath(String returnPath) {
|
||||
public String getAbsolutePath(String returnPath) {
|
||||
// 拼接存储路径
|
||||
return Files1.getPath(config.getStoragePath() + Const.SLASH + returnPath);
|
||||
}
|
||||
|
||||
@@ -20,13 +20,18 @@ public class LocalFileClientConfig extends FileClientConfig {
|
||||
* <p>
|
||||
* 无需 / 结尾
|
||||
*/
|
||||
private String storagePath = "";
|
||||
private String storagePath;
|
||||
|
||||
/**
|
||||
* 基础路径
|
||||
* <p>
|
||||
* 无需 / 结尾
|
||||
*/
|
||||
private String basePath = "";
|
||||
private String basePath;
|
||||
|
||||
public LocalFileClientConfig() {
|
||||
this.storagePath = "";
|
||||
this.basePath = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
"name": "orion.storage.local",
|
||||
"type": "com.orion.ops.framework.storage.core.client.local.LocalFileClientConfig",
|
||||
"sourceType": "com.orion.ops.framework.storage.core.client.local.LocalFileClientConfig"
|
||||
},
|
||||
{
|
||||
"name": "orion.storage.logs",
|
||||
"type": "com.orion.ops.framework.storage.core.client.local.LocalFileClientConfig",
|
||||
"sourceType": "com.orion.ops.framework.storage.core.client.local.LocalFileClientConfig"
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
@@ -34,7 +39,7 @@
|
||||
"name": "orion.storage.local.date-directory",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "是否拼接时间作为文件夹.",
|
||||
"defaultValue": true
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "orion.storage.local.date-pattern",
|
||||
@@ -51,6 +56,40 @@
|
||||
"name": "orion.storage.local.base-path",
|
||||
"type": "java.lang.String",
|
||||
"description": "基础路径."
|
||||
},
|
||||
{
|
||||
"name": "orion.storage.logs.enabled",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "是否启用.",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "orion.storage.logs.timestamp-prefix",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "是否使用时间戳作为文件名称前缀.",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "orion.storage.logs.date-directory",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "是否拼接时间作为文件夹.",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "orion.storage.logs.date-pattern",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "时间文件夹格式.",
|
||||
"defaultValue": "yyyy-MM-dd"
|
||||
},
|
||||
{
|
||||
"name": "orion.storage.logs.storage-path",
|
||||
"type": "java.lang.String",
|
||||
"description": "存储路径."
|
||||
},
|
||||
{
|
||||
"name": "orion.storage.logs.base-path",
|
||||
"type": "java.lang.String",
|
||||
"description": "基础路径."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -185,9 +185,17 @@ orion:
|
||||
local:
|
||||
primary: true
|
||||
enabled: true
|
||||
timestamp-prefix: true
|
||||
timestamp-prefix: false
|
||||
date-directory: false
|
||||
storage-path: ${user.home}
|
||||
base-path: /orion/storage/orion-ops-pro
|
||||
base-path: /orion/orion-ops-pro/storage
|
||||
# 日志文件存储
|
||||
logs:
|
||||
enabled: true
|
||||
timestamp-prefix: false
|
||||
date-directory: false
|
||||
storage-path: ${user.home}
|
||||
base-path: /orion/orion-ops-pro/logs
|
||||
security:
|
||||
password-encoder-length: 4
|
||||
# 匿名接口
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.orion.ops.module.asset.config;
|
||||
|
||||
import com.orion.ops.module.asset.handler.host.transfer.TransferMessageDispatcher;
|
||||
import com.orion.ops.module.asset.handler.host.exec.log.ExecLogTailHandler;
|
||||
import com.orion.ops.module.asset.handler.host.terminal.TerminalMessageDispatcher;
|
||||
import com.orion.ops.module.asset.handler.host.transfer.TransferMessageDispatcher;
|
||||
import com.orion.ops.module.asset.interceptor.ExecLogTailInterceptor;
|
||||
import com.orion.ops.module.asset.interceptor.TerminalAccessInterceptor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -26,12 +28,18 @@ public class AssetWebSocketConfiguration implements WebSocketConfigurer {
|
||||
@Resource
|
||||
private TerminalAccessInterceptor terminalAccessInterceptor;
|
||||
|
||||
@Resource
|
||||
private ExecLogTailInterceptor execLogTailInterceptor;
|
||||
|
||||
@Resource
|
||||
private TerminalMessageDispatcher terminalMessageDispatcher;
|
||||
|
||||
@Resource
|
||||
private TransferMessageDispatcher transferMessageDispatcher;
|
||||
|
||||
@Resource
|
||||
private ExecLogTailHandler execLogTailHandler;
|
||||
|
||||
@Override
|
||||
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
||||
// 终端
|
||||
@@ -42,6 +50,10 @@ public class AssetWebSocketConfiguration implements WebSocketConfigurer {
|
||||
registry.addHandler(transferMessageDispatcher, prefix + "/host/transfer/{accessToken}")
|
||||
.addInterceptors(terminalAccessInterceptor)
|
||||
.setAllowedOrigins("*");
|
||||
// 执行日志
|
||||
registry.addHandler(execLogTailHandler, prefix + "/exec/log/{token}")
|
||||
.addInterceptors(execLogTailInterceptor)
|
||||
.setAllowedOrigins("*");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ 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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -40,8 +41,8 @@ public class AssetAuthorizedDataServiceController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/current-host")
|
||||
@Operation(summary = "查询当前用户已授权的主机")
|
||||
public AuthorizedHostWrapperVO getCurrentAuthorizedHostGroup() {
|
||||
return assetAuthorizedDataService.getUserAuthorizedHostGroup(SecurityUtils.getLoginUserId());
|
||||
public AuthorizedHostWrapperVO getCurrentAuthorizedHost(@RequestParam("type") String type) {
|
||||
return assetAuthorizedDataService.getUserAuthorizedHost(SecurityUtils.getLoginUserId(), type);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
### 批量执行命令
|
||||
POST {{baseUrl}}/asset/exec/exec-command
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"description": 1,
|
||||
"timeout": 10,
|
||||
"command": "echo 这是日志@{{ hostAddress }}\nsleep 1\necho @{{ hostName }}",
|
||||
"parameterSchema": "[]",
|
||||
"hostIdList": [1]
|
||||
}
|
||||
|
||||
|
||||
### 中断执行命令
|
||||
POST {{baseUrl}}/asset/exec/interrupt-command
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"logId": 7
|
||||
}
|
||||
|
||||
|
||||
### 查看执行日志
|
||||
POST {{baseUrl}}/asset/exec/tail-log
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"execId": 56
|
||||
}
|
||||
|
||||
|
||||
### 下载执行日志文件
|
||||
GET {{baseUrl}}/asset/exec/download-log?id=83
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
###
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.orion.ops.module.asset.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.HttpWrapper;
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.ops.framework.biz.operator.log.core.enums.ReturnType;
|
||||
import com.orion.ops.framework.common.utils.Valid;
|
||||
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.ops.module.asset.define.operator.ExecOperatorType;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecCommandRequest;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecInterruptRequest;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecLogTailRequest;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ReExecCommandRequest;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecLogVO;
|
||||
import com.orion.ops.module.asset.service.ExecService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 批量执行
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/3/11 11:44
|
||||
*/
|
||||
@Tag(name = "asset - 批量执行服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class ExecController {
|
||||
|
||||
@Resource
|
||||
private ExecService execService;
|
||||
|
||||
@OperatorLog(value = ExecOperatorType.EXEC_COMMAND, ret = ReturnType.IGNORE)
|
||||
@PostMapping("/exec-command")
|
||||
@Operation(summary = "批量执行命令")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec:exec-command')")
|
||||
public ExecLogVO execCommand(@Validated @RequestBody ExecCommandRequest request) {
|
||||
return execService.execCommand(request);
|
||||
}
|
||||
|
||||
@OperatorLog(value = ExecOperatorType.EXEC_COMMAND, ret = ReturnType.IGNORE)
|
||||
@PostMapping("/re-exec-command")
|
||||
@Operation(summary = "重新执行命令")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec:exec-command')")
|
||||
public ExecLogVO reExecCommand(@Validated @RequestBody ReExecCommandRequest request) {
|
||||
return execService.reExecCommand(request.getLogId());
|
||||
}
|
||||
|
||||
@OperatorLog(ExecOperatorType.INTERRUPT_EXEC)
|
||||
@PutMapping("/interrupt")
|
||||
@Operation(summary = "中断执行命令")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec:interrupt-exec')")
|
||||
public HttpWrapper<?> interruptExec(@RequestBody ExecInterruptRequest request) {
|
||||
Long logId = Valid.notNull(request.getLogId());
|
||||
execService.interruptExec(logId);
|
||||
return HttpWrapper.ok();
|
||||
}
|
||||
|
||||
@OperatorLog(ExecOperatorType.INTERRUPT_HOST)
|
||||
@PutMapping("/interrupt-host")
|
||||
@Operation(summary = "中断执行主机命令")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec:interrupt-exec')")
|
||||
public HttpWrapper<?> interruptHostExec(@RequestBody ExecInterruptRequest request) {
|
||||
Long hostLogId = Valid.notNull(request.getHostLogId());
|
||||
execService.interruptHostExec(hostLogId);
|
||||
return HttpWrapper.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/tail-log")
|
||||
@Operation(summary = "查看执行日志")
|
||||
@PreAuthorize("@ss.hasAnyPermission('asset:exec:exec-command', 'asset:exec-log:query')")
|
||||
public String getExecLogTailToken(@Validated @RequestBody ExecLogTailRequest request) {
|
||||
return execService.getExecLogTailToken(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecOperatorType.DOWNLOAD_HOST_LOG)
|
||||
@GetMapping("/download-log")
|
||||
@Operation(summary = "下载执行日志")
|
||||
@PreAuthorize("@ss.hasAnyPermission('asset:exec:exec-command', 'asset:exec-log:query')")
|
||||
public void downloadExecLogFile(@RequestParam("id") Long id, HttpServletResponse response) {
|
||||
execService.downloadLogFile(id, response);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
### 查询批量执行日志
|
||||
GET {{baseUrl}}/asset/exec-log/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询批量执行日志
|
||||
POST {{baseUrl}}/asset/exec-log/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"id": "",
|
||||
"userId": "",
|
||||
"username": "",
|
||||
"source": "",
|
||||
"sourceId": "",
|
||||
"description": "",
|
||||
"command": "",
|
||||
"status": ""
|
||||
}
|
||||
|
||||
|
||||
### 删除批量执行日志
|
||||
DELETE {{baseUrl}}/asset/exec-log/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 批量删除批量执行日志
|
||||
DELETE {{baseUrl}}/asset/exec-log/batch-delete?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
###
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.orion.ops.module.asset.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.ops.framework.common.validator.group.Page;
|
||||
import com.orion.ops.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.ops.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.ops.framework.security.core.utils.SecurityUtils;
|
||||
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.ops.module.asset.define.operator.ExecOperatorType;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecHostLogVO;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecLogStatusVO;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecLogVO;
|
||||
import com.orion.ops.module.asset.enums.ExecSourceEnum;
|
||||
import com.orion.ops.module.asset.service.ExecHostLogService;
|
||||
import com.orion.ops.module.asset.service.ExecLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 执行日志 api
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 11:31
|
||||
*/
|
||||
@Tag(name = "asset - 执行日志服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-log")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class ExecLogController {
|
||||
|
||||
@Resource
|
||||
private ExecLogService execLogService;
|
||||
|
||||
@Resource
|
||||
private ExecHostLogService execHostLogService;
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询执行日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-log:query')")
|
||||
public DataGrid<ExecLogVO> getExecLogPage(@Validated(Page.class) @RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(ExecSourceEnum.BATCH.name());
|
||||
return execLogService.getExecLogPage(request);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查询执行日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-log:query')")
|
||||
public ExecLogVO getExecLog(@RequestParam("id") Long id) {
|
||||
return execLogService.getExecLog(id, ExecSourceEnum.BATCH.name());
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/host-list")
|
||||
@Operation(summary = "查询全部执行主机日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-log:query')")
|
||||
public List<ExecHostLogVO> getExecHostLogList(@RequestParam("logId") Long logId) {
|
||||
return execHostLogService.getExecHostLogList(logId);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/status")
|
||||
@Operation(summary = "查询命令执行状态")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-log:query')")
|
||||
public ExecLogStatusVO getExecLogStatus(@RequestParam("idList") List<Long> idList) {
|
||||
return execLogService.getExecLogStatus(idList);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/history")
|
||||
@Operation(summary = "查询执行历史")
|
||||
@PreAuthorize("@ss.hasAnyPermission('asset:exec-log:query', 'asset:exec:exec-command')")
|
||||
public List<ExecLogVO> getExecLogHistory(@Validated(Page.class) ExecLogQueryRequest request) {
|
||||
request.setSource(ExecSourceEnum.BATCH.name());
|
||||
request.setUserId(SecurityUtils.getLoginUserId());
|
||||
return execLogService.getExecHistory(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecOperatorType.DELETE_LOG)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除执行日志")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-log:delete')")
|
||||
public Integer deleteExecLog(@RequestParam("id") Long id) {
|
||||
return execLogService.deleteExecLogById(id);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecOperatorType.DELETE_LOG)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "删除执行日志")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-log:delete')")
|
||||
public Integer batchDeleteExecLog(@RequestParam("idList") List<Long> idList) {
|
||||
return execLogService.deleteExecLogByIdList(idList);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecOperatorType.DELETE_HOST_LOG)
|
||||
@DeleteMapping("/delete-host")
|
||||
@Operation(summary = "删除执行主机日志")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-log:delete')")
|
||||
public Integer deleteExecHostLog(@RequestParam("id") Long id) {
|
||||
return execHostLogService.deleteExecHostLogById(id);
|
||||
}
|
||||
|
||||
@PostMapping("/query-count")
|
||||
@Operation(summary = "查询执行日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-log:management:clear')")
|
||||
public Long getExecLogCount(@RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(ExecSourceEnum.BATCH.name());
|
||||
return execLogService.queryExecLogCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecOperatorType.CLEAR_LOG)
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空执行日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-log:management:clear')")
|
||||
public Integer clearExecLog(@RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(ExecSourceEnum.BATCH.name());
|
||||
return execLogService.clearExecLog(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
### 创建执行模板
|
||||
POST {{baseUrl}}/asset/exec-template/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"name": "",
|
||||
"command": "",
|
||||
"timeout": "",
|
||||
"parameter": ""
|
||||
}
|
||||
|
||||
|
||||
### 更新执行模板
|
||||
PUT {{baseUrl}}/asset/exec-template/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"name": "",
|
||||
"command": "",
|
||||
"timeout": "",
|
||||
"parameter": ""
|
||||
}
|
||||
|
||||
|
||||
### 查询执行模板
|
||||
GET {{baseUrl}}/asset/exec-template/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 查询全部执行模板
|
||||
GET {{baseUrl}}/asset/exec-template/list
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询执行模板
|
||||
POST {{baseUrl}}/asset/exec-template/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"id": "",
|
||||
"name": "",
|
||||
"command": "",
|
||||
"timeout": "",
|
||||
"parameter": ""
|
||||
}
|
||||
|
||||
|
||||
### 删除执行模板
|
||||
DELETE {{baseUrl}}/asset/exec-template/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
###
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.orion.ops.module.asset.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.ops.framework.common.validator.group.Page;
|
||||
import com.orion.ops.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.ops.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.ops.module.asset.define.operator.ExecTemplateOperatorType;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecTemplateCreateRequest;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecTemplateQueryRequest;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecTemplateUpdateRequest;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecTemplateVO;
|
||||
import com.orion.ops.module.asset.service.ExecTemplateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 执行模板 api
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-7 18:08
|
||||
*/
|
||||
@Tag(name = "asset - 执行模板服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-template")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class ExecTemplateController {
|
||||
|
||||
@Resource
|
||||
private ExecTemplateService execTemplateService;
|
||||
|
||||
@OperatorLog(ExecTemplateOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建执行模板")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:create')")
|
||||
public Long createExecTemplate(@Validated @RequestBody ExecTemplateCreateRequest request) {
|
||||
return execTemplateService.createExecTemplate(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecTemplateOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新执行模板")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:update')")
|
||||
public Integer updateExecTemplate(@Validated @RequestBody ExecTemplateUpdateRequest request) {
|
||||
return execTemplateService.updateExecTemplateById(request);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查询执行模板")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:query')")
|
||||
public ExecTemplateVO getExecTemplate(@RequestParam("id") Long id) {
|
||||
return execTemplateService.getExecTemplateById(id);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询执行模板")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:query')")
|
||||
public DataGrid<ExecTemplateVO> getExecTemplatePage(@Validated(Page.class) @RequestBody ExecTemplateQueryRequest request) {
|
||||
return execTemplateService.getExecTemplatePage(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecTemplateOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除执行模板")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:delete')")
|
||||
public Integer deleteExecTemplate(@RequestParam("id") Long id) {
|
||||
return execTemplateService.deleteExecTemplateById(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.orion.ops.module.asset.convert;
|
||||
|
||||
import com.orion.ops.module.asset.entity.domain.ExecHostLogDO;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecHostLogVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批量执行主机日志 内部对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 14:05
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExecHostLogConvert {
|
||||
|
||||
ExecHostLogConvert MAPPER = Mappers.getMapper(ExecHostLogConvert.class);
|
||||
|
||||
ExecHostLogVO to(ExecHostLogDO domain);
|
||||
|
||||
List<ExecHostLogVO> to(List<ExecHostLogDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.orion.ops.module.asset.convert;
|
||||
|
||||
import com.orion.ops.module.asset.entity.domain.ExecLogDO;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecLogVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批量执行日志 内部对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 11:31
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExecLogConvert {
|
||||
|
||||
ExecLogConvert MAPPER = Mappers.getMapper(ExecLogConvert.class);
|
||||
|
||||
ExecLogDO to(ExecLogQueryRequest request);
|
||||
|
||||
ExecLogVO to(ExecLogDO domain);
|
||||
|
||||
List<ExecLogVO> to(List<ExecLogDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.orion.ops.module.asset.convert;
|
||||
|
||||
import com.orion.ops.module.asset.entity.domain.ExecTemplateDO;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecTemplateCreateRequest;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecTemplateUpdateRequest;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecTemplateVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 执行模板 内部对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-7 18:08
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExecTemplateConvert {
|
||||
|
||||
ExecTemplateConvert MAPPER = Mappers.getMapper(ExecTemplateConvert.class);
|
||||
|
||||
ExecTemplateDO to(ExecTemplateCreateRequest request);
|
||||
|
||||
ExecTemplateDO to(ExecTemplateUpdateRequest request);
|
||||
|
||||
ExecTemplateVO to(ExecTemplateDO domain);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.orion.ops.module.asset.dao;
|
||||
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.asset.entity.domain.ExecHostLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批量执行主机日志 Mapper 接口
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 14:05
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExecHostLogDAO extends IMapper<ExecHostLogDO> {
|
||||
|
||||
/**
|
||||
* 通过 logId 查询
|
||||
*
|
||||
* @param logId logId
|
||||
* @return rows
|
||||
*/
|
||||
default List<ExecHostLogDO> selectByLogId(Long logId) {
|
||||
return this.of()
|
||||
.createWrapper()
|
||||
.eq(ExecHostLogDO::getLogId, logId)
|
||||
.then()
|
||||
.list();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.orion.ops.module.asset.dao;
|
||||
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.asset.entity.domain.ExecLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批量执行日志 Mapper 接口
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 11:31
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExecLogDAO extends IMapper<ExecLogDO> {
|
||||
|
||||
/**
|
||||
* 获取执行历史
|
||||
*
|
||||
* @param source source
|
||||
* @param userId userId
|
||||
* @param limit limit
|
||||
* @return rows
|
||||
*/
|
||||
List<ExecLogDO> getExecHistory(@Param("source") String source,
|
||||
@Param("userId") Long userId,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.orion.ops.module.asset.dao;
|
||||
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.asset.entity.domain.ExecTemplateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 执行模板 Mapper 接口
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-7 18:08
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExecTemplateDAO extends IMapper<ExecTemplateDO> {
|
||||
|
||||
}
|
||||
@@ -52,11 +52,13 @@ public interface HostConfigDAO extends IMapper<HostConfigDO> {
|
||||
* 通过 hostId 批量查询主机配置
|
||||
*
|
||||
* @param hostIdList hostIdList
|
||||
* @param type type
|
||||
* @return rows
|
||||
*/
|
||||
default List<HostConfigDO> getHostConfigByHostIdList(List<Long> hostIdList) {
|
||||
default List<HostConfigDO> getHostConfigByHostIdList(List<Long> hostIdList, String type) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<HostConfigDO> wrapper = this.lambda()
|
||||
LambdaQueryWrapper<HostConfigDO> wrapper = this.wrapper()
|
||||
.eq(HostConfigDO::getType, type)
|
||||
.in(HostConfigDO::getHostId, hostIdList);
|
||||
// 查询
|
||||
return this.of(wrapper).list();
|
||||
|
||||
@@ -15,6 +15,18 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
*/
|
||||
public interface AssetThreadPools {
|
||||
|
||||
/**
|
||||
* 超时检查线程池
|
||||
*/
|
||||
ThreadPoolExecutor TIMEOUT_CHECK = ExecutorBuilder.create()
|
||||
.namedThreadFactory("timeout-check-")
|
||||
.corePoolSize(1)
|
||||
.maxPoolSize(Integer.MAX_VALUE)
|
||||
.keepAliveTime(Const.MS_S_60)
|
||||
.workQueue(new SynchronousQueue<>())
|
||||
.allowCoreThreadTimeout(true)
|
||||
.build();
|
||||
|
||||
/**
|
||||
* terminal 标准输出线程池
|
||||
*/
|
||||
@@ -39,4 +51,40 @@ public interface AssetThreadPools {
|
||||
.allowCoreThreadTimeout(true)
|
||||
.build();
|
||||
|
||||
/**
|
||||
* 批量执行任务线程池
|
||||
*/
|
||||
ThreadPoolExecutor EXEC_TASK = ExecutorBuilder.create()
|
||||
.namedThreadFactory("exec-task-")
|
||||
.corePoolSize(1)
|
||||
.maxPoolSize(Integer.MAX_VALUE)
|
||||
.keepAliveTime(Const.MS_S_60)
|
||||
.workQueue(new SynchronousQueue<>())
|
||||
.allowCoreThreadTimeout(true)
|
||||
.build();
|
||||
|
||||
/**
|
||||
* 批量执行主机命令线程池
|
||||
*/
|
||||
ThreadPoolExecutor EXEC_HOST = ExecutorBuilder.create()
|
||||
.namedThreadFactory("exec-host-")
|
||||
.corePoolSize(1)
|
||||
.maxPoolSize(Integer.MAX_VALUE)
|
||||
.keepAliveTime(Const.MS_S_60)
|
||||
.workQueue(new SynchronousQueue<>())
|
||||
.allowCoreThreadTimeout(true)
|
||||
.build();
|
||||
|
||||
/**
|
||||
* 批量执行日志查看线程池
|
||||
*/
|
||||
ThreadPoolExecutor EXEC_LOG = ExecutorBuilder.create()
|
||||
.namedThreadFactory("exec-log-")
|
||||
.corePoolSize(1)
|
||||
.maxPoolSize(Integer.MAX_VALUE)
|
||||
.keepAliveTime(Const.MS_S_60)
|
||||
.workQueue(new SynchronousQueue<>())
|
||||
.allowCoreThreadTimeout(true)
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.orion.ops.module.asset.define.cache;
|
||||
|
||||
import com.orion.lang.define.cache.key.CacheKeyBuilder;
|
||||
import com.orion.lang.define.cache.key.CacheKeyDefine;
|
||||
import com.orion.lang.define.cache.key.struct.RedisCacheStruct;
|
||||
import com.orion.ops.module.asset.entity.dto.ExecLogTailDTO;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 命令执行服务缓存 key
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/3/18 16:31
|
||||
*/
|
||||
public interface ExecCacheKeyDefine {
|
||||
|
||||
CacheKeyDefine EXEC_TAIL = new CacheKeyBuilder()
|
||||
.key("exec:tail:{}")
|
||||
.desc("命令执行日志查看 ${token}")
|
||||
.type(ExecLogTailDTO.class)
|
||||
.struct(RedisCacheStruct.STRING)
|
||||
.timeout(5, TimeUnit.MINUTES)
|
||||
.build();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.orion.ops.module.asset.define.operator;
|
||||
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.Module;
|
||||
import com.orion.ops.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
|
||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||
|
||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.*;
|
||||
|
||||
/**
|
||||
* 批量执行 操作记录类型
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 11:31
|
||||
*/
|
||||
@Module("asset:exec")
|
||||
public class ExecOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String EXEC_COMMAND = "exec:exec-command";
|
||||
|
||||
public static final String INTERRUPT_EXEC = "exec:interrupt-exec";
|
||||
|
||||
public static final String INTERRUPT_HOST = "exec:interrupt-host";
|
||||
|
||||
public static final String DELETE_LOG = "exec:delete-log";
|
||||
|
||||
public static final String CLEAR_LOG = "exec:clear-log";
|
||||
|
||||
public static final String DELETE_HOST_LOG = "exec:delete-host-log";
|
||||
|
||||
public static final String DOWNLOAD_HOST_LOG = "exec:download-host-log";
|
||||
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
new OperatorType(M, EXEC_COMMAND, "执行主机命令"),
|
||||
new OperatorType(M, INTERRUPT_EXEC, "中断执行命令"),
|
||||
new OperatorType(M, INTERRUPT_HOST, "中断主机执行命令 <sb>${logId}</sb> <sb>${hostName}</sb>"),
|
||||
new OperatorType(H, DELETE_LOG, "删除执行记录 <sb>${count}</sb> 条"),
|
||||
new OperatorType(H, CLEAR_LOG, "清理执行记录 <sb>${count}</sb> 条"),
|
||||
new OperatorType(H, DELETE_HOST_LOG, "删除主机执行记录 <sb>${logId}</sb> <sb>${hostName}</sb>"),
|
||||
new OperatorType(L, DOWNLOAD_HOST_LOG, "下载主机执行日志 <sb>${logId}</sb> <sb>${hostName}</sb>"),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.orion.ops.module.asset.define.operator;
|
||||
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.Module;
|
||||
import com.orion.ops.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
|
||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||
|
||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.*;
|
||||
|
||||
/**
|
||||
* 执行模板 操作日志类型
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-7 18:08
|
||||
*/
|
||||
@Module("asset:exec-template")
|
||||
public class ExecTemplateOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String CREATE = "exec-template:create";
|
||||
|
||||
public static final String UPDATE = "exec-template:update";
|
||||
|
||||
public static final String DELETE = "exec-template:delete";
|
||||
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
new OperatorType(L, CREATE, "创建执行模板 ${name}"),
|
||||
new OperatorType(M, UPDATE, "更新执行模板 ${name}"),
|
||||
new OperatorType(H, DELETE, "删除执行模板 ${name}"),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||