Browse Source

web-ui: Update the BalancesService to use the order by parameter

scalafmt-draft
Alexis Hernandez 7 years ago
parent
commit
e000666b91
  1. 2
      web-ui/src/app/components/richest-addresses/richest-addresses.component.html
  2. 2
      web-ui/src/app/components/richest-addresses/richest-addresses.component.ts
  3. 4
      web-ui/src/app/services/balances.service.ts

2
web-ui/src/app/components/richest-addresses/richest-addresses.component.html

@ -20,7 +20,7 @@
<a routerLink="/addresses/{{item.address}}">{{item.address}}</a>
</td>
<td>{{item.available}} {{'label.coinName' | translate}}</td>
<td *ngIf="ticker == null || ticker.circulatingSupply == null">{{'label.unavailable' | translate}}</td>
<td *ngIf="ticker == null || ticker.circulatingSupply == null">{{'message.unavailable' | translate}}</td>
<td *ngIf="ticker != null && ticker.circulatingSupply != null">{{getPercent(item)}} %</td>
</tr>
</tbody>

2
web-ui/src/app/components/richest-addresses/richest-addresses.component.ts

@ -43,7 +43,7 @@ export class RichestAddressesComponent implements OnInit {
const limit = this.pageSize;
this.asyncItems = this.balancesService
.getRichest(offset, limit)
.get(offset, limit, 'available:desc')
.do(response => this.total = response.total)
.do(response => this.currentPage = 1 + (response.offset / this.pageSize))
.map(response => response.data);

4
web-ui/src/app/services/balances.service.ts

@ -18,8 +18,8 @@ export class BalancesService {
constructor(private http: HttpClient) { }
getRichest(offset: number = 0, limit: number = 10): Observable<PaginatedResult<Balance>> {
const url = `${this.baseUrl}?offset=${offset}&limit=${limit}`;
get(offset: number = 0, limit: number = 10, orderBy: string = ''): Observable<PaginatedResult<Balance>> {
const url = `${this.baseUrl}?offset=${offset}&limit=${limit}&orderBy=${orderBy}`;
return this.http.get<PaginatedResult<Balance>>(url);
}
}

Loading…
Cancel
Save