⬆️ 升级 orion-kit 版本.

This commit is contained in:
lijiahang
2024-04-07 18:59:43 +08:00
parent d1a73dc7d8
commit c674860885
7 changed files with 14 additions and 76 deletions

View File

@@ -4,6 +4,7 @@
`2024-04-` `release`
* 🚀 升级 `orion-kit``1.0.7`
* 🐞 修复 批量执行选择模板后默认参数未自动设置
* 🐞 修复 主机列表卡片视图重置条件后 tag 消失
* 🐞 修复 主机分组授权页面刷新不显示 loading

View File

@@ -18,7 +18,7 @@
<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>
<orion.kit.revision>1.0.6</orion.kit.revision>
<orion.kit.revision>1.0.7</orion.kit.revision>
<aspectj.version>1.9.7</aspectj.version>
<lombok.version>1.18.26</lombok.version>
<springdoc.version>1.6.15</springdoc.version>
@@ -336,4 +336,4 @@
</plugins>
</build>
</project>
</project>

View File

@@ -74,7 +74,7 @@ public enum ErrorCode implements CodeInfo {
DECRYPT_ERROR(908, "数据解密异常"),
EXPRESSION_ERROR(909, "表达式错误"),
PARSE_ERROR(909, "解析失败"),
TASK_EXECUTE_ERROR(910, "任务执行异常"),

View File

@@ -243,11 +243,10 @@ public class GlobalExceptionHandler {
return ErrorCode.INTERNAL_SERVER_ERROR.wrapper();
}
// TODO kit
@ExceptionHandler(value = ParseCronException.class)
public HttpWrapper<?> parseCronExceptionHandler(ParseCronException ex) {
log.error("parseCronExceptionHandler", ex);
return ErrorCode.EXPRESSION_ERROR.wrapper();
@ExceptionHandler(value = ParseRuntimeException.class)
public HttpWrapper<?> parseRuntimeExceptionHandler(ParseRuntimeException ex) {
log.error("parseRuntimeExceptionHandler", ex);
return ErrorCode.PARSE_ERROR.wrapper();
}
@ExceptionHandler(value = CodeArgumentException.class)

View File

@@ -1,55 +0,0 @@
package com.orion.ops.module.asset.handler.host.exec.command;
import com.orion.lang.support.timeout.TimeoutChecker;
import com.orion.lang.support.timeout.TimeoutEndpoint;
import com.orion.lang.utils.Threads;
import java.util.ArrayList;
import java.util.List;
/**
* TODO KIT
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/3/20 16:50
*/
public class TimeOutCheckerFix implements TimeoutChecker {
private final List<TimeoutEndpoint> tasks = new ArrayList<>();
private final long delay;
private boolean run;
public TimeOutCheckerFix() {
this(DEFAULT_DELAY);
}
public TimeOutCheckerFix(long delay) {
this.delay = delay;
this.run = true;
}
@Override
public <T extends TimeoutEndpoint> void addTask(T task) {
tasks.add(task);
}
@Override
public void run() {
while (run) {
// 完成或超时 直接移除
tasks.removeIf(ch -> ch.isDone() || ch.checkTimeout());
// 等待
// 不为空则休眠
Threads.sleep(delay);
}
}
@Override
public void close() {
this.run = false;
}
}

View File

@@ -1,6 +1,7 @@
package com.orion.ops.module.asset.handler.host.exec.command.handler;
import com.orion.lang.support.timeout.TimeoutChecker;
import com.orion.lang.support.timeout.TimeoutCheckers;
import com.orion.lang.utils.Threads;
import com.orion.lang.utils.collect.Lists;
import com.orion.lang.utils.io.Streams;
@@ -8,7 +9,6 @@ import com.orion.ops.module.asset.dao.ExecLogDAO;
import com.orion.ops.module.asset.define.AssetThreadPools;
import com.orion.ops.module.asset.entity.domain.ExecLogDO;
import com.orion.ops.module.asset.enums.ExecStatusEnum;
import com.orion.ops.module.asset.handler.host.exec.command.TimeOutCheckerFix;
import com.orion.ops.module.asset.handler.host.exec.command.dto.ExecCommandDTO;
import com.orion.ops.module.asset.handler.host.exec.command.dto.ExecCommandHostDTO;
import com.orion.ops.module.asset.handler.host.exec.command.manager.ExecTaskManager;
@@ -87,7 +87,8 @@ public class ExecTaskHandler implements IExecTaskHandler {
private void runHostCommand(List<ExecCommandHostDTO> hosts) throws Exception {
// 超时检查
if (execCommand.getTimeout() != 0) {
this.timeoutChecker = new TimeOutCheckerFix();
// TODO test
this.timeoutChecker = TimeoutCheckers.create();
AssetThreadPools.TIMEOUT_CHECK.execute(this.timeoutChecker);
}
if (hosts.size() == 1) {

View File

@@ -13,14 +13,12 @@ import com.orion.ops.module.asset.entity.request.host.HostSftpLogQueryRequest;
import com.orion.ops.module.asset.entity.vo.HostSftpLogVO;
import com.orion.ops.module.asset.service.HostSftpLogService;
import com.orion.ops.module.infra.api.OperatorLogApi;
import com.orion.ops.module.infra.entity.dto.operator.OperatorLogDTO;
import com.orion.ops.module.infra.entity.dto.operator.OperatorLogQueryDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* SFTP 操作日志 服务实现类
@@ -40,9 +38,9 @@ public class HostSftpLogServiceImpl implements HostSftpLogService {
public DataGrid<HostSftpLogVO> getHostSftpLogPage(HostSftpLogQueryRequest request) {
// 查询
OperatorLogQueryDTO query = this.buildQueryInfo(request);
DataGrid<OperatorLogDTO> dataGrid = operatorLogApi.getOperatorLogPage(query);
// TODO TEST
// 转换
List<HostSftpLogVO> rows = dataGrid.stream()
return operatorLogApi.getOperatorLogPage(query)
.map(s -> {
JSONObject extra = JSON.parseObject(s.getExtra());
HostSftpLogVO vo = HostSftpLogConvert.MAPPER.to(s);
@@ -52,13 +50,7 @@ public class HostSftpLogServiceImpl implements HostSftpLogService {
vo.setPaths(extra.getString(ExtraFieldConst.PATH).split("\\|"));
vo.setExtra(extra);
return vo;
}).collect(Collectors.toList());
// 返回
// TODO KIT
DataGrid<HostSftpLogVO> result = new DataGrid<>(rows, dataGrid.getTotal());
result.setPage(dataGrid.getPage());
result.setLimit(dataGrid.getLimit());
return result;
});
}
@Override