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

[Refactor][web] Refactor cluster config (#2084)

* refactor-cluster-config
parent ac56063c
...@@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -36,6 +36,7 @@ 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.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
...@@ -77,6 +78,7 @@ public class ClusterConfigurationController { ...@@ -77,6 +78,7 @@ public class ClusterConfigurationController {
/** 批量删除 */ /** 批量删除 */
@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<Integer> error = new ArrayList<>(); List<Integer> error = new ArrayList<>();
...@@ -98,6 +100,7 @@ public class ClusterConfigurationController { ...@@ -98,6 +100,7 @@ public class ClusterConfigurationController {
/** 获取指定ID的信息 */ /** 获取指定ID的信息 */
@PostMapping("/getOneById") @PostMapping("/getOneById")
@Deprecated
public Result<ClusterConfiguration> getOneById( public Result<ClusterConfiguration> getOneById(
@RequestBody ClusterConfiguration clusterConfiguration) { @RequestBody ClusterConfiguration clusterConfiguration) {
clusterConfiguration = clusterConfigurationService.getById(clusterConfiguration.getId()); clusterConfiguration = clusterConfigurationService.getById(clusterConfiguration.getId());
...@@ -111,7 +114,43 @@ public class ClusterConfigurationController { ...@@ -111,7 +114,43 @@ public class ClusterConfigurationController {
return Result.succeed(clusters); return Result.succeed(clusters);
} }
/** 测试 */ /**
* delete by id
*
* @param id {@link Integer}
* @return {@link Result}<{@link Void}>
*/
@DeleteMapping("/delete")
public Result<Void> deleteById(@RequestParam("id") Integer id) {
boolean removeById = clusterConfigurationService.removeById(id);
if (removeById) {
return Result.succeed(Status.DELETE_SUCCESS);
} else {
return Result.failed(Status.DELETE_FAILED);
}
}
/**
* enable by id
*
* @param id {@link Integer}
* @return {@link Result}<{@link Void}>
*/
@PutMapping("/enable")
public Result<Void> enable(@RequestParam("id") Integer id) {
if (clusterConfigurationService.enable(id)) {
return Result.succeed(Status.MODIFY_SUCCESS);
} else {
return Result.failed(Status.MODIFY_FAILED);
}
}
/**
* test connection
*
* @param clusterConfiguration {@link ClusterConfiguration}
* @return {@link Result}<{@link Void}>
*/
@PostMapping("/testConnect") @PostMapping("/testConnect")
public Result<Void> testConnect(@RequestBody ClusterConfiguration clusterConfiguration) { public Result<Void> testConnect(@RequestBody ClusterConfiguration clusterConfiguration) {
TestResult testResult = clusterConfigurationService.testGateway(clusterConfiguration); TestResult testResult = clusterConfigurationService.testGateway(clusterConfiguration);
......
...@@ -242,8 +242,15 @@ public class ClusterInstanceController { ...@@ -242,8 +242,15 @@ public class ClusterInstanceController {
* @return {@link Result}<{@link Cluster}> * @return {@link Result}<{@link Cluster}>
*/ */
@GetMapping("/deploySessionCluster") @GetMapping("/deploySessionCluster")
@Deprecated
public Result<Cluster> deploySessionCluster(@RequestParam("id") Integer id) { public Result<Cluster> deploySessionCluster(@RequestParam("id") Integer id) {
return Result.succeed( return Result.succeed(
clusterInstanceService.deploySessionCluster(id), Status.CLUSTER_INSTANCE_DEPLOY); clusterInstanceService.deploySessionCluster(id), Status.CLUSTER_INSTANCE_DEPLOY);
} }
@PutMapping("/deploySessionClusterInstance")
public Result<Cluster> deploySessionClusterInstance(@RequestParam("id") Integer id) {
return Result.succeed(
clusterInstanceService.deploySessionCluster(id), Status.CLUSTER_INSTANCE_DEPLOY);
}
} }
...@@ -40,4 +40,6 @@ public interface ClusterConfigurationService extends ISuperService<ClusterConfig ...@@ -40,4 +40,6 @@ public interface ClusterConfigurationService extends ISuperService<ClusterConfig
Map<String, Object> getGatewayConfig(Integer id); Map<String, Object> getGatewayConfig(Integer id);
TestResult testGateway(ClusterConfiguration clusterConfiguration); TestResult testGateway(ClusterConfiguration clusterConfiguration);
Boolean enable(Integer id);
} }
...@@ -141,4 +141,18 @@ public class ClusterConfigurationServiceImpl ...@@ -141,4 +141,18 @@ public class ClusterConfigurationServiceImpl
return JobManager.testGateway(gatewayConfig); return JobManager.testGateway(gatewayConfig);
} }
/**
* @param id
* @return
*/
@Override
public Boolean enable(Integer id) {
ClusterConfiguration clusterConfiguration = this.getById(id);
if (clusterConfiguration != null) {
clusterConfiguration.setEnabled(!clusterConfiguration.getEnabled());
return this.updateById(clusterConfiguration);
}
return false;
}
} }
...@@ -21,6 +21,13 @@ ...@@ -21,6 +21,13 @@
</properties> </properties>
<dependencies> <dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.flink/flink-shaded-hadoop-3-uber -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-shaded-hadoop-3-uber</artifactId>
<version>3.1.1.7.2.9.0-173-9.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.flink</groupId> <groupId>org.apache.flink</groupId>
<artifactId>flink-python</artifactId> <artifactId>flink-python</artifactId>
...@@ -133,4 +140,12 @@ ...@@ -133,4 +140,12 @@
<version>1.3.0</version> <version>1.3.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
<repositories>
<repository>
<id>cloudera</id>
<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
</repository>
</repositories>
</project> </project>
...@@ -99,7 +99,7 @@ export default [ ...@@ -99,7 +99,7 @@ export default [
{ {
path: '/registration/cluster/config', path: '/registration/cluster/config',
name: 'cluster-config', name: 'cluster-config',
// component: './RegistrationCenter/ClusterManage/ClusterConfiguration', component: './RegCenter/Cluster/Configuration',
}, },
], ],
}, },
......
/*
* 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 {Button} from "antd";
import {PlusOutlined} from "@ant-design/icons";
import React from "react";
import {ShowLogIcon, StartIcon, StopIcon} from "@/components/Icons/CustomIcons";
type RunningBtnProps = {
onClick: () => void;
isRunning?: boolean;
title?: string;
};
export const RunningBtn: React.FC<RunningBtnProps> = (props) => {
const {onClick, isRunning = false, title = l("button.start")} = props;
return (
<Button
className={"options-button"}
title={title}
icon={isRunning ? <StopIcon/> : <StartIcon/>}
onClick={() => onClick()}
/>
);
};
...@@ -120,3 +120,37 @@ export const BackIcon = (props: any) => { ...@@ -120,3 +120,37 @@ export const BackIcon = (props: any) => {
</>; </>;
}; };
export const StartIcon = (props: any) => {
return <>
<Icon {...props} style={{...IconStyle}} component={() => (
<svg className="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" >
<path
d="M512 962C263.4 962 62 760.5 62 512 62 263.4 263.5 62 512 62s450 201.4 450 450c0 78.6-20.3 152.5-55.8 216.8l-0.2-0.2c-5.2 16.7-20.1 29.1-38.5 29.1-22.6 0-40.9-18.3-40.9-41l0.3-3.7c9.2-26.2 18.9-44.5 18.9-44.5 22.5-47.7 35.5-100.9 35.5-157.1 0-203.7-165.1-368.8-368.8-368.8-203.7 0-368.8 165.1-368.8 368.8 0 203.7 165.1 368.8 368.8 368.8 81.3 0 156.2-26.7 217.1-71.3 7.4-7.8 17.8-12.9 29.5-12.9 22.6 0 40.9 18.3 40.9 40.9l-0.4 3.8c0 19.1-11.9 21.2-31.3 38.9C695.6 930.7 607.7 962 512 962z"
fill="#2E9DFB" ></path>
<path
d="M445.5 694.7c-9 6.6-21.1 6.9-30.5 0.9-9.9-6.8-15.7-18.1-15.5-30.1V321.4c0-12.5 5.9-24.1 15.5-30.1 9.4-6 21.5-5.7 30.5 0.9l239.9 172c8.7 6.4 14.1 17.4 14.1 29.2s-5.3 22.9-14.1 29.1L445.5 694.7z"
fill="#FF9000"></path>
</svg>
)}/>
</>;
};
export const StopIcon = (props: any) => {
return <>
<Icon {...props} style={{...IconStyle}} component={() => (
<svg className="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
>
<path
d="M710.6 277.1H318.7v-157L0.1 355.5l318.6 235.4v-157h391.9c86.6 0 156.7 70.2 156.7 156.8 0 86.6-70.2 156.8-156.7 156.8h-78.4v156.8h78.4c173.1 0 313.5-140.4 313.5-313.5S883.8 277.1 710.6 277.1z"
fill="#2C66E1"></path>
<path d="M240.4 747.4h78.4v156.8h-78.4z" fill="#8FB3FF"></path>
<path d="M397.1 747.4h156.8v156.8H397.1z" fill="#2C66E1"></path>
</svg>
)}/>
</>;
};
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import styled from "styled-components"; import styled from "styled-components";
export const DataSourceAction = styled.div` export const DataAction = styled.div`
display: flex !important; display: flex !important;
justify-content: space-between; justify-content: space-between;
margin-left: 2vw; margin-left: 2vw;
......
...@@ -192,6 +192,89 @@ export default { ...@@ -192,6 +192,89 @@ export default {
'rc.ci.namePlaceholder': 'Please enter a name!', 'rc.ci.namePlaceholder': 'Please enter a name!',
'rc.ci.aliasPlaceholder': 'Please enter an alias!', 'rc.ci.aliasPlaceholder': 'Please enter an alias!',
// configuration
'rc.cc.management': 'Cluster Config Management',
'rc.cc.name': 'Cluster Config Name',
'rc.cc.namePlaceholder': 'Please enter the cluster configuration name!',
'rc.cc.type': 'Type',
'rc.cc.typePlaceholder': 'Please select the cluster configuration type!',
'rc.cc.create': 'Create Cluster Config',
'rc.cc.modify': 'Modify Cluster Config',
'rc.cc.delete': 'Delete Cluster Config',
'rc.cc.deleteConfirm': 'Are you sure to delete this cluster configuration? ',
'rc.cc.start': 'Start Session Cluster',
'rc.cc.baseConfig': 'Basic Config',
'rc.cc.hadoopConfig': 'Hadoop Config',
'rc.cc.hadoop.defineConfig': 'Hadoop Custom Config (high priority))',
'rc.cc.hadoopConfigPath': 'Hadoop Config file path',
'rc.cc.hadoopConfigPathPlaceholder': 'Please enter the hadoop configuration file path, such as /etc/hadoop/conf! ',
'rc.cc.hadoopConfigPathHelp': 'Specify the configuration file path (without / at the end), the following files need to be included: core-site.xml, hdfs-site.xml, yarn-site.xml! ',
'rc.cc.libPath': 'Flink Lib Path',
'rc.cc.libPathPlaceholder': 'Please enter the hdfs path of lib! Values such as hdfs:///flink/lib',
'rc.cc.libPathHelp': 'Specify the hdfs path of lib (without / at the end), which needs to include the dependencies of Flink runtime',
'rc.cc.flinkConfig': 'Flink Config',
'rc.cc.flink.defineConfig': 'Flink Custom Config (high priority))',
'rc.cc.flinkConfigPath': 'Flink Config File Path',
'rc.cc.flinkConfigPathPlaceholder': 'Please enter the flink-conf.yaml path! Values such as /opt/module/flink/conf ',
'rc.cc.flinkConfigPathHelp': 'Please enter flink-conf.yaml path! Values such as /opt/module/flink/conf ',
'rc.cc.addConfig': 'Add Config item',
'rc.cc.deleteConfig': 'Delete configuration item',
'rc.cc.key': 'Config Key',
'rc.cc.value': 'Config Value',
'rc.cc.submitSqlConfig': 'Submit FlinkSQL Config items (required in Application mode)',
'rc.cc.sqlSubmitJarPath': 'Jar File Path',
'rc.cc.sqlSubmitJarPathHelp': 'Please enter the Jar file path! eg: hdfs:///dlink/jar/dlink-app.jar',
'rc.cc.defineConfig': 'Flink Default Config (high priority)',
'rc.cc.jmMem': 'JobManager Memory',
'rc.cc.jmMemHelp': 'Please enter the JobManager memory size! This parameter configuration item is: jobmanager.memory.process.size eg: 1024MB',
'rc.cc.tmMem': 'TaskManager Memory',
'rc.cc.tmMemHelp': 'Please enter the TaskManager memory size! This parameter configuration item is: taskmanager.memory.process.size eg: 1024MB',
'rc.cc.tmHeap': 'TaskManager Heap Memory',
'rc.cc.tmHeapHelp': 'Please enter the TaskManager heap memory size! This parameter configuration item is: taskmanager.memory.framework.heap.size eg: 1024MB',
'rc.cc.tsNum': 'Number of Slots',
'rc.cc.tsNumHelp': 'Please enter the number of TaskSlot! eg: 1',
'rc.cc.spDir': 'SavePoint Path',
'rc.cc.spDirHelp': 'Please enter the savepoint path! This parameter configuration item is: tate.savepoints.dir eg: hdfs:///dinky/sp',
'rc.cc.ckpDir': 'CheckPoint Path',
'rc.cc.ckpDirHelp': 'Please enter the checkpoint path! This parameter configuration item is: state.checkpoints.dir eg: hdfs:///dinky/ckp',
'rc.cc.dockerConfig': 'Docker Config',
'rc.cc.docker.dinky.addr': 'Dinky Remote Address',
'rc.cc.docker.dinky.addrHelp': 'Dinky remote address! eg: 127.0.0.1:8888',
'rc.cc.docker.instance': 'Docker Instance',
'rc.cc.docker.instanceHelp': 'Docker instance! eg: local: unix:///var/run/docker.sock or remote: tcp://remoteIp:2375',
'rc.cc.docker.url': 'DockerHub Container Address',
'rc.cc.docker.urlHelp': 'DockerHub container address! eg: (Aliyun, docker.io, harbor) registry.cn-hangzhou.aliyuncs.com/dlink/dlink:1.0.0',
'rc.cc.docker.username': 'DockerHub Username',
'rc.cc.docker.usernameHelp': 'DockerHub username! eg: dinky',
'rc.cc.docker.password': 'DockerHub Password',
'rc.cc.docker.passwordHelp': 'DockerHub password! eg: dinky',
'rc.cc.docker.tag': 'Docker Tag Version',
'rc.cc.docker.tagHelp': 'Docker Tag version! eg: 1.0.0',
'rc.cc.docker.file': 'Docker Image File',
'rc.cc.docker.fileHelp': 'Docker image file! eg: /opt/module/dinky/docker/Dockerfile',
'rc.cc.k8sConfig': 'Kubernetes Config',
'rc.cc.k8s.preConfig': 'Kubernetes preset configuration',
'rc.cc.k8s.defineConfig': 'Kubernetes default configuration',
'rc.cc.k8s.namespace': 'Kubernetes Namespace',
'rc.cc.k8s.namespaceHelp': 'Kubernetes namespace! eg: default',
'rc.cc.k8s.image': 'Flink Image Address',
'rc.cc.k8s.imageHelp': 'Flink image address! eg: registry.cn-hangzhou.aliyuncs.com/flink/flink:1.17.0',
'rc.cc.k8s.exposed': 'Exposed Port Type',
'rc.cc.k8s.exposedHelp': 'Exposed port type! eg: NodePort',
'rc.cc.k8s.jmCpu': 'JobManager CPU Config',
'rc.cc.k8s.jmCpuHelp': 'JobManager CPU configuration! eg: 10',
'rc.cc.k8s.tmCpu': 'TaskManager CPU Config',
'rc.cc.k8s.tmCpuHelp': 'TaskManager CPU configuration! eg: 10',
'rc.cc.k8s.configFile': 'Kube File Path',
'rc.cc.k8s.configFileHelp': 'Default ~/.kube/config, fill in the kube file path, which can be used as a remote connection! eg: /opt/module/kube/config',
'rc.cc.k8s.account': 'K8s Submit Account',
'rc.cc.k8s.accountHelp': 'The account submitted by K8s, default default! eg: default',
'rc.cc.k8s.podTemplate': 'K8s Pod Template',
'rc.cc.k8s.podTemplateHelp': 'K8s Pod template! Fill in your own pod template!',
'rc.cc.k8sOp.version': 'Flink Version',
'rc.cc.k8sOp.versionHelp': 'Please select the Flink version!',
'rc.cc.k8sOp.unSupportBatch': ' (UnSupport Batch)',
// datasource // datasource
'rc.ds.management': 'DataSource Management', 'rc.ds.management': 'DataSource Management',
......
...@@ -188,6 +188,92 @@ export default { ...@@ -188,6 +188,92 @@ export default {
'rc.ci.namePlaceholder': '请输入名称!', 'rc.ci.namePlaceholder': '请输入名称!',
'rc.ci.aliasPlaceholder': '请输入别名!', 'rc.ci.aliasPlaceholder': '请输入别名!',
// configration
'rc.cc.management': '集群配置管理',
'rc.cc.name': '集群配置名称',
'rc.cc.namePlaceholder': '请输入集群配置名称!',
'rc.cc.type': '类型',
'rc.cc.typePlaceholder': '请选择集群配置类型!',
'rc.cc.create': '创建集群配置',
'rc.cc.modify': '修改集群配置',
'rc.cc.delete': '删除集群配置',
'rc.cc.deleteConfirm': '确定删除该集群配置吗?',
'rc.cc.start': '启动 Session 集群',
'rc.cc.baseConfig': '基本配置',
'rc.cc.hadoopConfig': 'Hadoop 配置',
'rc.cc.hadoop.defineConfig': 'Hadoop 自定义配置(高优先级))',
'rc.cc.hadoopConfigPath': 'Hadoop 配置文件路径',
'rc.cc.hadoopConfigPathPlaceholder': '请输入 hadoop 配置文件路径 ,值如 /etc/hadoop/conf!',
'rc.cc.hadoopConfigPathHelp': '指定配置文件路径(末尾无/),需要包含以下文件:core-site.xml,hdfs-site.xml,yarn-site.xml !',
'rc.cc.libPath': 'Flink Lib 路径',
'rc.cc.libPathPlaceholder': '请输入 lib 的 hdfs 路径!值如 hdfs:///flink/lib',
'rc.cc.libPathHelp': '指定 lib 的 hdfs 路径(末尾无/),需要包含 Flink 运行时的依赖',
'rc.cc.flinkConfig': 'Flink 配置',
'rc.cc.flink.defineConfig': 'Flink 自定义配置(高优先级))',
'rc.cc.flinkConfigPath': 'Flink 配置文件路径',
'rc.cc.flinkConfigPathPlaceholder': '请输入 flink-conf.yaml 路径!值如 /opt/module/flink/conf ',
'rc.cc.flinkConfigPathHelp': '请输入 flink-conf.yaml 路径!值如 /opt/module/flink/conf ',
'rc.cc.addConfig': '添加配置项',
'rc.cc.deleteConfig': '删除配置项',
'rc.cc.key': '配置项',
'rc.cc.value': '配置值',
'rc.cc.submitSqlConfig': '提交 FlinkSQL 配置项 (Application 模式必填)',
'rc.cc.sqlSubmitJarPath': 'Jar 文件路径',
'rc.cc.sqlSubmitJarPathHelp': '请输入 Jar 文件路径! eg: hdfs:///dlink/jar/dlink-app.jar',
'rc.cc.defineConfig': 'Flink 预设配置(高优先级)',
'rc.cc.jmMem': 'JobManager 内存',
'rc.cc.jmMemHelp': '请输入 JobManager 内存大小! 此参数配置项为: jobmanager.memory.process.size eg: 1024MB',
'rc.cc.tmMem': 'TaskManager 内存',
'rc.cc.tmMemHelp': '请输入 TaskManager 内存大小! 此参数配置项为: taskmanager.memory.process.size eg: 1024MB',
'rc.cc.tmHeap': 'TaskManager 堆内存',
'rc.cc.tmHeapHelp': '请输入 TaskManager 堆内存大小! 此参数配置项为: taskmanager.memory.framework.heap.size eg: 1024MB',
'rc.cc.tsNum': '插槽数',
'rc.cc.tsNumHelp': '请输入 TaskSet 数量! eg: 1',
'rc.cc.spDir': '保存点路径',
'rc.cc.spDirHelp': '请输入保存点路径! 此参数配置项为: tate.savepoints.dir eg: hdfs:///dinky/sp',
'rc.cc.ckpDir': '检查点路径',
'rc.cc.ckpDirHelp': '请输入检查点路径! 此参数配置项为: state.checkpoints.dir eg: hdfs:///dinky/ckp',
'rc.cc.dockerConfig': 'Docker 配置',
'rc.cc.docker.dinky.addr': 'Dinky 远程地址',
'rc.cc.docker.dinky.addrHelp': 'Dinky 远程地址! eg: 127.0.0.1:8888',
'rc.cc.docker.instance': 'Docker 实例',
'rc.cc.docker.instanceHelp': 'Docker 实例! eg: 本地:unix:///var/run/docker.sock 或者 远程:tcp://remoteIp:2375',
'rc.cc.docker.url': 'DockerHub 容器地址',
'rc.cc.docker.urlHelp': 'DockerHub 容器地址! eg: (阿里云,docker.io,harbor) registry.cn-hangzhou.aliyuncs.com/dlink/dlink:1.0.0',
'rc.cc.docker.username': 'DockerHub 用户名',
'rc.cc.docker.usernameHelp': 'DockerHub 用户名! eg: dinky',
'rc.cc.docker.password': 'DockerHub 密码',
'rc.cc.docker.passwordHelp': 'DockerHub 密码! eg: dinky',
'rc.cc.docker.tag': 'Docker Tag版本',
'rc.cc.docker.tagHelp': 'Docker Tag版本! eg: 1.0.0',
'rc.cc.docker.file': 'Docker 镜像文件',
'rc.cc.docker.fileHelp': 'Docker 镜像文件! eg: /opt/module/dinky/docker/Dockerfile',
'rc.cc.k8sConfig': 'Kubernetes 配置',
'rc.cc.k8s.preConfig': 'Kubernetes 预设配置',
'rc.cc.k8s.defineConfig': 'Kubernetes 预设配置',
'rc.cc.k8s.namespace': 'Kubernetes 命名空间',
'rc.cc.k8s.namespaceHelp': 'Kubernetes 命名空间! eg: default',
'rc.cc.k8s.image': 'Flink 镜像地址',
'rc.cc.k8s.imageHelp': 'Flink 镜像地址! eg: registry.cn-hangzhou.aliyuncs.com/flink/flink:1.17.0',
'rc.cc.k8s.exposed': '暴露端口类型',
'rc.cc.k8s.exposedHelp': '暴露端口类型! eg: NodePort',
'rc.cc.k8s.jmCpu': 'JobManager CPU 配置',
'rc.cc.k8s.jmCpuHelp': 'JobManager CPU 配置! eg: 10',
'rc.cc.k8s.tmCpu': 'TaskManager CPU 配置',
'rc.cc.k8s.tmCpuHelp': 'TaskManager CPU 配置! eg: 10',
'rc.cc.k8s.configFile': 'Kube 文件路径',
'rc.cc.k8s.configFileHelp': '默认~/.kube/config, 填写kube文件路径,可用作远程连接! eg: /opt/module/kube/config',
'rc.cc.k8s.account': 'K8s 提交账号',
'rc.cc.k8s.accountHelp': 'K8s 提交使用的账号,默认 default! eg: default',
'rc.cc.k8s.podTemplate': 'K8s Pod 模板',
'rc.cc.k8s.podTemplateHelp': 'K8s Pod 模板! 自行填写你的pod模板!',
'rc.cc.k8sOp.version': 'Flink 版本',
'rc.cc.k8sOp.versionHelp': '请选择Flink 版本!',
'rc.cc.k8sOp.unSupportBatch': '(不支持批任务)',
// =============== data source ======================= // =============== data source =======================
// datasource list page // datasource list page
......
...@@ -6,7 +6,7 @@ import {Jobs} from '@/types/DevOps/data'; ...@@ -6,7 +6,7 @@ import {Jobs} from '@/types/DevOps/data';
import JobHistoryList from '@/pages/DevOps/JobList/components/JobHistoryList'; import JobHistoryList from '@/pages/DevOps/JobList/components/JobHistoryList';
import {l} from '@/utils/intl'; import {l} from '@/utils/intl';
import {parseSecondStr} from '@/utils/function'; import {parseSecondStr} from '@/utils/function';
import {API_CONSTANTS} from '@/services/constants'; import {API_CONSTANTS, PROTABLE_OPTIONS_PUBLIC} from '@/services/constants';
import {queryList} from '@/services/api'; import {queryList} from '@/services/api';
import {ClockCircleTwoTone, EyeTwoTone} from '@ant-design/icons'; import {ClockCircleTwoTone, EyeTwoTone} from '@ant-design/icons';
import {JOB_STATUS_FILTER, LIFECYCLE_FILTER, TagJobLifeCycle, TagJobStatus} from '@/pages/DevOps/JobList/function'; import {JOB_STATUS_FILTER, LIFECYCLE_FILTER, TagJobLifeCycle, TagJobStatus} from '@/pages/DevOps/JobList/function';
...@@ -39,6 +39,7 @@ const JobList = () => { ...@@ -39,6 +39,7 @@ const JobList = () => {
{ {
title: l('global.table.jobid'), title: l('global.table.jobid'),
dataIndex: 'jid', dataIndex: 'jid',
width: '15%',
}, },
{ {
title: l('global.table.createTime'), title: l('global.table.createTime'),
...@@ -79,6 +80,7 @@ const JobList = () => { ...@@ -79,6 +80,7 @@ const JobList = () => {
return ( return (
<ProTable<Jobs.JobInstance> <ProTable<Jobs.JobInstance>
{...PROTABLE_OPTIONS_PUBLIC}
rowKey={(record => record.jid)} rowKey={(record => record.jid)}
columns={jobListColumns} columns={jobListColumns}
params={{isHistory: false}} params={{isHistory: false}}
......
/*
*
* 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, ProList} from '@ant-design/pro-components';
import {API_CONSTANTS, PRO_LIST_CARD_OPTIONS, PROTABLE_OPTIONS_PUBLIC,} from '@/services/constants';
import {Cluster} from '@/types/RegCenter/data';
import {l} from '@/utils/intl';
import {queryList} from '@/services/api';
import {CreateBtn} from '@/components/CallBackButton/CreateBtn';
import React, {useEffect, useRef, useState} from 'react';
import {
handleAddOrUpdate,
handleOption,
handlePutDataByParams,
handleRemoveById,
updateEnabled
} from '@/services/BusinessCrud';
import {EditBtn} from '@/components/CallBackButton/EditBtn';
import {EnableSwitchBtn} from '@/components/CallBackButton/EnableSwitchBtn';
import ConfigurationModal from "@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal";
import {DataAction} from "@/components/StyledComponents";
import {Button, Descriptions, Modal, Space, Tag, Tooltip} from "antd";
import DescriptionsItem from "antd/es/descriptions/Item";
import {NormalDeleteBtn} from "@/components/CallBackButton/NormalDeleteBtn";
import {CheckCircleOutlined, ExclamationCircleOutlined, HeartTwoTone} from "@ant-design/icons";
import {ClusterConfigIcon} from "@/components/Icons/HomeIcon";
import {imgStyle} from "@/pages/Home/constants";
import {RunningBtn} from "@/components/CallBackButton/RunningBtn";
import {CLUSTER_CONFIG_TYPE} from "@/pages/RegCenter/Cluster/Configuration/components/contants";
export default () => {
/**
* state
*/
const actionRef = useRef<ActionType>();
const [loading, setLoading] = useState<boolean>(false);
const [createOpen, setCreateOpen] = useState<boolean>(false);
const [modifyOpen, setModifyOpen] = useState<boolean>(false);
const [formValue, setFormValue] = useState<Partial<Cluster.Config>>({});
const [data, setData] = useState<Cluster.Config[]>([]);
/**
* execute query list
* set list
*/
const queryDataList = async () => {
await queryList(API_CONSTANTS.CLUSTER_CONFIGURATION).then(res => setData(res.data));
};
/**
* query list
*/
useEffect(() => {
queryDataList();
}, []);
/**
* execute and callback function
* @param {() => void} callback
* @returns {Promise<void>}
*/
const executeAndCallbackRefresh = async (callback: () => void) => {
setLoading(true);
await callback();
await queryDataList();
setLoading(false);
actionRef.current?.reload?.();
};
/**
* handle delete
* @param id
*/
const handleDeleteSubmit = async (id: number) => {
Modal.confirm({
title: l('rc.cc.delete'),
content: l('rc.cc.deleteConfirm'),
okText: l('button.confirm'),
cancelText: l('button.cancel'),
onOk: async () => {
await executeAndCallbackRefresh(async () => {
await handleRemoveById(API_CONSTANTS.CLUSTER_CONFIGURATION_DELETE, id);
});
}
});
};
/**
* handle enable
* @param item
*/
const handleEnable = async (item: Cluster.Config) => {
await executeAndCallbackRefresh(async () => {
await updateEnabled(API_CONSTANTS.CLUSTER_CONFIGURATION_ENABLE, {id: item.id});
});
};
/**
* START CLUSTER
* @param item
*/
const handleStartCluster = async (item: Cluster.Config) => {
await executeAndCallbackRefresh(async () => {
await handlePutDataByParams(API_CONSTANTS.CLUSTER_CONFIGURATION_START, l('rc.cc.start'), {id: item.id});
});
};
/**
* cancel
*/
const handleCancel = async () => {
setCreateOpen(false);
setModifyOpen(false);
setFormValue({});
};
/**
* submit add or update
* @param value
*/
const handleSubmit = async (value: Partial<Cluster.Config>) => {
await executeAndCallbackRefresh(async () => {
console.log(value, 'value');
await handleAddOrUpdate(API_CONSTANTS.CLUSTER_CONFIGURATION, value);
await handleCancel();
});
};
/**
* render sub title
* @param item
*/
const renderDataSubTitle = (item: Cluster.Config) => {
return (
<Descriptions size={'small'} layout={'vertical'} column={1}>
<DescriptionsItem
className={'hidden-overflow'}
key={item.id}>
<Tooltip key={item.name} title={item.name}>{item.name}</Tooltip>
</DescriptionsItem>
</Descriptions>
);
};
/**
* edit click callback
* @param item
*/
const editClick = (item: Cluster.Config) => {
setFormValue(item);
setModifyOpen(!modifyOpen);
};
/**
* handle check heart
* @param item
*/
const handleCheckHeartBeat = async (item: Cluster.Config) => {
await executeAndCallbackRefresh(async () => {
await handleOption(API_CONSTANTS.CLUSTER_CONFIGURATION_TEST, l('button.heartbeat'), item);
});
};
/**
* render action button
* @param item
*/
const renderDataActionButton = (item: Cluster.Config) => {
return [
<EditBtn key={`${item.id}_edit`} onClick={() => editClick(item)}/>,
<NormalDeleteBtn key={`${item.id}_delete`} onClick={() => handleDeleteSubmit(item.id)}/>,
<RunningBtn key={`${item.id}_running`} title={l('rc.cc.start')} onClick={() => handleStartCluster(item)}/>,
<Button
className={'options-button'}
key={`${item.id}_heart`}
onClick={() => handleCheckHeartBeat(item)}
title={l('button.heartbeat')}
icon={<HeartTwoTone twoToneColor={item.isAvailable ? '#1ac431' : '#e10d0d'}/>}
/>,
];
};
/**
* render content
* @param item
*/
const renderDataContent = (item: Cluster.Config) => {
return (
<Space size={4} align={'baseline'} className={'hidden-overflow'}>
<EnableSwitchBtn record={item} onChange={() => handleEnable(item)}/>
<Tag color="cyan">{CLUSTER_CONFIG_TYPE.find(record => item.type === record.value)?.label}</Tag>
<Tag
icon={item.isAvailable ? <CheckCircleOutlined/> : <ExclamationCircleOutlined/>}
color={item.isAvailable ? 'success' : 'warning'}
>
{item.isAvailable ? l('global.table.status.normal') : l('global.table.status.abnormal')}
</Tag>
</Space>
);
};
/**
* render data list
*/
const renderData = data.map((item) => ({
subTitle: renderDataSubTitle(item),
actions: <DataAction>{renderDataActionButton(item)}</DataAction>,
avatar: <ClusterConfigIcon style={imgStyle}/>,
content: renderDataContent(item),
key: item.id,
}));
/**
* tool bar render
*/
const toolBarRender = () => [<CreateBtn key={'configcreate'} onClick={() => setCreateOpen(true)}/>,];
/**
* render
*/
return <>
<ProList<Cluster.Config>
{...PROTABLE_OPTIONS_PUBLIC}
{...PRO_LIST_CARD_OPTIONS as any}
loading={loading}
actionRef={actionRef}
headerTitle={l('rc.cc.management')}
toolBarRender={toolBarRender}
dataSource={renderData}
/>
{/*added*/}
<ConfigurationModal visible={createOpen} onClose={handleCancel} value={{}} onSubmit={handleSubmit}/>
{/*modify*/}
{modifyOpen &&
<ConfigurationModal 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 {l} from "@/utils/intl";
import {Divider} from "antd";
import {ProFormGroup, ProFormText} from "@ant-design/pro-components";
const ApplicationConfig = () => {
return <>
<Divider>{l('rc.cc.submitSqlConfig')}</Divider>
<ProFormGroup labelLayout={'inline'}>
<ProFormText
width={'xl'}
name="userJarPath"
placeholder={l('rc.cc.sqlSubmitJarPathHelp')}
label={l('rc.cc.sqlSubmitJarPath')}
tooltip={l('rc.cc.sqlSubmitJarPathHelp')}
/>
</ProFormGroup>
</>
}
export default ApplicationConfig
\ No newline at end of file
/*
*
* 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 {Divider} from "antd";
import {l} from "@/utils/intl";
import {ProFormGroup, ProFormSelect, ProFormSwitch, ProFormText} from "@ant-design/pro-components";
import {CLUSTER_CONFIG_TYPE} from "@/pages/RegCenter/Cluster/Configuration/components/contants";
const BaseConfig: React.FC = () => {
return <>
<Divider>{l('rc.cc.baseConfig')}</Divider>
<ProFormGroup>
<ProFormSelect
name="type"
label={l('rc.cc.type')}
width="md"
options={CLUSTER_CONFIG_TYPE}
rules={[{required: true, message: l('rc.cc.typePlaceholder')}]}
placeholder={l('rc.cc.typePlaceholder')}
/>
<ProFormText
name="name"
label={l('rc.cc.name')}
width="md"
rules={[{required: true, message: l('rc.cc.namePlaceholder')}]}
placeholder={l('rc.cc.namePlaceholder')}
/>
<ProFormText
name="note"
label={l('global.table.note')}
width="lg"
placeholder={l('global.table.notePlaceholder')}
/>
<ProFormSwitch
name="enabled"
label={l('global.table.isEnable')}
initialValue={false}
checkedChildren={l('button.enable')} unCheckedChildren={l('button.disable')}
/>
</ProFormGroup>
</>;
}
export default BaseConfig;
\ No newline at end of file
/*
*
* 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 {DOCKER_CONFIG_LIST} from "@/pages/RegCenter/Cluster/Configuration/components/contants";
import {ProFormGroup, ProFormText} from "@ant-design/pro-components";
import {Divider} from "antd";
import {l} from "@/utils/intl";
import React from "react";
const DockerConfig = () => {
const renderDockerConfigForm = () => {
return DOCKER_CONFIG_LIST.map(item => <>
<ProFormText
width={300}
key={item.name}
name={item.name}
label={item.label}
tooltip={item.tooltip}
placeholder={item.placeholder}
initialValue={item.defaultValue}
/>
</>
);
}
return <>
<Divider>{l('rc.cc.dockerConfig')}</Divider>
<ProFormGroup>
{renderDockerConfigForm()}
</ProFormGroup>
</>
};
export default DockerConfig
\ No newline at end of file
/*
*
* 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 {Col, Divider, Row} from "antd";
import {l} from "@/utils/intl";
import React from "react";
import {KUBERNETES_CONFIG_LIST} from "@/pages/RegCenter/Cluster/Configuration/components/contants";
import {ProCard, ProFormGroup, ProFormList, ProFormText} from "@ant-design/pro-components";
import {ClusterType} from "@/pages/RegCenter/Cluster/constants";
const K8sConfig = () => {
const renderK8sConfig = () => {
return KUBERNETES_CONFIG_LIST
.filter(item => item.showOnSubmitType !== ClusterType.KUBERNETES_OPERATOR)
.map(item => <>
<ProFormText
width={250}
key={item.name}
name={item.name}
label={item.label}
tooltip={item.tooltip}
placeholder={item.placeholder}
/>
</>
);
}
return <>
<Divider>{l('rc.cc.k8sConfig')}</Divider>
<Row gutter={[16, 16]}>
<Col span={10}>
<Divider>{l('rc.cc.k8s.preConfig')}</Divider>
<ProFormGroup>
{renderK8sConfig()}
</ProFormGroup>
</Col>
<ProCard.Divider type={'vertical'}/>
<Col span={12}>
<Divider>{l('rc.cc.k8s.defineConfig')}</Divider>
<ProFormList
name="kubernetesConfigList"
copyIconProps={false}
deleteIconProps={{
tooltipText: l('rc.cc.deleteConfig'),
}}
creatorButtonProps={{
style: {width: '32vw'},
creatorButtonText: l('rc.cc.addConfig'),
}}
>
<ProFormGroup key="flinkK8sNativeGroup">
<ProFormText width={'md'} name="name" label={l('rc.cc.key')}/>
<ProFormText width={'sm'} name="value" label={l('rc.cc.value')}/>
</ProFormGroup>
</ProFormList>
</Col>
</Row>
</>;
}
export default K8sConfig;
\ No newline at end of file
/*
*
* 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 DockerConfig
from "@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/FlinkK8sNative/DockerConfig";
import K8sConfig
from "@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/FlinkK8sNative/K8sConfig";
const FlinkK8sNative = () => {
return <>
<DockerConfig/>
<K8sConfig/>
</>;
}
export default FlinkK8sNative;
\ No newline at end of file
/*
*
* 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 {Col, Divider, Row} from "antd";
import {ProCard, ProFormGroup, ProFormItem, ProFormSelect, ProFormText} from "@ant-design/pro-components";
import {l} from "@/utils/intl";
import React from "react";
import {KUBERNETES_CONFIG_LIST} from "@/pages/RegCenter/Cluster/Configuration/components/contants";
import CodeEdit from "@/components/CustomEditor/CodeEdit";
import {ClusterType} from "@/pages/RegCenter/Cluster/constants";
const CodeEditProps = {
height: '30vh',
width: '60vw',
lineNumbers: 'on',
language: 'yaml',
};
const FlinkK8sOperator = (props: any) => {
const renderFlinkK8sOperatorConfig = () => {
return KUBERNETES_CONFIG_LIST
.filter(item => item.showOnSubmitType !== ClusterType.KUBERNETES_NATIVE && item.showType !== 'code')
.map(item => <>
<ProFormText
width={250}
key={item.name}
name={item.name}
label={item.label}
tooltip={item.tooltip}
placeholder={item.placeholder}
/>
</>
);
};
const renderFlinkK8sOperatorConfigCode = () => {
return KUBERNETES_CONFIG_LIST
.filter(item => item.showType === 'code')
.map(item => <>
<ProFormItem
key={item.name}
name={item.name}
label={item.label}
tooltip={item.tooltip}
>
<CodeEdit {...CodeEditProps} onChange={() => {
}} code={props.code}/>
</ProFormItem>
</>
);
}
return <>
<Divider>{l('rc.cc.k8sConfig')}</Divider>
<Row gutter={[16, 16]}>
<Col span={10}>
<ProFormGroup>
<ProFormSelect
name={'flinkVersion'}
label={l('rc.cc.k8sOp.version')}
width={250}
placeholder={l('rc.cc.k8sOp.versionHelp')}
options={[
{label: '1.13' + l('rc.cc.k8sOp.unSupportBatch'), value: 'v1_13'},
{label: '1.14' + l('rc.cc.k8sOp.unSupportBatch'), value: 'v1_14'},
{label: '1.15', value: 'v1_15'},
{label: '1.16', value: 'v1_16'},
{label: '1.17', value: 'v1_17'},
{label: '1.18', value: 'v1_18', disabled: true},
]}
/>
{renderFlinkK8sOperatorConfig()}
</ProFormGroup>
</Col>
<ProCard.Divider type={'vertical'}/>
<Col span={12}>
{renderFlinkK8sOperatorConfigCode()}
</Col>
</Row>
</>
}
export default FlinkK8sOperator;
\ No newline at end of file
/*
*
* 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 {Divider} from "antd";
import {l} from "@/utils/intl";
import {ProFormGroup, ProFormText} from "@ant-design/pro-components";
import {FLINK_CONFIG_LIST} from "@/pages/RegCenter/Cluster/Configuration/components/contants";
import React from "react";
const HighPriorityConfig = () => {
const renderHighPriorityConfig = () => {
return FLINK_CONFIG_LIST.map(item => <>
<ProFormText
name={item.name}
label={item.label}
width={400}
placeholder={item.placeholder}
tooltip={item.tooltip}
/>
</>)
};
return <>
<Divider>{l('rc.cc.defineConfig')}</Divider>
<ProFormGroup direction={'horizontal'} align={'baseline'}>
{renderHighPriorityConfig()}
</ProFormGroup>
</>
}
export default HighPriorityConfig
\ No newline at end of file
/*
*
* 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 {Col, Divider, Row} from "antd";
import {l} from "@/utils/intl";
import {ProCard, ProFormGroup, ProFormList, ProFormText} from "@ant-design/pro-components";
import React from "react";
const YarnConfig = () => {
return <>
<Row gutter={[16, 16]}>
<Col span={10}>
<Divider>{l('rc.cc.hadoopConfig')}</Divider>
<ProFormGroup>
<ProFormText
name="hadoopConfigPath"
label={l('rc.cc.hadoopConfigPath')}
width="md"
rules={[{required: true, message: l('rc.cc.hadoopConfigPathPlaceholder')}]}
placeholder={l('rc.cc.hadoopConfigPathPlaceholder')}
tooltip={l('rc.cc.hadoopConfigPathHelp')}
/>
</ProFormGroup>
<Divider>{l('rc.cc.hadoop.defineConfig')}</Divider>
<ProFormList
name="hadoopConfigList"
copyIconProps={false}
deleteIconProps={{
tooltipText: l('rc.cc.deleteConfig'),
}}
creatorButtonProps={{
style: {width: '26vw'},
creatorButtonText: l('rc.cc.addConfig'),
}}
>
<ProFormGroup key="hadoopGroup">
<ProFormText width={'sm'} name="name" label={l('rc.cc.key')}/>
<ProFormText width={'sm'} name="value" label={l('rc.cc.value')}/>
</ProFormGroup>
</ProFormList>
</Col>
<ProCard.Divider type={'vertical'}/>
<Col span={13}>
<Divider>{l('rc.cc.flinkConfig')}</Divider>
<ProFormGroup>
<ProFormText
name="flinkLibPath"
label={l('rc.cc.libPath')}
width="md"
rules={[{required: true, message: l('rc.cc.libPathPlaceholder')}]}
placeholder={l('rc.cc.libPathPlaceholder')}
tooltip={l('rc.cc.libPathHelp')}
/>
<ProFormText
name="flinkConfigPath"
label={l('rc.cc.flinkConfigPath')}
width="md"
rules={[{required: true, message: l('rc.cc.flinkConfigPathPlaceholder')}]}
placeholder={l('rc.cc.flinkConfigPathPlaceholder')}
tooltip={l('rc.cc.flinkConfigPathHelp')}
/>
</ProFormGroup>
<Divider>{l('rc.cc.flink.defineConfig')}</Divider>
<ProFormList
name="flinkConfigList"
copyIconProps={false}
deleteIconProps={{
tooltipText: l('rc.cc.deleteConfig'),
}}
creatorButtonProps={{
style: {width: '40vw'},
creatorButtonText: l('rc.cc.addConfig'),
}}
>
<ProFormGroup key="flinkGroup">
<ProFormText width={'md'} name="name" label={l('rc.cc.key')}/>
<ProFormText width={'md'} name="value" label={l('rc.cc.value')}/>
</ProFormGroup>
</ProFormList>
</Col>
</Row>
</>
}
export default YarnConfig;
\ No newline at end of file
/*
*
* 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 {ProForm,} from '@ant-design/pro-components';
import BaseConfig
from "@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/BaseConfig";
import ApplicationConfig
from "@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/ApplicationConfig";
import HighPriorityConfig
from "@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/HighPriorityConfig";
import YarnConfig
from "@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/YarnConfig";
import FlinkK8sNative
from "@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/FlinkK8sNative";
import FlinkK8sOperator
from "@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/FlinkK8sOperator";
import {ClusterType} from "@/pages/RegCenter/Cluster/constants";
type ConfigurationFormProps = {
form: FormInstance<Values>
value: any
}
const ConfigurationForm: React.FC<ConfigurationFormProps> = (props) => {
const {form, value} = props;
const [type, setType] = React.useState<string>(value.type || ClusterType.YARN);
const renderAllForm = () => {
return <>
<BaseConfig/>
{(type && type === ClusterType.YARN) && <YarnConfig/>}
{(type && type === ClusterType.KUBERNETES_NATIVE) && <FlinkK8sNative/>}
{(type && type === ClusterType.KUBERNETES_OPERATOR) &&
<FlinkK8sOperator code={value['kubernetes.pod-template'] || ''}/>}
<HighPriorityConfig/>
<ApplicationConfig/>
</>;
};
const handleValueChange = (changedValues: any, values: any) => {
if (values.type) setType(values.type)
}
return <>
<ProForm
onValuesChange={handleValueChange}
form={form}
initialValues={{...value,type}}
submitter={false}
>
{renderAllForm()}
</ProForm>
</>;
};
export default ConfigurationForm;
/*
*
* 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 React, {useEffect} from 'react';
import {ModalForm} from '@ant-design/pro-components';
import {l} from '@/utils/intl';
import {FormContextValue} from '@/components/Context/FormContext';
import ConfigurationForm from "@/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm";
import {buildClusterConfig, parseConfigJsonToValues} from "@/pages/RegCenter/Cluster/Configuration/components/function";
import {ClusterType} from "@/pages/RegCenter/Cluster/constants";
type ConfigurationModalProps = {
visible: boolean;
onClose: () => void;
value: Partial<Cluster.Config>;
onSubmit: (values: Partial<Cluster.Config>) => void;
}
const InstanceModal: React.FC<ConfigurationModalProps> = (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(parseConfigJsonToValues(value as Cluster.Config));
}, [visible, value, form]);
/**
* handle cancel
*/
const handleCancel = () => {
onClose();
formContext.resetForm();
setSubmitting(false);
};
/**
* submit form
*/
const submitForm = async () => {
const fieldsValue = await form.validateFields();
setSubmitting(true);
await onSubmit({...value, ...buildClusterConfig(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
width={'80%'}
open={visible}
modalProps={{
onCancel: handleCancel,
bodyStyle: {maxHeight: '70vh', overflowY: 'auto', overflowX: 'hidden'},
}}
title={value.id ? l('rc.cc.modify') : l('rc.cc.create')}
submitter={{render: () => [...renderFooter()]}}
initialValues={parseConfigJsonToValues(value as Cluster.Config)}
form={form}
>
<ConfigurationForm form={form} value={parseConfigJsonToValues(value as Cluster.Config)}/>
</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 {l} from '@/utils/intl';
import {FormConfig} from "@/pages/RegCenter/Cluster/Configuration/components/data";
import {ClusterType} from "@/pages/RegCenter/Cluster/constants";
import {DefaultOptionType} from "rc-select/es/Select";
/**
* Cluster config type
*/
export const CLUSTER_CONFIG_TYPE: DefaultOptionType[] = [
{value: ClusterType.YARN, label: 'Flink On Yarn', key: ClusterType.YARN},
{value: ClusterType.KUBERNETES_NATIVE, label: 'Kubernetes Native', key: ClusterType.KUBERNETES_NATIVE},
{value: ClusterType.KUBERNETES_OPERATOR, label: 'Kubernetes Operator', key: ClusterType.KUBERNETES_OPERATOR},
]
export const FLINK_CONFIG_LIST: FormConfig[] = [
{
name: 'jobmanager.memory.process.size',
label: l('rc.cc.jmMem'),
placeholder: l('rc.cc.jmMem'),
tooltip: l('rc.cc.jmMemHelp'),
},
{
name: 'taskmanager.memory.process.size',
label: l('rc.cc.tmMem'),
placeholder: l('rc.cc.tmMem'),
tooltip: l('rc.cc.tmMemHelp'),
},
{
name: 'taskmanager.memory.framework.heap.size',
label: l('rc.cc.tmHeap'),
placeholder: l('rc.cc.tmHeap'),
tooltip: l('rc.cc.tmHeapHelp'),
},
{
name: 'taskmanager.numberOfTaskSlots',
label: l('rc.cc.tsNum'),
placeholder: l('rc.cc.tsNum'),
tooltip: l('rc.cc.tsNumHelp'),
},
{
name: 'state.savepoints.dir',
label: l('rc.cc.spDir'),
placeholder: l('rc.cc.spDir'),
tooltip: l('rc.cc.spDirHelp'),
},
{
name: 'state.checkpoints.dir',
label: l('rc.cc.ckpDir'),
placeholder: l('rc.cc.ckpDir'),
tooltip: l('rc.cc.ckpDirHelp'),
}
];
export const DOCKER_CONFIG_LIST: FormConfig[] = [
{
name: 'dinky.remote.addr',
label: l('rc.cc.docker.dinky.addr'),
placeholder: l('rc.cc.docker.dinky.addrHelp'),
tooltip: l('rc.cc.docker.dinky.addrHelp'),
defaultValue: '127.0.0.1:8888',
},
{
name: 'docker.instance',
label: l('rc.cc.docker.instance'),
placeholder: l('rc.cc.docker.instanceHelp'),
tooltip: l('rc.cc.docker.instanceHelp'),
},
{
name: 'docker.registry.url',
label: l('rc.cc.docker.url'),
placeholder: l('rc.cc.docker.urlHelp'),
tooltip: l('rc.cc.docker.urlHelp'),
},
{
name: 'docker.registry.username',
label: l('rc.cc.docker.username'),
placeholder: l('rc.cc.docker.usernameHelp'),
tooltip: l('rc.cc.docker.usernameHelp'),
},
{
name: 'docker.registry.password',
label: l('rc.cc.docker.password'),
placeholder: l('rc.cc.docker.passwordHelp'),
tooltip: l('rc.cc.docker.passwordHelp'),
},
{
name: 'docker.image.tag',
label: l('rc.cc.docker.tag'),
placeholder: l('rc.cc.docker.tagHelp'),
tooltip: l('rc.cc.docker.tagHelp'),
},
{
name: 'docker.image.dockerfile',
label: l('rc.cc.docker.file'),
placeholder: l('rc.cc.docker.fileHelp'),
tooltip: l('rc.cc.docker.fileHelp'),
}
];
export const KUBERNETES_CONFIG_LIST: FormConfig[] = [
{
name: 'kubernetes.namespace',
label: l('rc.cc.k8s.namespace'),
placeholder: l('rc.cc.k8s.namespaceHelp'),
tooltip: l('rc.cc.k8s.namespaceHelp'),
},
{
name: 'kubernetes.container.image',
label: l('rc.cc.k8s.image'),
placeholder: l('rc.cc.k8s.imageHelp'),
tooltip: l('rc.cc.k8s.imageHelp'),
},
{
name: 'kubernetes.rest-service.exposed.type',
label: l('rc.cc.k8s.exposed'),
placeholder: l('rc.cc.k8s.exposedHelp'),
tooltip: l('rc.cc.k8s.exposedHelp'),
showOnSubmitType: ClusterType.KUBERNETES_NATIVE,
},
{
name: 'kubernetes.jobmanager.cpu',
label: l('rc.cc.k8s.jmCpu'),
placeholder: l('rc.cc.k8s.jmCpuHelp'),
tooltip: l('rc.cc.k8s.jmCpuHelp'),
},
{
name: 'kubernetes.taskmanager.cpu',
label: l('rc.cc.k8s.tmCpu'),
placeholder: l('rc.cc.k8s.tmCpuHelp'),
tooltip: l('rc.cc.k8s.tmCpuHelp'),
},
{
name: 'kubernetes.config.file',
label: l('rc.cc.k8s.configFile'),
placeholder: l('rc.cc.k8s.configFileHelp'),
tooltip: l('rc.cc.k8s.configFileHelp'),
},
{
name: 'kubernetes.service.account',
label: l('rc.cc.k8s.account'),
placeholder: l('rc.cc.k8s.accountHelp'),
tooltip: l('rc.cc.k8s.accountHelp'),
showOnSubmitType: ClusterType.KUBERNETES_OPERATOR,
},
{
name: 'kubernetes.pod-template',
label: l('rc.cc.k8s.podTemplate'),
placeholder: l('rc.cc.k8s.podTemplate'),
tooltip: l('rc.cc.k8s.podTemplateHelp'),
showOnSubmitType: ClusterType.KUBERNETES_OPERATOR,
showType: 'code'
},
];
\ No newline at end of file
/*
*
* 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.
*
*/
export type FormConfig = {
name: string,
label: string,
placeholder: string
tooltip?: string
defaultValue?: string
help?: string
showOnSubmitType?: string
showType?: string
}
export type ConfigItem = {
name: string,
value: string,
};
\ No newline at end of file
/*
*
* 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";
/**
* parse values to Cluster.Config
* @param {Cluster.Config} values
* @returns {{type: string} | {[p: string]: any, [p: number]: any, [p: symbol]: any, hadoopConfigPath: any, flinkConfigPath: any, flinkConfigList: any, type: string, flinkVersion: any, enabled: boolean, flinkConfig: any, hadoopConfigList: any, dockerConfig: any, flinkLibPath: any, kubernetesConfig: any, hadoopConfig: any, name: string, id: number, userJarPath: any}}
*/
export function parseConfigJsonToValues(values: Cluster.Config) {
if (!values.id) {
return {type: values.type};
}
// base info
const {type, id, name, enabled, configJson} = values;
// parse configJson
let config = JSON.parse(configJson);
// extract configJson from config
const {
hadoopConfigPath, flinkLibPath, flinkConfigPath, flinkVersion,
hadoopConfig, userJarPath, kubernetesConfig, dockerConfig,
flinkConfig, hadoopConfigList, flinkConfigList, ...rest
} = config;
// return values
return {
id,
name,
enabled,
type,
...rest, // ...rest 代表剩余参数
hadoopConfigPath,
flinkLibPath,
flinkConfigPath,
flinkVersion,
hadoopConfigList, // 使用此种方式 + antd 的 ProFormList 组件,可以实现动态表单 自动渲染该数组
flinkConfigList, // 使用此种方式 + antd 的 ProFormList 组件,可以实现动态表单 自动渲染该数组
hadoopConfig,
kubernetesConfig,
dockerConfig,
userJarPath,
flinkConfig,
}
}
/**
* build Cluster.Config from values
* @param values
* @returns {Cluster.Config}
*/
export function buildClusterConfig(values: any): Cluster.Config {
// extract values
const {
type, name, enabled, note,
hadoopConfigPath, flinkLibPath, flinkConfigPath, flinkVersion,
hadoopConfig, userJarPath, kubernetesConfig, dockerConfig,
flinkConfig, hadoopConfigList, flinkConfigList, ...rest
} = values;
// build configJson
const configJson = {
hadoopConfigPath, flinkLibPath, flinkConfigPath, flinkVersion,
hadoopConfig, userJarPath, kubernetesConfig, dockerConfig,
flinkConfig, hadoopConfigList, flinkConfigList, ...rest // ...rest 代表剩余参数
};
// deep copy configJson
const buildConfigJsonResult = JSON.stringify(configJson);
// return values
return {
name,
enabled,
note,
type,
configJson: buildConfigJsonResult,
} as Cluster.Config;
}
/*
*
* 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 Pop from "@/components/Animation/Pop";
import ConfigurationList from "@/pages/RegCenter/Cluster/Configuration/components/ConfigurationList";
export default () => {
return <Pop>
<PageContainer title={false}>
<ConfigurationList/>
</PageContainer>
</Pop>
}
\ No newline at end of file
...@@ -26,6 +26,7 @@ import {CLUSTER_INSTANCE_TYPE} from '@/pages/RegCenter/Cluster/Instance/componen ...@@ -26,6 +26,7 @@ import {CLUSTER_INSTANCE_TYPE} from '@/pages/RegCenter/Cluster/Instance/componen
import {MODAL_FORM_OPTIONS} from '@/services/constants'; import {MODAL_FORM_OPTIONS} from '@/services/constants';
import {l} from '@/utils/intl'; import {l} from '@/utils/intl';
import {validatorJMHAAdderess} from '@/pages/RegCenter/Cluster/Instance/components/function'; import {validatorJMHAAdderess} from '@/pages/RegCenter/Cluster/Instance/components/function';
import {ts} from "@hapi/hoek";
type InstanceFormProps = { type InstanceFormProps = {
...@@ -86,6 +87,7 @@ const InstanceForm: React.FC<InstanceFormProps> = (props) => { ...@@ -86,6 +87,7 @@ const InstanceForm: React.FC<InstanceFormProps> = (props) => {
return <> return <>
{/*// @ts-ignore*/}
<ProForm <ProForm
{...MODAL_FORM_OPTIONS} {...MODAL_FORM_OPTIONS}
form={form} form={form}
......
...@@ -15,18 +15,18 @@ ...@@ -15,18 +15,18 @@
* limitations under the License. * limitations under the License.
*/ */
import {RUN_MODE} from "@/services/constants";
import {Tag} from 'antd'; import {Tag} from 'antd';
import {l} from '@/utils/intl'; import {l} from '@/utils/intl';
import React from 'react'; import React from 'react';
import {ClusterType} from "@/pages/RegCenter/Cluster/constants";
/** /**
* Cluster instance type * Cluster instance type
*/ */
export const CLUSTER_INSTANCE_TYPE = [ export const CLUSTER_INSTANCE_TYPE = [
{value: RUN_MODE.STANDALONE, label: 'Standalone'}, {value: ClusterType.STANDALONE, label: ClusterType.STANDALONE},
{value: RUN_MODE.YARN_SESSION, label: 'Yarn Session'}, {value: ClusterType.YARN_SESSION, label: ClusterType.YARN_SESSION},
{value: RUN_MODE.KUBERNETES_SESSION, label: 'Kubernetes Session'}, {value: ClusterType.KUBERNETES_SESSION, label: ClusterType.KUBERNETES_SESSION},
] ]
/** /**
......
/*
*
* 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.
*
*/
export const enum ClusterType {
STANDALONE = 'Standalone',
YARN = 'Yarn',
YARN_SESSION = 'Yarn Session',
KUBERNETES_SESSION = 'Kubernetes Session',
KUBERNETES_NATIVE = 'Kubernetes',
KUBERNETES_OPERATOR = 'KubernetesOperator',
};
...@@ -37,7 +37,7 @@ import {renderDBIcon} from '@/pages/RegCenter/DataSource/components/function'; ...@@ -37,7 +37,7 @@ import {renderDBIcon} from '@/pages/RegCenter/DataSource/components/function';
import {EnableSwitchBtn} from '@/components/CallBackButton/EnableSwitchBtn'; import {EnableSwitchBtn} from '@/components/CallBackButton/EnableSwitchBtn';
import {EditBtn} from '@/components/CallBackButton/EditBtn'; import {EditBtn} from '@/components/CallBackButton/EditBtn';
import {NormalDeleteBtn} from '@/components/CallBackButton/NormalDeleteBtn'; import {NormalDeleteBtn} from '@/components/CallBackButton/NormalDeleteBtn';
import {DataSourceAction} from '@/components/StyledComponents'; import {DataAction} from '@/components/StyledComponents';
import DataSourceDetail from '@/pages/RegCenter/DataSource/components/DataSourceDetail'; import DataSourceDetail from '@/pages/RegCenter/DataSource/components/DataSourceDetail';
import {WarningMessage} from '@/utils/messages'; import {WarningMessage} from '@/utils/messages';
import {useNavigate} from '@@/exports'; import {useNavigate} from '@@/exports';
...@@ -239,7 +239,7 @@ const DataSourceTable = () => { ...@@ -239,7 +239,7 @@ const DataSourceTable = () => {
*/ */
const renderDataSource = dataSource.map((item) => ({ const renderDataSource = dataSource.map((item) => ({
subTitle: renderDataSourceSubTitle(item), subTitle: renderDataSourceSubTitle(item),
actions: <DataSourceAction>{renderDataSourceActionButton(item)}</DataSourceAction>, actions: <DataAction>{renderDataSourceActionButton(item)}</DataAction>,
avatar: <Space onClick={() => enterDetailPageClickHandler(item)}>{renderDBIcon(item.type, 60)}</Space>, avatar: <Space onClick={() => enterDetailPageClickHandler(item)}>{renderDBIcon(item.type, 60)}</Space>,
content: renderDataSourceContent(item), content: renderDataSourceContent(item),
key: item.id, key: item.id,
......
...@@ -87,6 +87,12 @@ export const API_CONSTANTS = { ...@@ -87,6 +87,12 @@ export const API_CONSTANTS = {
CLUSTER_INSTANCE_DELETE: "/api/cluster/delete", CLUSTER_INSTANCE_DELETE: "/api/cluster/delete",
CLUSTER_INSTANCE_HEARTBEATS: "/api/cluster/heartbeats", CLUSTER_INSTANCE_HEARTBEATS: "/api/cluster/heartbeats",
CLUSTER_INSTANCE_RECYCLE: "/api/cluster/recycle", CLUSTER_INSTANCE_RECYCLE: "/api/cluster/recycle",
CLUSTER_CONFIGURATION_START: "/api/cluster/deploySessionClusterInstance",
// cluster configuration list
CLUSTER_CONFIGURATION: "/api/clusterConfiguration",
CLUSTER_CONFIGURATION_DELETE: "/api/clusterConfiguration/delete",
CLUSTER_CONFIGURATION_ENABLE: "/api/clusterConfiguration/enable",
CLUSTER_CONFIGURATION_TEST: "/api/clusterConfiguration/testConnect",
// datasource registries list // datasource registries list
...@@ -202,6 +208,7 @@ export const API_CONSTANTS = { ...@@ -202,6 +208,7 @@ export const API_CONSTANTS = {
MONITOR_GET_SYSTEM_DATA:"/api/monitor/getSysData", MONITOR_GET_SYSTEM_DATA:"/api/monitor/getSysData",
MONITOR_GET_LAST_DATA:"/api/monitor/getLastUpdateData", MONITOR_GET_LAST_DATA:"/api/monitor/getLastUpdateData",
JOB_METRICS: "/api/monitor/jobMetrics", JOB_METRICS: "/api/monitor/jobMetrics",
SAVE_FLINK_METRICS: "/api/monitor/saveFlinkMetrics", SAVE_FLINK_METRICS: "/api/monitor/saveFlinkMetrics",
GET_METRICS_LAYOUT: "/api/monitor/getMetricsLayout", GET_METRICS_LAYOUT: "/api/monitor/getMetricsLayout",
...@@ -338,7 +345,7 @@ export const PROTABLE_OPTIONS_PUBLIC : any = { ...@@ -338,7 +345,7 @@ export const PROTABLE_OPTIONS_PUBLIC : any = {
y: "auto", y: "auto",
}, },
search: { search: {
labelWidth: 80, // must be number labelWidth: 100, // must be number
span: 4, span: 4,
}, },
}; };
......
...@@ -91,9 +91,9 @@ declare namespace Cluster { ...@@ -91,9 +91,9 @@ declare namespace Cluster {
*/ */
export type Config = BaseBeanColumns & { export type Config = BaseBeanColumns & {
type: string, type: string,
config: any, config?: any,
configJson: string, configJson: string,
isAvailable: boolean, isAvailable?: boolean,
note: string, note: string,
}; };
} }
......
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