From 90331e2c1b3555c7b8b6e2681ac2cd8911f7e71d Mon Sep 17 00:00:00 2001 From: natsoni Date: Thu, 25 Jul 2024 17:45:08 +0200 Subject: [PATCH] Get all pools in accelerations list --- .../accelerations-list.component.ts | 6 +++--- frontend/src/app/services/mining.service.ts | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/components/acceleration/accelerations-list/accelerations-list.component.ts b/frontend/src/app/components/acceleration/accelerations-list/accelerations-list.component.ts index 5b2b30d7a..46628bde9 100644 --- a/frontend/src/app/components/acceleration/accelerations-list/accelerations-list.component.ts +++ b/frontend/src/app/components/acceleration/accelerations-list/accelerations-list.component.ts @@ -83,9 +83,9 @@ export class AccelerationsListComponent implements OnInit, OnDestroy { this.pageChange(this.page); }); - this.miningService.getMiningStats('1m').subscribe(stats => { - for (const pool of stats.pools) { - this.pools[pool.poolUniqueId] = pool; + this.miningService.getPools().subscribe(pools => { + for (const pool of pools) { + this.pools[pool.unique_id] = pool; } }); } diff --git a/frontend/src/app/services/mining.service.ts b/frontend/src/app/services/mining.service.ts index 7bbf6b759..64748e547 100644 --- a/frontend/src/app/services/mining.service.ts +++ b/frontend/src/app/services/mining.service.ts @@ -31,6 +31,7 @@ export class MiningService { data: MiningStats; } } = {}; + poolsData: SinglePoolStats[] = []; constructor( private stateService: StateService, @@ -57,7 +58,19 @@ export class MiningService { ); } } - + + /** + * Get names and slugs of all pools + */ + public getPools(): Observable { + return this.poolsData.length ? of(this.poolsData) : this.apiService.listPools$(undefined).pipe( + map(response => { + this.poolsData = response.body; + return this.poolsData; + }) + ); + + } /** * Set the hashrate power of ten we want to display */