diff --git a/dinky-admin/src/main/java/org/dinky/data/dto/ClusterConfigurationDTO.java b/dinky-admin/src/main/java/org/dinky/data/dto/ClusterConfigurationDTO.java index c380952db8b..1ce17a8b818 100644 --- a/dinky-admin/src/main/java/org/dinky/data/dto/ClusterConfigurationDTO.java +++ b/dinky-admin/src/main/java/org/dinky/data/dto/ClusterConfigurationDTO.java @@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.json.JSONUtil; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -88,7 +89,7 @@ public static ClusterConfigurationDTO fromBean(ClusterConfiguration bean) { public ClusterConfiguration toBean() { ClusterConfiguration clusterConfiguration = new ClusterConfiguration(); BeanUtil.copyProperties(this, clusterConfiguration); - clusterConfiguration.setConfigJson(this.getConfig()); + clusterConfiguration.setConfigJson(JSONUtil.toJsonStr(this.getConfig())); return clusterConfiguration; } } diff --git a/dinky-admin/src/main/java/org/dinky/data/dto/JobDataDto.java b/dinky-admin/src/main/java/org/dinky/data/dto/JobDataDto.java index 0368370afd9..ae6bf3647f6 100644 --- a/dinky-admin/src/main/java/org/dinky/data/dto/JobDataDto.java +++ b/dinky-admin/src/main/java/org/dinky/data/dto/JobDataDto.java @@ -73,7 +73,7 @@ public class JobDataDto { @ApiModelProperty(value = "Checkpoints Config Object", notes = "Object representing checkpoints configuration") private CheckpointConfigInfo checkpointsConfig; - @ApiModelProperty(value = "FlinkJobConfigInfo", notes = "FlinkJobConfigInfo representing job configuration") + @ApiModelProperty(value = "JobConfigInfo", notes = "JobConfigInfo representing job configuration") private JobConfigInfo config; @ApiModelProperty(value = "Jar Object", notes = "Object representing the JAR used in the job") diff --git a/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/AbstractAlertInstanceConfig.java b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/AbstractAlertInstanceConfig.java new file mode 100644 index 00000000000..660da0b8cb2 --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/AbstractAlertInstanceConfig.java @@ -0,0 +1,22 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.alert.instance.parser; + +public class AbstractAlertInstanceConfig {} diff --git a/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/DingTalkConfigParser.java b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/DingTalkConfigParser.java new file mode 100644 index 00000000000..bbedb3a22f7 --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/DingTalkConfigParser.java @@ -0,0 +1,128 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.alert.instance.parser.types; + +import org.dinky.data.model.alert.instance.parser.AbstractAlertInstanceConfig; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * the full config is: + *

+ * {"webhook":"https:///111","keyword":"111","secret":"1111","isEnableProxy":true,"isAtAll":false,"proxy":"1121","port":2121,"user":"2121","password":"2121","atMobiles":"2121"} + */ +@Data +@NoArgsConstructor +@ApiModel(value = "DingTalkConfigParser", description = "DingTalk Config Parser") +public class DingTalkConfigParser extends AbstractAlertInstanceConfig implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty( + value = "webhook url", + required = true, + dataType = "String", + example = "https://oapi.dingtalk.com/robot/send?access_token=xxx") + @JsonProperty("webhook") + private String webhook; + + @ApiModelProperty(value = "keyword", required = true, dataType = "String", example = "111") + @JsonProperty("keyword") + private String keyword; + + @ApiModelProperty(value = "secret", required = true, dataType = "String", example = "1111") + @JsonProperty("secret") + private String secret; + + @ApiModelProperty(value = "isEnableProxy", required = true, dataType = "Boolean", example = "true") + @JsonProperty("isEnableProxy") + private boolean isEnableProxy; + + @ApiModelProperty(value = "isAtAll", required = true, dataType = "Boolean", example = "false") + @JsonProperty("isAtAll") + private boolean isAtAll; + + @ApiModelProperty(value = "atMobiles", required = true, dataType = "String", example = "2121") + @JsonProperty("atMobiles") + private String atMobiles; + + @ApiModelProperty(value = "proxy ip / host", required = true, dataType = "String", example = "1121") + @JsonProperty("proxy") + private String proxy; + + @ApiModelProperty(value = "proxy port", required = true, dataType = "Integer", example = "2121") + @JsonProperty("port") + private int port; + + @ApiModelProperty(value = "proxy user", required = true, dataType = "String", example = "2121") + @JsonProperty("user") + private String user; + + @ApiModelProperty(value = "proxy password", required = true, dataType = "String", example = "2121") + @JsonProperty("password") + private String password; + + @JsonCreator + public DingTalkConfigParser( + @JsonProperty("webhook") String webhook, + @JsonProperty("keyword") String keyword, + @JsonProperty("secret") String secret, + @JsonProperty("isEnableProxy") boolean isEnableProxy, + @JsonProperty("isAtAll") boolean isAtAll, + @JsonProperty("atMobiles") String atMobiles, + @JsonProperty("proxy") String proxy, + @JsonProperty("port") int port, + @JsonProperty("user") String user, + @JsonProperty("password") String password) { + this.webhook = webhook; + this.keyword = keyword; + this.secret = secret; + this.isEnableProxy = isEnableProxy; + this.isAtAll = isAtAll; + this.atMobiles = atMobiles; + this.proxy = proxy; + this.port = port; + this.user = user; + this.password = password; + } + + @JsonCreator + public DingTalkConfigParser( + @JsonProperty("webhook") String webhook, + @JsonProperty("keyword") String keyword, + @JsonProperty("secret") String secret, + @JsonProperty("isEnableProxy") boolean isEnableProxy, + @JsonProperty("isAtAll") boolean isAtAll, + @JsonProperty("atMobiles") String atMobiles) { + this.webhook = webhook; + this.keyword = keyword; + this.secret = secret; + this.isEnableProxy = isEnableProxy; + this.isAtAll = isAtAll; + this.atMobiles = atMobiles; + } +} diff --git a/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/EmailConfigParser.java b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/EmailConfigParser.java new file mode 100644 index 00000000000..bfc407ab7dd --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/EmailConfigParser.java @@ -0,0 +1,106 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.alert.instance.parser.types; + +import org.dinky.data.model.alert.instance.parser.AbstractAlertInstanceConfig; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * the full config is: + *

