From 250d81bcf81bc4432f832197e1f96ad440944d5d Mon Sep 17 00:00:00 2001 From: Tq Date: Mon, 14 Nov 2022 11:14:14 +0800 Subject: [PATCH] [bug][alert-12865] translate alert input field tips to chinese when using chinese (#12879) * submit email ding talk changes * submit alert messages * submit format * submit format --- .../alert/api/AlertInputTips.java | 70 +++++++++++++++++++ .../dingtalk/DingTalkAlertChannelFactory.java | 3 +- .../alert/email/EmailAlertChannelFactory.java | 7 +- .../feishu/FeiShuAlertChannelFactory.java | 3 +- .../alert/http/HttpAlertChannelFactory.java | 11 +-- .../script/ScriptAlertChannelFactory.java | 7 +- .../alert/slack/SlackAlertChannelFactory.java | 5 +- .../telegram/TelegramAlertChannelFactory.java | 7 +- .../WebexTeamsAlertChannelFactory.java | 11 +-- .../wechat/WeChatAlertChannelFactory.java | 9 +-- 10 files changed, 105 insertions(+), 28 deletions(-) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInputTips.java diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInputTips.java b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInputTips.java new file mode 100644 index 0000000000..dce02b16c9 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInputTips.java @@ -0,0 +1,70 @@ +/* + * Licensed to 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. Apache Software Foundation (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.apache.dolphinscheduler.alert.api; + +import java.util.Locale; + +import org.springframework.context.i18n.LocaleContextHolder; + +public enum AlertInputTips { + + PASSWORD("if enable use authentication, you need input password", "如果开启鉴权校验,则需要输入密码"), + USERNAME("if enable use authentication, you need input user", "如果开启鉴权校验,则需要输入账号"), + RECEIVERS("please input receivers", "请输入收件人"), + URL("input request URL", "请输入请求的URL"), + HEADER("input request headers as JSON format", "请输入JSON格式的请求头"), + JSON_BODY("input request body as JSON format", "请输入JSON格式的请求体"), + FIELD_NAME("input alert msg field name", "请输入告警信息的内容字段名称"), + HTTP_METHOD("input request type POST or GET", "请输入HTTP请求类型POST或GET"), + CUSTOMIZED_PARAMS("the custom parameters passed when calling scripts", "请输入调用脚本时传入的自定义参数"), + SCRIPT_PATH("the absolute script path under alert-server, and make sure access rights", + "请输入alert-server机器的脚本的绝对路径,并确保文件有权接入"), + WEBHOOK("input WebHook Url", "请输入webhook的url"), + BOT_NAME("input the bot username", "请输入bot的名称"), + BOT_TOKEN("input bot access token", "请输入bot的接入token"), + CHANNEL_ID("input telegram channel chat id", "请输入telegram的频道chat id"), + ROOM_ID("input the room ID the alert message send to", "请输入告警信息发送的room ID"), + RECIPIENT_USER_ID("input the person ID of the alert message recipient", "请输入告警信息接收人的person ID"), + RECIPIENT_EMAIL("input the email address of the alert message recipient", "请输入告警信息接收人的email地址"), + WEBEX_MENTION_USERS( + "use `,`(eng commas) to separate multiple emails, to specify the person you mention in the room", + "使用 `, `来分割多个email,来指出在房间中要@的人"), + CORP_ID("please input corp id", "请输入corp id"), + SECRET("please input secret", "请输入secret"), + WECHAT_MENTION_USERS("use `|` to separate userIds and `@all` to everyone", "使用`|`来分割userId或使用`@all`来提到所有人"), + WECHAT_AGENT_ID("please input agent id or chat id", "请输入agent id或chat id"), + ; + + private final String enMsg; + private final String zhMsg; + + AlertInputTips(String enMsg, String zhMsg) { + this.enMsg = enMsg; + this.zhMsg = zhMsg; + } + + public String getMsg() { + if (Locale.SIMPLIFIED_CHINESE.getLanguage().equals(LocaleContextHolder.getLocale().getLanguage())) { + return this.zhMsg; + } else { + return this.enMsg; + } + } +} diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java index cda3674bee..202f435604 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java @@ -24,6 +24,7 @@ import static org.apache.dolphinscheduler.common.constants.Constants.STRING_YES; 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.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; @@ -134,7 +135,7 @@ public final class DingTalkAlertChannelFactory implements AlertChannelFactory { .build(); PasswordParam passwordParam = PasswordParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PASSWORD, DingTalkParamsConstants.DING_TALK_PASSWORD) - .setPlaceholder("if enable use authentication, you need input password") + .setPlaceholder(AlertInputTips.PASSWORD.getMsg()) .build(); return Arrays.asList(webHookParam, keywordParam, secretParam, msgTypeParam, atMobilesParam, atUserIdsParam, diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java index 4ff4bb0eda..d2b955c6f9 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java @@ -25,6 +25,7 @@ import static org.apache.dolphinscheduler.common.constants.Constants.STRING_YES; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; 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.ParamsOptions; @@ -52,7 +53,7 @@ public final class EmailAlertChannelFactory implements AlertChannelFactory { InputParam receivesParam = InputParam .newBuilder(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, MailParamsConstants.PLUGIN_DEFAULT_EMAIL_RECEIVERS) - .setPlaceholder("please input receives") + .setPlaceholder(AlertInputTips.RECEIVERS.getMsg()) .addValidate(Validate.newBuilder() .setRequired(true) .build()) @@ -90,12 +91,12 @@ public final class EmailAlertChannelFactory implements AlertChannelFactory { .build(); InputParam mailUser = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_USER, MailParamsConstants.MAIL_USER) - .setPlaceholder("if enable use authentication, you need input user") + .setPlaceholder(AlertInputTips.USERNAME.getMsg()) .build(); PasswordParam mailPassword = PasswordParam.newBuilder(MailParamsConstants.NAME_MAIL_PASSWD, MailParamsConstants.MAIL_PASSWD) - .setPlaceholder("if enable use authentication, you need input password") + .setPlaceholder(AlertInputTips.PASSWORD.getMsg()) .build(); RadioParam enableTls = RadioParam diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java index 9325fef3c0..ffa77015c8 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java @@ -24,6 +24,7 @@ import static org.apache.dolphinscheduler.common.constants.Constants.STRING_YES; 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.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; @@ -82,7 +83,7 @@ public final class FeiShuAlertChannelFactory implements AlertChannelFactory { .build(); PasswordParam passwordParam = PasswordParam .newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PASSWORD, FeiShuParamsConstants.FEI_SHU_PASSWORD) - .setPlaceholder("if enable use authentication, you need input password") + .setPlaceholder(AlertInputTips.PASSWORD.getMsg()) .build(); return Arrays.asList(webHookParam, isEnableProxy, proxyParam, portParam, userParam, passwordParam); diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java index 0a54b42357..7fca63ea6d 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java @@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.alert.http; 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.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; @@ -40,7 +41,7 @@ public final class HttpAlertChannelFactory implements AlertChannelFactory { public List params() { InputParam url = InputParam.newBuilder(HttpAlertConstants.NAME_URL, HttpAlertConstants.URL) - .setPlaceholder("input request URL") + .setPlaceholder(AlertInputTips.URL.getMsg()) .addValidate(Validate.newBuilder() .setRequired(true) .build()) @@ -48,7 +49,7 @@ public final class HttpAlertChannelFactory implements AlertChannelFactory { InputParam headerParams = InputParam.newBuilder(HttpAlertConstants.NAME_HEADER_PARAMS, HttpAlertConstants.HEADER_PARAMS) - .setPlaceholder("input request headers as JSON format ") + .setPlaceholder(AlertInputTips.HEADER.getMsg()) .addValidate(Validate.newBuilder() .setRequired(true) .build()) @@ -56,7 +57,7 @@ public final class HttpAlertChannelFactory implements AlertChannelFactory { InputParam bodyParams = InputParam.newBuilder(HttpAlertConstants.NAME_BODY_PARAMS, HttpAlertConstants.BODY_PARAMS) - .setPlaceholder("input request body as JSON format ") + .setPlaceholder(AlertInputTips.JSON_BODY.getMsg()) .addValidate(Validate.newBuilder() .setRequired(false) .build()) @@ -64,7 +65,7 @@ public final class HttpAlertChannelFactory implements AlertChannelFactory { InputParam contentField = InputParam.newBuilder(HttpAlertConstants.NAME_CONTENT_FIELD, HttpAlertConstants.CONTENT_FIELD) - .setPlaceholder("input alert msg field name") + .setPlaceholder(AlertInputTips.FIELD_NAME.getMsg()) .addValidate(Validate.newBuilder() .setRequired(true) .build()) @@ -72,7 +73,7 @@ public final class HttpAlertChannelFactory implements AlertChannelFactory { InputParam requestType = InputParam.newBuilder(HttpAlertConstants.NAME_REQUEST_TYPE, HttpAlertConstants.REQUEST_TYPE) - .setPlaceholder("input request type POST or GET") + .setPlaceholder(AlertInputTips.HTTP_METHOD.getMsg()) .addValidate(Validate.newBuilder() .setRequired(true) .build()) diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java index 294bca04fd..81d5439617 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java @@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.alert.script; 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.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; @@ -46,8 +47,7 @@ public final class ScriptAlertChannelFactory implements AlertChannelFactory { .addValidate(Validate.newBuilder() .setRequired(false) .build()) - .setPlaceholder( - "please enter your custom parameters, which will be passed to you when calling your script") + .setPlaceholder(AlertInputTips.CUSTOMIZED_PARAMS.getMsg()) .build(); // need check file type and file exist InputParam scriptPathParam = @@ -55,8 +55,7 @@ public final class ScriptAlertChannelFactory implements AlertChannelFactory { .addValidate(Validate.newBuilder() .setRequired(true) .build()) - .setPlaceholder("please upload the file to the disk directory of the alert server," - + " and ensure that the path is absolute and has the corresponding access rights") + .setPlaceholder(AlertInputTips.SCRIPT_PATH.getMsg()) .build(); RadioParam scriptTypeParams = RadioParam diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java index e08bc4618e..1e81fa2ff6 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java @@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.alert.slack; 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.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; @@ -45,14 +46,14 @@ public final class SlackAlertChannelFactory implements AlertChannelFactory { .addValidate(Validate.newBuilder() .setRequired(true) .build()) - .setPlaceholder("Input WebHook Url") + .setPlaceholder(AlertInputTips.WEBHOOK.getMsg()) .build(); InputParam botName = InputParam.newBuilder(SlackParamsConstants.SLACK_BOT_NAME, SlackParamsConstants.SLACK_BOT) .addValidate(Validate.newBuilder() .setRequired(true) .build()) - .setPlaceholder("Input the bot username") + .setPlaceholder(AlertInputTips.BOT_NAME.getMsg()) .build(); paramsList.add(webHookParam); diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramAlertChannelFactory.java index 0169cafa56..2bd2b61922 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramAlertChannelFactory.java @@ -24,6 +24,7 @@ import static org.apache.dolphinscheduler.common.constants.Constants.STRING_YES; 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.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; @@ -58,7 +59,7 @@ public final class TelegramAlertChannelFactory implements AlertChannelFactory { .addValidate(Validate.newBuilder() .setRequired(true) .build()) - .setPlaceholder("telegram web hook") + .setPlaceholder(AlertInputTips.WEBHOOK.getMsg()) .build(); InputParam botTokenParam = InputParam @@ -66,7 +67,7 @@ public final class TelegramAlertChannelFactory implements AlertChannelFactory { .addValidate(Validate.newBuilder() .setRequired(true) .build()) - .setPlaceholder("telegram bot token") + .setPlaceholder(AlertInputTips.BOT_TOKEN.getMsg()) .build(); InputParam chatIdParam = InputParam @@ -74,7 +75,7 @@ public final class TelegramAlertChannelFactory implements AlertChannelFactory { .addValidate(Validate.newBuilder() .setRequired(true) .build()) - .setPlaceholder("telegram channel chat id") + .setPlaceholder(AlertInputTips.CHANNEL_ID.getMsg()) .build(); SelectParam parseMode = SelectParam diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-webexteams/src/main/java/org/apache/dolphinscheduler/plugin/alert/webexteams/WebexTeamsAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-webexteams/src/main/java/org/apache/dolphinscheduler/plugin/alert/webexteams/WebexTeamsAlertChannelFactory.java index e11078a31c..c6b016df27 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-webexteams/src/main/java/org/apache/dolphinscheduler/plugin/alert/webexteams/WebexTeamsAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-webexteams/src/main/java/org/apache/dolphinscheduler/plugin/alert/webexteams/WebexTeamsAlertChannelFactory.java @@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.alert.webexteams; 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.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; @@ -44,7 +45,7 @@ public final class WebexTeamsAlertChannelFactory implements AlertChannelFactory InputParam botAccessToken = InputParam .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_BOT_ACCESS_TOKEN, WebexTeamsParamsConstants.WEBEX_TEAMS_BOT_ACCESS_TOKEN) - .setPlaceholder("Please enter the robot's access token you were given") + .setPlaceholder(AlertInputTips.BOT_TOKEN.getMsg()) .addValidate(Validate.newBuilder() .setRequired(true) .build()) @@ -53,7 +54,7 @@ public final class WebexTeamsAlertChannelFactory implements AlertChannelFactory InputParam roomId = InputParam .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_ROOM_ID, WebexTeamsParamsConstants.WEBEX_TEAMS_ROOM_ID) - .setPlaceholder("The room ID of the message") + .setPlaceholder(AlertInputTips.ROOM_ID.getMsg()) .addValidate(Validate.newBuilder() .setRequired(false) .build()) @@ -62,7 +63,7 @@ public final class WebexTeamsAlertChannelFactory implements AlertChannelFactory InputParam toPersonId = InputParam .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_TO_PERSON_ID, WebexTeamsParamsConstants.WEBEX_TEAMS_TO_PERSON_ID) - .setPlaceholder("The person ID of the message recipient") + .setPlaceholder(AlertInputTips.RECIPIENT_USER_ID.getMsg()) .addValidate(Validate.newBuilder() .setRequired(false) .build()) @@ -71,7 +72,7 @@ public final class WebexTeamsAlertChannelFactory implements AlertChannelFactory InputParam toPersonEmail = InputParam .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_TO_PERSON_EMAIL, WebexTeamsParamsConstants.WEBEX_TEAMS_TO_PERSON_EMAIL) - .setPlaceholder("The email address of the message recipient") + .setPlaceholder(AlertInputTips.RECIPIENT_EMAIL.getMsg()) .addValidate(Validate.newBuilder() .setRequired(false) .build()) @@ -80,7 +81,7 @@ public final class WebexTeamsAlertChannelFactory implements AlertChannelFactory InputParam atSomeoneInRoom = InputParam .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_AT_SOMEONE_IN_ROOM, WebexTeamsParamsConstants.WEBEX_TEAMS_AT_SOMEONE_IN_ROOM) - .setPlaceholder("use ,(eng commas) to separate multiple emails") + .setPlaceholder(AlertInputTips.WEBEX_MENTION_USERS.getMsg()) .addValidate(Validate.newBuilder() .setRequired(false) .build()) diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java index a357756090..ebad2d72a0 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java @@ -20,6 +20,7 @@ package org.apache.dolphinscheduler.plugin.alert.wechat; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; 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.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; @@ -45,7 +46,7 @@ public final class WeChatAlertChannelFactory implements AlertChannelFactory { InputParam corpIdParam = InputParam .newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_CORP_ID, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_CORP_ID) - .setPlaceholder("please input corp id ") + .setPlaceholder(AlertInputTips.CORP_ID.getMsg()) .addValidate(Validate.newBuilder() .setRequired(true) .build()) @@ -54,7 +55,7 @@ public final class WeChatAlertChannelFactory implements AlertChannelFactory { InputParam secretParam = InputParam .newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_SECRET, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_SECRET) - .setPlaceholder("please input secret ") + .setPlaceholder(AlertInputTips.SECRET.getMsg()) .addValidate(Validate.newBuilder() .setRequired(true) .build()) @@ -63,7 +64,7 @@ public final class WeChatAlertChannelFactory implements AlertChannelFactory { InputParam usersParam = InputParam .newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USERS, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_USERS) - .setPlaceholder("use `|` to separate userIds and `@all` to everyone ") + .setPlaceholder(AlertInputTips.WECHAT_MENTION_USERS.getMsg()) .addValidate(Validate.newBuilder() .setRequired(false) .build()) @@ -72,7 +73,7 @@ public final class WeChatAlertChannelFactory implements AlertChannelFactory { InputParam agentIdParam = InputParam .newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_AGENT_ID, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_AGENT_ID) - .setPlaceholder("please input agent id or chat id ") + .setPlaceholder(AlertInputTips.WECHAT_AGENT_ID.getMsg()) .addValidate(Validate.newBuilder() .setRequired(true) .build())