update mechanic for new ballot form
This commit is contained in:
parent
d6ae1c11cf
commit
95cac8f05d
|
@ -228,7 +228,7 @@
|
|||
"arr-flatten": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
|
||||
"integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE="
|
||||
"integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg=="
|
||||
},
|
||||
"arr-union": {
|
||||
"version": "3.1.0",
|
||||
|
@ -2308,7 +2308,7 @@
|
|||
"cosmiconfig": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-2.2.2.tgz",
|
||||
"integrity": "sha1-YXPOvVb6wELB9DkO33r2wHx8uJI=",
|
||||
"integrity": "sha512-GiNXLwAFPYHy25XmTPpafYvn3CLAkJ8FLsscq78MQd1Kh0OU6Yzhn4eV2MVF4G9WEQZoWEGltatdR+ntGPMl5A==",
|
||||
"requires": {
|
||||
"is-directory": "0.3.1",
|
||||
"js-yaml": "3.7.0",
|
||||
|
@ -5450,7 +5450,7 @@
|
|||
"hosted-git-info": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz",
|
||||
"integrity": "sha1-bWDjSzq7yDEwYsO3mO+NkBoHrzw="
|
||||
"integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg=="
|
||||
},
|
||||
"hpack.js": {
|
||||
"version": "2.1.6",
|
||||
|
@ -8140,7 +8140,7 @@
|
|||
"normalize-package-data": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
|
||||
"integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=",
|
||||
"integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==",
|
||||
"requires": {
|
||||
"hosted-git-info": "2.5.0",
|
||||
"is-builtin-module": "1.0.0",
|
||||
|
@ -8259,7 +8259,7 @@
|
|||
"npmlog": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
|
||||
"integrity": "sha1-CKfyqL9zRgR3mp76StXMcXq7lUs=",
|
||||
"integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
|
||||
"requires": {
|
||||
"are-we-there-yet": "1.1.4",
|
||||
"console-control-strings": "1.1.0",
|
||||
|
@ -10134,7 +10134,7 @@
|
|||
"randomatic": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz",
|
||||
"integrity": "sha1-x6vpzIuHwLqodrGf3oP9RkeX44w=",
|
||||
"integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==",
|
||||
"requires": {
|
||||
"is-number": "3.0.0",
|
||||
"kind-of": "4.0.0"
|
||||
|
@ -10762,7 +10762,7 @@
|
|||
"safe-buffer": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
||||
"integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM="
|
||||
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
|
||||
},
|
||||
"sane": {
|
||||
"version": "1.6.0",
|
||||
|
@ -13378,7 +13378,7 @@
|
|||
"dependencies": {
|
||||
"fs-extra": {
|
||||
"version": "0.30.0",
|
||||
"resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
|
||||
"integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=",
|
||||
"requires": {
|
||||
"graceful-fs": "4.1.11",
|
||||
|
@ -13467,7 +13467,7 @@
|
|||
"which": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz",
|
||||
"integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=",
|
||||
"integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==",
|
||||
"requires": {
|
||||
"isexe": "2.0.0"
|
||||
}
|
||||
|
@ -13480,7 +13480,7 @@
|
|||
"wide-align": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz",
|
||||
"integrity": "sha1-Vx4PGwYEY268DfwhsDObvjE0FxA=",
|
||||
"integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==",
|
||||
"requires": {
|
||||
"string-width": "1.0.2"
|
||||
},
|
||||
|
|
|
@ -48,6 +48,11 @@ export class NewBallot extends React.Component {
|
|||
|
||||
if (ballotStore.isBallotForKey) {
|
||||
for (let ballotKeysProp in ballotStore.ballotKeys) {
|
||||
if (!ballotStore.ballotKeys[ballotKeysProp]) {
|
||||
swal("Warning!", `Ballot ${ballotKeysProp} is empty`, "warning");
|
||||
commonStore.hideLoading();
|
||||
return false;
|
||||
}
|
||||
if (ballotStore.ballotKeys[ballotKeysProp].length === 0) {
|
||||
swal("Warning!", `Ballot ${ballotKeysProp} is empty`, "warning");
|
||||
commonStore.hideLoading();
|
||||
|
@ -99,6 +104,12 @@ export class NewBallot extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
if (!ballotStore.isBallotForKey && !ballotStore.isBallotForMinThreshold && !ballotStore.isBallotForProxy) {
|
||||
swal("Warning!", messages.BALLOT_TYPE_IS_EMPTY_MSG, "warning");
|
||||
commonStore.hideLoading();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -205,6 +216,15 @@ export class NewBallot extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
menuItemActive = (ballotType) => {
|
||||
const { ballotStore } = this.props;
|
||||
if (ballotType == ballotStore.ballotType) {
|
||||
return 'ballot-types-i ballot-types-i_active';
|
||||
} else {
|
||||
return 'ballot-types-i';
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { contractsStore, ballotStore } = this.props;
|
||||
let validator = ballotStore.isNewValidatorPersonalData ? <Validator />: "";
|
||||
|
@ -233,13 +253,22 @@ export class NewBallot extends React.Component {
|
|||
<form action="" className="new-form">
|
||||
<div className="new-form-side new-form-side_left">
|
||||
<div className="ballot-types">
|
||||
<div className="ballot-types-i ballot-types-i_active">
|
||||
<div
|
||||
className={this.menuItemActive(ballotStore.BallotType.keys)}
|
||||
onClick={(e) => ballotStore.changeBallotType(e, ballotStore.BallotType.keys)}
|
||||
>
|
||||
Validator Management Ballot
|
||||
</div>
|
||||
<div className="ballot-types-i">
|
||||
<div
|
||||
className={this.menuItemActive(ballotStore.BallotType.minThreshold)}
|
||||
onClick={(e) => ballotStore.changeBallotType(e, ballotStore.BallotType.minThreshold)}
|
||||
>
|
||||
Consenus Thershold Ballot
|
||||
</div>
|
||||
<div className="ballot-types-i">
|
||||
<div
|
||||
className={this.menuItemActive(ballotStore.BallotType.proxy)}
|
||||
onClick={(e) => ballotStore.changeBallotType(e, ballotStore.BallotType.proxy)}
|
||||
>
|
||||
Modify Proxy Contract Ballot
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -12,6 +12,7 @@ messages.AFFECTED_KEY_IS_NOT_ADDRESS_MSG = "Ballot affectedKey isn't address";
|
|||
messages.MINING_KEY_IS_NOT_ADDRESS_MSG = "Ballot miningKey isn't address";
|
||||
messages.PROPOSED_ADDRESS_IS_NOT_ADDRESS_MSG = "Ballot proposedAddress isn't address";
|
||||
messages.END_TIME_SHOULD_BE_GREATER_THAN_NOW_MSG = "Ballot end time should be greater than now";
|
||||
messages.BALLOT_TYPE_IS_EMPTY_MSG = "Ballot type is empty";
|
||||
messages.NO_METAMASK_MSG = `You haven't chosen any account in MetaMask.
|
||||
Please, choose your voting key in MetaMask and reload the page.
|
||||
Check POA Network <a href='https://github.com/poanetwork/wiki' target='blank'>wiki</a> for more info.`;
|
||||
|
|
Loading…
Reference in New Issue