Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 服务测试模块内的方法测试执行后,动态生成consumer信息,host为空时,控制台和服务'消费者'标签无法显示问题 #920

Merged
merged 4 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.dubbo.common.BaseServiceMetadata;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.url.component.DubboServiceAddressURL;
import org.apache.dubbo.common.utils.StringUtils;

import java.util.ArrayList;
Expand Down Expand Up @@ -97,7 +98,13 @@ public static Consumer url2Consumer(Pair<String, URL> pair) {
String version = url.getUrlParam().getParameter(Constants.VERSION_KEY);
String service = BaseServiceMetadata.buildServiceKey(getServiceInterface(url), group, version);
c.setService(service);
c.setAddress(url.getHost());
if (url.getHost() == null) {
if (url instanceof DubboServiceAddressURL) {
c.setAddress(((DubboServiceAddressURL) url).getConsumerURL().getRawParameter("host"));
}
} else {
c.setAddress(url.getHost());
}
c.setApplication(url.getParameter(Constants.APPLICATION_KEY));
c.setParameters(url.toParameterString());

Expand Down
4 changes: 2 additions & 2 deletions dubbo-admin-ui/src/components/ServiceDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@
})
},
getIp: function (address) {
return address.split(':')[0]
return address != null ? address.split(':')[0] : null
},
getPort: function (address) {
return address.split(':')[1]
return address != null && address.split(':').length >= 1 ? address.split(':')[1] : null
},
toCopyText (text) {
this.$copyText(text).then(() => {
Expand Down