Merge branch 'develop' into feature_naming_ap

# Conflicts:
#	api/pom.xml
#	client/pom.xml
#	cmdb/pom.xml
#	common/pom.xml
#	config/pom.xml
#	console/pom.xml
#	core/pom.xml
#	distribution/pom.xml
#	example/pom.xml
#	naming/pom.xml
#	naming/src/main/java/com/alibaba/nacos/naming/consistency/persistent/raft/RaftCore.java
#	naming/src/main/java/com/alibaba/nacos/naming/controllers/RaftController.java
#	naming/src/main/java/com/alibaba/nacos/naming/core/ServiceManager.java
#	pom.xml
#	test/pom.xml
This commit is contained in:
nkorange 2019-01-23 13:50:02 +08:00
commit 19b785b20d
9 changed files with 39 additions and 16 deletions

View File

@ -12,6 +12,7 @@
"no-template-curly-in-string": "off",
"no-unused-vars": "off",
"no-tabs": "off",
"no-param-reassign": "off",
"react/no-string-refs": "off",
"react/no-unused-state": "off",
"no-return-assign": "off",
@ -29,6 +30,6 @@
"generator-star-spacing": "off",
"wrap-iife": "off",
"arrow-parens": "off",
"indent": "off",
"indent": "off"
}
}

View File

@ -61,6 +61,9 @@ class EditServiceDialog extends React.Component {
protectThreshold: locale.protectThresholdRequired,
healthCheckMode: locale.healthCheckModeRequired,
};
if (field.protectThreshold === 0) {
field.protectThreshold = '0';
}
for (const key in field) {
if (!field[key]) {
errors[key] = { validateState: 'error', help: helpMap[key] };

View File

@ -14,7 +14,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { request } from '@/globalLib';
import { Button, Card, ConfigProvider, Form, Loading } from '@alifd/next';
import { Input, Button, Card, ConfigProvider, Form, Loading } from '@alifd/next';
import EditServiceDialog from './EditServiceDialog';
import EditClusterDialog from './EditClusterDialog';
import InstanceTable from './InstanceTable';
@ -126,25 +126,25 @@ class ServiceDetail extends React.Component {
</Button>
</h1>
<Form style={{ width: '60%' }} {...pageFormLayout}>
<Form {...pageFormLayout}>
<FormItem label={`${locale.serviceName}:`}>
<p>{service.name}</p>
<Input value={service.name} readOnly />
</FormItem>
<FormItem label={`${locale.protectThreshold}:`}>
<p>{service.protectThreshold}</p>
<Input value={service.protectThreshold} readOnly />
</FormItem>
<FormItem label={`${locale.healthCheckPattern}:`}>
<p>{service.healthCheckMode}</p>
<Input value={service.healthCheckMode} readOnly />
</FormItem>
<FormItem label={`${locale.metadata}:`}>
<p>{metadataText}</p>
<Input value={metadataText} readOnly />
</FormItem>
<FormItem label={`${locale.type}:`}>
<p>{selector.type}</p>
<Input value={selector.type} readOnly />
</FormItem>
{service.type === 'label' && (
<FormItem label={`${locale.selector}:`}>
<p>{selector.selector}</p>
<Input value={selector.selector} readOnly />
</FormItem>
)}
</Form>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -36,7 +36,9 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.*;
@ -857,7 +859,13 @@ public class RaftCore {
}
private void deleteDatum(String key) {
Datum deleted = datums.remove(key);
Datum deleted = null;
try {
deleted = datums.remove(URLDecoder.decode(key, "UTF-8"));
} catch (UnsupportedEncodingException e) {
Loggers.RAFT.warn("datum key decode failed: {}", key);
}
if (deleted != null) {
RaftStore.delete(deleted);
notifier.addTask(deleted, ApplyAction.DELETE);

View File

@ -46,7 +46,7 @@ public class ClusterController {
@Autowired
protected ServiceManager domainsManager;
@RequestMapping(value = {"/update", "/add"}, method = RequestMethod.PUT)
@RequestMapping(value = "", method = RequestMethod.PUT)
public String update(HttpServletRequest request) throws Exception {
String namespaceId = WebUtils.optional(request, Constants.REQUEST_PARAM_NAMESPACE_ID,

View File

@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -76,6 +77,7 @@ public class RaftController {
String entity = new String(IoUtils.tryDecompress(request.getInputStream()), "UTF-8");
String value = Arrays.asList(entity).toArray(new String[1])[0];
value = URLDecoder.decode(value, "UTF-8");
JSONObject json = JSON.parseObject(value);
JSONObject beat = JSON.parseObject(json.getString("beat"));
@ -124,6 +126,7 @@ public class RaftController {
String entity = IOUtils.toString(request.getInputStream(), "UTF-8");
String value = Arrays.asList(entity).toArray(new String[1])[0];
value = URLDecoder.decode(value, "UTF-8");
JSONObject json = JSON.parseObject(value);
raftConsistencyService.put(json.getString("key"), json.getString("value"));
@ -150,6 +153,7 @@ public class RaftController {
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Content-Encode", "gzip");
String keysString = WebUtils.required(request, "keys");
keysString = URLDecoder.decode(keysString, "UTF-8");
String[] keys = keysString.split(",");
List<Datum> datums = new ArrayList<Datum>();
@ -186,6 +190,7 @@ public class RaftController {
String entity = IOUtils.toString(request.getInputStream(), "UTF-8");
String value = Arrays.asList(entity).toArray(new String[1])[0];
value = URLDecoder.decode(value, "UTF-8");
JSONObject jsonObject = JSON.parseObject(value);
Datum datum = JSON.parseObject(jsonObject.getString("datum"), Datum.class);
@ -205,6 +210,7 @@ public class RaftController {
String entity = IOUtils.toString(request.getInputStream(), "UTF-8");
String value = Arrays.asList(entity).toArray(new String[1])[0];
value = URLDecoder.decode(value, "UTF-8");
JSONObject jsonObject = JSON.parseObject(value);
Datum datum = JSON.parseObject(jsonObject.getString("datum"), Datum.class);

View File

@ -25,6 +25,7 @@ import com.alibaba.nacos.naming.cluster.members.Member;
import com.alibaba.nacos.naming.consistency.ConsistencyService;
import com.alibaba.nacos.naming.consistency.DataListener;
import com.alibaba.nacos.naming.consistency.Datum;
import com.alibaba.nacos.api.common.Constants;
import com.alibaba.nacos.naming.misc.*;
import com.alibaba.nacos.naming.push.PushService;
import org.apache.commons.lang3.ArrayUtils;
@ -640,6 +641,10 @@ public class ServiceManager implements DataListener {
public String namespaceId;
public Map<String, String> domName2Checksum = new HashMap<String, String>();
public DomainChecksum() {
this.namespaceId = Constants.REQUEST_PARAM_DEFAULT_NAMESPACE_ID;
}
public DomainChecksum(String namespaceId) {
this.namespaceId = namespaceId;
}