Commit 74769d16 authored by Pieterjan Vanhoof's avatar Pieterjan Vanhoof Committed by GitHub

Merge pull request #64 from stratisproject/ui

Adjust dashboard and history components to new history structure
parents 554eaa01 5b6cf1bf
...@@ -21,18 +21,20 @@ ...@@ -21,18 +21,20 @@
<div>Transactions</div> <div>Transactions</div>
<table cellspacing="5px" cellpadding="5px" class="transactionsTable" *ngIf="transactions; else noTransactions"> <table cellspacing="5px" cellpadding="5px" class="transactionsTable" *ngIf="transactions; else noTransactions">
<thead> <thead>
<th>Type</th>
<th>Amount</th> <th>Amount</th>
<th>Confirmed</th>
<th>Timestamp</th>
<th>Transaction ID</th> <th>Transaction ID</th>
<th>Confirmed in block</th>
<th>Timestamp</th>
</thead> </thead>
<tr *ngFor="let transaction of transactions; let i=index"> <tr *ngFor="let transaction of transactions; let i=index">
<!--<td *ngIf="{{ transaction.amount }} < 0">SENT</td> <!--<td *ngIf="{{ transaction.amount }} < 0">SENT</td>
<td *ngIf="{{ transaction.amount }} > 0">RECEIVED</td>--> <td *ngIf="{{ transaction.amount }} > 0">RECEIVED</td>-->
<td *ngIf="i<5">{{ transaction.type }}</td>
<td *ngIf="i<5">{{ transaction.amount | coinNotation | coinAbbreviation }}</td> <td *ngIf="i<5">{{ transaction.amount | coinNotation | coinAbbreviation }}</td>
<td *ngIf="i<5">{{ transaction.confirmed }}</td> <td *ngIf="i<5">{{ transaction.id }}</td>
<td *ngIf="i<5">{{ transaction.confirmedInBlock }}</td>
<td *ngIf="i<5">{{ transaction.timestamp * 1000 | date:'medium' }}</td> <td *ngIf="i<5">{{ transaction.timestamp * 1000 | date:'medium' }}</td>
<td *ngIf="i<5">{{ transaction.txId }}</td>
</tr> </tr>
</table> </table>
<ng-template #noTransactions>Looks like you haven't made any transactions yet</ng-template> <ng-template #noTransactions>Looks like you haven't made any transactions yet</ng-template>
......
...@@ -17,11 +17,9 @@ import { ReceiveComponent } from '../receive/receive.component'; ...@@ -17,11 +17,9 @@ import { ReceiveComponent } from '../receive/receive.component';
export class DashboardComponent { export class DashboardComponent {
constructor(private apiService: ApiService, private globalService: GlobalService, private modalService: NgbModal) {} constructor(private apiService: ApiService, private globalService: GlobalService, private modalService: NgbModal) {}
private balanceResponse: any;
private confirmedBalance: number; private confirmedBalance: number;
private unconfirmedBalance: number; private unconfirmedBalance: number;
private transactions: any; private transactions: any;
private errorMessage: string;
ngOnInit() { ngOnInit() {
this.getWalletBalance(); this.getWalletBalance();
...@@ -42,15 +40,15 @@ export class DashboardComponent { ...@@ -42,15 +40,15 @@ export class DashboardComponent {
.subscribe( .subscribe(
response => { response => {
if (response.status >= 200 && response.status < 400) { if (response.status >= 200 && response.status < 400) {
this.balanceResponse = response.json(); let balanceResponse = response.json();
this.confirmedBalance = this.balanceResponse.balances[0].amountConfirmed; this.confirmedBalance = balanceResponse.balances[0].amountConfirmed;
this.unconfirmedBalance = this.balanceResponse.balances[0].amountUnconfirmed; this.unconfirmedBalance = balanceResponse.balances[0].amountUnconfirmed;
} }
}, },
error => { error => {
if (error.status >= 400) { if (error.status >= 400) {
this.errorMessage = <any>error; let errorMessage = <any>error;
console.log(this.errorMessage); console.log(errorMessage);
} }
} }
); );
...@@ -62,15 +60,15 @@ export class DashboardComponent { ...@@ -62,15 +60,15 @@ export class DashboardComponent {
.subscribe( .subscribe(
response => { response => {
if (response.status >= 200 && response.status < 400) { if (response.status >= 200 && response.status < 400) {
if (response.json().transactions.length > 0) { if (response.json().transactionsHistory.length > 0) {
this.transactions = response.json().transactions; this.transactions = response.json().transactionsHistory;
} }
} }
}, },
error => { error => {
if (error.status >= 400) { if (error.status >= 400) {
this.errorMessage = <any>error; let errorMessage = <any>error;
console.log(this.errorMessage); console.log(errorMessage);
} }
} }
); );
......
...@@ -3,18 +3,20 @@ ...@@ -3,18 +3,20 @@
<div class="col"> <div class="col">
<table *ngIf="transactions; else noTransactions"> <table *ngIf="transactions; else noTransactions">
<thead> <thead>
<th>Timestamp</th> <th>Type</th>
<th>Amount</th> <th>Amount</th>
<th>Confirmed</th>
<th>Transaction ID</th> <th>Transaction ID</th>
<th>Confirmed in block</th>
<th>Timestamp</th>
</thead> </thead>
<tr *ngFor="let transaction of transactions"> <tr *ngFor="let transaction of transactions">
<!--<td *ngIf="{{ transaction.amount }} < 0; else received">SENT</td> <!--<td *ngIf="{{ transaction.amount }} < 0; else received">SENT</td>
<td #received>RECEIVED</td>--> <td #received>RECEIVED</td>-->
<td>{{ transaction.timestamp }}</td> <td>{{ transaction.type }}</td>
<td>{{ transaction.amount | coinNotation | coinAbbreviation }}</td> <td>{{ transaction.amount | coinNotation | coinAbbreviation }}</td>
<td>{{ transaction.confirmed }}</td> <td>{{ transaction.id }}</td>
<td>{{ transaction.txId }}</td> <td>{{ transaction.confirmedInBlock }}</td>
<td>{{ transaction.timestamp * 1000 | date:'medium' }}</td>
</tr> </tr>
</table> </table>
</div> </div>
......
...@@ -27,8 +27,8 @@ export class HistoryComponent { ...@@ -27,8 +27,8 @@ export class HistoryComponent {
.subscribe( .subscribe(
response => { response => {
if (response.status >= 200 && response.status < 400) { if (response.status >= 200 && response.status < 400) {
if (response.json().transactions.length > 0) { if (response.json().transactionsHistory.length > 0) {
this.transactions = response.json().transactions; this.transactions = response.json().transactionsHistory;
} }
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment