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

View File

@ -22,7 +22,6 @@ import ImportDialog from 'components/ImportDialog';
import ExportDialog from 'components/ExportDialog'; import ExportDialog from 'components/ExportDialog';
import { getParams, setParams, request, aliwareIntl } from '../../../globalLib'; import { getParams, setParams, request, aliwareIntl } from '../../../globalLib';
import { import {
Balloon,
Button, Button,
Checkbox, Checkbox,
Collapse, Collapse,
@ -799,48 +798,6 @@ class ConfigurationManagement extends React.Component {
const locale = { const locale = {
empty: pubnodedata, 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 ( return (
<div> <div>
<BatchHandle ref={ref => (this.batchHandle = ref)} /> <BatchHandle ref={ref => (this.batchHandle = ref)} />
@ -1040,8 +997,8 @@ class ConfigurationManagement extends React.Component {
language={aliwareIntl.currentLanguageCode} language={aliwareIntl.currentLanguageCode}
ref={'dataTable'} ref={'dataTable'}
> >
<Table.Column title={helpDataId} dataIndex={'dataId'} /> <Table.Column title={'Data Id'} dataIndex={'dataId'} />
<Table.Column title={helpGroup} dataIndex={'group'} /> <Table.Column title={'Group'} dataIndex={'group'} />
{!this.inApp ? ( {!this.inApp ? (
<Table.Column <Table.Column
title={aliwareIntl.get('nacos.page.configurationManagement.HOME_Application')} title={aliwareIntl.get('nacos.page.configurationManagement.HOME_Application')}

View File

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