This is an automated email from the ASF dual-hosted git repository.

zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 7876d455ab [Fix-16517][Alert Instance] Alert plugin instance i18n 
wrong result in rendering frontend ui (#16751)
7876d455ab is described below

commit 7876d455ab01bbe04bbcb5b9703a1c5ceec20a4d
Author: 小可耐 <[email protected]>
AuthorDate: Tue Nov 5 14:31:22 2024 +0800

    [Fix-16517][Alert Instance] Alert plugin instance i18n wrong result in 
rendering frontend ui (#16751)
---
 .../alert/voice/VoiceAlertChannelFactory.java      | 15 +++++++-----
 .../dolphinscheduler/alert/api/AlertInputTips.java |  9 ++++++++
 .../dingtalk/DingTalkAlertChannelFactory.java      |  3 ++-
 .../alert/email/EmailAlertChannelFactory.java      |  7 +++---
 .../alert/feishu/FeiShuAlertChannelFactory.java    |  3 ++-
 .../plugin/alert/http/HttpAlertChannelFactory.java |  7 +++---
 .../prometheus/PrometheusAlertChannelFactory.java  |  7 +++---
 .../alert/script/ScriptAlertChannelFactory.java    |  5 ++--
 .../alert/slack/SlackAlertChannelFactory.java      |  5 ++--
 .../telegram/TelegramAlertChannelFactory.java      |  9 ++++----
 .../webexteams/WebexTeamsAlertChannelFactory.java  | 11 +++++----
 .../alert/wechat/WeChatAlertChannelFactory.java    |  9 ++++----
 .../api/service/UiPluginServiceTest.java           | 14 ++++++++++-
 .../security/alarm-instance-manage/detail.tsx      | 27 +++++++++++++++++++++-
 14 files changed, 95 insertions(+), 36 deletions(-)

diff --git 
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-aliyunVoice/src/main/java/org/apache/dolphinscheduler/plugin/alert/voice/VoiceAlertChannelFactory.java
 
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-aliyunVoice/src/main/java/org/apache/dolphinscheduler/plugin/alert/voice/VoiceAlertChannelFactory.java
index 2fb5820e37..0e5b8f6036 100644
--- 
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-aliyunVoice/src/main/java/org/apache/dolphinscheduler/plugin/alert/voice/VoiceAlertChannelFactory.java
+++ 
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-aliyunVoice/src/main/java/org/apache/dolphinscheduler/plugin/alert/voice/VoiceAlertChannelFactory.java
@@ -20,6 +20,7 @@ package org.apache.dolphinscheduler.plugin.alert.voice;
 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.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.spi.params.base.PluginParams;
 import org.apache.dolphinscheduler.spi.params.base.Validate;
 import org.apache.dolphinscheduler.spi.params.input.InputParam;
@@ -42,7 +43,7 @@ public final class VoiceAlertChannelFactory implements 
AlertChannelFactory {
 
         InputParam calledNumber =
                 InputParam.newBuilder(VoiceAlertConstants.NAME_CALLED_NUMBER, 
VoiceAlertConstants.CALLED_NUMBER)
-                        .setPlaceholder(AlertInputTips.CALLED_NUMBER.getMsg())
+                        
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.CALLED_NUMBER)))
                         .addValidate(Validate.newBuilder()
                                 .setRequired(true)
                                 .build())
@@ -50,21 +51,21 @@ public final class VoiceAlertChannelFactory implements 
AlertChannelFactory {
 
         InputParam calledShowNumber = InputParam
                 .newBuilder(VoiceAlertConstants.NAME_CALLED_SHOW_NUMBER, 
VoiceAlertConstants.CALLED_SHOW_NUMBER)
-                .setPlaceholder(AlertInputTips.CALLED_SHOW_NUMBER.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.CALLED_SHOW_NUMBER)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(false)
                         .build())
                 .build();
 
         InputParam ttsCode = 
InputParam.newBuilder(VoiceAlertConstants.NAME_TTS_CODE, 
VoiceAlertConstants.TTS_CODE)
-                .setPlaceholder(AlertInputTips.TTS_CODE.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.TTS_CODE)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(false)
                         .build())
                 .build();
 
         InputParam address = 
