diff --git a/web-ui/src/app/app.component.ts b/web-ui/src/app/app.component.ts
index f541e74..8eb87f8 100644
--- a/web-ui/src/app/app.component.ts
+++ b/web-ui/src/app/app.component.ts
@@ -151,7 +151,8 @@ export class AppComponent implements OnInit {
'label.active': 'Active',
'label.details': 'Details',
'label.raw': 'Raw',
- 'label.date': 'Date'
+ 'label.date': 'Date',
+ 'label.more': 'More'
};
}
}
diff --git a/web-ui/src/app/components/richest-addresses/richest-addresses.component.html b/web-ui/src/app/components/richest-addresses/richest-addresses.component.html
index d96da36..ae01ea9 100644
--- a/web-ui/src/app/components/richest-addresses/richest-addresses.component.html
+++ b/web-ui/src/app/components/richest-addresses/richest-addresses.component.html
@@ -15,8 +15,8 @@
-
- {{(currentPage - 1) * pageSize + index + 1}} |
+
+ {{index + 1}} |
{{item.address}}
|
@@ -37,8 +37,7 @@
-
-
+
diff --git a/web-ui/src/app/components/richest-addresses/richest-addresses.component.ts b/web-ui/src/app/components/richest-addresses/richest-addresses.component.ts
index 996706e..1c0893d 100644
--- a/web-ui/src/app/components/richest-addresses/richest-addresses.component.ts
+++ b/web-ui/src/app/components/richest-addresses/richest-addresses.component.ts
@@ -1,14 +1,11 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
-import { Observable } from 'rxjs/Observable';
-
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/map';
import { Balance } from '../../models/balance';
import { BalancesService } from '../../services/balances.service';
-import { ErrorService } from '../../services/error.service';
import { TickerService } from '../../services/ticker.service';
import { ServerStats } from '../../models/ticker';
@@ -23,30 +20,28 @@ export class RichestAddressesComponent implements OnInit {
ticker: ServerStats;
// pagination
- total = 0;
- currentPage = 1;
- pageSize = 10;
- asyncItems: Observable;
+ limit = 10;
+ items: Balance[] = [];
constructor(
private balancesService: BalancesService,
- private tickerService: TickerService,
- private errorService: ErrorService) { }
+ private tickerService: TickerService) { }
ngOnInit() {
- this.getPage(this.currentPage);
+ this.load();
this.tickerService.get().subscribe(response => this.ticker = response);
}
- getPage(page: number) {
- const offset = (page - 1) * this.pageSize;
- const limit = this.pageSize;
+ load() {
+ let lastSeenAddress = '';
+ if (this.items.length > 0) {
+ lastSeenAddress = this.items[this.items.length - 1].address;
+ }
- this.asyncItems = this.balancesService
- .get(offset, limit, 'available:desc')
- .do(response => this.total = response.total)
- .do(response => this.currentPage = 1 + (response.offset / this.pageSize))
- .map(response => response.data);
+ this.balancesService
+ .getHighest(this.limit, lastSeenAddress)
+ .do(response => this.items = this.items.concat(response.data))
+ .subscribe();
}
getPercent(balance: Balance): number {
diff --git a/web-ui/src/app/models/wrapped-result.ts b/web-ui/src/app/models/wrapped-result.ts
new file mode 100644
index 0000000..5e8cc8b
--- /dev/null
+++ b/web-ui/src/app/models/wrapped-result.ts
@@ -0,0 +1,4 @@
+
+export class WrappedResult {
+ data: T[];
+}
diff --git a/web-ui/src/app/services/balances.service.ts b/web-ui/src/app/services/balances.service.ts
index af08243..74b2bf3 100644
--- a/web-ui/src/app/services/balances.service.ts
+++ b/web-ui/src/app/services/balances.service.ts
@@ -6,6 +6,7 @@ import { environment } from '../../environments/environment';
import { Balance } from '../models/balance';
import { PaginatedResult } from '../models/paginated-result';
+import { WrappedResult } from '../models/wrapped-result';
const httpOptions = {
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
@@ -15,6 +16,7 @@ const httpOptions = {
export class BalancesService {
private baseUrl = environment.api.url + '/balances';
+ private baseUrlV2 = environment.api.url + '/v2/balances';
constructor(private http: HttpClient) { }
@@ -22,4 +24,13 @@ export class BalancesService {
const url = `${this.baseUrl}?offset=${offset}&limit=${limit}&orderBy=${orderBy}`;
return this.http.get>(url);
}
+
+ getHighest(limit: number = 10, lastSeenAddress: string = ''): Observable> {
+ let url = `${this.baseUrlV2}?limit=${limit}`;
+ if (lastSeenAddress !== '') {
+ url += `&lastSeenAddress=${lastSeenAddress}`;
+ }
+
+ return this.http.get>(url);
+ }
}