From 26951eea0a4f9bfa9b4e2f38ee3212f150b13020 Mon Sep 17 00:00:00 2001 From: mrv777 Date: Thu, 12 Dec 2024 13:23:29 -0600 Subject: [PATCH] fix: Show custom values in dropdown if set --- .../app/components/edit/edit.component.html | 58 +------------------ .../src/app/components/edit/edit.component.ts | 55 +++++++++++++++++- 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/main/http_server/axe-os/src/app/components/edit/edit.component.html b/main/http_server/axe-os/src/app/components/edit/edit.component.html index 8211d66c..74917e6a 100644 --- a/main/http_server/axe-os/src/app/components/edit/edit.component.html +++ b/main/http_server/axe-os/src/app/components/edit/edit.component.html @@ -67,70 +67,18 @@ - - -
- -
- -
-
- - -
- - -
- -
- - - -
- -
- -
-
- -
- - -
-
- - +
-
- -
-
- - -
- - - - -
- -
- -
diff --git a/main/http_server/axe-os/src/app/components/edit/edit.component.ts b/main/http_server/axe-os/src/app/components/edit/edit.component.ts index 8e207c18..4dbd0d27 100644 --- a/main/http_server/axe-os/src/app/components/edit/edit.component.ts +++ b/main/http_server/axe-os/src/app/components/edit/edit.component.ts @@ -120,7 +120,6 @@ export class EditComponent implements OnInit { private fb: FormBuilder, private systemService: SystemService, private toastr: ToastrService, - private toastrService: ToastrService, private loadingService: LoadingService ) { @@ -247,4 +246,58 @@ export class EditComponent implements OnInit { }); } + getDropdownFrequency() { + // Get base frequency options based on ASIC model + let options = []; + switch(this.ASICModel) { + case this.eASICModel.BM1366: options = [...this.BM1366DropdownFrequency]; break; + case this.eASICModel.BM1368: options = [...this.BM1368DropdownFrequency]; break; + case this.eASICModel.BM1370: options = [...this.BM1370DropdownFrequency]; break; + case this.eASICModel.BM1397: options = [...this.BM1397DropdownFrequency]; break; + default: return []; + } + + // Get current frequency value from form + const currentFreq = this.form?.get('frequency')?.value; + + // If current frequency exists and isn't in the options + if (currentFreq && !options.some(opt => opt.value === currentFreq)) { + options.push({ + name: `${currentFreq} (Custom)`, + value: currentFreq + }); + // Sort options by frequency value + options.sort((a, b) => a.value - b.value); + } + + return options; + } + + getCoreVoltage() { + // Get base voltage options based on ASIC model + let options = []; + switch(this.ASICModel) { + case this.eASICModel.BM1366: options = [...this.BM1366CoreVoltage]; break; + case this.eASICModel.BM1368: options = [...this.BM1368CoreVoltage]; break; + case this.eASICModel.BM1370: options = [...this.BM1370CoreVoltage]; break; + case this.eASICModel.BM1397: options = [...this.BM1397CoreVoltage]; break; + default: return []; + } + + // Get current voltage value from form + const currentVoltage = this.form?.get('coreVoltage')?.value; + + // If current voltage exists and isn't in the options + if (currentVoltage && !options.some(opt => opt.value === currentVoltage)) { + options.push({ + name: `${currentVoltage} (Custom)`, + value: currentVoltage + }); + // Sort options by voltage value + options.sort((a, b) => a.value - b.value); + } + + return options; + } + }