InputParam.newBuilder(VoiceAlertConstants.NAME_ADDRESS, 
VoiceAlertConstants.ADDRESS)
-                .setPlaceholder(AlertInputTips.ALIYUN_VIICE_ADDRESS.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.ALIYUN_VIICE_ADDRESS)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(false)
                         .build())
@@ -72,14 +73,16 @@ public final class VoiceAlertChannelFactory implements 
AlertChannelFactory {
 
         InputParam accessKeyId =
                 InputParam.newBuilder(VoiceAlertConstants.NAME_ACCESS_KEY_ID, 
VoiceAlertConstants.ACCESS_KEY_ID)
-                        
.setPlaceholder(AlertInputTips.ALIYUN_VIICE_ACCESSKEYID.getMsg())
+                        .setPlaceholder(JSONUtils
+                                
.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.ALIYUN_VIICE_ACCESSKEYID)))
                         .addValidate(Validate.newBuilder()
                                 .setRequired(false)
                                 .build())
                         .build();
         InputParam accessKeySecret =
                 
InputParam.newBuilder(VoiceAlertConstants.NAME_ACCESS_KEY_SECRET, 
VoiceAlertConstants.ACCESS_KEY_SECRET)
-                        
.setPlaceholder(AlertInputTips.ALIYUN_VIICE_ACCESSKEY_SECRET.getMsg())
+                        .setPlaceholder(JSONUtils
+                                
.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.ALIYUN_VIICE_ACCESSKEY_SECRET)))
                         .addValidate(Validate.newBuilder()
                                 .setRequired(false)
                                 .build())
diff --git 
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInputTips.java
 
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInputTips.java
index 1dba93a03f..a0b783e814 100644
--- 
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInputTips.java
+++ 
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInputTips.java
@@ -17,7 +17,9 @@
 
 package org.apache.dolphinscheduler.alert.api;
 
+import java.util.HashMap;
 import java.util.Locale;
+import java.util.Map;
 
 import org.springframework.context.i18n.LocaleContextHolder;
 
@@ -73,4 +75,11 @@ public enum AlertInputTips {
             return this.enMsg;
         }
     }
+
+    public static Map<String, String> getAllMsg(AlertInputTips alertInputTips) 
{
+        Map<String, String> allMsgMap = new HashMap<>();
+        allMsgMap.put("zhMsg", alertInputTips.zhMsg);
+        allMsgMap.put("enMsg", alertInputTips.enMsg);
+        return allMsgMap;
+    }
 }
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 85a03abf25..7437536d22 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
@@ -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.AlertInputTips;
+import org.apache.dolphinscheduler.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.spi.params.base.DataType;
 import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
 import org.apache.dolphinscheduler.spi.params.base.PluginParams;
@@ -137,7 +138,7 @@ public final class DingTalkAlertChannelFactory implements 
AlertChannelFactory {
                 .build();
         InputParam passwordParam = InputParam
                 .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PASSWORD, 
DingTalkParamsConstants.DING_TALK_PASSWORD)
-                .setPlaceholder(AlertInputTips.PASSWORD.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.PASSWORD)))
                 .setType("password")
                 .build();
 
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 b82860b1ad..4fce013542 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
@@ -27,6 +27,7 @@ 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.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.spi.params.base.DataType;
 import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
 import org.apache.dolphinscheduler.spi.params.base.PluginParams;
@@ -54,7 +55,7 @@ public final class EmailAlertChannelFactory implements 
AlertChannelFactory {
         InputParam receivesParam = InputParam
                 
.newBuilder(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS,
                         MailParamsConstants.PLUGIN_DEFAULT_EMAIL_RECEIVERS)
-                .setPlaceholder(AlertInputTips.RECEIVERS.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.RECEIVERS)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(true)
                         .build())
