Unverified Commit 2a36f3b2 authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

refactor some list search (#2516)

* refactor-some-list-search * Spotless Apply * format code --------- Co-authored-by: 's avatarzhu-mingye <zhu-mingye@users.noreply.github.com>
parent 1c816ced
...@@ -24,7 +24,6 @@ import org.dinky.data.constant.PermissionConstants; ...@@ -24,7 +24,6 @@ import org.dinky.data.constant.PermissionConstants;
import org.dinky.data.enums.BusinessType; import org.dinky.data.enums.BusinessType;
import org.dinky.data.enums.Status; import org.dinky.data.enums.Status;
import org.dinky.data.model.AlertGroup; import org.dinky.data.model.AlertGroup;
import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result; import org.dinky.data.result.Result;
import org.dinky.service.AlertGroupService; import org.dinky.service.AlertGroupService;
...@@ -32,15 +31,12 @@ import java.util.List; ...@@ -32,15 +31,12 @@ import java.util.List;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -65,7 +61,7 @@ public class AlertGroupController { ...@@ -65,7 +61,7 @@ public class AlertGroupController {
* @param alertGroup {@link AlertGroup} * @param alertGroup {@link AlertGroup}
* @return {@link Result} with {@link Void} * @return {@link Result} with {@link Void}
*/ */
@PutMapping @PutMapping("/addOrUpdate")
@SaCheckPermission( @SaCheckPermission(
value = {PermissionConstants.REGISTRATION_ALERT_GROUP_ADD, PermissionConstants.REGISTRATION_ALERT_GROUP_EDIT value = {PermissionConstants.REGISTRATION_ALERT_GROUP_ADD, PermissionConstants.REGISTRATION_ALERT_GROUP_EDIT
}, },
...@@ -89,19 +85,13 @@ public class AlertGroupController { ...@@ -89,19 +85,13 @@ public class AlertGroupController {
/** /**
* list alert groups * list alert groups
* *
* @param para {@link JsonNode} * @param keyword {@link String}
* @return {@link ProTableResult} with {@link AlertGroup} * @return {@link Result} with {@link AlertGroup}
*/ */
@PostMapping @GetMapping("/list")
@ApiImplicitParam(
name = "para",
value = "JsonNode",
required = true,
dataType = "JsonNode",
dataTypeClass = JsonNode.class)
@ApiOperation("Query AlertGroup List") @ApiOperation("Query AlertGroup List")
public ProTableResult<AlertGroup> listAlertGroups(@RequestBody JsonNode para) { public Result<List<AlertGroup>> listAlertGroups(@RequestParam String keyword) {
return alertGroupService.selectForProTable(para); return Result.succeed(alertGroupService.selectListByKeyWord(keyword));
} }
/** /**
......
...@@ -27,7 +27,6 @@ import org.dinky.data.dto.AlertInstanceDTO; ...@@ -27,7 +27,6 @@ import org.dinky.data.dto.AlertInstanceDTO;
import org.dinky.data.enums.BusinessType; import org.dinky.data.enums.BusinessType;
import org.dinky.data.enums.Status; import org.dinky.data.enums.Status;
import org.dinky.data.model.AlertInstance; import org.dinky.data.model.AlertInstance;
import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result; import org.dinky.data.result.Result;
import org.dinky.service.AlertInstanceService; import org.dinky.service.AlertInstanceService;
...@@ -42,7 +41,6 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -42,7 +41,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter; import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters; import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
...@@ -54,7 +52,9 @@ import io.swagger.annotations.ApiOperation; ...@@ -54,7 +52,9 @@ import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** AlertInstanceController */ /**
* AlertInstanceController
*/
@Slf4j @Slf4j
@RestController @RestController
@Api(tags = "Alert Instance Controller") @Api(tags = "Alert Instance Controller")
...@@ -71,7 +71,7 @@ public class AlertInstanceController { ...@@ -71,7 +71,7 @@ public class AlertInstanceController {
* @return {@link Result} of {@link Void} * @return {@link Result} of {@link Void}
* @throws Exception {@link Exception} * @throws Exception {@link Exception}
*/ */
@PutMapping @PutMapping("/saveOrUpdate")
@Log(title = "Insert OR Update AlertInstance", businessType = BusinessType.INSERT_OR_UPDATE) @Log(title = "Insert OR Update AlertInstance", businessType = BusinessType.INSERT_OR_UPDATE)
@ApiOperation("Insert OR Update AlertInstance") @ApiOperation("Insert OR Update AlertInstance")
@ApiImplicitParam( @ApiImplicitParam(
...@@ -98,21 +98,12 @@ public class AlertInstanceController { ...@@ -98,21 +98,12 @@ public class AlertInstanceController {
/** /**
* listAlertInstances * listAlertInstances
* * @return {@link Result} of {@link AlertInstance}
* @param para {@link JsonNode}
* @return {@link ProTableResult} of {@link AlertInstance}
*/ */
@PostMapping @GetMapping("/list")
@ApiOperation("Query AlertInstance List") @ApiOperation("Query AlertInstance List")
@ApiImplicitParam( public Result<List<AlertInstance>> listAlertInstances(@RequestParam(value = "keyword") String keyword) {
name = "para", return Result.succeed(alertInstanceService.selectListByKeyWord(keyword));
value = "Query Condition",
dataType = "JsonNode",
paramType = "body",
required = true,
dataTypeClass = JsonNode.class)
public ProTableResult<AlertInstance> listAlertInstances(@RequestBody JsonNode para) {
return alertInstanceService.selectForProTable(para);
} }
/** /**
......
...@@ -25,13 +25,11 @@ import org.dinky.data.dto.ClusterConfigurationDTO; ...@@ -25,13 +25,11 @@ import org.dinky.data.dto.ClusterConfigurationDTO;
import org.dinky.data.enums.BusinessType; import org.dinky.data.enums.BusinessType;
import org.dinky.data.enums.Status; import org.dinky.data.enums.Status;
import org.dinky.data.model.ClusterConfiguration; import org.dinky.data.model.ClusterConfiguration;
import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result; import org.dinky.data.result.Result;
import org.dinky.gateway.result.TestResult; import org.dinky.gateway.result.TestResult;
import org.dinky.service.ClusterConfigurationService; import org.dinky.service.ClusterConfigurationService;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -42,8 +40,6 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -42,8 +40,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -70,7 +66,7 @@ public class ClusterConfigurationController { ...@@ -70,7 +66,7 @@ public class ClusterConfigurationController {
* @param clusterConfiguration * @param clusterConfiguration
* @return * @return
*/ */
@PutMapping @PutMapping("/saveOrUpdate")
@Log(title = "Insert Or Update Cluster Config", businessType = BusinessType.INSERT_OR_UPDATE) @Log(title = "Insert Or Update Cluster Config", businessType = BusinessType.INSERT_OR_UPDATE)
@ApiOperation("Insert Or Update Cluster Config") @ApiOperation("Insert Or Update Cluster Config")
@ApiImplicitParam( @ApiImplicitParam(
...@@ -98,29 +94,13 @@ public class ClusterConfigurationController { ...@@ -98,29 +94,13 @@ public class ClusterConfigurationController {
/** /**
* query cluster config list * query cluster config list
* * @param keyword
* @param para
* @return * @return
*/ */
@PostMapping @GetMapping("/list")
@ApiOperation("Cluster Config List") @ApiOperation("Cluster Config List")
@ApiImplicitParam( public Result<List<ClusterConfigurationDTO>> listClusterConfigList(@RequestParam String keyword) {
name = "para", return Result.succeed(clusterConfigurationService.selectListByKeyWord(keyword));
value = "Cluster Configuration",
dataType = "JsonNode",
paramType = "body",
required = true)
public ProTableResult<ClusterConfigurationDTO> listClusterConfigList(@RequestBody JsonNode para) {
ProTableResult<ClusterConfiguration> result = clusterConfigurationService.selectForProTable(para);
List<ClusterConfigurationDTO> dtoList =
result.getData().stream().map(ClusterConfigurationDTO::fromBean).collect(Collectors.toList());
return ProTableResult.<ClusterConfigurationDTO>builder()
.success(true)
.data(dtoList)
.total(result.getTotal())
.current(result.getCurrent())
.pageSize(result.getPageSize())
.build();
} }
/** /**
......
...@@ -40,7 +40,6 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -40,7 +40,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
...@@ -156,12 +155,7 @@ public class ClusterInstanceController { ...@@ -156,12 +155,7 @@ public class ClusterInstanceController {
required = true, required = true,
dataTypeClass = JsonNode.class) dataTypeClass = JsonNode.class)
public Result<List<ClusterInstance>> listClusterInstance(@RequestParam("keyword") String searchKeyWord) { public Result<List<ClusterInstance>> listClusterInstance(@RequestParam("keyword") String searchKeyWord) {
return Result.succeed(clusterInstanceService.list(new LambdaQueryWrapper<ClusterInstance>() return Result.succeed(clusterInstanceService.selectListByKeyWord(searchKeyWord));
.like(ClusterInstance::getName, searchKeyWord)
.or()
.like(ClusterInstance::getAlias, searchKeyWord)
.or()
.like(ClusterInstance::getNote, searchKeyWord)));
} }
/** /**
......
...@@ -31,7 +31,6 @@ import org.dinky.data.model.DataBase; ...@@ -31,7 +31,6 @@ import org.dinky.data.model.DataBase;
import org.dinky.data.model.QueryData; import org.dinky.data.model.QueryData;
import org.dinky.data.model.Schema; import org.dinky.data.model.Schema;
import org.dinky.data.model.SqlGeneration; import org.dinky.data.model.SqlGeneration;
import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result; import org.dinky.data.result.Result;
import org.dinky.metadata.driver.DriverPool; import org.dinky.metadata.driver.DriverPool;
import org.dinky.metadata.result.JdbcSelectResult; import org.dinky.metadata.result.JdbcSelectResult;
...@@ -50,8 +49,6 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -50,8 +49,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -107,27 +104,13 @@ public class DataBaseController { ...@@ -107,27 +104,13 @@ public class DataBaseController {
/** /**
* get all database * get all database
* *
* @param para {@link JsonNode} * @param keyword {@link String}
* @return {@link ProTableResult}< {@link DataBase}> * @return {@link Result}< {@link DataBase}>
*/ */
@PostMapping @GetMapping("/list")
@ApiOperation("DataBase Get All") @ApiOperation("DataBase Get All")
@ApiImplicitParam( public Result<List<DataBase>> listDataBases(@RequestParam(value = "keyword") String keyword) {
name = "para", return Result.succeed(databaseService.selectListByKeyWord(keyword));
value = "JsonNode",
required = true,
dataType = "JsonNode",
paramType = "body",
dataTypeClass = JsonNode.class)
public ProTableResult<DataBase> listDataBases(@RequestBody JsonNode para) {
final ProTableResult<DataBase> result = databaseService.selectForProTable(para);
// 密码不返回
if (result != null && result.getData() != null) {
for (DataBase data : result.getData()) {
data.setPassword(null);
}
}
return result;
} }
/** /**
...@@ -295,9 +278,9 @@ public class DataBaseController { ...@@ -295,9 +278,9 @@ public class DataBaseController {
/** /**
* get columns of table * get columns of table
* *
* @param id {@link Integer} * @param id {@link Integer}
* @param schemaName {@link String} * @param schemaName {@link String}
* @param tableName {@link String} * @param tableName {@link String}
* @return {@link Result}< {@link List}< {@link Column}>> * @return {@link Result}< {@link List}< {@link Column}>>
*/ */
@GetMapping("/listColumns") @GetMapping("/listColumns")
...@@ -387,9 +370,9 @@ public class DataBaseController { ...@@ -387,9 +370,9 @@ public class DataBaseController {
/** /**
* get sql generation * get sql generation
* *
* @param id {@link Integer} * @param id {@link Integer}
* @param schemaName {@link String} * @param schemaName {@link String}
* @param tableName {@link String} * @param tableName {@link String}
* @return {@link Result}< {@link SqlGeneration}> * @return {@link Result}< {@link SqlGeneration}>
*/ */
@GetMapping("/getSqlGeneration") @GetMapping("/getSqlGeneration")
......
...@@ -57,4 +57,6 @@ public interface AlertGroupService extends ISuperService<AlertGroup> { ...@@ -57,4 +57,6 @@ public interface AlertGroupService extends ISuperService<AlertGroup> {
* @return {@link Boolean} * @return {@link Boolean}
*/ */
Boolean deleteGroupById(Integer id); Boolean deleteGroupById(Integer id);
List<AlertGroup> selectListByKeyWord(String keyword);
} }
...@@ -60,4 +60,6 @@ public interface AlertInstanceService extends ISuperService<AlertInstance> { ...@@ -60,4 +60,6 @@ public interface AlertInstanceService extends ISuperService<AlertInstance> {
* @return {@link Boolean} * @return {@link Boolean}
*/ */
Boolean modifyAlertInstanceStatus(Integer id); Boolean modifyAlertInstanceStatus(Integer id);
List<AlertInstance> selectListByKeyWord(String keyword);
} }
...@@ -72,4 +72,6 @@ public interface ClusterConfigurationService extends ISuperService<ClusterConfig ...@@ -72,4 +72,6 @@ public interface ClusterConfigurationService extends ISuperService<ClusterConfig
* @return A boolean value indicating whether the modification was successful. * @return A boolean value indicating whether the modification was successful.
*/ */
Boolean modifyClusterConfigStatus(Integer id); Boolean modifyClusterConfigStatus(Integer id);
List<ClusterConfigurationDTO> selectListByKeyWord(String keyword);
} }
...@@ -144,4 +144,6 @@ public interface ClusterInstanceService extends ISuperService<ClusterInstance> { ...@@ -144,4 +144,6 @@ public interface ClusterInstanceService extends ISuperService<ClusterInstance> {
* @return {@link ClusterInstance} * @return {@link ClusterInstance}
*/ */
ClusterInstance deploySessionCluster(Integer id); ClusterInstance deploySessionCluster(Integer id);
List<ClusterInstance> selectListByKeyWord(String searchKeyWord);
} }
...@@ -194,4 +194,6 @@ public interface DataBaseService extends ISuperService<DataBase> { ...@@ -194,4 +194,6 @@ public interface DataBaseService extends ISuperService<DataBase> {
* @return A {@link JobResult} object representing the execution result of the SQL statement. * @return A {@link JobResult} object representing the execution result of the SQL statement.
*/ */
JobResult executeCommonSql(SqlDTO sqlDTO); JobResult executeCommonSql(SqlDTO sqlDTO);
List<DataBase> selectListByKeyWord(String keyword);
} }
...@@ -43,7 +43,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -43,7 +43,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
/** AlertGroupServiceImpl */ /**
* AlertGroupServiceImpl
*/
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class AlertGroupServiceImpl extends SuperServiceImpl<AlertGroupMapper, AlertGroup> implements AlertGroupService { public class AlertGroupServiceImpl extends SuperServiceImpl<AlertGroupMapper, AlertGroup> implements AlertGroupService {
...@@ -100,4 +102,17 @@ public class AlertGroupServiceImpl extends SuperServiceImpl<AlertGroupMapper, Al ...@@ -100,4 +102,17 @@ public class AlertGroupServiceImpl extends SuperServiceImpl<AlertGroupMapper, Al
.forEach(alertHistory -> alertHistoryService.removeById(alertHistory.getId())); .forEach(alertHistory -> alertHistoryService.removeById(alertHistory.getId()));
return removeById(id); return removeById(id);
} }
/**
* @param keyword
* @return
*/
@Override
public List<AlertGroup> selectListByKeyWord(String keyword) {
return getBaseMapper()
.selectList(new LambdaQueryWrapper<>(AlertGroup.class)
.like(AlertGroup::getName, keyword)
.or()
.like(AlertGroup::getNote, keyword));
}
} }
...@@ -109,6 +109,19 @@ public class AlertInstanceServiceImpl extends SuperServiceImpl<AlertInstanceMapp ...@@ -109,6 +109,19 @@ public class AlertInstanceServiceImpl extends SuperServiceImpl<AlertInstanceMapp
return updateById(alertInstance); return updateById(alertInstance);
} }
/**
* @param keyword
* @return
*/
@Override
public List<AlertInstance> selectListByKeyWord(String keyword) {
return getBaseMapper()
.selectList(new LambdaQueryWrapper<AlertInstance>()
.like(AlertInstance::getName, keyword)
.or()
.like(AlertInstance::getType, keyword));
}
private void writeBackGroupInformation(Map<Integer, Set<Integer>> alertGroupInformation) { private void writeBackGroupInformation(Map<Integer, Set<Integer>> alertGroupInformation) {
if (MapUtils.isEmpty(alertGroupInformation)) { if (MapUtils.isEmpty(alertGroupInformation)) {
return; return;
......
...@@ -31,10 +31,12 @@ import org.dinky.mybatis.service.impl.SuperServiceImpl; ...@@ -31,10 +31,12 @@ import org.dinky.mybatis.service.impl.SuperServiceImpl;
import org.dinky.service.ClusterConfigurationService; import org.dinky.service.ClusterConfigurationService;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
...@@ -87,4 +89,17 @@ public class ClusterConfigurationServiceImpl extends SuperServiceImpl<ClusterCon ...@@ -87,4 +89,17 @@ public class ClusterConfigurationServiceImpl extends SuperServiceImpl<ClusterCon
} }
return false; return false;
} }
/**
* @param keyword
* @return
*/
@Override
public List<ClusterConfigurationDTO> selectListByKeyWord(String keyword) {
return getBaseMapper()
.selectList(new LambdaQueryWrapper<ClusterConfiguration>().like(ClusterConfiguration::getName, keyword))
.stream()
.map(ClusterConfigurationDTO::fromBean)
.collect(Collectors.toList());
}
} }
...@@ -45,6 +45,7 @@ import java.util.List; ...@@ -45,6 +45,7 @@ import java.util.List;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
...@@ -207,6 +208,21 @@ public class ClusterInstanceServiceImpl extends SuperServiceImpl<ClusterInstance ...@@ -207,6 +208,21 @@ public class ClusterInstanceServiceImpl extends SuperServiceImpl<ClusterInstance
null)); null));
} }
/**
* @param searchKeyWord
* @return
*/
@Override
public List<ClusterInstance> selectListByKeyWord(String searchKeyWord) {
return getBaseMapper()
.selectList(new LambdaQueryWrapper<ClusterInstance>()
.like(ClusterInstance::getName, searchKeyWord)
.or()
.like(ClusterInstance::getAlias, searchKeyWord)
.or()
.like(ClusterInstance::getNote, searchKeyWord));
}
private boolean checkHealth(ClusterInstance clusterInstance) { private boolean checkHealth(ClusterInstance clusterInstance) {
FlinkClusterInfo info = checkHeartBeat(clusterInstance.getHosts(), clusterInstance.getJobManagerHost()); FlinkClusterInfo info = checkHeartBeat(clusterInstance.getHosts(), clusterInstance.getJobManagerHost());
if (!info.isEffective()) { if (!info.isEffective()) {
......
...@@ -51,8 +51,11 @@ import java.util.UUID; ...@@ -51,8 +51,11 @@ import java.util.UUID;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.collection.CollectionUtil;
/** /**
* DataBaseServiceImpl * DataBaseServiceImpl
* *
...@@ -308,4 +311,25 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa ...@@ -308,4 +311,25 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa
result.setEndTime(LocalDateTime.now()); result.setEndTime(LocalDateTime.now());
return result; return result;
} }
/**
* @param keyword
* @return
*/
@Override
public List<DataBase> selectListByKeyWord(String keyword) {
List<DataBase> dataBaseList = getBaseMapper()
.selectList(new LambdaQueryWrapper<DataBase>()
.like(DataBase::getName, keyword)
.or()
.like(DataBase::getNote, keyword));
if (CollectionUtil.isNotEmpty(dataBaseList)) {
for (DataBase data : dataBaseList) {
data.setPassword(null);
}
}
return dataBaseList;
}
} }
...@@ -438,6 +438,7 @@ export default { ...@@ -438,6 +438,7 @@ export default {
'rc.ag.management': 'Alert Group Management ', 'rc.ag.management': 'Alert Group Management ',
'rc.ag.modify': 'Modify Alert Group', 'rc.ag.modify': 'Modify Alert Group',
'rc.ag.name': 'Alert Group Name', 'rc.ag.name': 'Alert Group Name',
'rc.ag.search': 'Search Name/Note',
'rc.ai.accessKeyId': 'AccessKeyId', 'rc.ai.accessKeyId': 'AccessKeyId',
'rc.ai.accessKeyIdPleaseHolder': 'Please enter AccessKeyId', 'rc.ai.accessKeyIdPleaseHolder': 'Please enter AccessKeyId',
'rc.ai.accessKeySecret': 'AccessKeySecret', 'rc.ai.accessKeySecret': 'AccessKeySecret',
...@@ -500,6 +501,7 @@ export default { ...@@ -500,6 +501,7 @@ export default {
'rc.ai.mf.uni': 'Uni SMS', 'rc.ai.mf.uni': 'Uni SMS',
'rc.ai.mf.yunpian': 'Yunpian SMS', 'rc.ai.mf.yunpian': 'Yunpian SMS',
'rc.ai.modify': 'Modify Alert Instance', 'rc.ai.modify': 'Modify Alert Instance',
'rc.ai.search': 'Search Name/Type',
'rc.ai.name': 'Name', 'rc.ai.name': 'Name',
'rc.ai.namePleaseHolder': 'please enter Alert instance name', 'rc.ai.namePleaseHolder': 'please enter Alert instance name',
'rc.ai.password': 'Password', 'rc.ai.password': 'Password',
...@@ -634,6 +636,7 @@ export default { ...@@ -634,6 +636,7 @@ export default {
'rc.cc.management': 'Cluster Config Management', 'rc.cc.management': 'Cluster Config Management',
'rc.cc.modify': 'Modify Cluster Config', 'rc.cc.modify': 'Modify Cluster Config',
'rc.cc.name': 'Cluster Config Name', 'rc.cc.name': 'Cluster Config Name',
'rc.cc.search': 'Search Name',
'rc.cc.namePlaceholder': 'Please enter the cluster configuration name!', 'rc.cc.namePlaceholder': 'Please enter the cluster configuration name!',
'rc.cc.spDir': 'SavePoint Path', 'rc.cc.spDir': 'SavePoint Path',
'rc.cc.spDirHelp': 'Please enter the savepoint path! This parameter configuration item is', 'rc.cc.spDirHelp': 'Please enter the savepoint path! This parameter configuration item is',
...@@ -708,6 +711,7 @@ export default { ...@@ -708,6 +711,7 @@ export default {
'rc.ds.columnName': 'Field Name', 'rc.ds.columnName': 'Field Name',
'rc.ds.columnType': 'Type', 'rc.ds.columnType': 'Type',
'rc.ds.comment': 'Comment', 'rc.ds.comment': 'Comment',
'rc.ds.search': 'Search Name/Note',
'rc.ds.console.exec': 'Execute', 'rc.ds.console.exec': 'Execute',
'rc.ds.console.running': 'Running...', 'rc.ds.console.running': 'Running...',
'rc.ds.create': 'Create DataSource', 'rc.ds.create': 'Create DataSource',
......
...@@ -422,6 +422,7 @@ export default { ...@@ -422,6 +422,7 @@ export default {
'rc.ag.management': '告警组管理', 'rc.ag.management': '告警组管理',
'rc.ag.modify': '修改告警组', 'rc.ag.modify': '修改告警组',
'rc.ag.name': '告警组名称', 'rc.ag.name': '告警组名称',
'rc.ag.search': '搜索 名称/备注',
'rc.ai.accessKeyId': 'AccessKeyId', 'rc.ai.accessKeyId': 'AccessKeyId',
'rc.ai.accessKeyIdPleaseHolder': '请输入AccessKeyId', 'rc.ai.accessKeyIdPleaseHolder': '请输入AccessKeyId',
'rc.ai.accessKeySecret': 'AccessKeySecret', 'rc.ai.accessKeySecret': 'AccessKeySecret',
...@@ -483,6 +484,7 @@ export default { ...@@ -483,6 +484,7 @@ export default {
'rc.ai.mf.yunpian': '云片短信', 'rc.ai.mf.yunpian': '云片短信',
'rc.ai.modify': '修改告警实例', 'rc.ai.modify': '修改告警实例',
'rc.ai.name': '名称', 'rc.ai.name': '名称',
'rc.ai.search': '搜索 名称/类型',
'rc.ai.namePleaseHolder': '请输入告警实例名称', 'rc.ai.namePleaseHolder': '请输入告警实例名称',
'rc.ai.password': '密码', 'rc.ai.password': '密码',
'rc.ai.passwordPleaseHolder': '请输入密码', 'rc.ai.passwordPleaseHolder': '请输入密码',
...@@ -605,6 +607,7 @@ export default { ...@@ -605,6 +607,7 @@ export default {
'rc.cc.management': '集群配置管理', 'rc.cc.management': '集群配置管理',
'rc.cc.modify': '修改集群配置', 'rc.cc.modify': '修改集群配置',
'rc.cc.name': '集群配置名称', 'rc.cc.name': '集群配置名称',
'rc.cc.search': '搜索 名称',
'rc.cc.namePlaceholder': '请输入集群配置名称!', 'rc.cc.namePlaceholder': '请输入集群配置名称!',
'rc.cc.spDir': '保存点路径', 'rc.cc.spDir': '保存点路径',
'rc.cc.spDirHelp': '请输入保存点路径! 此参数配置项为', 'rc.cc.spDirHelp': '请输入保存点路径! 此参数配置项为',
...@@ -674,6 +677,7 @@ export default { ...@@ -674,6 +677,7 @@ export default {
'rc.ds.collationRule': '排序规则', 'rc.ds.collationRule': '排序规则',
'rc.ds.columnName': '名称', 'rc.ds.columnName': '名称',
'rc.ds.columnType': '类型', 'rc.ds.columnType': '类型',
'rc.ds.search': '搜索 名称/注释',
'rc.ds.comment': '注释', 'rc.ds.comment': '注释',
'rc.ds.console.exec': '执行', 'rc.ds.console.exec': '执行',
'rc.ds.console.running': '运行中...', 'rc.ds.console.running': '运行中...',
......
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
...@@ -131,11 +131,21 @@ const JobConfig = (props: any) => { ...@@ -131,11 +131,21 @@ const JobConfig = (props: any) => {
) : ( ) : (
<ProFormSelect <ProFormSelect
style={{ width: '100%' }} style={{ width: '100%' }}
placeholder={l('pages.datastudio.label.jobConfig.cluster.tip')} placeholder={l('pages.datastudio.label.jobConfig.clusterConfig.tip1', '', {
type: current?.type
})}
label={l('pages.datastudio.label.jobConfig.cluster')} label={l('pages.datastudio.label.jobConfig.cluster')}
tooltip={l('pages.datastudio.label.jobConfig.clusterConfig.tip1', '', { tooltip={l('pages.datastudio.label.jobConfig.clusterConfig.tip1', '', {
type: current?.type type: current?.type
})} })}
rules={[
{
required: true,
message: l('pages.datastudio.label.jobConfig.clusterConfig.tip1', '', {
type: current?.type
})
}
]}
name='clusterId' name='clusterId'
options={buildClusterOptions(sessionCluster)} options={buildClusterOptions(sessionCluster)}
fieldProps={{ fieldProps={{
...@@ -150,10 +160,10 @@ const JobConfig = (props: any) => { ...@@ -150,10 +160,10 @@ const JobConfig = (props: any) => {
size={'middle'} size={'middle'}
initialValues={{ initialValues={{
type: RUN_MODE.LOCAL, type: RUN_MODE.LOCAL,
envId: 0, envId: -1,
parallelism: 1, parallelism: 1,
savePointStrategy: 0, savePointStrategy: 0,
alertGroupId: 0 alertGroupId: -1
}} }}
className={'data-studio-form'} className={'data-studio-form'}
style={{ paddingInline: '15px', overflow: 'scroll' }} style={{ paddingInline: '15px', overflow: 'scroll' }}
...@@ -166,6 +176,7 @@ const JobConfig = (props: any) => { ...@@ -166,6 +176,7 @@ const JobConfig = (props: any) => {
name='type' name='type'
label={l('global.table.execmode')} label={l('global.table.execmode')}
tooltip={l('pages.datastudio.label.jobConfig.execmode.tip')} tooltip={l('pages.datastudio.label.jobConfig.execmode.tip')}
rules={[{ required: true, message: l('pages.datastudio.label.jobConfig.execmode.tip') }]}
options={buildRunModelOptions()} options={buildRunModelOptions()}
/> />
...@@ -183,9 +194,12 @@ const JobConfig = (props: any) => { ...@@ -183,9 +194,12 @@ const JobConfig = (props: any) => {
name='clusterConfigurationId' name='clusterConfigurationId'
placeholder={l('pages.datastudio.label.jobConfig.clusterConfig.tip2')} placeholder={l('pages.datastudio.label.jobConfig.clusterConfig.tip2')}
label={l('pages.datastudio.label.jobConfig.clusterConfig')} label={l('pages.datastudio.label.jobConfig.clusterConfig')}
tooltip={l('pages.datastudio.label.jobConfig.clusterConfig.tip1', '', { tooltip={l('pages.datastudio.label.jobConfig.clusterConfig.tip2', '', {
type: current?.type type: current?.type
})} })}
rules={[
{ required: true, message: l('pages.datastudio.label.jobConfig.clusterConfig.tip2') }
]}
options={buildClusterConfigOptions(current, clusterConfiguration)} options={buildClusterConfigOptions(current, clusterConfiguration)}
/> />
)} )}
...@@ -195,6 +209,9 @@ const JobConfig = (props: any) => { ...@@ -195,6 +209,9 @@ const JobConfig = (props: any) => {
label={l('pages.datastudio.label.jobConfig.flinksql.env')} label={l('pages.datastudio.label.jobConfig.flinksql.env')}
tooltip={l('pages.datastudio.label.jobConfig.flinksql.env.tip1')} tooltip={l('pages.datastudio.label.jobConfig.flinksql.env.tip1')}
options={buildEnvOptions(env)} options={buildEnvOptions(env)}
rules={[
{ required: true, message: l('pages.datastudio.label.jobConfig.flinksql.env.tip1') }
]}
showSearch showSearch
/> />
......
...@@ -26,8 +26,12 @@ import { Authorized, HasAuthority } from '@/hooks/useAccess'; ...@@ -26,8 +26,12 @@ import { Authorized, HasAuthority } from '@/hooks/useAccess';
import AlertGroupForm from '@/pages/RegCenter/Alert/AlertGroup/components/AlertGroupForm'; import AlertGroupForm from '@/pages/RegCenter/Alert/AlertGroup/components/AlertGroupForm';
import { getAlertIcon } from '@/pages/RegCenter/Alert/AlertInstance/function'; import { getAlertIcon } from '@/pages/RegCenter/Alert/AlertInstance/function';
import { ALERT_MODEL_ASYNC } from '@/pages/RegCenter/Alert/AlertInstance/model'; import { ALERT_MODEL_ASYNC } from '@/pages/RegCenter/Alert/AlertInstance/model';
import { queryList } from '@/services/api'; import {
import { handleAddOrUpdate, handleRemoveById, updateDataByParam } from '@/services/BusinessCrud'; handleAddOrUpdate,
handleRemoveById,
queryDataByParams,
updateDataByParam
} from '@/services/BusinessCrud';
import { PROTABLE_OPTIONS_PUBLIC, PRO_LIST_CARD_OPTIONS } from '@/services/constants'; import { PROTABLE_OPTIONS_PUBLIC, PRO_LIST_CARD_OPTIONS } from '@/services/constants';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { Alert, ALERT_TYPE } from '@/types/RegCenter/data.d'; import { Alert, ALERT_TYPE } from '@/types/RegCenter/data.d';
...@@ -39,7 +43,7 @@ import { ProList } from '@ant-design/pro-components'; ...@@ -39,7 +43,7 @@ import { ProList } from '@ant-design/pro-components';
import { PageContainer } from '@ant-design/pro-layout'; import { PageContainer } from '@ant-design/pro-layout';
import { ActionType } from '@ant-design/pro-table'; import { ActionType } from '@ant-design/pro-table';
import { connect, Dispatch } from '@umijs/max'; import { connect, Dispatch } from '@umijs/max';
import { Button, Descriptions, Modal, Space, Tag, Tooltip } from 'antd'; import { Button, Descriptions, Input, Modal, Space, Tag, Tooltip } from 'antd';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
const AlertGroupTableList: React.FC = (props: any) => { const AlertGroupTableList: React.FC = (props: any) => {
...@@ -54,9 +58,12 @@ const AlertGroupTableList: React.FC = (props: any) => { ...@@ -54,9 +58,12 @@ const AlertGroupTableList: React.FC = (props: any) => {
* execute query alert instance list * execute query alert instance list
* set alert instance list * set alert instance list
*/ */
const queryAlertGroupList = async () => { const queryAlertGroupList = async (keyword = '') => {
queryList(API_CONSTANTS.ALERT_GROUP).then((res) => queryDataByParams(API_CONSTANTS.ALERT_GROUP, { keyword }).then((res) =>
setAlertGroupState((prevState) => ({ ...prevState, alertGroupList: res.data })) setAlertGroupState((prevState) => ({
...prevState,
alertGroupList: res as Alert.AlertGroup[]
}))
); );
}; };
...@@ -124,7 +131,7 @@ const AlertGroupTableList: React.FC = (props: any) => { ...@@ -124,7 +131,7 @@ const AlertGroupTableList: React.FC = (props: any) => {
const handleSubmit = async (value: Alert.AlertGroup) => { const handleSubmit = async (value: Alert.AlertGroup) => {
await exexuteWithRefreshLoading(async () => await exexuteWithRefreshLoading(async () =>
handleAddOrUpdate( handleAddOrUpdate(
API_CONSTANTS.ALERT_GROUP, API_CONSTANTS.ALERT_GROUP_ADD_OR_UPDATE,
value, value,
() => {}, () => {},
() => handleCleanState() () => handleCleanState()
...@@ -137,6 +144,13 @@ const AlertGroupTableList: React.FC = (props: any) => { ...@@ -137,6 +144,13 @@ const AlertGroupTableList: React.FC = (props: any) => {
*/ */
const renderToolBar = () => { const renderToolBar = () => {
return () => [ return () => [
<Input.Search
loading={alertGroupState.loading}
key={`_search`}
allowClear
placeholder={l('rc.ag.search')}
onSearch={(value) => queryAlertGroupList(value)}
/>,
<Authorized key='create' path='/registration/alert/group/add'> <Authorized key='create' path='/registration/alert/group/add'>
<Button <Button
key={'CreateAlertGroup'} key={'CreateAlertGroup'}
......
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
import { CreateBtn } from '@/components/CallBackButton/CreateBtn'; import { CreateBtn } from '@/components/CallBackButton/CreateBtn';
...@@ -30,8 +32,7 @@ import { ...@@ -30,8 +32,7 @@ import {
createOrModifyAlertInstance, createOrModifyAlertInstance,
sendTest sendTest
} from '@/pages/RegCenter/Alert/AlertInstance/service'; } from '@/pages/RegCenter/Alert/AlertInstance/service';
import { queryList } from '@/services/api'; import { handleRemoveById, queryDataByParams, updateDataByParam } from '@/services/BusinessCrud';
import { handleRemoveById, updateDataByParam } from '@/services/BusinessCrud';
import { PROTABLE_OPTIONS_PUBLIC, PRO_LIST_CARD_OPTIONS } from '@/services/constants'; import { PROTABLE_OPTIONS_PUBLIC, PRO_LIST_CARD_OPTIONS } from '@/services/constants';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { Alert } from '@/types/RegCenter/data.d'; import { Alert } from '@/types/RegCenter/data.d';
...@@ -40,7 +41,7 @@ import { AlertInstanceState } from '@/types/RegCenter/state.d'; ...@@ -40,7 +41,7 @@ import { AlertInstanceState } from '@/types/RegCenter/state.d';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { ProList } from '@ant-design/pro-components'; import { ProList } from '@ant-design/pro-components';
import { ActionType } from '@ant-design/pro-table'; import { ActionType } from '@ant-design/pro-table';
import { Descriptions, Modal, Space, Tag, Tooltip } from 'antd'; import { Descriptions, Input, Modal, Space, Tag, Tooltip } from 'antd';
import DescriptionsItem from 'antd/es/descriptions/Item'; import DescriptionsItem from 'antd/es/descriptions/Item';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import AlertTypeChoose from '../AlertTypeChoose'; import AlertTypeChoose from '../AlertTypeChoose';
...@@ -58,9 +59,12 @@ const AlertInstanceList: React.FC = () => { ...@@ -58,9 +59,12 @@ const AlertInstanceList: React.FC = () => {
* execute query alert instance list * execute query alert instance list
* set alert instance list * set alert instance list
*/ */
const queryAlertInstanceList = async () => { const queryAlertInstanceList = async (keyword = '') => {
queryList(API_CONSTANTS.ALERT_INSTANCE).then((res) => queryDataByParams(API_CONSTANTS.ALERT_INSTANCE, { keyword }).then((res) =>
setAlertInstanceState((prevState) => ({ ...prevState, alertInstanceList: res.data })) setAlertInstanceState((prevState) => ({
...prevState,
alertInstanceList: res as Alert.AlertInstance[]
}))
); );
}; };
...@@ -191,6 +195,13 @@ const AlertInstanceList: React.FC = () => { ...@@ -191,6 +195,13 @@ const AlertInstanceList: React.FC = () => {
*/ */
const renderToolBar = () => { const renderToolBar = () => {
return () => [ return () => [
<Input.Search
loading={alertInstanceState.loading}
key={`_search`}
allowClear
placeholder={l('rc.ai.search')}
onSearch={(value) => queryAlertInstanceList(value)}
/>,
<Authorized key='create' path='/registration/alert/instance/add'> <Authorized key='create' path='/registration/alert/instance/add'>
<CreateBtn <CreateBtn
key={'CreateAlertInstanceBtn'} key={'CreateAlertInstanceBtn'}
......
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
import { postAll } from '@/services/api'; import { postAll } from '@/services/api';
import { handleAddOrUpdate } from '@/services/BusinessCrud'; import { handleAddOrUpdate } from '@/services/BusinessCrud';
import { RESPONSE_CODE } from '@/services/constants'; import { RESPONSE_CODE } from '@/services/constants';
import { API_CONSTANTS } from '@/services/endpoints';
import { Alert } from '@/types/RegCenter/data.d'; import { Alert } from '@/types/RegCenter/data.d';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { import {
...@@ -28,13 +31,13 @@ import { ...@@ -28,13 +31,13 @@ import {
} from '@/utils/messages'; } from '@/utils/messages';
export async function createOrModifyAlertInstance(alertInstance: Alert.AlertInstance) { export async function createOrModifyAlertInstance(alertInstance: Alert.AlertInstance) {
return handleAddOrUpdate('/api/alertInstance', alertInstance); return handleAddOrUpdate(API_CONSTANTS.ALERT_INSTANCE_ADD_OR_UPDATE, alertInstance);
} }
export async function sendTest(alertInstance: Alert.AlertInstance) { export async function sendTest(alertInstance: Alert.AlertInstance) {
await LoadingMessageAsync(l('app.request.test.alert.msg')); await LoadingMessageAsync(l('app.request.test.alert.msg'));
try { try {
const { code, msg } = await postAll('/api/alertInstance/sendTest', alertInstance); const { code, msg } = await postAll(API_CONSTANTS.ALERT_INSTANCE_SEND_TEST, alertInstance);
if (code === RESPONSE_CODE.SUCCESS) { if (code === RESPONSE_CODE.SUCCESS) {
SuccessMessage(msg); SuccessMessage(msg);
return true; return true;
......
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
...@@ -28,12 +28,12 @@ import { Authorized, HasAuthority } from '@/hooks/useAccess'; ...@@ -28,12 +28,12 @@ import { Authorized, HasAuthority } from '@/hooks/useAccess';
import { imgStyle } from '@/pages/Home/constants'; import { imgStyle } from '@/pages/Home/constants';
import ConfigurationModal from '@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal'; import ConfigurationModal from '@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal';
import { CLUSTER_CONFIG_TYPE } from '@/pages/RegCenter/Cluster/Configuration/components/contants'; import { CLUSTER_CONFIG_TYPE } from '@/pages/RegCenter/Cluster/Configuration/components/contants';
import { queryList } from '@/services/api';
import { import {
handleAddOrUpdate, handleAddOrUpdate,
handleOption, handleOption,
handlePutDataByParams, handlePutDataByParams,
handleRemoveById, handleRemoveById,
queryDataByParams,
updateDataByParam updateDataByParam
} from '@/services/BusinessCrud'; } from '@/services/BusinessCrud';
import { PROTABLE_OPTIONS_PUBLIC, PRO_LIST_CARD_OPTIONS } from '@/services/constants'; import { PROTABLE_OPTIONS_PUBLIC, PRO_LIST_CARD_OPTIONS } from '@/services/constants';
...@@ -44,7 +44,7 @@ import { ClusterConfigState } from '@/types/RegCenter/state.d'; ...@@ -44,7 +44,7 @@ import { ClusterConfigState } from '@/types/RegCenter/state.d';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { CheckCircleOutlined, ExclamationCircleOutlined, HeartTwoTone } from '@ant-design/icons'; import { CheckCircleOutlined, ExclamationCircleOutlined, HeartTwoTone } from '@ant-design/icons';
import { ActionType, ProList } from '@ant-design/pro-components'; import { ActionType, ProList } from '@ant-design/pro-components';
import { Button, Descriptions, Modal, Space, Tag, Tooltip } from 'antd'; import { Button, Descriptions, Input, Modal, Space, Tag, Tooltip } from 'antd';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
export default () => { export default () => {
...@@ -56,15 +56,9 @@ export default () => { ...@@ -56,15 +56,9 @@ export default () => {
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
// const { data, run } = useRequest({ const queryClusterConfigList = async (keyword = '') => {
// url: API_CONSTANTS.CLUSTER_CONFIGURATION, queryDataByParams(API_CONSTANTS.CLUSTER_CONFIGURATION, { keyword }).then((res) =>
// method: 'POST', setClusterConfigState((prevState) => ({ ...prevState, configList: res as Cluster.Config[] }))
// data: {}
// });
const queryClusterConfigList = async () => {
queryList(API_CONSTANTS.CLUSTER_CONFIGURATION).then((res) =>
setClusterConfigState((prevState) => ({ ...prevState, configList: res.data }))
); );
}; };
...@@ -144,7 +138,7 @@ export default () => { ...@@ -144,7 +138,7 @@ export default () => {
*/ */
const handleSubmit = async (value: Partial<Cluster.Config>) => { const handleSubmit = async (value: Partial<Cluster.Config>) => {
await executeAndCallbackRefresh(async () => { await executeAndCallbackRefresh(async () => {
await handleAddOrUpdate(API_CONSTANTS.CLUSTER_CONFIGURATION, value); await handleAddOrUpdate(API_CONSTANTS.CLUSTER_CONFIGURATION_ADD_OR_UPDATE, value);
await handleCancel(); await handleCancel();
}); });
}; };
...@@ -260,6 +254,13 @@ export default () => { ...@@ -260,6 +254,13 @@ export default () => {
* tool bar render * tool bar render
*/ */
const toolBarRender = () => [ const toolBarRender = () => [
<Input.Search
loading={clusterConfigState.loading}
key={`_search`}
allowClear
placeholder={l('rc.cc.search')}
onSearch={(value) => queryClusterConfigList(value)}
/>,
<Authorized key='new' path='/registration/cluster/config/add'> <Authorized key='new' path='/registration/cluster/config/add'>
<CreateBtn <CreateBtn
key={'configcreate'} key={'configcreate'}
......
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
import { CreateBtn } from '@/components/CallBackButton/CreateBtn'; import { CreateBtn } from '@/components/CallBackButton/CreateBtn';
...@@ -25,11 +27,11 @@ import { StateType, STUDIO_MODEL } from '@/pages/DataStudio/model'; ...@@ -25,11 +27,11 @@ import { StateType, STUDIO_MODEL } from '@/pages/DataStudio/model';
import DataSourceDetail from '@/pages/RegCenter/DataSource/components/DataSourceDetail'; import DataSourceDetail from '@/pages/RegCenter/DataSource/components/DataSourceDetail';
import { renderDBIcon } from '@/pages/RegCenter/DataSource/components/function'; import { renderDBIcon } from '@/pages/RegCenter/DataSource/components/function';
import { handleTest, saveOrUpdateHandle } from '@/pages/RegCenter/DataSource/service'; import { handleTest, saveOrUpdateHandle } from '@/pages/RegCenter/DataSource/service';
import { queryList } from '@/services/api';
import { import {
handleOption, handleOption,
handlePutDataByParams, handlePutDataByParams,
handleRemoveById, handleRemoveById,
queryDataByParams,
updateDataByParam updateDataByParam
} from '@/services/BusinessCrud'; } from '@/services/BusinessCrud';
import { PROTABLE_OPTIONS_PUBLIC, PRO_LIST_CARD_OPTIONS } from '@/services/constants'; import { PROTABLE_OPTIONS_PUBLIC, PRO_LIST_CARD_OPTIONS } from '@/services/constants';
...@@ -45,7 +47,7 @@ import { ...@@ -45,7 +47,7 @@ import {
HeartTwoTone HeartTwoTone
} from '@ant-design/icons'; } from '@ant-design/icons';
import { ActionType, ProList } from '@ant-design/pro-components'; import { ActionType, ProList } from '@ant-design/pro-components';
import { Button, Descriptions, Modal, Space, Tag, Tooltip } from 'antd'; import { Button, Descriptions, Input, Modal, Space, Tag, Tooltip } from 'antd';
import DescriptionsItem from 'antd/es/descriptions/Item'; import DescriptionsItem from 'antd/es/descriptions/Item';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { connect } from 'umi'; import { connect } from 'umi';
...@@ -65,6 +67,12 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => { ...@@ -65,6 +67,12 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
const [formValues, setFormValues] = useState<Partial<DataSources.DataSource>>({}); const [formValues, setFormValues] = useState<Partial<DataSources.DataSource>>({});
const actionRef = React.useRef<ActionType>(); const actionRef = React.useRef<ActionType>();
const queryDataSourceList = async (keyword = '') => {
queryDataByParams(API_CONSTANTS.DATASOURCE, { keyword }).then((res) =>
setDataSource(res as DataSources.DataSource[])
);
};
/** /**
* query list * query list
*/ */
...@@ -76,10 +84,6 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => { ...@@ -76,10 +84,6 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
* execute query list * execute query list
* set list * set list
*/ */
const queryDataSourceList = async () => {
const res = await queryList(API_CONSTANTS.DATASOURCE);
setDataSource(res.data);
};
/** /**
* extra callback * extra callback
...@@ -257,6 +261,21 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => { ...@@ -257,6 +261,21 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
setFormValues({}); setFormValues({});
}; };
const renderToolBar = () => {
return [
<Input.Search
loading={loading}
key={`_search`}
allowClear
placeholder={l('rc.ds.search')}
onSearch={(value) => queryDataSourceList(value)}
/>,
<Authorized key='create' path='/registration/datasource/add'>
<CreateBtn key={'CreateBtn'} onClick={() => setModalVisible(true)} />
</Authorized>
];
};
/** /**
* render * render
*/ */
...@@ -271,11 +290,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => { ...@@ -271,11 +290,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
tooltip={l('rc.ds.enter')} tooltip={l('rc.ds.enter')}
actionRef={actionRef} actionRef={actionRef}
headerTitle={l('rc.ds.management')} headerTitle={l('rc.ds.management')}
toolBarRender={() => [ toolBarRender={renderToolBar}
<Authorized key='create' path='/registration/datasource/add'>
<CreateBtn key={'CreateBtn'} onClick={() => setModalVisible(true)} />
</Authorized>
]}
dataSource={renderDataSource} dataSource={renderDataSource}
/> />
......
...@@ -112,13 +112,14 @@ export enum API_CONSTANTS { ...@@ -112,13 +112,14 @@ export enum API_CONSTANTS {
CLUSTER_INSTANCE_RECYCLE = '/api/cluster/recycle', CLUSTER_INSTANCE_RECYCLE = '/api/cluster/recycle',
CLUSTER_CONFIGURATION_START = '/api/cluster/deploySessionClusterInstance', CLUSTER_CONFIGURATION_START = '/api/cluster/deploySessionClusterInstance',
// cluster configuration list // cluster configuration list
CLUSTER_CONFIGURATION = '/api/clusterConfiguration', CLUSTER_CONFIGURATION = '/api/clusterConfiguration/list',
CLUSTER_CONFIGURATION_ADD_OR_UPDATE = '/api/clusterConfiguration/addOrUpdate',
CLUSTER_CONFIGURATION_DELETE = '/api/clusterConfiguration/delete', CLUSTER_CONFIGURATION_DELETE = '/api/clusterConfiguration/delete',
CLUSTER_CONFIGURATION_ENABLE = '/api/clusterConfiguration/enable', CLUSTER_CONFIGURATION_ENABLE = '/api/clusterConfiguration/enable',
CLUSTER_CONFIGURATION_TEST = '/api/clusterConfiguration/testConnect', CLUSTER_CONFIGURATION_TEST = '/api/clusterConfiguration/testConnect',
// datasource registries list // datasource registries list
DATASOURCE = '/api/database', DATASOURCE = '/api/database/list',
// datasource registries delete // datasource registries delete
DATASOURCE_DELETE = '/api/database/delete', DATASOURCE_DELETE = '/api/database/delete',
// datasource registries enable or disable // datasource registries enable or disable
...@@ -144,16 +145,20 @@ export enum API_CONSTANTS { ...@@ -144,16 +145,20 @@ export enum API_CONSTANTS {
// ---- alert instance ---- // ---- alert instance ----
// alert instance list // alert instance list
ALERT_INSTANCE = '/api/alertInstance', ALERT_INSTANCE = '/api/alertInstance/list',
ALERT_INSTANCE_ADD_OR_UPDATE = '/api/alertInstance/addOrUpdate',
// delete alert instance by id // delete alert instance by id
ALERT_INSTANCE_DELETE = '/api/alertInstance/delete', ALERT_INSTANCE_DELETE = '/api/alertInstance/delete',
// alert instance enable or disable // alert instance enable or disable
ALERT_INSTANCE_ENABLE = '/api/alertInstance/enable', ALERT_INSTANCE_ENABLE = '/api/alertInstance/enable',
// alert instance list all // alert instance list all
ALERT_INSTANCE_LIST_ENABLE_ALL = '/api/alertInstance/listEnabledAll', ALERT_INSTANCE_LIST_ENABLE_ALL = '/api/alertInstance/listEnabledAll',
// sendTest
ALERT_INSTANCE_SEND_TEST = '/api/alertInstance/sendTest',
// ---- alert group ---- // ---- alert group ----
ALERT_GROUP = '/api/alertGroup', ALERT_GROUP = '/api/alertGroup/list',
ALERT_GROUP_ADD_OR_UPDATE = '/api/alertGroup/addOrUpdate',
// delete alert group by id // delete alert group by id
ALERT_GROUP_DELETE = '/api/alertGroup/delete', ALERT_GROUP_DELETE = '/api/alertGroup/delete',
// alert group enable or disable // alert group enable or disable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment