Skip to content

Commit

Permalink
Some fixes to the position of the dynamic properties in the request, …
Browse files Browse the repository at this point in the history
…changes to the controller, and added comments to the config table
  • Loading branch information
周倬贤 committed Apr 7, 2024
1 parent d4ddbd8 commit baa7aa6
Show file tree
Hide file tree
Showing 34 changed files with 106 additions and 170 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public String updateConfigsByTypeAndId(@Validated @RequestBody UpdateConfigDTO u
@PostMapping("/cluster/config/getInstanceDetailConfigs")
public List<DetailConfigsVO> getInstanceDetailConfigs(@Validated @RequestBody GetConfigsListDTO getConfigsListDTO) {
List<ConfigEntity> configEntityList = configService.selectToFront(getConfigsListDTO.getInstanceId(),
getConfigsListDTO.getInstanceType(), getConfigsListDTO.getDynamicGetConfigDto());
getConfigsListDTO.getInstanceType(), getConfigsListDTO);
Map<String, String> stringStringConcurrentHashMap = configService.selectDefaultConfig(getConfigsListDTO.getBusinessType(),
getConfigsListDTO.getInstanceId(), getConfigsListDTO.getInstanceType());
ArrayList<DetailConfigsVO> showDetailConfigsVOS = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@
package org.apache.eventmesh.dashboard.console.controller;

import org.apache.eventmesh.dashboard.console.entity.log.LogEntity;
import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO;
import org.apache.eventmesh.dashboard.console.service.log.LogService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
Expand All @@ -32,9 +35,9 @@ public class LogController {
@Autowired
private LogService logService;

@GetMapping("/cluster/log/getList")
public List<LogEntity> getLogLIstToFront(Integer pageIndex, Integer pageNum) {
return logService.getLogListByCluster(pageIndex, pageNum);
@PostMapping("/cluster/log/getList")
public List<LogEntity> getLogLIstToFront(@Validated @RequestBody GetLogListDTO getLogListDTO) {
return logService.getLogListByCluster(getLogListDTO);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public boolean matchVersion(String eventmeshVersion) {
return (xiaoyu(eventmeshVersion) && dayu(eventmeshVersion));
}


public boolean xiaoyu(String eventmeshVersion) {
String[] em = eventmeshVersion.split(".");
String[] startVersion = this.getStartVersion().split(".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,4 @@ public class DefaultConfigKey {
private String businessType;

private String configName;


}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ public interface ClientMapper {
void insert(ClientEntity clientEntity);

@Update("UPDATE `client` SET status = 0, end_time = NOW() WHERE id = #{id}")
void deActive(ClientEntity clientEntity);
void deActivate(ClientEntity clientEntity);

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ public interface ClusterMapper {
void updateClusterById(ClusterEntity cluster);

@Update("UPDATE cluster SET status=0 WHERE id=#{id}")
void deActive(ClusterEntity clusterEntity);
void deActivate(ClusterEntity clusterEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public interface ConnectorMapper {
void active(ConnectorEntity connectorEntity);

@Update("UPDATE connector SET status = 0 WHERE id = #{id}")
void deActive(ConnectorEntity connectorEntity);
void deActivate(ConnectorEntity connectorEntity);

@Update("UPDATE connector SET pod_state = #{podState} WHERE id = #{id}")
void updatePodState(ConnectorEntity connectorEntity);
Expand All @@ -76,7 +76,7 @@ public interface ConnectorMapper {
void updateConfigIds(ConnectorEntity connectorEntity);

@Update("UPDATE connector SET status = 0 WHERE cluster_id = #{clusterId}")
void deActiveById(ConnectorEntity connectorEntity);
void deActivateById(ConnectorEntity connectorEntity);

@Update({
"<script>",
Expand All @@ -87,5 +87,5 @@ public interface ConnectorMapper {
" </foreach>",
"</script>"
})
void batchDeActive(List<ConnectorEntity> connectorEntities);
void batchDeActivate(List<ConnectorEntity> connectorEntities);
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,35 @@ public interface OprLogMapper {
"</script>"})
List<LogEntity> getLogList(LogEntity logEntity);

@Insert("INSERT INTO operation_log ( cluster_id, operation_type,target_Type, content,operation_user,result)"
@Insert("INSERT INTO operation_log ( cluster_id, operation_type,target_type, content,operation_user,result)"
+ "VALUE (#{clusterId},#{operationType},#{targetType},#{content},#{operationUser},#{result})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
Long addLog(LogEntity logEntity);

@Update("UPDATE operation_log SET state=#{state} ,result=#{result} WHERE id=#{id}")
Integer updateLog(LogEntity logEntity);

@Select("SELECT * FROM operation_log WHERE is_delete=0")
List<LogEntity> getLogListToFront(Integer pageIndex, Integer pageNum);
@Select({
"<script>",
"SELECT * FROM operation_log",
"<where>",
"<if test='clusterId != null'>",
"AND cluster_id = #{clusterId}",
"</if>",
"<if test='operationType != null'>",
"AND operation_type = #{operationType}",
"</if>",
"<if test='targetType != null'>",
"AND target_type = #{targetType}",
"</if>",
"<if test='state != null'>",
"AND state = #{state}",
"</if>",
"<if test='operationUser != null'>",
"AND operation_user = #{operationUser}",
"</if>",
"</where>",
"</script>"
})
List<LogEntity> getLogListToFront(LogEntity logEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ public interface MetaMapper {
Long insert(MetaEntity metaEntity);

@Update("UPDATE meta SET status = 0 WHERE id = #{id}")
void deActive(MetaEntity metaEntity);
void deActivate(MetaEntity metaEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ public interface RuntimeMapper {
void deleteRuntimeByCluster(RuntimeEntity runtimeEntity);

@Update("UPDATE runtime SET status = 0 WHERE id = #{id}")
void deActive(RuntimeEntity runtimeEntity);
void deActivate(RuntimeEntity runtimeEntity);

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ public class GetConfigsListDTO {

private Integer instanceType;

private DynamicGetConfigDTO dynamicGetConfigDto;
private String configName;

private Integer isModify;

private Integer alreadyUpdate;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public class GetConnectionListDTO {

private Long clusterId;

private DynamicGetConnectionDTO dynamicGetConnectionDTO;
private String topicName;

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.eventmesh.dashboard.console.modle.dto.config;
package org.apache.eventmesh.dashboard.console.modle.dto.log;

import lombok.AllArgsConstructor;
import lombok.Data;
Expand All @@ -24,11 +24,15 @@
@NoArgsConstructor
@AllArgsConstructor
@Data
public class DynamicGetConfigDTO {
public class GetLogListDTO {

private String configName;
private String operationType;

private Integer isModify;
private String targetType;

private Integer alreadyUpdate;
private Long clusterId;

private Integer state;

private String operationUser;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public class GetRuntimeListDTO {

private Long clusterId;

private DynamicGetRuntimeDTO dynamicGetRuntimeDTO;
private String host;

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ public class GetTopicListDTO {

private Long clusterId;

private DynamicGetTopicDTO dynamicGetTopicDTO;
private String topicName;
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void updateClusterById(ClusterEntity cluster) {

@Override
public void deleteClusterById(ClusterEntity cluster) {
clusterMapper.deActive(cluster);
clusterMapper.deActivate(cluster);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
import org.apache.eventmesh.dashboard.console.modle.dto.config.ChangeConfigDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.config.DynamicGetConfigDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO;

import java.util.List;
import java.util.Map;
Expand All @@ -31,7 +31,7 @@
*/
public interface ConfigService {

List<ConfigEntity> selectToFront(Long instanceId, Integer type, DynamicGetConfigDTO dynamicGetConfigDto);
List<ConfigEntity> selectToFront(Long instanceId, Integer type, GetConfigsListDTO getConfigsListDTO);

void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId, List<ChangeConfigDTO> changeConfigDTOList);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.eventmesh.dashboard.console.entity.config.DefaultConfigKey;
import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper;
import org.apache.eventmesh.dashboard.console.modle.dto.config.ChangeConfigDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.config.DynamicGetConfigDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.config.UpdateConfigsLog;
import org.apache.eventmesh.dashboard.console.service.config.ConfigService;

Expand Down Expand Up @@ -181,27 +181,27 @@ public List<ConfigEntity> selectByInstanceIdAndType(Long instanceId, Integer typ
return configMapper.selectByInstanceId(config);
}

public ConfigEntity setSearchCriteria(DynamicGetConfigDTO dynamicGetConfigDto, ConfigEntity configEntity) {
if (dynamicGetConfigDto != null) {
if (dynamicGetConfigDto.getConfigName() != null) {
configEntity.setConfigName(dynamicGetConfigDto.getConfigName());
public ConfigEntity setSearchCriteria(GetConfigsListDTO getConfigsListDTO, ConfigEntity configEntity) {
if (getConfigsListDTO != null) {
if (getConfigsListDTO.getConfigName() != null) {
configEntity.setConfigName(getConfigsListDTO.getConfigName());
}
if (dynamicGetConfigDto.getIsModify() != null) {
configEntity.setIsModify(dynamicGetConfigDto.getIsModify());
if (getConfigsListDTO.getIsModify() != null) {
configEntity.setIsModify(getConfigsListDTO.getIsModify());
}
if (dynamicGetConfigDto.getAlreadyUpdate() != null) {
configEntity.setAlreadyUpdate(dynamicGetConfigDto.getAlreadyUpdate());
if (getConfigsListDTO.getAlreadyUpdate() != null) {
configEntity.setAlreadyUpdate(getConfigsListDTO.getAlreadyUpdate());
}
}
return configEntity;
}

@Override
public List<ConfigEntity> selectToFront(Long instanceId, Integer type, DynamicGetConfigDTO dynamicGetConfigDto) {
public List<ConfigEntity> selectToFront(Long instanceId, Integer type, GetConfigsListDTO getConfigsListDTO) {
ConfigEntity config = new ConfigEntity();
config.setInstanceId(instanceId);
config.setInstanceType(type);
config = this.setSearchCriteria(dynamicGetConfigDto, config);
config = this.setSearchCriteria(getConfigsListDTO, config);
return configMapper.getConfigsToFrontWithDynamic(config);
}

Expand Down
Loading

0 comments on commit baa7aa6

Please sign in to comment.