From 52b4a1c6eb096cd82a743a8e214ed152bb07c671 Mon Sep 17 00:00:00 2001 From: Snider Date: Thu, 11 Dec 2025 14:52:36 +0000 Subject: [PATCH] feat: Refactor profile selection to support multiple miners and improve event handling --- ui/src/app/dashboard.component.html | 36 ++++++++++++++++------------- ui/src/app/dashboard.component.ts | 13 ++++++----- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/ui/src/app/dashboard.component.html b/ui/src/app/dashboard.component.html index 67a3c43..62cecaf 100644 --- a/ui/src/app/dashboard.component.html +++ b/ui/src/app/dashboard.component.html @@ -49,23 +49,27 @@ } } @else { -
- - Profile - @for(profile of state().profiles; track profile.id) { - @if(profile.minerType === miner.type) { - {{ profile.name }} + @if(miner.type) { +
+ + Profile + @for(profile of state().profiles; track profile.id) { + @if(profile.minerType === miner.type) { + {{ profile.name }} + } } - } - - - - Start - -
+
+ + + Start + +
+ } } } diff --git a/ui/src/app/dashboard.component.ts b/ui/src/app/dashboard.component.ts index 6ef9019..f53f424 100644 --- a/ui/src/app/dashboard.component.ts +++ b/ui/src/app/dashboard.component.ts @@ -33,11 +33,12 @@ export class MiningDashboardComponent { error = signal(null); showProfileManager = signal(false); - selectedProfileId = signal(null); + // Use a map to track the selected profile for each miner type + selectedProfileIds = signal>(new Map()); - handleProfileSelection(event: any) { - // The value is in the detail property of the custom event - this.selectedProfileId.set(event.detail.value); + handleProfileSelection(minerType: string, event: Event) { + const selectedValue = (event.target as HTMLSelectElement).value; + this.selectedProfileIds.update(m => m.set(minerType, selectedValue)); } private handleError(err: HttpErrorResponse, defaultMessage: string) { @@ -52,8 +53,8 @@ export class MiningDashboardComponent { } } - startMiner(): void { - const profileId = this.selectedProfileId(); + startMiner(minerType: string): void { + const profileId = this.selectedProfileIds().get(minerType); if (!profileId) { this.error.set('Please select a profile to start.'); return;