(Feature) Add validator key to the table

This commit is contained in:
Roman Storm 2018-01-21 20:21:23 -08:00
parent d8dd34fb7d
commit d4ad97afb1
6 changed files with 38 additions and 14 deletions

View File

@ -724,15 +724,15 @@ textarea {
display: table-row; display: table-row;
width: 100% !important; } } width: 100% !important; } }
.ballots-about-i_name { .ballots-about-i_name {
width: 25%; } width: 20%; }
.ballots-about-i_action { .ballots-about-i_action {
width: 15%; } width: 10%; }
.ballots-about-i_type { .ballots-about-i_type {
width: 15%; } width: 10%; }
.ballots-about-i_proposal { .ballots-about-i_proposal {
width: 30%; } width: 30%; }
.ballots-about-i_mining-key { .ballots-about-i_mining-key {
width: 30%; width: 25%;
word-break: break-all; } word-break: break-all; }
.ballots-about-i_proposed-min-threshold { .ballots-about-i_proposed-min-threshold {
width: 60%; width: 60%;
@ -744,7 +744,7 @@ textarea {
width: 30%; width: 30%;
word-break: break-all; } word-break: break-all; }
.ballots-about-i_time { .ballots-about-i_time {
width: 15%; width: 10%;
text-align: right; } text-align: right; }
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
.ballots-about-i_time { .ballots-about-i_time {

View File

@ -32,15 +32,15 @@
} }
&_name { &_name {
width: 25%; width: 20%;
} }
&_action { &_action {
width: 15%; width: 10%;
} }
// 25
&_type { &_type {
width: 15%; width: 10%;
} }
&_proposal { &_proposal {
@ -48,7 +48,7 @@
} }
&_mining-key { &_mining-key {
width: 30%; width: 25%;
word-break: break-all; word-break: break-all;
} }
@ -68,7 +68,7 @@
} }
&_time { &_time {
width: 15%; width: 10%;
text-align: right; text-align: right;
@media screen and (max-width: $tablet-width) { @media screen and (max-width: $tablet-width) {

View File

@ -338,7 +338,7 @@ export class BallotCard extends React.Component {
<div className="ballots-about"> <div className="ballots-about">
<div className="ballots-about-i ballots-about-i_name"> <div className="ballots-about-i ballots-about-i_name">
<div className="ballots-about-td"> <div className="ballots-about-td">
<p className="ballots-about-i--title">Name</p> <p className="ballots-about-i--title">Proposer</p>
</div> </div>
<div className="ballots-about-td"> <div className="ballots-about-td">
<p className="ballots-i--name">{this.creator}</p> <p className="ballots-i--name">{this.creator}</p>

View File

@ -11,6 +11,7 @@ export class BallotKeysCard extends React.Component {
@observable affectedKeyTypeDisplayName; @observable affectedKeyTypeDisplayName;
@observable ballotType; @observable ballotType;
@observable ballotTypeDisplayName; @observable ballotTypeDisplayName;
@observable miningKey;
@action("Get ballotTypeDisplayName") @action("Get ballotTypeDisplayName")
getBallotTypeDisplayName(ballotType) { getBallotTypeDisplayName(ballotType) {
@ -73,12 +74,20 @@ export class BallotKeysCard extends React.Component {
let affectedKey = await contractsStore.votingToChangeKeys.getAffectedKey(id); let affectedKey = await contractsStore.votingToChangeKeys.getAffectedKey(id);
this.affectedKey = affectedKey; this.affectedKey = affectedKey;
} }
@action("Get mining key of keys ballot")
getMiningKey = async () => {
const { contractsStore, id } = this.props;
let miningKey = await contractsStore.votingToChangeKeys.getMiningKey(id);
const metadata = await contractsStore.getValidatorMetadata(miningKey)
this.miningKey = `${metadata.lastName} ${miningKey}`;
}
constructor(props) { constructor(props) {
super(props); super(props);
this.getAffectedKey(); this.getAffectedKey();
this.getAffectedKeyType(); this.getAffectedKeyType();
this.getBallotType(); this.getBallotType();
this.getMiningKey();
} }
isSearchPattern = () => { isSearchPattern = () => {
@ -120,6 +129,14 @@ export class BallotKeysCard extends React.Component {
<p>{this.affectedKey}</p> <p>{this.affectedKey}</p>
</div> </div>
</div> </div>
<div className="ballots-about-i ballots-about-i_mining-key">
<div className="ballots-about-td">
<p className="ballots-about-i--title">Validator key</p>
</div>
<div className="ballots-about-td">
<p>{this.miningKey}</p>
</div>
</div>
</BallotCard> </BallotCard>
); );
} }

View File

@ -72,6 +72,10 @@ export default class VotingToChangeKeys {
return this.votingToChangeKeysInstance.methods.getAffectedKey(_id).call(); return this.votingToChangeKeysInstance.methods.getAffectedKey(_id).call();
} }
getMiningKey(_id) {
return this.votingToChangeKeysInstance.methods.getMiningKey(_id).call();
}
getMiningByVotingKey(_votingKey) { getMiningByVotingKey(_votingKey) {
return this.votingToChangeKeysInstance.methods.getMiningByVotingKey(_votingKey).call(); return this.votingToChangeKeysInstance.methods.getMiningByVotingKey(_votingKey).call();
} }

View File

@ -203,7 +203,10 @@ class ContractsStore {
const metadata = await this.validatorMetadata.getValidatorData({miningKey: key}) const metadata = await this.validatorMetadata.getValidatorData({miningKey: key})
this.validatorsMetadata.push({label: `${key} ${metadata.lastName}`, value: key}) this.validatorsMetadata.push({label: `${key} ${metadata.lastName}`, value: key})
}) })
}
@action
async getValidatorMetadata(miningKey) {
return await this.validatorMetadata.getValidatorData({miningKey})
} }
} }