Browse Source

fix: Alarm instance port verification (#13827)

close: #13532
3.2.0-release
Jay Chung 2 years ago committed by GitHub
parent
commit
6a33d2bec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java
  2. 9
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java
  3. 10
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java
  4. 8
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramAlertChannelFactory.java
  5. 2
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/FormType.java
  6. 10
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/number/InputNumberParam.java

5
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java

@ -26,10 +26,12 @@ import org.apache.dolphinscheduler.alert.api.AlertChannel;
import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory;
import org.apache.dolphinscheduler.alert.api.AlertInputTips; import org.apache.dolphinscheduler.alert.api.AlertInputTips;
import org.apache.dolphinscheduler.spi.params.PasswordParam; import org.apache.dolphinscheduler.spi.params.PasswordParam;
import org.apache.dolphinscheduler.spi.params.base.DataType;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.base.Validate;
import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.input.number.InputNumberParam;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import java.util.Arrays; import java.util.Arrays;
@ -120,10 +122,11 @@ public final class DingTalkAlertChannelFactory implements AlertChannelFactory {
.build()) .build())
.build(); .build();
InputParam portParam = InputParam InputNumberParam portParam = InputNumberParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PORT, DingTalkParamsConstants.DING_TALK_PORT) .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PORT, DingTalkParamsConstants.DING_TALK_PORT)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(false) .setRequired(false)
.setType(DataType.NUMBER.getDataType())
.build()) .build())
.build(); .build();

9
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java

@ -28,10 +28,12 @@ import org.apache.dolphinscheduler.alert.api.AlertConstants;
import org.apache.dolphinscheduler.alert.api.AlertInputTips; import org.apache.dolphinscheduler.alert.api.AlertInputTips;
import org.apache.dolphinscheduler.alert.api.ShowType; import org.apache.dolphinscheduler.alert.api.ShowType;
import org.apache.dolphinscheduler.spi.params.PasswordParam; import org.apache.dolphinscheduler.spi.params.PasswordParam;
import org.apache.dolphinscheduler.spi.params.base.DataType;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.base.Validate;
import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.input.number.InputNumberParam;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import java.util.ArrayList; import java.util.ArrayList;
@ -69,11 +71,12 @@ public final class EmailAlertChannelFactory implements AlertChannelFactory {
.addValidate(Validate.newBuilder().setRequired(true).build()) .addValidate(Validate.newBuilder().setRequired(true).build())
.build(); .build();
InputParam mailSmtpPort = InputNumberParam mailSmtpPort =
InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_PORT, MailParamsConstants.MAIL_SMTP_PORT) InputNumberParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_PORT, MailParamsConstants.MAIL_SMTP_PORT)
.setValue("25") .setValue(25)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(true) .setRequired(true)
.setType(DataType.NUMBER.getDataType())
.build()) .build())
.build(); .build();

10
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java

@ -26,10 +26,12 @@ import org.apache.dolphinscheduler.alert.api.AlertChannel;
import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory;
import org.apache.dolphinscheduler.alert.api.AlertInputTips; import org.apache.dolphinscheduler.alert.api.AlertInputTips;
import org.apache.dolphinscheduler.spi.params.PasswordParam; import org.apache.dolphinscheduler.spi.params.PasswordParam;
import org.apache.dolphinscheduler.spi.params.base.DataType;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.base.Validate;
import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.input.number.InputNumberParam;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import java.util.Arrays; import java.util.Arrays;
@ -70,10 +72,12 @@ public final class FeiShuAlertChannelFactory implements AlertChannelFactory {
.setRequired(false).build()) .setRequired(false).build())
.build(); .build();
InputParam portParam = InputNumberParam portParam =
InputParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PORT, FeiShuParamsConstants.FEI_SHU_PORT) InputNumberParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PORT, FeiShuParamsConstants.FEI_SHU_PORT)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(false).build()) .setRequired(false)
.setType(DataType.NUMBER.getDataType())
.build())
.build(); .build();
InputParam userParam = InputParam userParam =

8
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramAlertChannelFactory.java

@ -26,10 +26,12 @@ import org.apache.dolphinscheduler.alert.api.AlertChannel;
import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory;
import org.apache.dolphinscheduler.alert.api.AlertInputTips; import org.apache.dolphinscheduler.alert.api.AlertInputTips;
import org.apache.dolphinscheduler.spi.params.PasswordParam; import org.apache.dolphinscheduler.spi.params.PasswordParam;
import org.apache.dolphinscheduler.spi.params.base.DataType;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.base.Validate;
import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.input.number.InputNumberParam;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import org.apache.dolphinscheduler.spi.params.select.SelectParam; import org.apache.dolphinscheduler.spi.params.select.SelectParam;
@ -113,10 +115,12 @@ public final class TelegramAlertChannelFactory implements AlertChannelFactory {
.build()) .build())
.build(); .build();
InputParam portParam = InputNumberParam portParam =
InputParam.newBuilder(TelegramParamsConstants.NAME_TELEGRAM_PORT, TelegramParamsConstants.TELEGRAM_PORT) InputNumberParam
.newBuilder(TelegramParamsConstants.NAME_TELEGRAM_PORT, TelegramParamsConstants.TELEGRAM_PORT)
.addValidate(Validate.newBuilder() .addValidate(Validate.newBuilder()
.setRequired(false) .setRequired(false)
.setType(DataType.NUMBER.getDataType())
.build()) .build())
.build(); .build();

2
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/FormType.java

@ -28,7 +28,7 @@ import com.google.common.base.Functions;
public enum FormType { public enum FormType {
INPUT("input"), INPUT("input"),
INPUTNUMBER("inputNumber"), INPUTNUMBER("input-number"),
RADIO("radio"), RADIO("radio"),
SELECT("select"), SELECT("select"),
SWITCH("switch"), SWITCH("switch"),

10
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/number/InputNumberParam.java

@ -30,12 +30,13 @@ import java.util.List;
*/ */
public class InputNumberParam extends PluginParams { public class InputNumberParam extends PluginParams {
private final InputNumberParamProps props;
private InputNumberParam(Builder builder) { private InputNumberParam(Builder builder) {
super(builder); super(builder);
this.props = builder.props;
} }
private InputNumberParamProps props;
public static Builder newBuilder(String name, String title) { public static Builder newBuilder(String name, String title) {
return new Builder(name, title); return new Builder(name, title);
} }
@ -95,6 +96,11 @@ public class InputNumberParam extends PluginParams {
this.display = display; this.display = display;
return this; return this;
} }
@Override
public InputNumberParam build() {
return new InputNumberParam(this);
}
} }
@Override @Override

Loading…
Cancel
Save