+ * {"serverHost":"121","serverPort":1212,"sender":"212121","receivers":"2121","receiverCcs":"2121","enableSmtpAuth":true,"starttlsEnable":true,"sslEnable":true,"User":"212","Password":"121","smtpSslTrust":"2121"} + */ +@Data +@NoArgsConstructor +@ApiModel(value = "EmailConfigParser", description = "Email Config Parser") +public class EmailConfigParser extends AbstractAlertInstanceConfig implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "server Host", required = true, dataType = "String", example = "121") + private String serverHost; + + @ApiModelProperty(value = "server Port", required = true, dataType = "Integer", example = "1212") + private Integer serverPort; + + @ApiModelProperty(value = "sender", required = true, dataType = "String", example = "212121") + private String sender; + + @ApiModelProperty(value = "receivers", required = true, dataType = "String", example = "2121") + private String receivers; + + @ApiModelProperty(value = "receiver Ccs", required = true, dataType = "String", example = "2121") + private String receiverCcs; + + @ApiModelProperty(value = "enable Smtp Auth", required = true, dataType = "Boolean", example = "true") + private boolean enableSmtpAuth; + + @ApiModelProperty(value = "starttls Enable", required = true, dataType = "Boolean", example = "true") + private boolean starttlsEnable; + + @ApiModelProperty(value = "ssl Enable", required = true, dataType = "Boolean", example = "true") + private boolean sslEnable; + + @ApiModelProperty(value = "User", required = true, dataType = "String", example = "212") + @JsonProperty("User") + private String user; + + @ApiModelProperty(value = "Password", required = true, dataType = "String", example = "121") + @JsonProperty("Password") + private String password; + + @ApiModelProperty(value = "smtp Ssl Trust", required = true, dataType = "String", example = "2121") + @JsonProperty("smtpSslTrust") + private String smtpSslTrust; + + @JsonCreator + public EmailConfigParser( + @JsonProperty("serverHost") String serverHost, + @JsonProperty("serverPort") Integer serverPort, + @JsonProperty("sender") String sender, + @JsonProperty("receivers") String receivers, + @JsonProperty("receiverCcs") String receiverCcs, + @JsonProperty("enableSmtpAuth") boolean enableSmtpAuth, + @JsonProperty("starttlsEnable") boolean starttlsEnable, + @JsonProperty("sslEnable") boolean sslEnable, + @JsonProperty("User") String user, + @JsonProperty("Password") String password, + @JsonProperty("smtpSslTrust") String smtpSslTrust) { + this.serverHost = serverHost; + this.serverPort = serverPort; + this.sender = sender; + this.receivers = receivers; + this.receiverCcs = receiverCcs; + this.enableSmtpAuth = enableSmtpAuth; + this.starttlsEnable = starttlsEnable; + this.sslEnable = sslEnable; + this.user = user; + this.password = password; + this.smtpSslTrust = smtpSslTrust; + } +} diff --git a/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/FeiShuConfigParser.java b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/FeiShuConfigParser.java new file mode 100644 index 00000000000..0e51afc7710 --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/FeiShuConfigParser.java @@ -0,0 +1,128 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.alert.instance.parser.types; + +import org.dinky.data.model.alert.instance.parser.AbstractAlertInstanceConfig; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * the full config is: + *

