⚡ 操作日志不用记录 command.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.orion.ops.module.asset.convert;
|
||||
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecCommandExecRequest;
|
||||
import com.orion.ops.module.asset.entity.dto.ExecCommandExecDTO;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecCommandRequest;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
@@ -17,6 +17,6 @@ public interface ExecConvert {
|
||||
|
||||
ExecConvert MAPPER = Mappers.getMapper(ExecConvert.class);
|
||||
|
||||
ExecCommandExecRequest to(ExecCommandRequest request);
|
||||
ExecCommandExecDTO to(ExecCommandRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ public class ExecTemplateOperatorType extends InitializingOperatorTypes {
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
new OperatorType(L, CREATE, "创建执行模板 ${name}"),
|
||||
new OperatorType(M, UPDATE, "更新执行模板 ${name}"),
|
||||
new OperatorType(H, DELETE, "删除执行模板 ${name}"),
|
||||
new OperatorType(L, CREATE, "创建执行模板 <sb>${name}</sb>"),
|
||||
new OperatorType(M, UPDATE, "更新执行模板 <sb>${name}</sb>"),
|
||||
new OperatorType(H, DELETE, "删除执行模板 <sb>${name}</sb>"),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.orion.ops.module.asset.entity.request.exec;
|
||||
package com.orion.ops.module.asset.entity.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -19,8 +19,8 @@ import java.util.List;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "ExecCommandExecRequest", description = "批量执行命令 请求对象")
|
||||
public class ExecCommandExecRequest {
|
||||
@Schema(name = "ExecCommandExecDTO", description = "批量执行命令对象")
|
||||
public class ExecCommandExecDTO {
|
||||
|
||||
@Schema(description = "执行用户id")
|
||||
private Long userId;
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orion.ops.module.asset.entity.request.exec;
|
||||
|
||||
import com.orion.ops.framework.desensitize.core.annotation.Desensitize;
|
||||
import com.orion.ops.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@@ -19,6 +21,7 @@ import java.util.List;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@DesensitizeObject
|
||||
@Schema(name = "ExecCommandRequest", description = "批量执行命令 请求对象")
|
||||
public class ExecCommandRequest {
|
||||
|
||||
@@ -35,6 +38,7 @@ public class ExecCommandRequest {
|
||||
private Integer scriptExec;
|
||||
|
||||
@NotBlank
|
||||
@Desensitize(toEmpty = true)
|
||||
@Schema(description = "执行命令")
|
||||
private String command;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orion.ops.module.asset.entity.request.exec;
|
||||
|
||||
import com.orion.ops.framework.desensitize.core.annotation.Desensitize;
|
||||
import com.orion.ops.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@@ -21,6 +23,7 @@ import java.util.List;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@DesensitizeObject
|
||||
@Schema(name = "ExecJobCreateRequest", description = "计划任务 创建请求对象")
|
||||
public class ExecJobCreateRequest implements Serializable {
|
||||
|
||||
@@ -45,6 +48,7 @@ public class ExecJobCreateRequest implements Serializable {
|
||||
private Integer scriptExec;
|
||||
|
||||
@NotBlank
|
||||
@Desensitize(toEmpty = true)
|
||||
@Schema(description = "执行命令")
|
||||
private String command;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orion.ops.module.asset.entity.request.exec;
|
||||
|
||||
import com.orion.ops.framework.desensitize.core.annotation.Desensitize;
|
||||
import com.orion.ops.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@@ -21,6 +23,7 @@ import java.util.List;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@DesensitizeObject
|
||||
@Schema(name = "ExecJobUpdateRequest", description = "计划任务 更新请求对象")
|
||||
public class ExecJobUpdateRequest implements Serializable {
|
||||
|
||||
@@ -49,6 +52,7 @@ public class ExecJobUpdateRequest implements Serializable {
|
||||
private Integer scriptExec;
|
||||
|
||||
@NotBlank
|
||||
@Desensitize(toEmpty = true)
|
||||
@Schema(description = "执行命令")
|
||||
private String command;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orion.ops.module.asset.entity.request.exec;
|
||||
|
||||
import com.orion.ops.framework.desensitize.core.annotation.Desensitize;
|
||||
import com.orion.ops.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -22,6 +24,7 @@ import java.io.Serializable;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@DesensitizeObject
|
||||
@Schema(name = "ExecTemplateCreateRequest", description = "执行模板 创建请求对象")
|
||||
public class ExecTemplateCreateRequest implements Serializable {
|
||||
|
||||
@@ -33,6 +36,7 @@ public class ExecTemplateCreateRequest implements Serializable {
|
||||
private String name;
|
||||
|
||||
@NotBlank
|
||||
@Desensitize(toEmpty = true)
|
||||
@Schema(description = "命令")
|
||||
private String command;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orion.ops.module.asset.entity.request.exec;
|
||||
|
||||
import com.orion.ops.framework.desensitize.core.annotation.Desensitize;
|
||||
import com.orion.ops.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -22,6 +24,7 @@ import java.io.Serializable;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@DesensitizeObject
|
||||
@Schema(name = "ExecTemplateUpdateRequest", description = "执行模板 更新请求对象")
|
||||
public class ExecTemplateUpdateRequest implements Serializable {
|
||||
|
||||
@@ -38,6 +41,7 @@ public class ExecTemplateUpdateRequest implements Serializable {
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "命令")
|
||||
@Desensitize(toEmpty = true)
|
||||
private String command;
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.orion.ops.module.asset.service;
|
||||
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecCommandExecRequest;
|
||||
import com.orion.ops.module.asset.entity.dto.ExecCommandExecDTO;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecCommandRequest;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecLogVO;
|
||||
|
||||
@@ -27,7 +27,7 @@ public interface ExecCommandService {
|
||||
* @param request request
|
||||
* @return result
|
||||
*/
|
||||
ExecLogVO execCommandWithSource(ExecCommandExecRequest request);
|
||||
ExecLogVO execCommandWithSource(ExecCommandExecDTO request);
|
||||
|
||||
/**
|
||||
* 重新执行命令
|
||||
|
||||
@@ -28,8 +28,8 @@ import com.orion.ops.module.asset.dao.HostDAO;
|
||||
import com.orion.ops.module.asset.entity.domain.ExecHostLogDO;
|
||||
import com.orion.ops.module.asset.entity.domain.ExecLogDO;
|
||||
import com.orion.ops.module.asset.entity.domain.HostDO;
|
||||
import com.orion.ops.module.asset.entity.dto.ExecCommandExecDTO;
|
||||
import com.orion.ops.module.asset.entity.dto.ExecParameterSchemaDTO;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecCommandExecRequest;
|
||||
import com.orion.ops.module.asset.entity.request.exec.ExecCommandRequest;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecHostLogVO;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecLogVO;
|
||||
@@ -99,7 +99,7 @@ public class ExecCommandServiceImpl implements ExecCommandService {
|
||||
log.info("ExecService.startExecCommand host hostList: {}", hostIdList);
|
||||
Valid.notEmpty(hostIdList, ErrorMessage.CHECK_AUTHORIZED_HOST);
|
||||
// 执行命令
|
||||
ExecCommandExecRequest execRequest = ExecConvert.MAPPER.to(request);
|
||||
ExecCommandExecDTO execRequest = ExecConvert.MAPPER.to(request);
|
||||
execRequest.setUserId(userId);
|
||||
execRequest.setUsername(user.getUsername());
|
||||
execRequest.setSource(ExecSourceEnum.BATCH.name());
|
||||
@@ -108,7 +108,7 @@ public class ExecCommandServiceImpl implements ExecCommandService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ExecLogVO execCommandWithSource(ExecCommandExecRequest request) {
|
||||
public ExecLogVO execCommandWithSource(ExecCommandExecDTO request) {
|
||||
String command = request.getCommand();
|
||||
List<Long> hostIdList = request.getHostIdList();
|
||||
// 查询主机信息
|
||||
@@ -258,7 +258,7 @@ public class ExecCommandServiceImpl implements ExecCommandService {
|
||||
* @param request request
|
||||
* @return params
|
||||
*/
|
||||
private Map<String, Object> getBaseBuiltinsParams(Long execId, ExecCommandExecRequest request) {
|
||||
private Map<String, Object> getBaseBuiltinsParams(Long execId, ExecCommandExecDTO request) {
|
||||
String uuid = UUIds.random();
|
||||
Date date = new Date();
|
||||
// 输入参数
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.orion.ops.module.asset.dao.HostDAO;
|
||||
import com.orion.ops.module.asset.entity.domain.ExecJobDO;
|
||||
import com.orion.ops.module.asset.entity.domain.ExecLogDO;
|
||||
import com.orion.ops.module.asset.entity.domain.HostDO;
|
||||
import com.orion.ops.module.asset.entity.dto.ExecCommandExecDTO;
|
||||
import com.orion.ops.module.asset.entity.request.exec.*;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecJobVO;
|
||||
import com.orion.ops.module.asset.entity.vo.ExecLogVO;
|
||||
@@ -281,7 +282,7 @@ public class ExecJobServiceImpl implements ExecJobService {
|
||||
OperatorLogs.add(OperatorLogs.NAME, job.getName());
|
||||
OperatorLogs.add(OperatorLogs.SEQ, execSeq);
|
||||
// 执行命令
|
||||
ExecCommandExecRequest exec = ExecCommandExecRequest.builder()
|
||||
ExecCommandExecDTO exec = ExecCommandExecDTO.builder()
|
||||
.userId(request.getUserId())
|
||||
.username(request.getUsername())
|
||||
.source(ExecSourceEnum.JOB.name())
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<!-- 左侧信息 -->
|
||||
<a-space class="log-header-left" :size="12">
|
||||
<!-- 执行序列 -->
|
||||
<a-tag v-if="execLog.execSeq" color="green">
|
||||
<a-tag v-if="execLog.execSeq" color="purple">
|
||||
#{{ execLog.execSeq }}
|
||||
</a-tag>
|
||||
<!-- 状态 -->
|
||||
|
||||
Reference in New Issue
Block a user