Merge branch 'upstream-develop'

This commit is contained in:
hxy1991 2018-12-01 11:55:32 +08:00
commit b3dcd9f91a
3 changed files with 12 additions and 50 deletions

View File

@ -98,7 +98,7 @@ class ConfigEditor extends React.Component {
lineNumbersMinChars: true,
theme: 'vs-dark',
wordWrapColumn: 120,
folding: true,
folding: false,
showFoldingControls: 'always',
wordWrap: 'wordWrapColumn',
cursorStyle: 'line',
@ -116,7 +116,7 @@ class ConfigEditor extends React.Component {
lineNumbersMinChars: true,
theme: 'vs-dark',
wordWrapColumn: 120,
folding: true,
folding: false,
showFoldingControls: 'always',
wordWrap: 'wordWrapColumn',
cursorStyle: 'line',

View File

@ -22,7 +22,6 @@ import ImportDialog from 'components/ImportDialog';
import ExportDialog from 'components/ExportDialog';
import { getParams, setParams, request, aliwareIntl } from '../../../globalLib';
import {
Balloon,
Button,
Checkbox,
Collapse,
@ -799,48 +798,6 @@ class ConfigurationManagement extends React.Component {
const locale = {
empty: pubnodedata,
};
const helpDataId = (
<Balloon
trigger={
<span>
Data ID{' '}
<Icon
type={'help'}
size={'small'}
style={{ color: '#1DC11D', marginRight: 5, verticalAlign: 'middle' }}
/>
</span>
}
align={'t'}
style={{ marginRight: 5 }}
triggerType={'hover'}
>
<a href={window._getLink && window._getLink('knowDataid')} target={'_blank'}>
{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.click_to_learn_DataId')}
</a>
</Balloon>
);
const helpGroup = (
<Balloon
trigger={
<span>
Group{' '}
<Icon
type={'help'}
size={'small'}
style={{ color: '#1DC11D', marginRight: 5, verticalAlign: 'middle' }}
/>
</span>
}
align={'t'}
style={{ marginRight: 5 }}
triggerType={'hover'}
>
<a href={window._getLink && window._getLink('knowGoup')} target={'_blank'}>
{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.click_to_learn_Group')}
</a>
</Balloon>
);
return (
<div>
<BatchHandle ref={ref => (this.batchHandle = ref)} />
@ -1040,8 +997,8 @@ class ConfigurationManagement extends React.Component {
language={aliwareIntl.currentLanguageCode}
ref={'dataTable'}
>
<Table.Column title={helpDataId} dataIndex={'dataId'} />
<Table.Column title={helpGroup} dataIndex={'group'} />
<Table.Column title={'Data Id'} dataIndex={'dataId'} />
<Table.Column title={'Group'} dataIndex={'group'} />
{!this.inApp ? (
<Table.Column
title={aliwareIntl.get('nacos.page.configurationManagement.HOME_Application')}

View File

@ -120,17 +120,22 @@ public class PeerSet {
peers.put(candidate.ip, candidate);
SortedBag ips = new TreeBag();
int maxApproveCount = 0;
String maxApprovePeer = null;
for (RaftPeer peer : peers.values()) {
if (StringUtils.isEmpty(peer.voteFor)) {
continue;
}
ips.add(peer.voteFor);
if (ips.getCount(peer.voteFor) > maxApproveCount) {
maxApproveCount = ips.getCount(peer.voteFor);
maxApprovePeer = peer.voteFor;
}
}
String first = (String) ips.last();
if (ips.getCount(first) >= majorityCount()) {
RaftPeer peer = peers.get(first);
if (maxApproveCount >= majorityCount()) {
RaftPeer peer = peers.get(maxApprovePeer);
peer.state = RaftPeer.State.LEADER;
if (!Objects.equals(leader, peer)) {