Add overheat button and change loading service (#364)

* fix: change overheat check to button
* fix: Handle errors on loading
* fix: Simplify loading service
* fix: error should use subscriber.error(
This commit is contained in:
mrv777 2024-10-10 12:24:02 -05:00 committed by GitHub
parent df0c9ed745
commit 1a4015f70c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 12 deletions

View File

@ -153,6 +153,16 @@
</ng-container>
<div class="col-12" *ngIf="form.get('overheat_mode')?.value === 1">
<button pButton type="button" label="Disable Overheat Mode"
class="p-button-danger w-full py-3"
(click)="disableOverheatMode()">
</button>
<small class="block mt-1 text-center" style="color: #ff0000;">
Make sure to reset Frequency and Voltage before clicking this button.
</small>
</div>
<div class="col-12 md:col-4">
<div class="field-checkbox">
<p-checkbox name="flipscreen" formControlName="flipscreen" inputId="flipscreen"
@ -187,14 +197,6 @@
</div>
</div>
<div class="col-12" *ngIf="form.get('overheat_mode')?.value === 1">
<div class="field-checkbox">
<p-checkbox name="overheat_mode" formControlName="overheat_mode" inputId="overheat_mode"
[binary]="true"></p-checkbox>
<label for="overheat_mode" style="color: #ff0000;">Disable Overheat Mode. Make sure to reset Frequency and Voltage</label>
</div>
</div>
<div class="mt-2">
<button pButton [disabled]="form.invalid" (click)="updateSystem()"
class="btn btn-primary mr-2">Save</button>

View File

@ -199,8 +199,6 @@ export class EditComponent implements OnInit {
delete form.stratumPassword;
}
form.overheat_mode = form.overheat_mode ? 1 : 0;
this.systemService.updateSystem(this.uri, form)
.pipe(this.loadingService.lockUIUntilComplete())
.subscribe({
@ -223,6 +221,11 @@ export class EditComponent implements OnInit {
this.showWifiPassword = !this.showWifiPassword;
}
disableOverheatMode() {
this.form.patchValue({ overheat_mode: 0 });
this.updateSystem();
}
showFallbackStratumPassword: boolean = false;
toggleFallbackStratumPasswordVisibility() {
this.showFallbackStratumPassword = !this.showFallbackStratumPassword;

View File

@ -20,7 +20,7 @@ export class LoadingService {
},
error: (err) => {
this.loading$.next(false);
subscriber.next(err);
subscriber.error(err);
},
complete: () => {
this.loading$.next(false);
@ -31,4 +31,3 @@ export class LoadingService {
}
}
}