Browse Source

web-ui: Display total rewards on BlockDetails view

scalafmt-draft
Alexis Hernandez 7 years ago
parent
commit
0719a0455d
  1. 3
      web-ui/src/app/app.component.ts
  2. 12
      web-ui/src/app/components/block-details/block-details.component.html
  3. 32
      web-ui/src/app/components/block-details/block-details.component.ts

3
web-ui/src/app/app.component.ts

@ -87,7 +87,8 @@ export class AppComponent {
'label.tposContract': 'Contract',
'label.owner': 'Owner',
'label.merchant': 'Merchant'
'label.merchant': 'Merchant',
'label.total': 'Total'
};
}
}

12
web-ui/src/app/components/block-details/block-details.component.html

@ -110,6 +110,11 @@
<label class="col-sm-2 col-md-1 col-xs-1 col-lg-1">{{'label.rewards' | translate}}</label>
</div>
<div class="row">
<label class="col-sm-2 col-md-1 col-xs-1 col-lg-1">{{'label.total' | translate}}</label>
<label class="col-sm-2 col-md-1 col-xs-1 col-lg-1">{{getPoSTotalReward(blockDetails)}} {{'label.coinName' | translate}}</label>
</div>
<div class="row">
<label class="col-sm-offset-1 col-md-offset-1 col-offset-xs-1 col-offset-lg-1">{{'label.coinstake' | translate}}</label>
</div>
@ -146,7 +151,12 @@
<div class="row">
<label class="col-sm-2 col-md-1 col-xs-1 col-lg-1">{{'label.rewards' | translate}}</label>
</div>
<div class="row">
<label class="col-sm-2 col-md-1 col-xs-1 col-lg-1">{{'label.total' | translate}}</label>
<label class="col-sm-2 col-md-1 col-xs-1 col-lg-1">{{getTPoSTotalReward(blockDetails)}} {{'label.coinName' | translate}}</label>
</div>
<div class="row">
<label class="col-sm-offset-1 col-md-offset-1 col-offset-xs-1 col-offset-lg-1">{{'label.owner' | translate}}</label>
</div>

32
web-ui/src/app/components/block-details/block-details.component.ts

@ -66,4 +66,36 @@ export class BlockDetailsComponent implements OnInit {
isTPoS(details: BlockDetails): boolean {
return !this.isPoW(details) && details.block.tposContract != null;
}
getPoSTotalReward(details: BlockDetails): number {
let total = 0;
if (details.rewards.masternode != null) {
total += details.rewards.masternode.value;
}
if (details.rewards.coinstake != null) {
total += details.rewards.coinstake.value;
}
return total;
}
getTPoSTotalReward(details: BlockDetails): number {
let total = 0;
if (details.rewards.masternode != null) {
total += details.rewards.masternode.value;
}
if (details.rewards.owner != null) {
total += details.rewards.owner.value;
}
if (details.rewards.merchant != null) {
total += details.rewards.merchant.value;
}
return total;
}
}

Loading…
Cancel
Save