Add token symbol to accounts datatable.

This commit is contained in:
Spencer Ofwiti 2021-06-22 13:16:42 +03:00
parent 3b5976c32c
commit b08250fd12
2 changed files with 13 additions and 3 deletions

View File

@ -89,7 +89,9 @@
<ng-container matColumnDef="balance">
<mat-header-cell *matHeaderCellDef mat-sort-header> BALANCE </mat-header-cell>
<mat-cell *matCellDef="let user"> {{ user?.balance | tokenRatio }} </mat-cell>
<mat-cell *matCellDef="let user">
{{ user?.balance | tokenRatio }} {{ tokenSymbol | uppercase }}
</mat-cell>
</ng-container>
<ng-container matColumnDef="location">

View File

@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, OnInit, ViewChild } from '@angular/
import { MatTableDataSource } from '@angular/material/table';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { LoggingService, UserService } from '@app/_services';
import { LoggingService, TokenService, UserService } from '@app/_services';
import { Router } from '@angular/router';
import { exportCsv } from '@app/_helpers';
import { strip0x } from '@src/assets/js/ethtx/dist/hex';
@ -24,6 +24,7 @@ export class AccountsComponent implements OnInit {
pageSizeOptions: Array<number> = [10, 20, 50, 100];
accountsType: string = 'all';
accountTypes: Array<string>;
tokenSymbol: string;
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@ -31,11 +32,13 @@ export class AccountsComponent implements OnInit {
constructor(
private userService: UserService,
private loggingService: LoggingService,
private router: Router
private router: Router,
private tokenService: TokenService
) {}
async ngOnInit(): Promise<void> {
await this.userService.init();
await this.tokenService.init();
try {
// TODO it feels like this should be in the onInit handler
await this.userService.loadAccounts(100);
@ -52,6 +55,11 @@ export class AccountsComponent implements OnInit {
.getAccountTypes()
.pipe(first())
.subscribe((res) => (this.accountTypes = res));
this.tokenService.load.subscribe(async (status: boolean) => {
if (status) {
this.tokenSymbol = await this.tokenService.getTokenSymbol();
}
});
}
doFilter(value: string): void {