Skip to content

Commit

Permalink
credit history
Browse files Browse the repository at this point in the history
  • Loading branch information
KJ committed Feb 22, 2022
1 parent 7c4e630 commit d0ff161
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@
<span>{{ 'AccountDetail.Account lifecycle' | translate }}</span>
</a>
</li>
<li [ngClass]="{'is-active': currentTab == 'credit-history'}">
<a routerLink="." fragment="credit-history">
<span>{{ 'AccountDetail.Credit history' | translate }}</span>
</a>
</li>
<li [ngClass]="{'is-active': currentTab == 'roles'}">
<a routerLink="." fragment="roles">
<span>{{ 'AccountDetail.Roles' | translate }}</span>
Expand Down Expand Up @@ -764,6 +769,27 @@
<a class="card-footer-item" routerLink="." [queryParams]="{ authoredBlocksPage: authoredBlocksPage + 1}" [fragment]="currentTab">{{ 'AccountDetail.View next' | translate }}</a>
</footer>
</div>
<div class="card-table" id="credit-history" *ngIf="currentTab == 'credit-history'">
<div class="content">
<app-loading-box *ngIf="!creditUpdates || creditUpdates.is_loading"></app-loading-box>
<table class="table is-fullwidth is-striped" *ngIf="creditUpdates?.data">
<thead>
<th class="is-hidden-mobile">{{ 'AccountDetail.Block' | translate }} #</th>
<th>{{ 'AccountDetail.Datetime' | translate }}</th>
<th>{{ 'AccountDetail.Credit' | translate }}</th>
<th>Event</th>
</thead>
<tbody>
<tr *ngFor="let creditUpdate of creditUpdates.data">
<td class="is-hidden-mobile"><a [routerLink]="[networkURLPrefix, 'block', creditUpdate.attributes.block_id]">{{ creditUpdate.attributes.block_id }}</a></td>
<td>{{ creditUpdate.attributes.block_datetime }} </td>
<td>{{ creditUpdate.attributes.attributes[1].value }} </td>
<td width="5%"><a class="button is-small is-primary" routerLink="{{ networkURLPrefix }}/event/{{ creditUpdate.id }}">Details</a></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="card-table" id="roles" *ngIf="currentTab == 'roles'">
<div class="content">
<table class="table is-fullwidth is-striped">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class AccountDetailComponent implements OnInit, OnDestroy {

public slashes: DocumentCollection<Event>;
public rewards: DocumentCollection<Event>;
public creditUpdates: DocumentCollection<Event>;
public councilActivity: DocumentCollection<Event>;
public memberActivity: DocumentCollection<Extrinsic>;
public electionActivity: DocumentCollection<Event>;
Expand Down Expand Up @@ -135,7 +136,7 @@ export class AccountDetailComponent implements OnInit, OnDestroy {
this.fragmentSubsription = this.activatedRoute.fragment.subscribe(value => {
if ([
'roles', 'transactions', 'slashes', 'transfers', 'rewards', 'council', 'election', 'member', 'techcomm', 'balance-history',
'bonding', 'imonline', 'identity', 'authoredblocks', 'lifecycle', 'treasury', 'proposals', 'referenda',
'bonding', 'imonline', 'identity', 'authoredblocks', 'lifecycle', 'treasury', 'proposals', 'referenda', 'credit-history',
'sessions'
].includes(value)) {
this.currentTab = value;
Expand Down Expand Up @@ -269,6 +270,8 @@ export class AccountDetailComponent implements OnInit, OnDestroy {
this.accountLifecyclePage = +queryParams.accountLifecyclePage || 1;
this.getAccountLifecycle(this.accountLifecyclePage);

this.getCreditUpdateEvents();

this.proposalActivityPage = +queryParams.proposalActivityPage || 1;
this.getProposalActivity(this.proposalActivityPage);

Expand Down Expand Up @@ -402,6 +405,15 @@ export class AccountDetailComponent implements OnInit, OnDestroy {
});
}

public getCreditUpdateEvents() {
this.eventService.all({
// page: {number: page, size: 25},
remotefilter: {address: this.accountId, search_index: '43'},
}).subscribe(events => {
this.creditUpdates = events;
});
}

public getSlashEvents(page: number) {
this.eventService.all({
page: {number: page, size: 25},
Expand Down

0 comments on commit d0ff161

Please sign in to comment.