@@ -93,12 +94,12 @@ public final class EmailAlertChannelFactory implements 
AlertChannelFactory {
                         .build();
 
         InputParam mailUser = 
InputParam.newBuilder(MailParamsConstants.NAME_MAIL_USER, 
MailParamsConstants.MAIL_USER)
-                .setPlaceholder(AlertInputTips.USERNAME.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.USERNAME)))
                 .build();
 
         InputParam mailPassword =
                 InputParam.newBuilder(MailParamsConstants.NAME_MAIL_PASSWD, 
MailParamsConstants.MAIL_PASSWD)
-                        .setPlaceholder(AlertInputTips.PASSWORD.getMsg())
+                        
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.PASSWORD)))
                         .setType("password")
                         .build();
 
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 016cfa9a70..a251876fe7 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
@@ -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.AlertInputTips;
+import org.apache.dolphinscheduler.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.spi.params.base.DataType;
 import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
 import org.apache.dolphinscheduler.spi.params.base.PluginParams;
@@ -86,7 +87,7 @@ public final class FeiShuAlertChannelFactory implements 
AlertChannelFactory {
                         .build();
         InputParam passwordParam = InputParam
                 .newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PASSWORD, 
FeiShuParamsConstants.FEI_SHU_PASSWORD)
-                .setPlaceholder(AlertInputTips.PASSWORD.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.PASSWORD)))
                 .setType("password")
                 .build();
 
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 3b7dc84d4b..178485a600 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
@@ -21,6 +21,7 @@ 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.common.model.OkHttpRequestHeaderContentType;
+import org.apache.dolphinscheduler.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.spi.params.base.DataType;
 import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
 import org.apache.dolphinscheduler.spi.params.base.PluginParams;
@@ -46,7 +47,7 @@ public final class HttpAlertChannelFactory implements 
AlertChannelFactory {
     public List<PluginParams> params() {
 
         InputParam url = InputParam.newBuilder(HttpAlertConstants.NAME_URL, 
HttpAlertConstants.URL)
-                .setPlaceholder(AlertInputTips.URL.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.URL)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(true)
                         .build())
@@ -54,7 +55,7 @@ public final class HttpAlertChannelFactory implements 
AlertChannelFactory {
 
         InputParam headerParams =
                 InputParam.newBuilder(HttpAlertConstants.NAME_HEADER_PARAMS, 
HttpAlertConstants.HEADER_PARAMS)
-                        .setPlaceholder(AlertInputTips.HEADER.getMsg())
+                        
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.HEADER)))
                         .addValidate(Validate.newBuilder()
                                 .setRequired(false)
                                 .build())
@@ -75,7 +76,7 @@ public final class HttpAlertChannelFactory implements 
AlertChannelFactory {
 
         InputParam bodyParams =
                 InputParam.newBuilder(HttpAlertConstants.NAME_BODY_PARAMS, 
HttpAlertConstants.BODY_PARAMS)
-                        .setPlaceholder(AlertInputTips.JSON_BODY.getMsg())
+                        
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.JSON_BODY)))
                         .addValidate(Validate.newBuilder()
                                 .setRequired(false)
                                 .build())
diff --git 
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-prometheus/src/main/java/org/apache/dolphinscheduler/plugin/alert/prometheus/PrometheusAlertChannelFactory.java
 
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-prometheus/src/main/java/org/apache/dolphinscheduler/plugin/alert/prometheus/PrometheusAlertChannelFactory.java
index 093b14a2c1..33bdb67d92 100644
--- 
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-prometheus/src/main/java/org/apache/dolphinscheduler/plugin/alert/prometheus/PrometheusAlertChannelFactory.java
+++ 
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-prometheus/src/main/java/org/apache/dolphinscheduler/plugin/alert/prometheus/PrometheusAlertChannelFactory.java
@@ -20,6 +20,7 @@ package org.apache.dolphinscheduler.plugin.alert.prometheus;
 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.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.spi.params.base.PluginParams;
 import org.apache.dolphinscheduler.spi.params.base.Validate;
 import org.apache.dolphinscheduler.spi.params.input.InputParam;
@@ -43,7 +44,7 @@ public final class PrometheusAlertChannelFactory implements 
AlertChannelFactory
                 InputParam
                         
