fix: Alarm instance port verification (#13827)

close: #13532
This commit is contained in:
Jay Chung 2023-03-30 18:57:47 +08:00 committed by GitHub
parent 3630b00c9f
commit 6a33d2bec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 12 deletions

View File

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

View File

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

View File

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

View File

@ -26,10 +26,12 @@ import org.apache.dolphinscheduler.alert.api.AlertChannel;
import org.apache.dolphinscheduler.alert.api.AlertChannelFactory;
import org.apache.dolphinscheduler.alert.api.AlertInputTips;
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.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
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.select.SelectParam;
@ -113,10 +115,12 @@ public final class TelegramAlertChannelFactory implements AlertChannelFactory {
.build())
.build();
InputParam portParam =
InputParam.newBuilder(TelegramParamsConstants.NAME_TELEGRAM_PORT, TelegramParamsConstants.TELEGRAM_PORT)
InputNumberParam portParam =
InputNumberParam
.newBuilder(TelegramParamsConstants.NAME_TELEGRAM_PORT, TelegramParamsConstants.TELEGRAM_PORT)
.addValidate(Validate.newBuilder()
.setRequired(false)
.setType(DataType.NUMBER.getDataType())
.build())
.build();

View File

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

View File

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