From 1e96c93557dafe2eef5460ceb23e5c1b09f3e741 Mon Sep 17 00:00:00 2001 From: nymkappa Date: Tue, 15 Feb 2022 18:36:58 +0900 Subject: [PATCH] Fix rendering issue when clicking on block link from pool page --- frontend/src/app/components/pool/pool.component.html | 2 +- frontend/src/app/components/pool/pool.component.ts | 11 +++++------ frontend/src/app/services/api.service.ts | 11 ++++------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/frontend/src/app/components/pool/pool.component.html b/frontend/src/app/components/pool/pool.component.html index e10b8e6e4..43bc647e8 100644 --- a/frontend/src/app/components/pool/pool.component.html +++ b/frontend/src/app/components/pool/pool.component.html @@ -95,7 +95,7 @@ - {{ block.height }} + {{ block.height }} ‎{{ block.timestamp * 1000 | date:'yyyy-MM-dd HH:mm' }} diff --git a/frontend/src/app/components/pool/pool.component.ts b/frontend/src/app/components/pool/pool.component.ts index 8b0d2fcaf..230b9a0f8 100644 --- a/frontend/src/app/components/pool/pool.component.ts +++ b/frontend/src/app/components/pool/pool.component.ts @@ -1,9 +1,8 @@ -import { Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; -import { once } from 'process'; -import { BehaviorSubject, combineLatest, from, merge, Observable } from 'rxjs'; -import { delay, distinctUntilChanged, map, scan, startWith, switchMap, tap } from 'rxjs/operators'; +import { BehaviorSubject, combineLatest, Observable } from 'rxjs'; +import { distinctUntilChanged, map, startWith, switchMap, tap } from 'rxjs/operators'; import { BlockExtended, PoolStat } from 'src/app/interfaces/node-api.interface'; import { ApiService } from 'src/app/services/api.service'; import { StateService } from 'src/app/services/state.service'; @@ -11,7 +10,8 @@ import { StateService } from 'src/app/services/state.service'; @Component({ selector: 'app-pool', templateUrl: './pool.component.html', - styleUrls: ['./pool.component.scss'] + styleUrls: ['./pool.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush }) export class PoolComponent implements OnInit { poolStats$: Observable; @@ -22,7 +22,6 @@ export class PoolComponent implements OnInit { blocks: BlockExtended[] = []; poolId: number = undefined; - isLoading = false; radioGroupForm: FormGroup; constructor( diff --git a/frontend/src/app/services/api.service.ts b/frontend/src/app/services/api.service.ts index ec01a2a5c..bf468c467 100644 --- a/frontend/src/app/services/api.service.ts +++ b/frontend/src/app/services/api.service.ts @@ -138,12 +138,9 @@ export class ApiService { } getPoolBlocks$(poolId: number, fromHeight: number): Observable { - if (fromHeight !== undefined) { - return this.httpClient.get(this.apiBaseUrl + this.apiBasePath + - `/api/v1/mining/pool/${poolId}/blocks/${fromHeight}`); - } else { - return this.httpClient.get(this.apiBaseUrl + this.apiBasePath + - `/api/v1/mining/pool/${poolId}/blocks`); - } + return this.httpClient.get( + this.apiBaseUrl + this.apiBasePath + `/api/v1/mining/pool/${poolId}/blocks` + + (fromHeight !== undefined ? `/${fromHeight}` : '') + ); } }