diff --git a/README.md b/README.md index db042119..78279377 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ orion-ops-pro 是什么 -`orion-ops-pro` 一款开箱即用的一站式智能运维平台, 提供了资产管理、资产授权、Web终端、WebSftp、角色管理、系统管理等功能。致力于简化运维团队的治理工作。它是根据 `orion-ops` +`orion-ops-pro` 一款开箱即用的一站式智能运维管理平台, +提供了资产管理、资产授权、Web终端、WebSftp、角色管理、系统管理等功能。致力于简化运维团队的治理工作。它是根据 `orion-ops` 的产品思路完全重构的一套系统, 重新设计了架构并优化交互逻辑, 操作更快捷友好。

@@ -32,11 +33,12 @@ 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` 这对我很重要 +📞 合作/功能定制请联系底部 备注: '定制' ## 特性 @@ -46,10 +48,9 @@ demo: http://101.43.254.243:1081/#/ * 权限控制: 全面管理用户角色, 支持动态菜单配置和强制下线等功能。 * 在线终端: 提供便捷的在线 Web 终端服务, 支持快捷命令、自定义快捷键和主题风格。 * 文件管理: 实现远程主机大文件的批量上传、下载和在线编辑等操作。 +* 批量操作: 支持远程主机批量执行 shell 命令。 * 可扩展性: 前后端代码规范统一、代码质量高、健壮且易于阅读和扩展。 -[comment]: <> ( FIXME * 批量操作: 支持远程主机批量执行命令 以及 批量执行上传文件) - [comment]: <> ( FIXME * 调度任务: 维护 cron 表达式, 定时执行主机命令) [comment]: <> ( FIXME * 功能强大: 命令批量执行, 任务定时调度, 远程日志查看, 操作日志全记录等) @@ -112,7 +113,8 @@ roadmap: https://lijiahangmax.gitee.io/orion-ops-pro/#/about/roadmap wx -📧 微信添加备注: ops +📧 咨询问题微信备注: ops +📧 合作/功能定制备注: 合作 ## 支持一下 diff --git a/docs/README.md b/docs/README.md index 340a035f..4546ba92 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,7 +2,8 @@ orion-ops-pro 是什么 -`orion-ops-pro` 一款开箱即用的一站式智能运维平台, 提供了资产管理、资产授权、Web终端、WebSftp、角色管理、系统管理等功能。致力于简化运维团队的治理工作。它是根据 `orion-ops` +`orion-ops-pro` 一款开箱即用的一站式智能运维管理平台, +提供了资产管理、资产授权、Web终端、WebSftp、角色管理、系统管理等功能。致力于简化运维团队的治理工作。它是根据 `orion-ops` 的产品思路完全重构的一套系统, 重新设计了架构并优化交互逻辑, 操作更快捷友好。

@@ -32,11 +33,12 @@ 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` 这对我很重要 +📞 合作/功能定制请联系底部 备注: '合作' ## 特性 @@ -46,10 +48,9 @@ demo: http://101.43.254.243:1081/#/ * 权限控制: 全面管理用户角色, 支持动态菜单配置和强制下线等功能。 * 在线终端: 提供便捷的在线 Web 终端服务, 支持快捷命令、自定义快捷键和主题风格。 * 文件管理: 实现远程主机大文件的批量上传、下载和在线编辑等操作。 +* 批量操作: 支持远程主机批量执行 shell 命令。 * 可扩展性: 前后端代码规范统一、代码质量高、健壮且易于阅读和扩展。 -[comment]: <> ( FIXME * 批量操作: 支持远程主机批量执行命令 以及 批量执行上传文件) - [comment]: <> ( FIXME * 调度任务: 维护 cron 表达式, 定时执行主机命令) [comment]: <> ( FIXME * 功能强大: 命令批量执行, 任务定时调度, 远程日志查看, 操作日志全记录等) @@ -112,7 +113,8 @@ roadmap: https://lijiahangmax.gitee.io/orion-ops-pro/#/about/roadmap wx -📧 微信添加备注: ops +📧 咨询问题微信备注: ops +📧 合作/功能定制备注: 合作 ## 支持一下 diff --git a/docs/about/update.md b/docs/about/update.md index 89ab7d14..c2849e72 100644 --- a/docs/about/update.md +++ b/docs/about/update.md @@ -1,5 +1,15 @@ ⚡ 注意: 应用不支持跨版本升级, 可以进行多次升级 +## 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`; +``` + ## v1.0.1 > sql 脚本 diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/controller/ExecController.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/controller/ExecController.java index aa58078f..b6b28a43 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/controller/ExecController.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/controller/ExecController.java @@ -75,6 +75,5 @@ public class ExecController { } // TODO tail log - // TODO parameterSchema 存储 } diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/domain/ExecLogDO.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/domain/ExecLogDO.java index e30ddfcd..e2f995a2 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/domain/ExecLogDO.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/domain/ExecLogDO.java @@ -56,6 +56,10 @@ public class ExecLogDO extends BaseDO { @TableField("command") private String command; + @Schema(description = "参数 schema") + @TableField("parameter_schema") + private String parameterSchema; + @Schema(description = "超时时间") @TableField("timeout") private Integer timeout; diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/request/exec/ExecCommandRequest.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/request/exec/ExecCommandRequest.java index 93440067..13dd5475 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/request/exec/ExecCommandRequest.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/request/exec/ExecCommandRequest.java @@ -38,6 +38,10 @@ public class ExecCommandRequest { @Schema(description = "执行参数") private String parameter; + @NotBlank + @Schema(description = "参数 schema") + private String parameterSchema; + @NotEmpty @Schema(description = "执行主机") private List hostIdList; diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/vo/ExecLogVO.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/vo/ExecLogVO.java index bfa302b3..3871e04d 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/vo/ExecLogVO.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/vo/ExecLogVO.java @@ -40,6 +40,9 @@ public class ExecLogVO implements Serializable { @Schema(description = "执行命令") private String command; + @Schema(description = "参数 schema") + private String parameterSchema; + @Schema(description = "超时时间") private Integer timeout; diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/handler/ExecCommandHandler.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/handler/ExecCommandHandler.java index 5370752d..ce4665d8 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/handler/ExecCommandHandler.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/handler/ExecCommandHandler.java @@ -2,6 +2,7 @@ package com.orion.ops.module.asset.handler.host.exec.handler; import com.alibaba.fastjson.JSON; import com.orion.lang.exception.AuthenticationException; +import com.orion.lang.exception.ConnectionRuntimeException; import com.orion.lang.exception.argument.InvalidArgumentException; import com.orion.lang.support.timeout.TimeoutChecker; import com.orion.lang.utils.Strings; @@ -82,7 +83,6 @@ public class ExecCommandHandler implements IExecCommandHandler { } // 执行回调 if (this.interrupted) { - // TODO 测试 // 中断执行 this.updateStatus(ExecHostStatusEnum.INTERRUPTED, null); } else if (ex != null) { @@ -192,6 +192,8 @@ public class ExecCommandHandler implements IExecCommandHandler { message = "执行超时"; } else if (ex instanceof InvalidArgumentException) { message = ex.getMessage(); + } else if (ex instanceof ConnectionRuntimeException) { + message = "连接失败"; } else if (ex instanceof AuthenticationException) { message = "认证失败"; } else { diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecServiceImpl.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecServiceImpl.java index c9f17a01..0f5b3a24 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecServiceImpl.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/ExecServiceImpl.java @@ -102,6 +102,7 @@ public class ExecServiceImpl implements ExecService { .source(ExecSourceEnum.BATCH.name()) .description(Strings.ifBlank(request.getDescription(), Strings.retain(command, 60) + Const.OMIT)) .command(command) + .parameterSchema(request.getParameterSchema()) .timeout(request.getTimeout()) .status(ExecStatusEnum.WAITING.name()) .build(); @@ -159,6 +160,7 @@ public class ExecServiceImpl implements ExecService { .timeout(execLog.getTimeout()) .command(execLog.getCommand()) .parameter(hostLogs.get(0).getParameter()) + .parameterSchema(execLog.getParameterSchema()) .hostIdList(hostIdList) .build(); return this.execCommand(request); diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/resources/mapper/ExecLogMapper.xml b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/resources/mapper/ExecLogMapper.xml index 4d9cd14a..d2860196 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/resources/mapper/ExecLogMapper.xml +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/resources/mapper/ExecLogMapper.xml @@ -11,6 +11,7 @@ + @@ -24,7 +25,7 @@ - id, user_id, username, source, source_id, description, command, timeout, status, start_time, finish_time, create_time, update_time, creator, updater, deleted + id, user_id, username, source, source_id, description, command, parameter_schema, timeout, status, start_time, finish_time, create_time, update_time, creator, updater, deleted diff --git a/orion-ops-ui/src/api/exec/exec.ts b/orion-ops-ui/src/api/exec/exec.ts index ac61830e..77eeeb8b 100644 --- a/orion-ops-ui/src/api/exec/exec.ts +++ b/orion-ops-ui/src/api/exec/exec.ts @@ -33,9 +33,9 @@ export interface ExecCommandResponse { } /** - * 执行命令 + * 批量执行命令 */ -export function execCommand(request: ExecCommandRequest) { +export function batchExecCommand(request: ExecCommandRequest) { return axios.post('/asset/exec/exec-command', request); } diff --git a/orion-ops-ui/src/components/view/exec-editor/index.vue b/orion-ops-ui/src/components/view/exec-editor/index.vue index c24d2e50..72c42ed7 100644 --- a/orion-ops-ui/src/components/view/exec-editor/index.vue +++ b/orion-ops-ui/src/components/view/exec-editor/index.vue @@ -48,10 +48,11 @@ // 内置参数提示 builtinsParams.forEach(s => { suggestions.push({ - label: s.name, - kind: monaco.languages.CompletionItemKind.Function, + label: '_' + s.name, + kind: monaco.languages.CompletionItemKind.Variable, insertText: `@{{ ${s.name} }}`, detail: s.desc || '', + documentation: s.desc || '', }); }); // 命令参数提示 @@ -60,10 +61,11 @@ return; } suggestions.push({ - label: s.name, - kind: monaco.languages.CompletionItemKind.Function, + label: '_' + s.name, + kind: monaco.languages.CompletionItemKind.Field, insertText: `@{{ ${s.name} }}`, detail: s.desc || '', + documentation: s.desc || '', }); }); return { diff --git a/orion-ops-ui/src/utils/index.ts b/orion-ops-ui/src/utils/index.ts index 58995bcd..314c1244 100644 --- a/orion-ops-ui/src/utils/index.ts +++ b/orion-ops-ui/src/utils/index.ts @@ -108,6 +108,9 @@ export function formatDuration(start: number, end?: number): string { return ''; } const duration = (end - start) / 1000; + if (duration < 1) { + return `${duration.toFixed(1)}s`; + } const minutes = Math.floor(duration / 60); const seconds = Math.floor(duration % 60); let result = ''; @@ -188,7 +191,7 @@ export const resetObject = (obj: any, ignore: string[] = []) => { export const objectTruthKeyCount = (obj: any, ignore: string[] = []) => { return Object.keys(obj) .filter(s => !ignore.includes(s)) - .reduce(function(acc, curr) { + .reduce(function (acc, curr) { const currVal = obj[curr]; return acc + ~~(currVal !== undefined && currVal !== null && currVal?.length !== 0 && currVal !== ''); }, 0); @@ -221,7 +224,7 @@ export function detectZoom() { * 获取唯一的 UUID */ export function getUUID() { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { const r = Math.random() * 16 | 0; const v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); diff --git a/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-table.vue b/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-table.vue index a6f85803..787bc9ae 100644 --- a/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-table.vue +++ b/orion-ops-ui/src/views/asset-audit/connect-log/components/connect-log-table.vue @@ -19,10 +19,6 @@ placeholder="请选择主机" allow-clear /> - - - - + + + + -

123
+
+ +