diff --git a/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/web/governance/module/screen/Providers.java b/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/web/governance/module/screen/Providers.java index e368ecc2197..1f8df3f6949 100644 --- a/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/web/governance/module/screen/Providers.java +++ b/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/web/governance/module/screen/Providers.java @@ -23,8 +23,10 @@ import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; /** *

Providers.

@@ -107,11 +109,35 @@ else if (application != null && application.length() > 0) { } context.put("providers", providers); + context.put("serviceAppMap", getServiceAppMap(providers)); // 设置搜索结果到cookie中 setSearchHistroy(context, value); } + /** + * @author WangXin + * 计算各个服务对应的应用列表,方便页面对"重复"的提示 + * @param providers app services + */ + private Map> getServiceAppMap(List providers) { + Map> serviceAppMap = new HashMap>(); + if (providers != null && providers.size() >= 0) { + for (Provider provider : providers) { + Set appSet; + String service = provider.getService(); + if (serviceAppMap.get(service) == null) { + appSet = new HashSet(); + } else { + appSet = serviceAppMap.get(service); + } + appSet.add(provider.getApplication()); + serviceAppMap.put(service, appSet); + } + } + return serviceAppMap; + } + /** * 设置search记录到cookie中,操作步骤: * 检查加入的记录是否已经存在cookie中,如果存在,则更新列表次序;如果不存在,则插入到最前面 diff --git a/dubbo-admin/src/main/webapp/WEB-INF/i18n/message_zh.properties b/dubbo-admin/src/main/webapp/WEB-INF/i18n/message_zh.properties index d2dcb1ac45b..15d9241db54 100644 --- a/dubbo-admin/src/main/webapp/WEB-INF/i18n/message_zh.properties +++ b/dubbo-admin/src/main/webapp/WEB-INF/i18n/message_zh.properties @@ -456,7 +456,7 @@ confirm.batch.tostatic=\u786e\u5b9a\u8f6c\u4e3a\u9759\u6001\u6240\u9009\u9879? confirm.batch.todynamic=\u786e\u5b9a\u8f6c\u4e3a\u52a8\u6001\u6240\u9009\u9879? current.user=\u5f53\u524d\u7528\u6237 CheckProviderLocalAddress={0}\u4E0D\u662F\u6709\u6548\u7684\u8FDC\u7A0B\u670D\u52A1\u5730\u5740\uFF0C\u8BF7\u68C0\u67E5\u63D0\u4F9B\u65B9/etc/hosts\u6620\u5C04\u662F\u5426\u6B63\u786E\u3002 -CheckProviderApplicationDifferent=\u591a\u4e2a\u4e0d\u540c\u5e94\u7528\u6ce8\u518c\u4e86\u76f8\u540c\u670d\u52a1\uFF0C\u8BF7\u68C0\u67E5{0}\u548C{1}\u4E2D\u662F\u5426\u6709\u8BEF\u66B4\u9732\u3002 +CheckProviderApplicationDifferent=\u591a\u4e2a\u4e0d\u540c\u5e94\u7528\u6ce8\u518c\u4e86\u76f8\u540c\u670d\u52a1\uff0c\u8bf7\u68c0\u67e5{0}\u4e2d\u662f\u5426\u6709\u8bef\u66b4\u9732\u3002 CheckProviderAddressMismatch=\u670d\u52a1URL\u4e0a\u7684IP\u4e0e\u8fde\u63a5\u6ce8\u518c\u4e2d\u5fc3\u7684IP\u4e0d\u76f8\u540c CheckConnectionDisconnected=\u8be5\u8fde\u63a5\u5df2\u65ad\u5f00\uff0c\u6570\u636e\u5e93\u810f\u6570\u636e\uff0c\u8bf7\u70b9\u51fb\u201c\u91cd\u8fde\u201d CheckConnectionExpired=\u8be5\u8fde\u63a5\u6240\u5728\u6ce8\u518c\u4e2d\u5fc3\u5df2\u4e0d\u5b58\u5728\uff08\u6570\u636e\u4f1a\u81ea\u52a8\u5b9a\u671f\u6e05\u7406\uff09 diff --git a/dubbo-admin/src/main/webapp/WEB-INF/i18n/message_zh_TW.properties b/dubbo-admin/src/main/webapp/WEB-INF/i18n/message_zh_TW.properties index 3c1b7c0b4bc..8e4a18bc492 100644 --- a/dubbo-admin/src/main/webapp/WEB-INF/i18n/message_zh_TW.properties +++ b/dubbo-admin/src/main/webapp/WEB-INF/i18n/message_zh_TW.properties @@ -424,7 +424,7 @@ confirm.batch.tostatic=\u78ba\u5b9a\u8f49\u70ba\u975c\u614b\u6240\u9078\u9805? confirm.batch.todynamic=\u78ba\u5b9a\u8f49\u70ba\u52d5\u614b\u6240\u9078\u9805? current.user=\u7576\u524d\u7528\u6236 CheckProviderAddressMismatch=\u670d\u52d9URL\u4e0a\u7684IP\u8207\u9023\u63a5\u8a3b\u518a\u4e2d\u5fc3\u7684IP\u4e0d\u76f8\u540c -CheckProviderApplicationDifferent=\u591a\u500b\u4e0d\u540c\u61c9\u7528\u8a3b\u518a\u4e86\u76f8\u540c\u670d\u52d9 +CheckProviderApplicationDifferent=\u591a\u500b\u4e0d\u540c\u61c9\u7528\u8a3b\u518a\u4e86\u76f8\u540c\u670d\u52d9\uff0c\u8acb\u6aa2\u67e5{0}\u4e2d\u662f\u5426\u6709\u8aa4\u66b4\u9732\u3002 CheckConnectionDisconnected=\u8a72\u9023\u63a5\u5df2\u65b7\u958b\uff0c\u8cc7\u6599\u5eab\u9ad2\u8cc7\u6599\uff0c\u8acb\u9ede\u64ca\u201c\u91cd\u9023\u201d CheckConnectionExpired=\u8a72\u9023\u63a5\u6240\u5728\u8a3b\u518a\u4e2d\u5fc3\u5df2\u4e0d\u5b58\u5728\uff08\u8cc7\u6599\u6703\u81ea\u52d5\u5b9a\u671f\u6e05\u7406\uff09 CheckDatabaseMiss=\u8cc7\u6599\u5eab\u8cc7\u6599\u610f\u5916\u4e1f\u5931\u6b64\u8cc7\u6599\uff0c\u8acb\u9ede\u64ca\u201c\u6062\u5fa9\u201d diff --git a/dubbo-admin/src/main/webapp/WEB-INF/templates/governance/screen/providers/index.vm b/dubbo-admin/src/main/webapp/WEB-INF/templates/governance/screen/providers/index.vm index 746da434675..099dcba9266 100644 --- a/dubbo-admin/src/main/webapp/WEB-INF/templates/governance/screen/providers/index.vm +++ b/dubbo-admin/src/main/webapp/WEB-INF/templates/governance/screen/providers/index.vm @@ -88,15 +88,11 @@ #set($errorLevel = "ok") #set($errorMessage = "") - - #if ($providerApplication == "") - #set($providerApplication = $provider.application) - #end - - #if($providerApplication != $provider.application) + #set($appList = $!serviceAppMap.get($provider.service)) + #if($appList.size()>1) #if ($errorLevel != "error") #set($errorLevel = "warn") #end #set($errorMessage ="$errorMessage
$i18n.get('warn'): $i18n.get( - 'CheckProviderApplicationDifferent', $providerApplication, $provider.application)") + 'CheckProviderApplicationDifferent', $appList)") #end #if($provider.address.startsWith("127.") || $provider.address.startsWith(