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

[Refactor][web] refactor cluster instance (#1992)

* refactor cluster instance * added note
parent 4dd8002d
...@@ -24,14 +24,16 @@ import org.dinky.common.result.ProTableResult; ...@@ -24,14 +24,16 @@ import org.dinky.common.result.ProTableResult;
import org.dinky.common.result.Result; import org.dinky.common.result.Result;
import org.dinky.model.Cluster; import org.dinky.model.Cluster;
import org.dinky.model.JobInstance; import org.dinky.model.JobInstance;
import org.dinky.service.ClusterService; import org.dinky.service.ClusterInstanceService;
import org.dinky.service.JobInstanceService; import org.dinky.service.JobInstanceService;
import org.dinky.utils.MessageResolverUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.transaction.annotation.Transactional;
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.PostMapping;
...@@ -46,44 +48,87 @@ import com.fasterxml.jackson.databind.JsonNode; ...@@ -46,44 +48,87 @@ import com.fasterxml.jackson.databind.JsonNode;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /** ClusterInstanceController */
* ClusterController
*
* @since 2021/5/28 14:03
*/
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/api/cluster") @RequestMapping("/api/cluster")
@RequiredArgsConstructor @RequiredArgsConstructor
public class ClusterController { public class ClusterInstanceController {
private final ClusterService clusterService; private final ClusterInstanceService clusterInstanceService;
private final JobInstanceService jobInstanceService; private final JobInstanceService jobInstanceService;
/** 新增或者更新 */ /**
* added or updated cluster instance
*
* @param cluster {@link Cluster} cluster instance
* @return {@link Result}<{@link Void}>
* @throws Exception exception
*/
@PutMapping @PutMapping
public Result<Void> saveOrUpdate(@RequestBody Cluster cluster) throws Exception { public Result<Void> saveOrUpdate(@RequestBody Cluster cluster) throws Exception {
cluster.setAutoRegisters(false); cluster.setAutoRegisters(false);
Integer id = cluster.getId(); Integer id = cluster.getId();
clusterService.registersCluster(cluster); clusterInstanceService.registersCluster(cluster);
return Result.succeed(Asserts.isNotNull(id) ? "修改成功" : "新增成功"); return Result.succeed(
Asserts.isNotNull(id)
? MessageResolverUtils.getMessage("modify.success")
: MessageResolverUtils.getMessage("create.success"));
} }
/** 启用和禁用 */ /**
* enable cluster instance or disable cluster instance
*
* @param id {@link Integer} cluster instance id
* @return {@link Result}<{@link Void}>
*/
@PutMapping("/enable") @PutMapping("/enable")
public Result<Void> enableCluster(@RequestBody Cluster cluster) { public Result<Void> enableCluster(@RequestParam Integer id) {
clusterService.enableCluster(cluster); Boolean enabled = clusterInstanceService.enableClusterInstance(id);
return Result.succeed("修改成功"); if (enabled) {
return Result.succeed(MessageResolverUtils.getMessage("modify.success"));
} else {
return Result.failed(MessageResolverUtils.getMessage("modify.failed"));
}
} }
/** 动态查询列表 */ /**
* delete cluster instance by id
*
* @param id {@link Integer} cluster instance id
* @return {@link Result}<{@link Void}>
*/
@DeleteMapping("/delete")
@Transactional(rollbackFor = Exception.class)
public Result<Void> deleteClusterInstanceById(@RequestParam Integer id) {
Boolean deleted = clusterInstanceService.deleteClusterInstanceById(id);
if (deleted) {
return Result.succeed(MessageResolverUtils.getMessage("delete.success"));
} else {
return Result.failed(MessageResolverUtils.getMessage("delete.failed"));
}
}
/**
* list cluster instances
*
* @param para {@link JsonNode} query parameters
* @return {@link ProTableResult}<{@link Cluster}>
*/
@PostMapping @PostMapping
public ProTableResult<Cluster> listClusters(@RequestBody JsonNode para) { public ProTableResult<Cluster> listClusters(@RequestBody JsonNode para) {
return clusterService.selectForProTable(para); return clusterInstanceService.selectForProTable(para);
} }
/** 批量删除 */ /**
* batch delete cluster instances , this method is {@link Deprecated}, please use {@link
* ClusterInstanceController#deleteClusterInstanceById(Integer id) }
*
* @param para {@link JsonNode} cluster instance ids
* @return {@link Result}<{@link Void}>
*/
@DeleteMapping @DeleteMapping
@Deprecated
public Result<Void> deleteMul(@RequestBody JsonNode para) { public Result<Void> deleteMul(@RequestBody JsonNode para) {
if (para.size() > 0) { if (para.size() > 0) {
List<JobInstance> instances = jobInstanceService.listJobInstanceActive(); List<JobInstance> instances = jobInstanceService.listJobInstanceActive();
...@@ -92,8 +137,8 @@ public class ClusterController { ...@@ -92,8 +137,8 @@ public class ClusterController {
List<String> error = new ArrayList<>(); List<String> error = new ArrayList<>();
for (final JsonNode item : para) { for (final JsonNode item : para) {
Integer id = item.asInt(); Integer id = item.asInt();
if (ids.contains(id) || !clusterService.removeById(id)) { if (ids.contains(id) || !clusterInstanceService.removeById(id)) {
error.add(clusterService.getById(id).getName()); error.add(clusterInstanceService.getById(id).getName());
} }
} }
if (error.size() == 0) { if (error.size() == 0) {
...@@ -116,65 +161,108 @@ public class ClusterController { ...@@ -116,65 +161,108 @@ public class ClusterController {
} }
} }
/** 获取指定ID的信息 */ /**
* get cluster instance by id
*
* @param cluster {@link Cluster} cluster instance
* @return {@link Result}<{@link Cluster}>
* @throws Exception
*/
@PostMapping("/getOneById") @PostMapping("/getOneById")
public Result<Cluster> getOneById(@RequestBody Cluster cluster) throws Exception { public Result<Cluster> getOneById(@RequestBody Cluster cluster) throws Exception {
cluster = clusterService.getById(cluster.getId()); cluster = clusterInstanceService.getById(cluster.getId());
return Result.succeed(cluster, "获取成功"); return Result.succeed(cluster, MessageResolverUtils.getMessage("response.get.success"));
} }
/** 获取可用的集群列表 */ /**
* get all enable cluster instances
*
* @return {@link Result}<{@link List}<{@link Cluster}>>
*/
@GetMapping("/listEnabledAll") @GetMapping("/listEnabledAll")
public Result<List<Cluster>> listEnabledAll() { public Result<List<Cluster>> listEnabledAll() {
List<Cluster> clusters = clusterService.listEnabledAll(); List<Cluster> clusters = clusterInstanceService.listEnabledAll();
return Result.succeed(clusters, "获取成功"); return Result.succeed(clusters, MessageResolverUtils.getMessage("response.get.success"));
} }
/** 获取可用的集群列表 */ /**
* get session enable cluster instances , this method is {@link Deprecated}
*
* @return {@link Result}<{@link List}<{@link Cluster}>>
*/
@GetMapping("/listSessionEnable") @GetMapping("/listSessionEnable")
@Deprecated
public Result<List<Cluster>> listSessionEnable() { public Result<List<Cluster>> listSessionEnable() {
List<Cluster> clusters = clusterService.listSessionEnable(); List<Cluster> clusters = clusterInstanceService.listSessionEnable();
return Result.succeed(clusters, "获取成功"); return Result.succeed(clusters, MessageResolverUtils.getMessage("response.get.success"));
} }
/** 全部心跳监测 */ /**
* heartbeat all cluster instances
*
* @return {@link Result}<{@link Void}>
*/
@PostMapping("/heartbeats") @PostMapping("/heartbeats")
public Result<Void> heartbeat() { public Result<Void> heartbeat() {
List<Cluster> clusters = clusterService.listEnabledAll(); List<Cluster> clusters = clusterInstanceService.list();
for (Cluster cluster : clusters) { for (Cluster cluster : clusters) {
clusterService.registersCluster(cluster); clusterInstanceService.registersCluster(cluster);
} }
return Result.succeed("状态刷新完成"); return Result.succeed(MessageResolverUtils.getMessage("cluster.instance.heartbeat"));
} }
/** 回收过期集群 */ /**
@GetMapping("/clear") * recycle cluster instances
public Result<Integer> clear() { *
return Result.succeed(clusterService.clearCluster(), "回收完成"); * @return {@link Result}<{@link Integer}>
*/
@DeleteMapping("/recycle")
@Transactional(rollbackFor = Exception.class)
public Result<Integer> recycleCluster() {
return Result.succeed(
clusterInstanceService.recycleCluster(),
MessageResolverUtils.getMessage("cluster.instance.recycle"));
} }
/** 停止集群 */ /**
* kill cluster instance
*
* @param id {@link Integer} cluster instance id
* @return {@link Result}<{@link Void}>
*/
@GetMapping("/killCluster") @GetMapping("/killCluster")
public Result<Void> killCluster(@RequestParam("id") Integer id) { public Result<Void> killCluster(@RequestParam("id") Integer id) {
clusterService.killCluster(id); clusterInstanceService.killCluster(id);
return Result.succeed("Kill Cluster Succeed."); return Result.succeed("Kill Cluster Succeed.");
} }
/** 批量停止 */ /**
* batch kill cluster instances , this method is {@link Deprecated}
*
* @param para {@link JsonNode} cluster instance ids
* @return {@link Result}<{@link Void}>
*/
@DeleteMapping("/killMulCluster") @DeleteMapping("/killMulCluster")
@Deprecated
public Result<Void> killMulCluster(@RequestBody JsonNode para) { public Result<Void> killMulCluster(@RequestBody JsonNode para) {
if (para.size() > 0) { if (para.size() > 0) {
for (final JsonNode item : para) { for (final JsonNode item : para) {
clusterService.killCluster(item.asInt()); clusterInstanceService.killCluster(item.asInt());
} }
} }
return Result.succeed("Kill cluster succeed."); return Result.succeed(MessageResolverUtils.getMessage("cluster.instance.kill"));
} }
/** 启动 Session 集群 */ /**
* deploy session cluster by id
*
* @param id {@link Integer} cluster instance id
* @return {@link Result}<{@link Cluster}>
*/
@GetMapping("/deploySessionCluster") @GetMapping("/deploySessionCluster")
public Result<Cluster> deploySessionCluster(@RequestParam("id") Integer id) { public Result<Cluster> deploySessionCluster(@RequestParam("id") Integer id) {
return Result.succeed( return Result.succeed(
clusterService.deploySessionCluster(id), "Deploy session cluster succeed."); clusterInstanceService.deploySessionCluster(id),
MessageResolverUtils.getMessage("cluster.instance.deploy"));
} }
} }
...@@ -31,7 +31,7 @@ import org.dinky.model.JobInstance; ...@@ -31,7 +31,7 @@ import org.dinky.model.JobInstance;
import org.dinky.model.JobStatus; import org.dinky.model.JobStatus;
import org.dinky.model.Task; import org.dinky.model.Task;
import org.dinky.service.ClusterConfigurationService; import org.dinky.service.ClusterConfigurationService;
import org.dinky.service.ClusterService; import org.dinky.service.ClusterInstanceService;
import org.dinky.service.HistoryService; import org.dinky.service.HistoryService;
import org.dinky.service.JarService; import org.dinky.service.JarService;
import org.dinky.service.JobHistoryService; import org.dinky.service.JobHistoryService;
...@@ -52,7 +52,7 @@ import org.springframework.context.annotation.DependsOn; ...@@ -52,7 +52,7 @@ import org.springframework.context.annotation.DependsOn;
public class Job2MysqlHandler implements JobHandler { public class Job2MysqlHandler implements JobHandler {
private static final HistoryService historyService; private static final HistoryService historyService;
private static final ClusterService clusterService; private static final ClusterInstanceService clusterInstanceService;
private static final ClusterConfigurationService clusterConfigurationService; private static final ClusterConfigurationService clusterConfigurationService;
private static final JarService jarService; private static final JarService jarService;
private static final JobInstanceService jobInstanceService; private static final JobInstanceService jobInstanceService;
...@@ -61,7 +61,9 @@ public class Job2MysqlHandler implements JobHandler { ...@@ -61,7 +61,9 @@ public class Job2MysqlHandler implements JobHandler {
static { static {
historyService = SpringContextUtils.getBean("historyServiceImpl", HistoryService.class); historyService = SpringContextUtils.getBean("historyServiceImpl", HistoryService.class);
clusterService = SpringContextUtils.getBean("clusterServiceImpl", ClusterService.class); clusterInstanceService =
SpringContextUtils.getBean(
"clusterInstanceServiceImpl", ClusterInstanceService.class);
clusterConfigurationService = clusterConfigurationService =
SpringContextUtils.getBean( SpringContextUtils.getBean(
"clusterConfigurationServiceImpl", ClusterConfigurationService.class); "clusterConfigurationServiceImpl", ClusterConfigurationService.class);
...@@ -135,7 +137,7 @@ public class Job2MysqlHandler implements JobHandler { ...@@ -135,7 +137,7 @@ public class Job2MysqlHandler implements JobHandler {
final Integer clusterConfigurationId = job.getJobConfig().getClusterConfigurationId(); final Integer clusterConfigurationId = job.getJobConfig().getClusterConfigurationId();
if (job.isUseGateway()) { if (job.isUseGateway()) {
cluster = cluster =
clusterService.registersCluster( clusterInstanceService.registersCluster(
Cluster.autoRegistersCluster( Cluster.autoRegistersCluster(
job.getJobManagerAddress(), job.getJobManagerAddress(),
job.getJobId(), job.getJobId(),
...@@ -149,7 +151,7 @@ public class Job2MysqlHandler implements JobHandler { ...@@ -149,7 +151,7 @@ public class Job2MysqlHandler implements JobHandler {
} else if (GatewayType.LOCAL.equalsValue(job.getJobConfig().getType()) } else if (GatewayType.LOCAL.equalsValue(job.getJobConfig().getType())
&& Asserts.isNotNullString(job.getJobManagerAddress())) { && Asserts.isNotNullString(job.getJobManagerAddress())) {
cluster = cluster =
clusterService.registersCluster( clusterInstanceService.registersCluster(
Cluster.autoRegistersCluster( Cluster.autoRegistersCluster(
job.getJobManagerAddress(), job.getJobManagerAddress(),
job.getJobId(), job.getJobId(),
...@@ -161,7 +163,7 @@ public class Job2MysqlHandler implements JobHandler { ...@@ -161,7 +163,7 @@ public class Job2MysqlHandler implements JobHandler {
clusterId = cluster.getId(); clusterId = cluster.getId();
} }
} else { } else {
cluster = clusterService.getById(clusterId); cluster = clusterInstanceService.getById(clusterId);
} }
history.setClusterId(clusterId); history.setClusterId(clusterId);
......
...@@ -25,7 +25,7 @@ import org.dinky.model.ClusterConfiguration; ...@@ -25,7 +25,7 @@ import org.dinky.model.ClusterConfiguration;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
* ClusterMapper * ClusterConfigurationMapper
* *
* @since 2021/5/28 13:56 * @since 2021/5/28 13:56
*/ */
......
...@@ -26,13 +26,8 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -26,13 +26,8 @@ import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
/** /** ClusterInstanceMapper */
* ClusterMapper
*
* @since 2021/5/28 13:56
*/
@Mapper @Mapper
public interface ClusterMapper extends SuperMapper<Cluster> { public interface ClusterInstanceMapper extends SuperMapper<Cluster> {
List<Cluster> listSessionEnable(); List<Cluster> listSessionEnable();
} }
...@@ -25,36 +25,115 @@ import org.dinky.model.Cluster; ...@@ -25,36 +25,115 @@ import org.dinky.model.Cluster;
import java.util.List; import java.util.List;
/** /** ClusterInstanceService */
* ClusterService public interface ClusterInstanceService extends ISuperService<Cluster> {
/**
* check cluster heartbeat status
* *
* @since 2021/5/28 14:01 * @param hosts {@link String} eg: host1:8081,host2:8082,host3:8083,host4:8084
* @param host {@link String} eg: host1
* @return {@link FlinkClusterInfo}
*/ */
public interface ClusterService extends ISuperService<Cluster> {
FlinkClusterInfo checkHeartBeat(String hosts, String host); FlinkClusterInfo checkHeartBeat(String hosts, String host);
/**
* get job manager address
*
* @param cluster {@link Cluster} cluster instance
* @return {@link String} eg: host1:8081
*/
String getJobManagerAddress(Cluster cluster); String getJobManagerAddress(Cluster cluster);
/**
* build environment address
*
* @param useRemote {@link Boolean} use remote or local
* @param id {@link Integer} cluster id
* @return {@link String} eg: host1:8081
*/
String buildEnvironmentAddress(boolean useRemote, Integer id); String buildEnvironmentAddress(boolean useRemote, Integer id);
/**
* build remote environment address by cluster id
*
* @param id {@link Integer} cluster id
* @return {@link String} eg: host1:8081
*/
String buildRemoteEnvironmentAddress(Integer id); String buildRemoteEnvironmentAddress(Integer id);
/**
* build local environment address
*
* @return {@link String} eg: host1:8081
*/
String buildLocalEnvironmentAddress(); String buildLocalEnvironmentAddress();
/**
* list enabled cluster instances
*
* @return {@link List<Cluster>}
*/
List<Cluster> listEnabledAll(); List<Cluster> listEnabledAll();
/**
* list session enable cluster instances , this method is {@link @Deprecated}
*
* @return {@link List<Cluster>}
*/
@Deprecated
List<Cluster> listSessionEnable(); List<Cluster> listSessionEnable();
/**
* list auto enable cluster instances
*
* @return {@link List<Cluster>}
*/
List<Cluster> listAutoEnable(); List<Cluster> listAutoEnable();
/**
* register cluster instance
*
* @param cluster {@link Cluster} cluster instance
* @return {@link Cluster}
*/
Cluster registersCluster(Cluster cluster); Cluster registersCluster(Cluster cluster);
boolean enableCluster(Cluster cluster); /**
* delete cluster instance by id
*
* @param id {@link Integer} cluster id
* @return {@link Boolean}
*/
Boolean deleteClusterInstanceById(Integer id);
/**
* enable cluster or disable cluster by id
*
* @param id {@link Integer} cluster id
* @return {@link Boolean}
*/
Boolean enableClusterInstance(Integer id);
int clearCluster(); /**
* recycle cluster instance
*
* @return {@link Integer} eg: 1
*/
Integer recycleCluster();
/**
* kill cluster instance by id
*
* @param id {@link Integer} cluster id
*/
void killCluster(Integer id); void killCluster(Integer id);
/**
* deploy session cluster
*
* @param id {@link Integer} cluster id
* @return {@link Cluster}
*/
Cluster deploySessionCluster(Integer id); Cluster deploySessionCluster(Integer id);
} }
...@@ -30,11 +30,11 @@ import org.dinky.gateway.config.GatewayConfig; ...@@ -30,11 +30,11 @@ import org.dinky.gateway.config.GatewayConfig;
import org.dinky.gateway.exception.GatewayException; import org.dinky.gateway.exception.GatewayException;
import org.dinky.gateway.result.GatewayResult; import org.dinky.gateway.result.GatewayResult;
import org.dinky.job.JobManager; import org.dinky.job.JobManager;
import org.dinky.mapper.ClusterMapper; import org.dinky.mapper.ClusterInstanceMapper;
import org.dinky.model.Cluster; import org.dinky.model.Cluster;
import org.dinky.model.ClusterConfiguration; import org.dinky.model.ClusterConfiguration;
import org.dinky.service.ClusterConfigurationService; import org.dinky.service.ClusterConfigurationService;
import org.dinky.service.ClusterService; import org.dinky.service.ClusterInstanceService;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
...@@ -48,14 +48,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -48,14 +48,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
/** /**
* ClusterServiceImpl * ClusterInstanceServiceImpl
* *
* @since 2021/5/28 14:02 * @since 2021/5/28 14:02
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class ClusterServiceImpl extends SuperServiceImpl<ClusterMapper, Cluster> public class ClusterInstanceServiceImpl extends SuperServiceImpl<ClusterInstanceMapper, Cluster>
implements ClusterService { implements ClusterInstanceService {
private final ClusterConfigurationService clusterConfigurationService; private final ClusterConfigurationService clusterConfigurationService;
...@@ -130,16 +130,25 @@ public class ClusterServiceImpl extends SuperServiceImpl<ClusterMapper, Cluster> ...@@ -130,16 +130,25 @@ public class ClusterServiceImpl extends SuperServiceImpl<ClusterMapper, Cluster>
return cluster; return cluster;
} }
/**
* @param id
* @return
*/
@Override
public Boolean deleteClusterInstanceById(Integer id) {
return baseMapper.deleteById(id) > 0;
}
@Override @Override
public boolean enableCluster(Cluster cluster) { public Boolean enableClusterInstance(Integer id) {
Cluster clusterInfo = getById(cluster); Cluster clusterInfo = getById(id);
clusterInfo.setEnabled(cluster.getEnabled()); clusterInfo.setEnabled(!clusterInfo.getEnabled());
checkHealth(clusterInfo); checkHealth(clusterInfo);
return updateById(clusterInfo); return updateById(clusterInfo);
} }
@Override @Override
public int clearCluster() { public Integer recycleCluster() {
List<Cluster> clusters = listAutoEnable(); List<Cluster> clusters = listAutoEnable();
int count = 0; int count = 0;
for (Cluster item : clusters) { for (Cluster item : clusters) {
......
...@@ -36,7 +36,7 @@ import org.dinky.model.JobInstanceCount; ...@@ -36,7 +36,7 @@ import org.dinky.model.JobInstanceCount;
import org.dinky.model.JobInstanceStatus; import org.dinky.model.JobInstanceStatus;
import org.dinky.model.JobStatus; import org.dinky.model.JobStatus;
import org.dinky.service.ClusterConfigurationService; import org.dinky.service.ClusterConfigurationService;
import org.dinky.service.ClusterService; import org.dinky.service.ClusterInstanceService;
import org.dinky.service.HistoryService; import org.dinky.service.HistoryService;
import org.dinky.service.JobHistoryService; import org.dinky.service.JobHistoryService;
import org.dinky.service.JobInstanceService; import org.dinky.service.JobInstanceService;
...@@ -65,7 +65,7 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper, ...@@ -65,7 +65,7 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper,
implements JobInstanceService { implements JobInstanceService {
private final HistoryService historyService; private final HistoryService historyService;
private final ClusterService clusterService; private final ClusterInstanceService clusterInstanceService;
private final ClusterConfigurationService clusterConfigurationService; private final ClusterConfigurationService clusterConfigurationService;
private final JobHistoryService jobHistoryService; private final JobHistoryService jobHistoryService;
...@@ -149,7 +149,7 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper, ...@@ -149,7 +149,7 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper,
} else { } else {
JobInfoDetail jobInfoDetail = new JobInfoDetail(jobInstance.getId()); JobInfoDetail jobInfoDetail = new JobInfoDetail(jobInstance.getId());
jobInfoDetail.setInstance(jobInstance); jobInfoDetail.setInstance(jobInstance);
jobInfoDetail.setCluster(clusterService.getById(jobInstance.getClusterId())); jobInfoDetail.setCluster(clusterInstanceService.getById(jobInstance.getClusterId()));
jobInfoDetail.setJobHistory(jobHistoryService.getJobHistory(jobInstance.getId())); jobInfoDetail.setJobHistory(jobHistoryService.getJobHistory(jobInstance.getId()));
History history = historyService.getById(jobInstance.getHistoryId()); History history = historyService.getById(jobInstance.getHistoryId());
history.setConfig(JSONUtil.parseObject(history.getConfigJson())); history.setConfig(JSONUtil.parseObject(history.getConfigJson()));
...@@ -172,7 +172,7 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper, ...@@ -172,7 +172,7 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper,
jobInfoDetail = new JobInfoDetail(jobInstance.getId()); jobInfoDetail = new JobInfoDetail(jobInstance.getId());
jobInfoDetail.setInstance(jobInstance); jobInfoDetail.setInstance(jobInstance);
jobInfoDetail.setCluster(clusterService.getById(jobInstance.getClusterId())); jobInfoDetail.setCluster(clusterInstanceService.getById(jobInstance.getClusterId()));
jobInfoDetail.setJobHistory(jobHistoryService.getJobHistory(jobInstance.getId())); jobInfoDetail.setJobHistory(jobHistoryService.getJobHistory(jobInstance.getId()));
History history = historyService.getById(jobInstance.getHistoryId()); History history = historyService.getById(jobInstance.getHistoryId());
......
...@@ -55,7 +55,7 @@ import org.dinky.result.IResult; ...@@ -55,7 +55,7 @@ import org.dinky.result.IResult;
import org.dinky.result.SelectResult; import org.dinky.result.SelectResult;
import org.dinky.result.SqlExplainResult; import org.dinky.result.SqlExplainResult;
import org.dinky.service.ClusterConfigurationService; import org.dinky.service.ClusterConfigurationService;
import org.dinky.service.ClusterService; import org.dinky.service.ClusterInstanceService;
import org.dinky.service.DataBaseService; import org.dinky.service.DataBaseService;
import org.dinky.service.FragmentVariableService; import org.dinky.service.FragmentVariableService;
import org.dinky.service.SavepointsService; import org.dinky.service.SavepointsService;
...@@ -90,7 +90,7 @@ public class StudioServiceImpl implements StudioService { ...@@ -90,7 +90,7 @@ public class StudioServiceImpl implements StudioService {
private static final Logger logger = LoggerFactory.getLogger(StudioServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(StudioServiceImpl.class);
private final ClusterService clusterService; private final ClusterInstanceService clusterInstanceService;
private final ClusterConfigurationService clusterConfigurationService; private final ClusterConfigurationService clusterConfigurationService;
private final SavepointsService savepointsService; private final SavepointsService savepointsService;
private final DataBaseService dataBaseService; private final DataBaseService dataBaseService;
...@@ -156,7 +156,7 @@ public class StudioServiceImpl implements StudioService { ...@@ -156,7 +156,7 @@ public class StudioServiceImpl implements StudioService {
// If you are using a shared session, configure the current jobManager address // If you are using a shared session, configure the current jobManager address
if (!config.isUseSession()) { if (!config.isUseSession()) {
config.setAddress( config.setAddress(
clusterService.buildEnvironmentAddress( clusterInstanceService.buildEnvironmentAddress(
config.isUseRemote(), config.getClusterId())); config.isUseRemote(), config.getClusterId()));
} }
} }
...@@ -245,7 +245,7 @@ public class StudioServiceImpl implements StudioService { ...@@ -245,7 +245,7 @@ public class StudioServiceImpl implements StudioService {
JobConfig config = studioDDLDTO.getJobConfig(); JobConfig config = studioDDLDTO.getJobConfig();
if (!config.isUseSession()) { if (!config.isUseSession()) {
config.setAddress( config.setAddress(
clusterService.buildEnvironmentAddress( clusterInstanceService.buildEnvironmentAddress(
config.isUseRemote(), studioDDLDTO.getClusterId())); config.isUseRemote(), studioDDLDTO.getClusterId()));
} }
JobManager jobManager = JobManager.build(config); JobManager jobManager = JobManager.build(config);
...@@ -381,7 +381,7 @@ public class StudioServiceImpl implements StudioService { ...@@ -381,7 +381,7 @@ public class StudioServiceImpl implements StudioService {
@Override @Override
public List<JsonNode> listJobs(Integer clusterId) { public List<JsonNode> listJobs(Integer clusterId) {
Cluster cluster = clusterService.getById(clusterId); Cluster cluster = clusterInstanceService.getById(clusterId);
Asserts.checkNotNull(cluster, "该集群不存在"); Asserts.checkNotNull(cluster, "该集群不存在");
try { try {
return FlinkAPI.build(cluster.getJobManagerHost()).listJobs(); return FlinkAPI.build(cluster.getJobManagerHost()).listJobs();
...@@ -393,7 +393,7 @@ public class StudioServiceImpl implements StudioService { ...@@ -393,7 +393,7 @@ public class StudioServiceImpl implements StudioService {
@Override @Override
public boolean cancel(Integer clusterId, String jobId) { public boolean cancel(Integer clusterId, String jobId) {
Cluster cluster = clusterService.getById(clusterId); Cluster cluster = clusterInstanceService.getById(clusterId);
Asserts.checkNotNull(cluster, "该集群不存在"); Asserts.checkNotNull(cluster, "该集群不存在");
JobConfig jobConfig = new JobConfig(); JobConfig jobConfig = new JobConfig();
jobConfig.setAddress(cluster.getJobManagerHost()); jobConfig.setAddress(cluster.getJobManagerHost());
...@@ -410,7 +410,7 @@ public class StudioServiceImpl implements StudioService { ...@@ -410,7 +410,7 @@ public class StudioServiceImpl implements StudioService {
@Override @Override
public boolean savepoint( public boolean savepoint(
Integer taskId, Integer clusterId, String jobId, String savePointType, String name) { Integer taskId, Integer clusterId, String jobId, String savePointType, String name) {
Cluster cluster = clusterService.getById(clusterId); Cluster cluster = clusterInstanceService.getById(clusterId);
Asserts.checkNotNull(cluster, "该集群不存在"); Asserts.checkNotNull(cluster, "该集群不存在");
boolean useGateway = false; boolean useGateway = false;
......
...@@ -93,7 +93,7 @@ import org.dinky.service.AlertGroupService; ...@@ -93,7 +93,7 @@ import org.dinky.service.AlertGroupService;
import org.dinky.service.AlertHistoryService; import org.dinky.service.AlertHistoryService;
import org.dinky.service.CatalogueService; import org.dinky.service.CatalogueService;
import org.dinky.service.ClusterConfigurationService; import org.dinky.service.ClusterConfigurationService;
import org.dinky.service.ClusterService; import org.dinky.service.ClusterInstanceService;
import org.dinky.service.DataBaseService; import org.dinky.service.DataBaseService;
import org.dinky.service.FragmentVariableService; import org.dinky.service.FragmentVariableService;
import org.dinky.service.HistoryService; import org.dinky.service.HistoryService;
...@@ -166,7 +166,7 @@ import lombok.RequiredArgsConstructor; ...@@ -166,7 +166,7 @@ import lombok.RequiredArgsConstructor;
public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implements TaskService { public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implements TaskService {
private final StatementService statementService; private final StatementService statementService;
private final ClusterService clusterService; private final ClusterInstanceService clusterInstanceService;
private final ClusterConfigurationService clusterConfigurationService; private final ClusterConfigurationService clusterConfigurationService;
private final SavepointsService savepointsService; private final SavepointsService savepointsService;
private final JarService jarService; private final JarService jarService;
...@@ -412,7 +412,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -412,7 +412,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
task.parseConfig(); task.parseConfig();
if (task.getClusterId() != null) { if (task.getClusterId() != null) {
Cluster cluster = clusterService.getById(task.getClusterId()); Cluster cluster = clusterInstanceService.getById(task.getClusterId());
if (cluster != null) { if (cluster != null) {
task.setClusterName(cluster.getAlias()); task.setClusterName(cluster.getAlias());
} }
...@@ -884,7 +884,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -884,7 +884,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
return true; return true;
} }
Cluster cluster = clusterService.getById(jobInstance.getClusterId()); Cluster cluster = clusterInstanceService.getById(jobInstance.getClusterId());
Asserts.checkNotNull(cluster, "该集群不存在"); Asserts.checkNotNull(cluster, "该集群不存在");
Task task = this.getTaskInfoById(jobInstance.getTaskId()); Task task = this.getTaskInfoById(jobInstance.getTaskId());
...@@ -967,7 +967,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -967,7 +967,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
config.setJarTask(isJarTask); config.setJarTask(isJarTask);
if (!JobManager.useGateway(config.getType())) { if (!JobManager.useGateway(config.getType())) {
config.setAddress( config.setAddress(
clusterService.buildEnvironmentAddress( clusterInstanceService.buildEnvironmentAddress(
config.isUseRemote(), task.getClusterId())); config.isUseRemote(), task.getClusterId()));
} else if (Dialect.KUBERNETES_APPLICATION.equalsVal(task.getDialect()) } else if (Dialect.KUBERNETES_APPLICATION.equalsVal(task.getDialect())
// support custom K8s app submit, rather than clusterConfiguration // support custom K8s app submit, rather than clusterConfiguration
...@@ -1066,7 +1066,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -1066,7 +1066,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
Asserts.checkNull(jobInstance, "the task instance not exist."); Asserts.checkNull(jobInstance, "the task instance not exist.");
TenantContextHolder.set(jobInstance.getTenantId()); TenantContextHolder.set(jobInstance.getTenantId());
jobInfoDetail.setInstance(jobInstance); jobInfoDetail.setInstance(jobInstance);
Cluster cluster = clusterService.getById(jobInstance.getClusterId()); Cluster cluster = clusterInstanceService.getById(jobInstance.getClusterId());
jobInfoDetail.setCluster(cluster); jobInfoDetail.setCluster(cluster);
History history = historyService.getById(jobInstance.getHistoryId()); History history = historyService.getById(jobInstance.getHistoryId());
history.setConfig(JSONUtil.parseObject(history.getConfigJson())); history.setConfig(JSONUtil.parseObject(history.getConfigJson()));
...@@ -1184,7 +1184,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -1184,7 +1184,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
public String exportJsonByTaskId(Integer taskId) { public String exportJsonByTaskId(Integer taskId) {
Task task = getTaskInfoById(taskId); Task task = getTaskInfoById(taskId);
if (Asserts.isNotNull(task.getClusterId())) { if (Asserts.isNotNull(task.getClusterId())) {
Cluster cluster = clusterService.getById(task.getClusterId()); Cluster cluster = clusterInstanceService.getById(task.getClusterId());
if (Asserts.isNotNull(cluster)) { if (Asserts.isNotNull(cluster)) {
task.setClusterName(cluster.getName()); task.setClusterName(cluster.getName());
} }
...@@ -1277,7 +1277,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -1277,7 +1277,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
Task task = mapper.treeToValue(json, Task.class); Task task = mapper.treeToValue(json, Task.class);
if (Asserts.isNotNull(task.getClusterName())) { if (Asserts.isNotNull(task.getClusterName())) {
Cluster cluster = Cluster cluster =
clusterService.getOne( clusterInstanceService.getOne(
new QueryWrapper<Cluster>().eq("name", task.getClusterName())); new QueryWrapper<Cluster>().eq("name", task.getClusterName()));
if (Asserts.isNotNull(cluster)) { if (Asserts.isNotNull(cluster)) {
task.setClusterId(cluster.getId()); task.setClusterId(cluster.getId());
......
...@@ -112,3 +112,10 @@ hdfs.file.lose=\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u6CA1\u6709\u627E\u523 ...@@ -112,3 +112,10 @@ hdfs.file.lose=\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u6CA1\u6709\u627E\u523
unknown.error=\u672A\u77E5\u5F02\u5E38\uFF1A{0} unknown.error=\u672A\u77E5\u5F02\u5E38\uFF1A{0}
operate.success=\u64CD\u4F5C\u6210\u529F operate.success=\u64CD\u4F5C\u6210\u529F
# cluster instance
cluster.instance.heartbeat=\u72B6\u6001\u5237\u65B0\u5B8C\u6210
cluster.instance.recycle=\u56DE\u6536\u5B8C\u6210
cluster.instance.kill=\u5DF2\u6740\u6B7B\u8BE5\u8FDB\u7A0B/\u96C6\u7FA4
cluster.instance.deploy=\u90E8\u7F72\u5B8C\u6210
\ No newline at end of file
...@@ -111,3 +111,9 @@ hdfs.file.lose=If you can't find the core-site.xml/hdfs-site.xml/yarn-site.xml f ...@@ -111,3 +111,9 @@ hdfs.file.lose=If you can't find the core-site.xml/hdfs-site.xml/yarn-site.xml f
unknown.error=Unknown error: {0} unknown.error=Unknown error: {0}
operate.success=operate success operate.success=operate success
# cluster instance
cluster.instance.heartbeat=Status refresh completed
cluster.instance.recycle=Recycle completed
cluster.instance.kill=The process/cluster has been killed
cluster.instance.deploy = Deployment completed
\ No newline at end of file
...@@ -111,3 +111,10 @@ hdfs.file.lose=\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u6CA1\u6709\u627E\u523 ...@@ -111,3 +111,10 @@ hdfs.file.lose=\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u6CA1\u6709\u627E\u523
unknown.error=\u672A\u77E5\u5F02\u5E38\uFF1A{0} unknown.error=\u672A\u77E5\u5F02\u5E38\uFF1A{0}
operate.success=\u64CD\u4F5C\u6210\u529F operate.success=\u64CD\u4F5C\u6210\u529F
# cluster instance
cluster.instance.heartbeat=\u72B6\u6001\u5237\u65B0\u5B8C\u6210
cluster.instance.recycle=\u56DE\u6536\u5B8C\u6210
cluster.instance.kill=\u5DF2\u6740\u6B7B\u8BE5\u8FDB\u7A0B/\u96C6\u7FA4
cluster.instance.deploy=\u90E8\u7F72\u5B8C\u6210
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dinky.mapper.ClusterMapper"> <mapper namespace="org.dinky.mapper.ClusterInstanceMapper">
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="org.dinky.model.Cluster"> <resultMap id="BaseResultMap" type="org.dinky.model.Cluster">
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
<if test='param.alias!=null and param.alias!=""'> <if test='param.alias!=null and param.alias!=""'>
and a.alias like "%${param.alias}%" and a.alias like "%${param.alias}%"
</if> </if>
<if test='param.note!=null and param.note!=""'>
and a.note like "%${param.note}%"
</if>
<if test='param.createTime!=null and param.createTime!=""'> <if test='param.createTime!=null and param.createTime!=""'>
and a.create_time <![CDATA[>=]]> str_to_date( #{param.createTime},'%Y-%m-%d %H:%i:%s') and a.create_time <![CDATA[>=]]> str_to_date( #{param.createTime},'%Y-%m-%d %H:%i:%s')
</if> </if>
......
...@@ -111,7 +111,7 @@ export default [ ...@@ -111,7 +111,7 @@ export default [
{ {
path: '/registration/cluster/instance', path: '/registration/cluster/instance',
name: 'cluster-instance', name: 'cluster-instance',
// component: './RegistrationCenter/ClusterManage/Cluster', component: './RegCenter/Cluster/Instance',
}, },
{ {
path: '/registration/cluster/config', path: '/registration/cluster/config',
...@@ -128,6 +128,7 @@ export default [ ...@@ -128,6 +128,7 @@ export default [
routes: [ routes: [
{ {
path: '/registration/database/detail/:id', path: '/registration/database/detail/:id',
footerRender: false,
} }
] ]
}, },
......
...@@ -87,3 +87,20 @@ export const ShowCodeTreeIcon = () => { ...@@ -87,3 +87,20 @@ export const ShowCodeTreeIcon = () => {
)}/> )}/>
</>; </>;
}; };
export const WebIcon = () => {
return <>
<Icon style={{...IconStyle}} component={() => (
<svg className="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" >
<path
d="M221.866667 405.333333c-14.933333 36.266667-23.466667 76.8-23.466667 117.333334 0 34.133333 6.4 68.266667 17.066667 98.133333 19.2-32 44.8-68.266667 76.8-106.666667-4.266667-8.533333-8.533333-19.2-8.533334-29.866666 0-8.533333 2.133333-14.933333 4.266667-21.333334-29.866667-21.333333-51.2-40.533333-66.133333-57.6zM332.8 778.666667c10.666667-8.533333 19.2-17.066667 29.866667-23.466667 87.466667-66.133333 166.4-104.533333 228.266666-125.866667 0-4.266667-2.133333-8.533333-2.133333-12.8v-6.4c-21.333333-6.4-44.8-12.8-66.133333-21.333333-55.466667-19.2-102.4-42.666667-142.933334-64-10.666667 10.666667-25.6 17.066667-40.533333 17.066667-8.533333 0-14.933333-2.133333-21.333333-4.266667-40.533333 46.933333-68.266667 91.733333-87.466667 125.866667 25.6 46.933333 59.733333 85.333333 102.4 115.2zM535.466667 556.8c23.466667 8.533333 46.933333 14.933333 70.4 21.333333 6.4-6.4 12.8-10.666667 19.2-12.8-6.4-23.466667-14.933333-46.933333-25.6-70.4-14.933333-34.133333-32-66.133333-49.066667-93.866666-6.4 2.133333-10.666667 2.133333-17.066667 2.133333-12.8 0-25.6-4.266667-36.266666-12.8-23.466667 14.933333-46.933333 29.866667-72.533334 49.066667l-32 25.6c2.133333 6.4 4.266667 14.933333 4.266667 21.333333v8.533333c38.4 19.2 85.333333 42.666667 138.666667 61.866667zM834.133333 522.666667c0-89.6-38.4-172.8-102.4-228.266667-32 6.4-81.066667 19.2-140.8 44.8v6.4c0 12.8-4.266667 23.466667-10.666666 34.133333 19.2 29.866667 36.266667 64 53.333333 102.4 10.666667 27.733333 21.333333 55.466667 29.866667 81.066667 17.066667 4.266667 32 17.066667 40.533333 34.133333 12.8 2.133333 25.6 2.133333 38.4 2.133334 32 2.133333 61.866667 0 85.333333 0 2.133333-27.733333 6.4-51.2 6.4-76.8zM516.266667 290.133333c6.4-2.133333 10.666667-2.133333 17.066666-2.133333 17.066667 0 32 6.4 42.666667 19.2 46.933333-21.333333 87.466667-34.133333 119.466667-42.666667-51.2-34.133333-113.066667-55.466667-179.2-55.466666-23.466667 0-49.066667 2.133333-70.4 8.533333 19.2 19.2 44.8 42.666667 70.4 72.533333zM661.333333 800c2.133333-32 0-74.666667-10.666666-128h-4.266667c-14.933333 0-27.733333-4.266667-36.266667-12.8-59.733333 21.333333-138.666667 57.6-224 123.733333-6.4 4.266667-12.8 10.666667-21.333333 14.933334 44.8 23.466667 96 36.266667 149.333333 36.266666 53.333333 2.133333 104.533333-10.666667 147.2-34.133333zM238.933333 371.2c14.933333 17.066667 38.4 40.533333 72.533334 66.133333 8.533333-4.266667 19.2-8.533333 29.866666-8.533333 10.666667 0 21.333333 2.133333 29.866667 8.533333l32-25.6c25.6-19.2 51.2-36.266667 74.666667-51.2-2.133333-4.266667-2.133333-8.533333-2.133334-14.933333 0-12.8 4.266667-23.466667 10.666667-34.133333-32-36.266667-59.733333-64-83.2-81.066667-70.4 25.6-128 76.8-164.266667 140.8zM733.866667 633.6c-6.4 0-17.066667 0-32 4.266667-4.266667 8.533333-8.533333 14.933333-14.933334 21.333333 8.533333 46.933333 12.8 87.466667 12.8 119.466667 51.2-36.266667 91.733333-85.333333 115.2-145.066667h-81.066666z"
fill="#00C1DE"></path>
<path
d="M661.333333 87.466667C652.8 61.866667 629.333333 42.666667 599.466667 42.666667c-34.133333 0-64 27.733333-64 61.866666s27.733333 61.866667 64 61.866667c17.066667 0 34.133333-6.4 44.8-19.2C804.266667 202.666667 917.333333 349.866667 917.333333 522.666667c0 42.666667-6.4 83.2-19.2 121.6l55.466667 32c17.066667-46.933333 27.733333-100.266667 27.733333-153.6C981.333333 320 846.933333 147.2 661.333333 87.466667zM842.666667 740.266667c-34.133333 0-64 27.733333-64 61.866666 0 6.4 2.133333 10.666667 2.133333 17.066667-70.4 61.866667-164.266667 100.266667-266.666667 100.266667-117.333333 0-224-51.2-298.666666-130.133334l-57.6 32c85.333333 98.133333 213.333333 160 354.133333 160 119.466667 0 230.4-44.8 311.466667-119.466666 4.266667 2.133333 8.533333 2.133333 14.933333 2.133333 34.133333 0 64-27.733333 64-61.866667s-25.6-61.866667-59.733333-61.866666zM121.6 599.466667c-4.266667-25.6-8.533333-49.066667-8.533333-76.8 0-189.866667 136.533333-347.733333 317.866666-386.133334v-64C213.333333 110.933333 49.066667 298.666667 49.066667 522.666667c0 32 4.266667 64 10.666666 93.866666-10.666667 10.666667-17.066667 25.6-17.066666 42.666667 0 34.133333 27.733333 61.866667 64 61.866667 34.133333 0 64-27.733333 64-61.866667 0-29.866667-21.333333-53.333333-49.066667-59.733333z"
fill="#00C1DE" ></path>
</svg>
)}/>
</>;
}
\ No newline at end of file
...@@ -150,6 +150,8 @@ export default { ...@@ -150,6 +150,8 @@ export default {
'global.fullScreen': 'FullScreen', 'global.fullScreen': 'FullScreen',
'global.fullScreen.exit': 'Exit FullScreen', 'global.fullScreen.exit': 'Exit FullScreen',
'global.yes': 'Yes',
'global.no': 'No',
'global.info': 'Info', 'global.info': 'Info',
'global.error': 'Error', 'global.error': 'Error',
......
...@@ -124,6 +124,30 @@ export default { ...@@ -124,6 +124,30 @@ export default {
//-------------------------------- register center -------------------------------- //-------------------------------- register center --------------------------------
'rc.ci.management': 'Cluster Instance Management',
'rc.ci.name': 'Name',
'rc.ci.alias': 'Alias',
'rc.ci.type': 'Type',
'rc.ci.version': 'Version',
'rc.ci.jma': 'JobManger Address',
'rc.ci.ar': 'Auto Registration',
'rc.ci.status': 'Status',
'rc.ci.jmha': 'JobManger HA Address',
'rc.ci.create': 'Create Cluster Instance',
'rc.ci.modify': 'Modify cluster Instance',
'rc.ci.deleteConfirm': 'Are you sure to delete this Flink Cluster instance? ',
'rc.ci.recycle': 'Recycle Flink Cluster Instances',
'rc.ci.heartbeat': 'Heartbeat Detection',
'rc.ci.recycleConfirm': 'Are you sure to recycle all automatically created and expired Flink instances? ',
'rc.ci.jmha.validate.slash': 'Does not comply with the rules! Cannot contain /',
'rc.ci.jmha.validate.port': 'Does not meet the rules! Port number range [0-65535]',
'rc.ci.jmha.tips': 'Add the RestApi address of the JobManager of the Flink cluster. In HA mode, the addresses are separated by commas, for example: 192.168.123.101:8081,192.168.123.102:8081,192.168.123.103:8081',
'rc.ci.jmhaPlaceholder': 'Please enter the JobManager HA address!',
'rc.ci.typePlaceholder': 'Please select a cluster type!',
'rc.ci.namePlaceholder': 'Please enter a name!',
'rc.ci.aliasPlaceholder': 'Please enter an alias!',
// datasource // datasource
'rc.ds.management': 'DataSource Management', 'rc.ds.management': 'DataSource Management',
'rc.ds.name': 'Name', 'rc.ds.name': 'Name',
...@@ -183,6 +207,10 @@ export default { ...@@ -183,6 +207,10 @@ export default {
'rc.ds.collationRule': 'Collation Rule', 'rc.ds.collationRule': 'Collation Rule',
'rc.ds.javaType': 'Java Type', 'rc.ds.javaType': 'Java Type',
// console sql
'rc.ds.console.exec': 'Execute',
'rc.ds.console.running': 'Running...',
// alert instance // alert instance
'rc.ai.management': 'Alert Instance Management', 'rc.ai.management': 'Alert Instance Management',
......
...@@ -147,6 +147,8 @@ export default { ...@@ -147,6 +147,8 @@ export default {
'global.fullScreen': '全屏', 'global.fullScreen': '全屏',
'global.fullScreen.exit': '退出全屏', 'global.fullScreen.exit': '退出全屏',
'global.yes': '是',
'global.no': '否',
'global.info': '信息', 'global.info': '信息',
'global.error': '错误', 'global.error': '错误',
......
...@@ -120,6 +120,32 @@ export default { ...@@ -120,6 +120,32 @@ export default {
//-------------------------------- register center -------------------------------- //-------------------------------- register center --------------------------------
// ============= cluster =======================
// instance
'rc.ci.management': '集群实例管理',
'rc.ci.name': '实例名称',
'rc.ci.alias': '实例别名',
'rc.ci.type': '类型',
'rc.ci.version': '版本',
'rc.ci.jma': 'JobManger 地址',
'rc.ci.ar': '自动注册',
'rc.ci.status': '状态',
'rc.ci.jmha': 'JobManger 高可用地址',
'rc.ci.create': '创建集群',
'rc.ci.modify': '修改集群',
'rc.ci.deleteConfirm': '确定删除该 Flink 实例吗?',
'rc.ci.recycle': '回收 Flink 实例',
'rc.ci.heartbeat': '心跳检测',
'rc.ci.recycleConfirm': '确定回收所有自动创建且过期的 Flink 实例吗?',
'rc.ci.jmha.validate.slash': '不符合规则! 不能包含/',
'rc.ci.jmha.validate.port': '不符合规则! 端口号区间[0-65535]',
'rc.ci.jmha.tips': '添加 Flink 集群的 JobManager 的 RestApi 地址。当 HA 模式时,地址间用英文逗号分隔,例如:192.168.123.101:8081,192.168.123.102:8081,192.168.123.103:8081',
'rc.ci.jmhaPlaceholder': '请输入 JobManager HA 地址!',
'rc.ci.typePlaceholder': '请选择集群类型!',
'rc.ci.namePlaceholder': '请输入名称!',
'rc.ci.aliasPlaceholder': '请输入别名!',
// =============== data source ======================= // =============== data source =======================
// datasource list page // datasource list page
'rc.ds.management': '数据源管理', 'rc.ds.management': '数据源管理',
...@@ -180,6 +206,10 @@ export default { ...@@ -180,6 +206,10 @@ export default {
'rc.ds.collationRule': '排序规则', 'rc.ds.collationRule': '排序规则',
'rc.ds.javaType': 'Java 类型', 'rc.ds.javaType': 'Java 类型',
// console sql
'rc.ds.console.exec': '执行',
'rc.ds.console.running': '运行中...',
// alert instance // alert instance
'rc.ai.management': '告警实例管理', 'rc.ai.management': '告警实例管理',
......
/*
*
* 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.
*
*/
import {ActionType, ProTable} from '@ant-design/pro-components';
import {API_CONSTANTS, PROTABLE_OPTIONS_PUBLIC, STATUS_ENUM, STATUS_MAPPING} from '@/services/constants';
import {ProColumns} from '@ant-design/pro-table';
import {Cluster} from '@/types/RegCenter/data';
import {l} from '@/utils/intl';
import {queryList} from '@/services/api';
import {CreateBtn} from '@/components/CallBackButton/CreateBtn';
import React, {useRef, useState} from 'react';
import InstanceModal from '@/pages/RegCenter/Cluster/Instance/components/InstanceModal';
import {handleAddOrUpdate, handleOption, handleRemoveById, updateEnabled} from '@/services/BusinessCrud';
import {EditBtn} from '@/components/CallBackButton/EditBtn';
import {PopconfirmDeleteBtn} from '@/components/CallBackButton/PopconfirmDeleteBtn';
import {EnableSwitchBtn} from '@/components/CallBackButton/EnableSwitchBtn';
import {Button, Popconfirm} from 'antd';
import {ClearOutlined, HeartTwoTone} from '@ant-design/icons';
import {renderWebUiRedirect} from '@/pages/RegCenter/Cluster/Instance/components/function';
import {
CLUSTER_INSTANCE_AUTO_REGISTERS_ENUM,
CLUSTER_INSTANCE_STATUS_ENUM
} from '@/pages/RegCenter/Cluster/Instance/components/contants';
export default () => {
/**
* state
*/
const actionRef = useRef<ActionType>();
const [loading, setLoading] = useState<boolean>(false);
const [createOpen, setCreateOpen] = useState<boolean>(false);
const [modifyOpen, setModifyeOpen] = useState<boolean>(false);
const [formValue, setFormValue] = useState<Partial<Cluster.Instance>>({});
/**
* execute and callback function
* @param {() => void} callback
* @returns {Promise<void>}
*/
const executeAndCallback = async (callback: () => void) => {
setLoading(true);
await callback();
setLoading(false);
actionRef.current?.reload?.();
};
/**
* cancel
*/
const handleCancel = async () => {
setCreateOpen(false);
setModifyeOpen(false);
setFormValue({});
};
/**
* submit add or update
* @param value
*/
const handleSubmit = async (value: Partial<Cluster.Instance>) => {
await executeAndCallback(async () => {
await handleAddOrUpdate(API_CONSTANTS.CLUSTER_INSTANCE, value);
await handleCancel();
});
};
/**
* edit open
* @param value
*/
const handleEdit = async (value: Partial<Cluster.Instance>) => {
setFormValue(value);
setModifyeOpen(true);
};
/**
* delete by id
* @param id
*/
const handleDelete = async (id: number) => {
await executeAndCallback(async () => {
await handleRemoveById(API_CONSTANTS.CLUSTER_INSTANCE_DELETE, id);
});
};
/**
* enable or disable
* @param record
*/
const handleChangeEnable = async (record: Partial<Cluster.Instance>) => {
await executeAndCallback(async () => {
await updateEnabled(API_CONSTANTS.CLUSTER_INSTANCE_ENABLE, {id: record.id});
});
};
/**
* check heart beat
*/
const handleHeartBeat = async () => {
await executeAndCallback(async () => {
await handleOption(API_CONSTANTS.CLUSTER_INSTANCE_HEARTBEATS, l('rc.ci.heartbeat'), null);
});
};
/**
* recycle instance
*/
const handleRecycle = async () => {
await executeAndCallback(async () => {
await handleRemoveById(API_CONSTANTS.CLUSTER_INSTANCE_RECYCLE, 0);
});
};
/**
* columns
*/
const columns: ProColumns<Cluster.Instance>[] = [
{
title: l('rc.ci.name'),
dataIndex: 'name',
},
{
title: l('rc.ci.alias'),
dataIndex: 'alias',
},
{
title: l('rc.ci.type'),
dataIndex: 'type',
hideInSearch: true,
},
{
title: l('rc.ci.jma'),
dataIndex: 'jobManagerHost',
copyable: true,
hideInSearch: true,
},
{
title: l('rc.ci.ar'),
dataIndex: 'autoRegisters',
hideInSearch: true,
valueEnum: CLUSTER_INSTANCE_AUTO_REGISTERS_ENUM,
},
{
title: l('rc.ci.version'),
dataIndex: 'version',
hideInSearch: true,
},
{
title: l('rc.ci.status'),
dataIndex: 'status',
hideInSearch: true,
valueEnum: CLUSTER_INSTANCE_STATUS_ENUM,
},
{
title: l('global.table.note'),
dataIndex: 'note',
},
{
title: l('global.table.isEnable'),
dataIndex: 'enabled',
hideInSearch: true,
filters: STATUS_MAPPING(),
filterMultiple: false,
valueEnum: STATUS_ENUM(),
render: (_, record) => {
return <EnableSwitchBtn key={`${record.id}_enable`} record={record}
onChange={() => handleChangeEnable(record)}/>;
},
},
{
title: l('global.table.createTime'),
dataIndex: 'createTime',
hideInSearch: true,
hideInTable: true,
},
{
title: l('global.table.updateTime'),
dataIndex: 'updateTime',
hideInSearch: true,
hideInTable: true,
},
{
title: l('global.table.operate'),
hideInSearch: true,
valueType: 'option',
width: '10vw',
render: (_, record) => [
<EditBtn key={`${record.id}_edit`} onClick={() => handleEdit(record)}/>,
<PopconfirmDeleteBtn key={`${record.id}_delete`} onClick={() => handleDelete(record.id)}
description={l('rc.ci.deleteConfirm')}/>,
renderWebUiRedirect(record),
],
},
];
/**
* tool bar render
*/
const toolBarRender = () => [
<CreateBtn key={'instancecreate'} onClick={() => setCreateOpen(true)}/>,
<Button key={'heartbeat_all'} type={'primary'} icon={<HeartTwoTone/>}
onClick={() => handleHeartBeat()}>{l('button.heartbeat')}</Button>,
<Popconfirm key={'recycle'} title={l('rc.ci.recycle')} description={l('rc.ci.recycleConfirm')}
onConfirm={handleRecycle}>
<Button key={'recycle_btn'} type={'primary'} icon={<ClearOutlined/>}>{l('button.recycle')}</Button>
</Popconfirm>,
];
/**
* render
*/
return <>
<ProTable<Cluster.Instance>
headerTitle={l('rc.ci.management')}
{...PROTABLE_OPTIONS_PUBLIC}
columns={columns}
actionRef={actionRef}
loading={loading}
toolBarRender={toolBarRender}
request={(params, sorter, filter: any) => queryList(API_CONSTANTS.CLUSTER_INSTANCE, {...params, sorter, filter})}
/>
{/*added*/}
<InstanceModal visible={createOpen} onClose={handleCancel} value={{}} onSubmit={handleSubmit}/>
{/*modify*/}
<InstanceModal visible={modifyOpen} onClose={handleCancel} value={formValue} onSubmit={handleSubmit}/>
</>;
};
/*
*
* 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.
*
*/
import React from 'react';
import {FormInstance} from 'antd/es/form/hooks/useForm';
import {Values} from 'async-validator';
import {Cluster} from '@/types/RegCenter/data';
import {ProForm, ProFormGroup, ProFormSelect, ProFormText, ProFormTextArea} from '@ant-design/pro-components';
import {CLUSTER_INSTANCE_TYPE} from '@/pages/RegCenter/Cluster/Instance/components/contants';
import {MODAL_FORM_OPTIONS} from '@/services/constants';
import {l} from '@/utils/intl';
import {validatorJMHAAdderess} from '@/pages/RegCenter/Cluster/Instance/components/function';
type InstanceFormProps = {
form: FormInstance<Values>
value: Partial<Cluster.Instance>;
}
const InstanceForm: React.FC<InstanceFormProps> = (props) => {
const {form, value} = props;
const renderForm = () => {
return <>
<ProFormGroup>
<ProFormText
name="name"
label={l('rc.ci.name')}
width="md"
rules={[{required: true, message: l('rc.ci.namePlaceholder')}]}
placeholder={l('rc.ci.namePlaceholder')}
/>
<ProFormText
name="alias"
label={l('rc.ci.alias')}
width="sm"
placeholder={l('rc.ci.aliasPlaceholder')}
/>
<ProFormSelect
name="type"
label={l('rc.ci.type')}
width="sm"
options={CLUSTER_INSTANCE_TYPE}
rules={[{required: true, message: l('rc.ci.typePlaceholder')}]}
placeholder={l('rc.ci.typePlaceholder')}
/>
<ProFormTextArea
name="hosts"
label={l('rc.ci.jmha')}
width="md"
tooltip={l('rc.ci.jmha.tips')}
validateTrigger={['onChange']}
rules={[{required: true, validator: (rule, hostsValue) => validatorJMHAAdderess(rule, hostsValue)}]}
placeholder={l('rc.ci.jmhaPlaceholder')}
/>
<ProFormTextArea
name="note"
label={l('global.table.note')}
width="md"
placeholder={l('global.table.notePlaceholder')}
/>
</ProFormGroup>
</>;
};
return <>
<ProForm
{...MODAL_FORM_OPTIONS}
form={form}
initialValues={value}
submitter={false}
>
{renderForm()}
</ProForm>
</>;
};
export default InstanceForm;
/*
*
* 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.
*
*/
import {Cluster} from '@/types/RegCenter/data';
import {Button, Form} from 'antd';
import {MODAL_FORM_OPTIONS, NORMAL_MODAL_OPTIONS} from '@/services/constants';
import React, {useEffect} from 'react';
import {ModalForm} from '@ant-design/pro-components';
import {l} from '@/utils/intl';
import {FormContextValue} from '@/components/Context/FormContext';
import InstanceForm from './InstanceForm';
type InstanceModalProps = {
visible: boolean;
onClose: () => void;
value: Partial<Cluster.Instance>;
onSubmit: (values: Partial<Cluster.Instance>) => void;
}
const InstanceModal: React.FC<InstanceModalProps> = (props) => {
const {visible, onClose, onSubmit, value} = props;
/**
* init form
*/
const [form] = Form.useForm();
/**
* init form context
*/
const formContext = React.useMemo<FormContextValue>(() => ({
resetForm: () => form.resetFields(), // 定义 resetForm 方法
}), [form]);
const [submitting, setSubmitting] = React.useState<boolean>(false);
/**
* when modalVisible or values changed, set form values
*/
useEffect(() => {
form.setFieldsValue(value);
}, [visible, value, form]);
/**
* handle cancel
*/
const handleCancel = () => {
onClose();
setSubmitting(false);
formContext.resetForm();
};
/**
* submit form
*/
const submitForm = async () => {
const fieldsValue = await form.validateFields();
setSubmitting(true);
await onSubmit({...value, ...fieldsValue});
handleCancel();
};
/**
* render footer
* @returns {[JSX.Element, JSX.Element]}
*/
const renderFooter = () => {
return [
<Button key={'cancel'} onClick={() => handleCancel()}>{l('button.cancel')}</Button>,
<Button key={'finish'} loading={submitting} type="primary"
onClick={() => submitForm()}>{l('button.finish')}</Button>,
];
};
return <>
<ModalForm
{...MODAL_FORM_OPTIONS}
open={visible}
modalProps={{onCancel: handleCancel}}
title={value.id ? l('rc.ci.modify') : l('rc.ci.create')}
submitter={{render: () => [...renderFooter()]}}
initialValues={value}
>
<InstanceForm form={form} value={value}/>
</ModalForm>
</>;
};
export default InstanceModal;
/*
* 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.
*/
import {RUN_MODE} from "@/services/constants";
import {Tag} from 'antd';
import {l} from '@/utils/intl';
import React from 'react';
/**
* Cluster instance type
*/
export const CLUSTER_INSTANCE_TYPE = [
{value: RUN_MODE.STANDALONE, label: 'Standalone'},
{value: RUN_MODE.YARN_SESSION, label: 'Yarn Session'},
{value: RUN_MODE.KUBERNETES_SESSION, label: 'Kubernetes Session'},
]
/**
* Cluster instance is auto registers
*/
export const CLUSTER_INSTANCE_AUTO_REGISTERS_ENUM = {
true: {text: <Tag color={'success'}>{l('global.yes')}</Tag>, status: 'Success'},
false: {text: <Tag color={'error'}>{l('global.no')}</Tag>, status: 'Error'},
}
/**
* Cluster instance status enum
*/
export const CLUSTER_INSTANCE_STATUS_ENUM = {
1: {text: <Tag color={'success'}>{l('global.table.status.normal')}</Tag>, status: 'Success'},
0: {text: <Tag color={'error'}>{l('global.table.status.abnormal')}</Tag>, status: 'Error'},
}
/*
*
* 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.
*
*/
import {l} from "@/utils/intl";
import {RuleObject} from "rc-field-form/es/interface";
import {Cluster} from "@/types/RegCenter/data";
import {RUN_MODE} from "@/services/constants";
import {Button} from "antd";
import {WebIcon} from "@/components/Icons/CustomIcons";
import React from "react";
/**
* validatorJMHAAdderess
* @param rule
* @param value
*/
export const validatorJMHAAdderess = (rule: RuleObject, value = '') => {
let hostArray = [];
if (value.trim().length === 0) {
return Promise.reject(new Error(l('rc.ci.jmhaPlaceholder')));
} else {
hostArray = value.split(',')
for (let i = 0; i < hostArray.length; i++) {
if (hostArray[i].includes('/')) {
return Promise.reject(new Error(l('rc.ci.jmha.validate.slash')));
}
if (parseInt(hostArray[i].split(':')[1]) >= 65535) {
return Promise.reject(new Error(l('rc.ci.jmha.validate.port')));
}
}
return Promise.resolve();
}
}
/**
* render WebUi icon button
* @param record
*/
export const renderWebUiRedirect = (record: Cluster.Instance) => {
if (record.status && (record.type === RUN_MODE.YARN_SESSION || record.type === RUN_MODE.STANDALONE || record.type === RUN_MODE.YARN_APPLICATION || record.type === RUN_MODE.YARN_PER_JOB)) {
return <>
<Button
icon={<WebIcon/>}
key={`${record.id}_webui`}
type="link"
title={`http://${record.jobManagerHost}/#/overview`}
href={`http://${record.jobManagerHost}/#/overview`}
target="_blank"
/>
</>
}
return undefined
}
/*
*
* 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.
*
*/
import React from "react";
import {PageContainer} from "@ant-design/pro-components";
import InstanceList from "@/pages/RegCenter/Cluster/Instance/components/InstanceList";
export default () => {
return <PageContainer title={false}>
<InstanceList/>
</PageContainer>
}
\ No newline at end of file
...@@ -79,6 +79,15 @@ export const API_CONSTANTS = { ...@@ -79,6 +79,15 @@ export const API_CONSTANTS = {
// --- registries center --- // --- registries center ---
// ----cluster instance
// cluster instance list
CLUSTER_INSTANCE: "/api/cluster",
CLUSTER_INSTANCE_ENABLE: "/api/cluster/enable",
CLUSTER_INSTANCE_DELETE: "/api/cluster/delete",
CLUSTER_INSTANCE_HEARTBEATS: "/api/cluster/heartbeats",
CLUSTER_INSTANCE_RECYCLE: "/api/cluster/recycle",
// datasource registries list // datasource registries list
DATASOURCE: "/api/database", DATASOURCE: "/api/database",
// datasource registries delete // datasource registries delete
...@@ -354,3 +363,15 @@ export const DIALECT = { ...@@ -354,3 +363,15 @@ export const DIALECT = {
SQL: "sql", SQL: "sql",
JAVASCRIPT: "javascript", JAVASCRIPT: "javascript",
}; };
export const RUN_MODE = {
LOCAL: 'local',
STANDALONE: 'standalone',
YARN_SESSION: 'yarn-session',
YARN_PER_JOB: 'yarn-per-job',
YARN_APPLICATION: 'yarn-application',
KUBERNETES_SESSION: 'kubernetes-session',
KUBERNETES_APPLICATION: 'kubernetes-application',
KUBERNETES_APPLICATION_OPERATOR: 'kubernetes-application-operator',
};
...@@ -34,9 +34,9 @@ import { ...@@ -34,9 +34,9 @@ import {
handleAddOrUpdate, handleAddOrUpdate,
handleOption, handleOption,
handleRemove, handleRemove,
queryData, queryData, removeData,
updateEnabled updateEnabled
} from "@/components/Common/crud"; } from '@/components/Common/crud';
import {showCluster, showSessionCluster} from "@/components/Studio/StudioEvent/DDL"; import {showCluster, showSessionCluster} from "@/components/Studio/StudioEvent/DDL";
import {RUN_MODE} from "@/components/Studio/conf"; import {RUN_MODE} from "@/components/Studio/conf";
import ClusterForm from "@/pages/RegistrationCenter/ClusterManage/Cluster/components/ClusterForm"; import ClusterForm from "@/pages/RegistrationCenter/ClusterManage/Cluster/components/ClusterForm";
...@@ -98,7 +98,7 @@ const ClusterTableList: React.FC<{}> = (props: any) => { ...@@ -98,7 +98,7 @@ const ClusterTableList: React.FC<{}> = (props: any) => {
okText: l('button.confirm'), okText: l('button.confirm'),
cancelText: l('button.cancel'), cancelText: l('button.cancel'),
onOk: async () => { onOk: async () => {
const {datas} = await getData(url + '/clear', l('pages.rc.cluster.recycle'), null); const {datas} = await removeData(url + '/recycle', [0]);
message.success(l('pages.rc.cluster.recycle.success', '', {total: datas})); message.success(l('pages.rc.cluster.recycle.success', '', {total: datas}));
actionRef.current?.reloadAndRest?.(); actionRef.current?.reloadAndRest?.();
} }
...@@ -474,8 +474,7 @@ const ClusterTableList: React.FC<{}> = (props: any) => { ...@@ -474,8 +474,7 @@ const ClusterTableList: React.FC<{}> = (props: any) => {
onCancel={() => handleModalVisible(false)} onCancel={() => handleModalVisible(false)}
modalVisible={modalVisible} modalVisible={modalVisible}
values={{}} values={{}}
> />
</ClusterForm>
{formValues && Object.keys(formValues).length ? ( {formValues && Object.keys(formValues).length ? (
<ClusterForm <ClusterForm
onSubmit={async (value) => { onSubmit={async (value) => {
......
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