.newBuilder(PrometheusAlertConstants.NAME_ALERT_MANAGER_URL,
                                 PrometheusAlertConstants.ALERT_MANAGER_URL)
-                        .setPlaceholder(AlertInputTips.URL.getMsg())
+                        
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.URL)))
                         .addValidate(Validate.newBuilder()
                                 .setRequired(true)
                                 .build())
@@ -52,14 +53,14 @@ public final class PrometheusAlertChannelFactory implements 
AlertChannelFactory
                 InputParam
                         
.newBuilder(PrometheusAlertConstants.NAME_ALERT_MANAGER_ANNOTATIONS,
                                 
PrometheusAlertConstants.ALERT_MANAGER_ANNOTATIONS)
-                        .setPlaceholder(AlertInputTips.ANNOTATION.getMsg())
+                        
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.ANNOTATION)))
                         .addValidate(Validate.newBuilder()
                                 .setRequired(false).build())
                         .build();
         InputParam generatorUrlParam =
                 InputParam
                         
.newBuilder(PrometheusAlertConstants.NAME_GENERATOR_URL, 
PrometheusAlertConstants.GENERATOR_URL)
-                        .setPlaceholder(AlertInputTips.GENERATOR_URL.getMsg())
+                        
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.GENERATOR_URL)))
                         .addValidate(Validate.newBuilder()
                                 .setRequired(false).build())
                         .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 81d5439617..a8364c2f33 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
@@ -20,6 +20,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.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
 import org.apache.dolphinscheduler.spi.params.base.PluginParams;
 import org.apache.dolphinscheduler.spi.params.base.Validate;
@@ -47,7 +48,7 @@ public final class ScriptAlertChannelFactory implements 
AlertChannelFactory {
                 .addValidate(Validate.newBuilder()
                         .setRequired(false)
                         .build())
-                .setPlaceholder(AlertInputTips.CUSTOMIZED_PARAMS.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.CUSTOMIZED_PARAMS)))
                 .build();
         // need check file type and file exist
         InputParam scriptPathParam =
@@ -55,7 +56,7 @@ public final class ScriptAlertChannelFactory implements 
AlertChannelFactory {
                         .addValidate(Validate.newBuilder()
                                 .setRequired(true)
                                 .build())
-                        .setPlaceholder(AlertInputTips.SCRIPT_PATH.getMsg())
+                        
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.SCRIPT_PATH)))
                         .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 1e81fa2ff6..2b749ffdb6 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
@@ -20,6 +20,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.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.spi.params.base.PluginParams;
 import org.apache.dolphinscheduler.spi.params.base.Validate;
 import org.apache.dolphinscheduler.spi.params.input.InputParam;
@@ -46,14 +47,14 @@ public final class SlackAlertChannelFactory implements 
AlertChannelFactory {
                 .addValidate(Validate.newBuilder()
                         .setRequired(true)
                         .build())
-                .setPlaceholder(AlertInputTips.WEBHOOK.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.WEBHOOK)))
                 .build();
 
         InputParam botName = 
InputParam.newBuilder(SlackParamsConstants.SLACK_BOT_NAME, 
SlackParamsConstants.SLACK_BOT)
                 .addValidate(Validate.newBuilder()
                         .setRequired(true)
                         .build())
-                .setPlaceholder(AlertInputTips.BOT_NAME.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.BOT_NAME)))
                 .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 284ecee8fa..9fd7014c38 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
@@ -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.AlertInputTips;
+import org.apache.dolphinscheduler.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.spi.params.base.DataType;
 import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
 import org.apache.dolphinscheduler.spi.params.base.PluginParams;
@@ -60,7 +61,7 @@ public final class TelegramAlertChannelFactory implements 
AlertChannelFactory {
                 .addValidate(Validate.newBuilder()
                         .setRequired(true)
                         .build())
-                .setPlaceholder(AlertInputTips.WEBHOOK.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.WEBHOOK)))
                 .build();
 
         InputParam botTokenParam = InputParam