+ * {"webhook":"12121","keyword":"212121","secret":"321312321","isEnableProxy":true,"isAtAll":false,"proxy":"31312","port":312321,"user":"321312","password":"3312321","users":"312321321"} + */ +@Data +@NoArgsConstructor +@ApiModel(value = "FeiShuConfigParser", description = " FeiShu Config Parser") +public class FeiShuConfigParser extends AbstractAlertInstanceConfig implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty( + value = "webhook url", + required = true, + dataType = "String", + example = "https://oapi.feushu.com/robot/send?access_token=xxx") + @JsonProperty("webhook") + private String webhook; + + @ApiModelProperty(value = "keyword", required = true, dataType = "String", example = "111") + @JsonProperty("keyword") + private String keyword; + + @ApiModelProperty(value = "secret", required = true, dataType = "String", example = "1111") + @JsonProperty("secret") + private String secret; + + @ApiModelProperty(value = "isEnableProxy", required = true, dataType = "Boolean", example = "true") + @JsonProperty("isEnableProxy") + private boolean isEnableProxy; + + @ApiModelProperty(value = "isAtAll", required = true, dataType = "Boolean", example = "false") + @JsonProperty("isAtAll") + private boolean isAtAll; + + @ApiModelProperty(value = "proxy ip / host", required = true, dataType = "String", example = "1121") + @JsonProperty("proxy") + private String proxy; + + @ApiModelProperty(value = "proxy port", required = true, dataType = "Integer", example = "2121") + @JsonProperty("port") + private int port; + + @ApiModelProperty(value = "proxy user", required = true, dataType = "String", example = "2121") + @JsonProperty("user") + private String user; + + @ApiModelProperty(value = "proxy password", required = true, dataType = "String", example = "2121") + @JsonProperty("password") + private String password; + + @ApiModelProperty(value = "users", required = true, dataType = "String", example = "2121") + @JsonProperty("users") + private String users; + + @JsonCreator + public FeiShuConfigParser( + @JsonProperty("webhook") String webhook, + @JsonProperty("keyword") String keyword, + @JsonProperty("secret") String secret, + @JsonProperty("isEnableProxy") boolean isEnableProxy, + @JsonProperty("isAtAll") boolean isAtAll, + @JsonProperty("proxy") String proxy, + @JsonProperty("port") int port, + @JsonProperty("user") String user, + @JsonProperty("password") String password, + @JsonProperty("users") String users) { + this.webhook = webhook; + this.keyword = keyword; + this.secret = secret; + this.isEnableProxy = isEnableProxy; + this.isAtAll = isAtAll; + this.proxy = proxy; + this.port = port; + this.user = user; + this.password = password; + this.users = users; + } + + @JsonCreator + public FeiShuConfigParser( + @JsonProperty("webhook") String webhook, + @JsonProperty("keyword") String keyword, + @JsonProperty("secret") String secret, + @JsonProperty("isEnableProxy") boolean isEnableProxy, + @JsonProperty("isAtAll") boolean isAtAll, + @JsonProperty("users") String users) { + this.webhook = webhook; + this.keyword = keyword; + this.secret = secret; + this.isEnableProxy = isEnableProxy; + this.isAtAll = isAtAll; + this.users = users; + } +} diff --git a/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/WeChatAppConfigParser.java b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/WeChatAppConfigParser.java new file mode 100644 index 00000000000..afc4e7aeaaa --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/WeChatAppConfigParser.java @@ -0,0 +1,78 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.alert.instance.parser.types; + +import org.dinky.data.model.alert.instance.parser.AbstractAlertInstanceConfig; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * the full config is: + *

