Skip to content

Commit

Permalink
Add overheat button and change loading service (#364)
Browse files Browse the repository at this point in the history
* fix: change overheat check to button
* fix: Handle errors on loading
* fix: Simplify loading service
* fix: error should use subscriber.error(
  • Loading branch information
mrv777 authored Oct 10, 2024
1 parent df0c9ed commit 1a4015f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions main/http_server/axe-os/src/app/services/loading.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class LoadingService {
},
error: (err) => {
this.loading$.next(false);
subscriber.next(err);
subscriber.error(err);
},
complete: () => {
this.loading$.next(false);
Expand All @@ -31,4 +31,3 @@ export class LoadingService {
}
}
}

0 comments on commit 1a4015f

Please sign in to comment.