Fix update metadata failed bug, modify health status display words
This commit is contained in:
parent
c824b2a463
commit
216007ff97
@ -473,7 +473,7 @@ window.i18ndoc = {
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.service_name": "服务名",
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.cluster_count": "集群数目",
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.ip_count": "IP数目",
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.health_status": "健康程度",
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.health_status": "健康实例/所有实例",
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.operation": "操作",
|
||||
"com.alibaba.nacos.page.serviceManagement.query": "查询",
|
||||
"serviceManagement": "服务列表",
|
||||
@ -980,7 +980,7 @@ window.i18ndoc = {
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.service_name": "Service Name",
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.cluster_count": "Cluster Count",
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.ip_count": "IP Count",
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.health_status": "Health Status",
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.health_status": "Healthy Instances/All Instances",
|
||||
"com.alibaba.nacos.page.serviceManagement.table.column.operation": "Operation",
|
||||
"com.alibaba.nacos.page.serviceManagement.query": "Search",
|
||||
"serviceManagement": "Service Management",
|
||||
|
@ -31,14 +31,15 @@ import com.alibaba.nacos.naming.view.ServiceDetailView;
|
||||
import com.alibaba.nacos.naming.view.ServiceView;
|
||||
import com.alibaba.nacos.naming.web.BaseServlet;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dungu.zpf
|
||||
@ -84,20 +85,7 @@ public class CatalogController {
|
||||
}
|
||||
}
|
||||
|
||||
double validRatio = validCount * 1.0 / vDomain.allIPs().size();
|
||||
|
||||
// FIXME:
|
||||
validRatio = RandomUtils.nextDouble(0, 1.2);
|
||||
|
||||
if (validRatio > 0.9) {
|
||||
serviceView.setStatus("优");
|
||||
} else if (validRatio > 0.6) {
|
||||
serviceView.setStatus("良");
|
||||
} else if (validRatio > 0.3) {
|
||||
serviceView.setStatus("中");
|
||||
} else {
|
||||
serviceView.setStatus("差");
|
||||
}
|
||||
serviceView.setStatus(validCount + "/" + vDomain.allIPs().size());
|
||||
|
||||
domArray.add(serviceView);
|
||||
}
|
||||
|
@ -24,6 +24,9 @@ import com.alibaba.nacos.naming.core.VirtualClusterDomain;
|
||||
import com.alibaba.nacos.naming.exception.NacosException;
|
||||
import com.alibaba.nacos.naming.misc.UtilsAndCommons;
|
||||
import com.alibaba.nacos.naming.web.BaseServlet;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@ -47,7 +50,9 @@ public class ClusterController {
|
||||
String clusterName = BaseServlet.required(request, "clusterName");
|
||||
String serviceName = BaseServlet.required(request, "serviceName");
|
||||
String healthChecker = BaseServlet.required(request, "healthChecker");
|
||||
String metadata = BaseServlet.required(request, "metadata");
|
||||
String metadata = BaseServlet.optional(request, "metadata", StringUtils.EMPTY);
|
||||
String checkPort = BaseServlet.required(request, "checkPort");
|
||||
String useInstancePort4Check = BaseServlet.required(request, "useInstancePort4Check");
|
||||
|
||||
VirtualClusterDomain domain = (VirtualClusterDomain) domainsManager.getDomain(serviceName);
|
||||
if (domain == null) {
|
||||
@ -59,6 +64,9 @@ public class ClusterController {
|
||||
throw new NacosException(NacosException.INVALID_PARAM, "cluster not found:"+ clusterName + ", " + serviceName);
|
||||
}
|
||||
|
||||
cluster.setDefCkport(NumberUtils.toInt(checkPort));
|
||||
cluster.setUseIPPort4Check(BooleanUtils.toBoolean(useInstancePort4Check));
|
||||
|
||||
JSONObject healthCheckObj = JSON.parseObject(healthChecker);
|
||||
AbstractHealthChecker abstractHealthChecker;
|
||||
|
||||
|
@ -22,6 +22,7 @@ import com.alibaba.nacos.naming.exception.NacosException;
|
||||
import com.alibaba.nacos.naming.healthcheck.HealthCheckMode;
|
||||
import com.alibaba.nacos.naming.misc.UtilsAndCommons;
|
||||
import com.alibaba.nacos.naming.web.BaseServlet;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -77,7 +78,7 @@ public class ServiceController {
|
||||
String serviceName = BaseServlet.required(request, "serviceName");
|
||||
float protectThreshold = NumberUtils.toFloat(BaseServlet.required(request, "protectThreshold"));
|
||||
String healthCheckMode = BaseServlet.required(request, "healthCheckMode");
|
||||
String metadata = BaseServlet.required(request, "metadata");
|
||||
String metadata = BaseServlet.optional(request, "metadata", StringUtils.EMPTY);
|
||||
|
||||
VirtualClusterDomain domain = (VirtualClusterDomain) domainsManager.getDomain(serviceName);
|
||||
if (domain == null) {
|
||||
|
@ -212,6 +212,10 @@ public class UtilsAndCommons {
|
||||
|
||||
Map<String, String> metadataMap = new HashMap<>(16);
|
||||
|
||||
if (StringUtils.isBlank(metadata)) {
|
||||
return metadataMap;
|
||||
}
|
||||
|
||||
try {
|
||||
metadataMap = JSON.parseObject(metadata, new TypeReference<Map<String, String>>(){});
|
||||
} catch (Exception e) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
server.port=8080
|
||||
server.port=8848
|
||||
server.servlet.context-path=/nacos
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user