+ * {"sendType":"app","corpId":"12121","secret":"2121","agentId":2121,"users":"212121"} + */ +@Data +@NoArgsConstructor +@ApiModel(value = "WeChatAppConfigParser", description = "WeChat App Config Parser") +public class WeChatAppConfigParser extends AbstractAlertInstanceConfig implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "send Type", required = true, dataType = "String", example = "app") + @JsonProperty("sendType") + private String sendType; + + @ApiModelProperty(value = "corpId", required = true, dataType = "String", example = "12121") + @JsonProperty("corpId") + private String corpId; + + @ApiModelProperty(value = "secret", required = true, dataType = "String", example = "2121") + @JsonProperty("secret") + private String secret; + + @ApiModelProperty(value = "agentId", required = true, dataType = "Integer", example = "2121") + @JsonProperty("agentId") + private Integer agentId; + + @ApiModelProperty(value = "users", required = true, dataType = "String", example = "212121") + @JsonProperty("users") + private String users; + + @JsonCreator + public WeChatAppConfigParser( + @JsonProperty("sendType") String sendType, + @JsonProperty("corpId") String corpId, + @JsonProperty("secret") String secret, + @JsonProperty("agentId") Integer agentId, + @JsonProperty("users") String users) { + this.sendType = sendType; + this.corpId = corpId; + this.secret = secret; + this.agentId = agentId; + this.users = users; + } +} diff --git a/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/WeChatChatConfigParser.java b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/WeChatChatConfigParser.java new file mode 100644 index 00000000000..b5ca75d247f --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/alert/instance/parser/types/WeChatChatConfigParser.java @@ -0,0 +1,78 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.alert.instance.parser.types; + +import org.dinky.data.model.alert.instance.parser.AbstractAlertInstanceConfig; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * the full config is: + *