@@ -68,7 +69,7 @@ public final class TelegramAlertChannelFactory implements 
AlertChannelFactory {
                 .addValidate(Validate.newBuilder()
                         .setRequired(true)
                         .build())
-                .setPlaceholder(AlertInputTips.BOT_TOKEN.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.BOT_TOKEN)))
                 .build();
 
         InputParam chatIdParam = InputParam
@@ -76,7 +77,7 @@ public final class TelegramAlertChannelFactory implements 
AlertChannelFactory {
                 .addValidate(Validate.newBuilder()
                         .setRequired(true)
                         .build())
-                .setPlaceholder(AlertInputTips.CHANNEL_ID.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.CHANNEL_ID)))
                 .build();
 
         SelectParam parseMode = SelectParam
@@ -135,7 +136,7 @@ public final class TelegramAlertChannelFactory implements 
AlertChannelFactory {
                 .addValidate(Validate.newBuilder()
                         .setRequired(false)
                         .build())
-                .setPlaceholder("if enable use authentication, you need input 
password")
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.PASSWORD)))
                 .setType("password")
                 .build();
 
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 c6b016df27..777058aa0a 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
@@ -20,6 +20,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.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
 import org.apache.dolphinscheduler.spi.params.base.PluginParams;
 import org.apache.dolphinscheduler.spi.params.base.Validate;
@@ -45,7 +46,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(AlertInputTips.BOT_TOKEN.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.BOT_TOKEN)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(true)
                         .build())
@@ -54,7 +55,7 @@ public final class WebexTeamsAlertChannelFactory implements 
AlertChannelFactory
         InputParam roomId = InputParam
                 .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_ROOM_ID,
                         WebexTeamsParamsConstants.WEBEX_TEAMS_ROOM_ID)
-                .setPlaceholder(AlertInputTips.ROOM_ID.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.ROOM_ID)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(false)
                         .build())
@@ -63,7 +64,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(AlertInputTips.RECIPIENT_USER_ID.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.RECIPIENT_USER_ID)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(false)
                         .build())
@@ -72,7 +73,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(AlertInputTips.RECIPIENT_EMAIL.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.RECIPIENT_EMAIL)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(false)
                         .build())
@@ -81,7 +82,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(AlertInputTips.WEBEX_MENTION_USERS.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.WEBEX_MENTION_USERS)))
                 .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 ebad2d72a0..d1d2532f85 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
@@ -22,6 +22,7 @@ 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.common.utils.JSONUtils;
 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,7 +47,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(AlertInputTips.CORP_ID.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.CORP_ID)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(true)
                         .build())
@@ -55,7 +56,7 @@ public final class WeChatAlertChannelFactory implements 
AlertChannelFactory {
         InputParam secretParam = InputParam
                 
.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_SECRET,
                         WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_SECRET)
-                .setPlaceholder(AlertInputTips.SECRET.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.SECRET)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(true)
                         .build())
@@ -64,7 +65,7 @@ public final class WeChatAlertChannelFactory implements 
AlertChannelFactory {
         InputParam usersParam = InputParam
                 
.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USERS,
                         WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_USERS)
-                .setPlaceholder(AlertInputTips.WECHAT_MENTION_USERS.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.WECHAT_MENTION_USERS)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(false)
                         .build())
@@ -73,7 +74,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(AlertInputTips.WECHAT_AGENT_ID.getMsg())
+                
.setPlaceholder(JSONUtils.toJsonString(AlertInputTips.getAllMsg(AlertInputTips.WECHAT_AGENT_ID)))
                 .addValidate(Validate.newBuilder()
                         .setRequired(true)
                         .build())
diff --git 
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UiPluginServiceTest.java
 
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UiPluginServiceTest.java
index 3002d9a20f..e9ef94fee9 100644
--- 
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UiPluginServiceTest.java
+++ 
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UiPluginServiceTest.java
@@ -20,6 +20,7 @@ package org.apache.dolphinscheduler.api.service;
 import org.apache.dolphinscheduler.api.enums.Status;
 import org.apache.dolphinscheduler.api.service.impl.UiPluginServiceImpl;
 import org.apache.dolphinscheduler.common.enums.PluginType;
