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