+ * {"sendType":"wechat","isAtAll":false,"webhook":"212121","keyword":"212121","users":"21212" ,} + */ +@Data +@NoArgsConstructor +@ApiModel(value = "WeChatChatConfigParser", description = "WeChat Chat Config Parser") +public class WeChatChatConfigParser extends AbstractAlertInstanceConfig implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "send Type", required = true, dataType = "String", example = "wechat") + @JsonProperty("sendType") + private String sendType; + + @ApiModelProperty(value = "isAtAll", required = true, dataType = "Boolean", example = "false") + @JsonProperty("isAtAll") + private boolean isAtAll; + + @ApiModelProperty(value = "webhook", required = true, dataType = "String", example = "212121") + @JsonProperty("webhook") + private String webhook; + + @ApiModelProperty(value = "keyword", required = true, dataType = "String", example = "212121") + @JsonProperty("keyword") + private String keyword; + + @ApiModelProperty(value = "users", required = true, dataType = "String", example = "21212") + @JsonProperty("users") + private String users; + + @JsonCreator + public WeChatChatConfigParser( + @JsonProperty("sendType") String sendType, + @JsonProperty("isAtAll") boolean isAtAll, + @JsonProperty("webhook") String webhook, + @JsonProperty("keyword") String keyword, + @JsonProperty("users") String users) { + this.sendType = sendType; + this.isAtAll = isAtAll; + this.webhook = webhook; + this.keyword = keyword; + this.users = users; + } +} diff --git a/dinky-admin/src/main/java/org/dinky/data/model/ClusterConfiguration.java b/dinky-admin/src/main/java/org/dinky/data/model/cluster/ClusterConfiguration.java similarity index 93% rename from dinky-admin/src/main/java/org/dinky/data/model/ClusterConfiguration.java rename to dinky-admin/src/main/java/org/dinky/data/model/cluster/ClusterConfiguration.java index 5a110c9c770..382f607ba03 100644 --- a/dinky-admin/src/main/java/org/dinky/data/model/ClusterConfiguration.java +++ b/dinky-admin/src/main/java/org/dinky/data/model/cluster/ClusterConfiguration.java @@ -17,7 +17,7 @@ * */ -package org.dinky.data.model; +package org.dinky.data.model.cluster; import org.dinky.mybatis.model.SuperEntity; @@ -58,6 +58,8 @@ public class ClusterConfiguration extends SuperEntity { dataType = "String", example = "test", notes = "cluster config json") + // todo: handler + // @TableField(typeHandler = ClusterConfigTypeHandler.class, jdbcType = JdbcType.VARCHAR) private String configJson; @ApiModelProperty( diff --git a/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/ClusterConfigJsonParser.java b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/ClusterConfigJsonParser.java new file mode 100644 index 00000000000..3a594889fc1 --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/ClusterConfigJsonParser.java @@ -0,0 +1,56 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.cluster.parser; + +import org.dinky.data.model.cluster.parser.configs.ApplicationConfigParser; +import org.dinky.data.model.cluster.parser.configs.HighPriorityConfigParser; +import org.dinky.data.model.cluster.parser.configs.K8sConfigParser; +import org.dinky.data.model.cluster.parser.configs.YarnConfigParser; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "ClusterConfigJsonParser", description = "Cluster Config Json Parser of serialized data") +public class ClusterConfigJsonParser implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "Yarn config", dataType = "YarnConfigParser", notes = "Yarn config") + private YarnConfigParser yarnConfig; + + @ApiModelProperty(value = "K8s config", dataType = "K8sConfigParser", notes = "K8s config") + private K8sConfigParser k8sConfig; + + @ApiModelProperty( + value = "High priority config", + dataType = "HighPriorityConfigParser", + notes = "High priority config") + private HighPriorityConfigParser highPriorityConfig; + + @ApiModelProperty(value = "Application config", dataType = "ApplicationConfigParser", notes = "Application config") + private ApplicationConfigParser applicationConfig; +} diff --git a/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/ApplicationConfigParser.java b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/ApplicationConfigParser.java new file mode 100644 index 00000000000..77f897ff390 --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/ApplicationConfigParser.java @@ -0,0 +1,43 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.cluster.parser.configs; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "ApplicationConfigParser", description = "Application Config Parser of serialized data") +public class ApplicationConfigParser implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty( + value = "user jar path", + dataType = "String", + example = "/opt/flink/examples/streaming/WordCount.jar", + notes = "user jar path") + private String userJarPath; +} diff --git a/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/HighPriorityConfigParser.java b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/HighPriorityConfigParser.java new file mode 100644 index 00000000000..39ee6c1fbc8 --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/HighPriorityConfigParser.java @@ -0,0 +1,47 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.cluster.parser.configs; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "HighPriorityConfigParser", description = "High Priority Config Parser of serialized data") +public class HighPriorityConfigParser implements Serializable { + private static final long serialVersionUID = 1L; + + private List> configurationList; + + @ApiModelProperty( + value = "Flink config path", + dataType = "String", + example = "/opt/flink/conf", + notes = "Flink config path") + private String flinkConfigPath; +} diff --git a/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/K8sConfigParser.java b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/K8sConfigParser.java new file mode 100644 index 00000000000..7fc32fec96c --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/K8sConfigParser.java @@ -0,0 +1,67 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.cluster.parser.configs; + +import org.dinky.data.model.base.ConfigItem; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "K8sConfigParser", description = "K8s Config Parser of serialized data") +public class K8sConfigParser implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "config list", dataType = "List>", notes = "config list ") + private List> configurationList; + + @ApiModelProperty(value = "Pod template", dataType = "String", example = "flink-session", notes = "Pod template") + private String podTemplate; + + @ApiModelProperty( + value = "JobManager Pod template", + dataType = "String", + example = "flink-jobmanager", + notes = "JobManager Pod template") + private String jmPodTemplate; + + @ApiModelProperty( + value = "TaskManager Pod template", + dataType = "String", + example = "flink-taskmanager", + notes = "TaskManager Pod template") + private String tmPodTemplate; + + @ApiModelProperty( + value = "Flink config List", + dataType = "List", + example = "[{\"key\":\"key1\",\"value\":\"value1\"}]", + notes = "Flink config List") + private List flinkConfigList; +} diff --git a/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/YarnConfigParser.java b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/YarnConfigParser.java new file mode 100644 index 00000000000..68ad0fc93c7 --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/YarnConfigParser.java @@ -0,0 +1,74 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.cluster.parser.configs; + +import org.dinky.data.model.base.ConfigItem; + +import java.io.Serializable; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "YarnConfigParser", description = "Yarn Config Parser of serialized data") +public class YarnConfigParser implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty( + value = "Hadoop Config Path", + dataType = "String", + example = "/etc/hadoop/conf", + notes = "Hadoop Config Path") + private String hadoopConfigPath; + + @ApiModelProperty( + value = "Hadoop Config List", + dataType = "List", + example = "[{\"key\":\"key1\",\"value\":\"value1\"}]", + notes = "Hadoop Config List") + private List hadoopConfigList; + + @ApiModelProperty( + value = "Flink Lib Path", + dataType = "String", + example = "/opt/flink/lib", + notes = "Flink Lib Path") + private String flinkLibPath; + + @ApiModelProperty( + value = "Flink Config Path", + dataType = "String", + example = "/opt/flink/conf", + notes = "Flink Config Path") + private String flinkConfigPath; + + @ApiModelProperty( + value = "Flink Config List", + dataType = "List", + example = "[{\"key\":\"key1\",\"value\":\"value1\"}]", + notes = "Flink Config List") + private List flinkConfigList; +} diff --git a/dinky-common/src/main/java/org/dinky/data/flink/config/FlinkJobConfigInfo.java b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/k8s/K8sApplicationNativeParser.java similarity index 53% rename from dinky-common/src/main/java/org/dinky/data/flink/config/FlinkJobConfigInfo.java rename to dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/k8s/K8sApplicationNativeParser.java index 2f06f9841ee..b449edf4146 100644 --- a/dinky-common/src/main/java/org/dinky/data/flink/config/FlinkJobConfigInfo.java +++ b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/k8s/K8sApplicationNativeParser.java @@ -17,7 +17,7 @@ * */ -package org.dinky.data.flink.config; +package org.dinky.data.model.cluster.parser.configs.k8s; import java.io.Serializable; @@ -29,40 +29,18 @@ import lombok.Data; import lombok.NoArgsConstructor; -/** - * { - * "jid": "62254c597e60e3b978e1663f29b333cd", - * "name": "测测吧", - * "execution-config": { - * "execution-mode": "PIPELINED", - * "restart-strategy": "Cluster level default restart strategy", - * "job-parallelism": 1, - * "object-reuse-mode": false, - * "user-config": {} - * } - * } - */ -@ApiModel(value = "FlinkJobConfigInfo", description = "Flink Job Config Info") @Data @AllArgsConstructor @NoArgsConstructor -public class FlinkJobConfigInfo implements Serializable { +@ApiModel(value = "K8sConfigParser", description = "K8s Config Parser of serialized data") +public class K8sApplicationNativeParser implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty( - value = "Job ID", - required = true, - notes = "Job ID", + value = "kubernetes.rest-service.exposed.type", dataType = "String", - example = "62254c597e60e3b978e1663f29b333cd") - @JSONField(name = "jid") - private String jid; - - @ApiModelProperty(value = "Job Name", required = true, notes = "Job Name", dataType = "String", example = "test") - @JSONField(name = "name") - private String name; - - @ApiModelProperty(value = "Execution Config", required = true, notes = "Execution Config", dataType = "ObjectNode") - @JSONField(name = "execution-config") - private ExecutionConfig executionConfig; + example = "NodePort", + notes = "kubernetes.rest-service.exposed.type") + @JSONField(name = "kubernetes.rest-service.exposed.type") + private String restServiceExposedType; } diff --git a/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/k8s/K8sApplicationOperatorParser.java b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/k8s/K8sApplicationOperatorParser.java new file mode 100644 index 00000000000..2443f59ad4a --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/model/cluster/parser/configs/k8s/K8sApplicationOperatorParser.java @@ -0,0 +1,39 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.model.cluster.parser.configs.k8s; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "K8sConfigParser", description = "K8s Config Parser of serialized data") +public class K8sApplicationOperatorParser implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "flink.version", dataType = "String", example = "1.11.2", notes = "flink.version") + private String flinkVersion; +} diff --git a/dinky-admin/src/main/java/org/dinky/data/typehandler/ClusterConfigTypeHandler.java b/dinky-admin/src/main/java/org/dinky/data/typehandler/ClusterConfigTypeHandler.java new file mode 100644 index 00000000000..6b2199020ea --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/typehandler/ClusterConfigTypeHandler.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.typehandler; + +import org.dinky.gateway.model.FlinkClusterConfig; + +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; + +import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler; + +import cn.hutool.json.JSONUtil; + +@MappedTypes({FlinkClusterConfig.class}) +@MappedJdbcTypes({JdbcType.VARCHAR}) +public class ClusterConfigTypeHandler extends AbstractJsonTypeHandler { + + protected FlinkClusterConfig parse(String json) { + return JSONUtil.toBean(json, FlinkClusterConfig.class); + } + + @Override + protected String toJson(FlinkClusterConfig obj) { + return JSONUtil.toJsonStr(obj); + } +} diff --git a/dinky-admin/src/main/java/org/dinky/data/typehandler/cluster/ClusterConfigurationTypeHandler.java b/dinky-admin/src/main/java/org/dinky/data/typehandler/cluster/ClusterConfigurationTypeHandler.java new file mode 100644 index 00000000000..1a33fd7353d --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/typehandler/cluster/ClusterConfigurationTypeHandler.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.typehandler.cluster; + +import org.dinky.data.model.cluster.ClusterConfiguration; + +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; + +import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler; + +import cn.hutool.json.JSONUtil; + +@MappedTypes({ClusterConfiguration.class}) +@MappedJdbcTypes({JdbcType.VARCHAR}) +public class ClusterConfigurationTypeHandler extends AbstractJsonTypeHandler { + + protected ClusterConfiguration parse(String json) { + return JSONUtil.toBean(json, ClusterConfiguration.class); + } + + @Override + protected String toJson(ClusterConfiguration obj) { + return JSONUtil.toJsonStr(obj); + } +} diff --git a/dinky-admin/src/main/java/org/dinky/data/typehandler/cluster/ClusterInstanceTypeHandler.java b/dinky-admin/src/main/java/org/dinky/data/typehandler/cluster/ClusterInstanceTypeHandler.java new file mode 100644 index 00000000000..5510bcf1bfc --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/typehandler/cluster/ClusterInstanceTypeHandler.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.typehandler.cluster; + +import org.dinky.data.model.cluster.ClusterInstance; + +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; + +import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler; + +import cn.hutool.json.JSONUtil; + +@MappedTypes({ClusterInstance.class}) +@MappedJdbcTypes({JdbcType.VARCHAR}) +public class ClusterInstanceTypeHandler extends AbstractJsonTypeHandler { + + protected ClusterInstance parse(String json) { + return JSONUtil.toBean(json, ClusterInstance.class); + } + + @Override + protected String toJson(ClusterInstance obj) { + return JSONUtil.toJsonStr(obj); + } +} diff --git a/dinky-admin/src/main/java/org/dinky/data/typehandler/json/AbstractJsonTypeHandler.java b/dinky-admin/src/main/java/org/dinky/data/typehandler/json/AbstractJsonTypeHandler.java new file mode 100644 index 00000000000..0967af8e679 --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/typehandler/json/AbstractJsonTypeHandler.java @@ -0,0 +1,63 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.typehandler.json; + +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * @author ZackYoung + * @version 1.0 + * @date 2022/1/14 + */ +public abstract class AbstractJsonTypeHandler extends BaseTypeHandler { + + @Override + public void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException { + ps.setString(i, toJson(parameter)); + } + + @Override + public T getNullableResult(ResultSet rs, String columnName) throws SQLException { + String json = rs.getString(columnName); + return parse(json); + } + + @Override + public T getNullableResult(ResultSet rs, int columnIndex) throws SQLException { + final String json = rs.getString(columnIndex); + return parse(json); + } + + @Override + public T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { + final String json = cs.getString(columnIndex); + return parse(json); + } + + protected abstract T parse(String json); + + protected abstract String toJson(T obj); +} diff --git a/dinky-admin/src/main/java/org/dinky/data/typehandler/json/AlertInstanceConfigHandler.java b/dinky-admin/src/main/java/org/dinky/data/typehandler/json/AlertInstanceConfigHandler.java new file mode 100644 index 00000000000..506bd1f9d59 --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/data/typehandler/json/AlertInstanceConfigHandler.java @@ -0,0 +1,72 @@ +/* + * + * 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. + * + */ + +package org.dinky.data.typehandler.json; + +import org.dinky.data.model.alert.instance.parser.types.DingTalkConfigParser; +import org.dinky.data.model.alert.instance.parser.types.EmailConfigParser; +import org.dinky.data.model.alert.instance.parser.types.FeiShuConfigParser; +import org.dinky.data.model.alert.instance.parser.types.WeChatAppConfigParser; +import org.dinky.data.model.alert.instance.parser.types.WeChatChatConfigParser; + +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONValidator; + +import lombok.extern.slf4j.Slf4j; + +/** + * @author ZackYoung + * @version 1.0 + * @date 2022/1/12 + */ +@Slf4j +@MappedJdbcTypes(value = JdbcType.VARCHAR, includeNullJdbcType = true) +@MappedTypes({ + DingTalkConfigParser.class, + EmailConfigParser.class, + FeiShuConfigParser.class, + WeChatAppConfigParser.class, + WeChatChatConfigParser.class, +}) +public class AlertInstanceConfigHandler extends AbstractJsonTypeHandler { + + private final Class type; + + public AlertInstanceConfigHandler(Class type) { + this.type = type; + } + + @Override + protected T parse(String content) { + if (!JSONValidator.from(content).validate()) { + log.error("unknown json:{}", content); + return null; + } + return JSON.parseObject(content, type); + } + + @Override + protected String toJson(T object) { + return JSON.toJSONString(object); + } +} diff --git a/dinky-admin/src/main/java/org/dinky/interceptor/RepeatHandler.java b/dinky-admin/src/main/java/org/dinky/interceptor/RepeatHandler.java new file mode 100644 index 00000000000..fb5558663d8 --- /dev/null +++ b/dinky-admin/src/main/java/org/dinky/interceptor/RepeatHandler.java @@ -0,0 +1,24 @@ +/* + * + * 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. + * + */ + +package org.dinky.interceptor; + +import org.springframework.web.servlet.HandlerInterceptor; + +public class RepeatHandler implements HandlerInterceptor {} diff --git a/dinky-web/src/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/FlinkK8s/index.tsx b/dinky-web/src/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/FlinkK8s/index.tsx index 2aefd123d82..56016d1fa5c 100644 --- a/dinky-web/src/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/FlinkK8s/index.tsx +++ b/dinky-web/src/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/FlinkK8s/index.tsx @@ -55,6 +55,7 @@ const FlinkK8s = (props: { type: string; value: any } & connect) => { { return FLINK_CONFIG_LIST.map((item) => ( <> { > + {/*todo 属性名称 改为 key*/}