+import org.apache.dolphinscheduler.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.dao.entity.PluginDefine;
 import org.apache.dolphinscheduler.dao.mapper.PluginDefineMapper;
 
@@ -35,6 +36,8 @@ import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.junit.jupiter.MockitoExtension;
 
+import com.fasterxml.jackson.databind.node.ArrayNode;
+
 /**
  * ui plugin service test
  */
@@ -51,7 +54,8 @@ public class UiPluginServiceTest {
 
     @BeforeEach
     public void before() {
-        String pluginParams = 
"[{\"field\":\"receivers\",\"props\":null,\"type\"}]";
+        String pluginParams =
+                
"[{\"field\":\"receivers\",\"props\":{\"placeholder\":\"{\\\"zhMsg\\\": 
\\\"请输入收件人\\\",\\\"enMsg\\\": 
\\\"pleaseinputreceivers\\\"}\"},\"type\":\"input\"}]";
         pluginDefine = new PluginDefine("email-alert", "alert", pluginParams);
     }
 
@@ -82,6 +86,14 @@ public class UiPluginServiceTest {
         
Mockito.when(pluginDefineMapper.queryDetailById(1)).thenReturn(pluginDefine);
         result = uiPluginService.queryUiPluginDetailById(1);
         Assertions.assertEquals(Status.SUCCESS, result.get("status"));
+
+        PluginDefine data = (PluginDefine) result.get("data");
+        String pluginParams = data.getPluginParams();
+        ArrayNode arrayNode = JSONUtils.parseArray(pluginParams);
+        String placeholder = 
arrayNode.path(0).path("props").path("placeholder").asText();
+        Map<String, String> placeholderMap = JSONUtils.toMap(placeholder);
+        Assertions.assertEquals("请输入收件人", placeholderMap.get("zhMsg"));
+        Assertions.assertEquals("pleaseinputreceivers", 
placeholderMap.get("enMsg"));
     }
 
 }
diff --git 
a/dolphinscheduler-ui/src/views/security/alarm-instance-manage/detail.tsx 
b/dolphinscheduler-ui/src/views/security/alarm-instance-manage/detail.tsx
index 4970a02b62..972bdc00bb 100644
--- a/dolphinscheduler-ui/src/views/security/alarm-instance-manage/detail.tsx
+++ b/dolphinscheduler-ui/src/views/security/alarm-instance-manage/detail.tsx
@@ -53,7 +53,7 @@ const DetailModal = defineComponent({
   props,
   emits: ['cancel', 'update'],
   setup(props, ctx) {
-    const { t } = useI18n()
+    const { t, locale } = useI18n()
 
     const rules = ref<IFormRules>({})
     const elements = ref<IFormItem[]>([]) as IElements
@@ -94,6 +94,30 @@ const DetailModal = defineComponent({
 
     const trim = getCurrentInstance()?.appContext.config.globalProperties.trim
 
+    function isJSON(str: string): boolean {
+      try {
+        const parsed = JSON.parse(str)
+        return typeof parsed === 'object' && parsed !== null
+      } catch (e) {
+        return false
+      }
+    }
+
+    function updatePlaceholder(mergedItem: any) {
+      const { props } = mergedItem
+      if (!props || !props.placeholder) return
+
+      const placeholder = props.placeholder
+      if (!isJSON(placeholder)) return
+
+      const msgMap = JSON.parse(placeholder)
+      if (locale.value === 'zh_CN') {
+        props.placeholder = msgMap.zhMsg
+      } else if (locale.value === 'en_US') {
+        props.placeholder = msgMap.enMsg
+      }
+    }
+
     watch(
       () => props.show,
       async () => {
@@ -109,6 +133,7 @@ const DetailModal = defineComponent({
           mergedItem.name = t(
             'security.alarm_instance' + '.' + mergedItem.field
           )
+          updatePlaceholder(mergedItem)
         })
         const { rules: fieldsRules, elements: fieldsElements } =
           getElementByJson(state.json, state.detailForm)


Reply via email to