mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-03-17 21:32:52 +01:00
fix: Add restart to settings & better disabled state (#493)
* fix: Add restart to settings & better disabled state * fix: Correct function call and better handling * fix: Add to network restart and form dirty check
This commit is contained in:
parent
4100402990
commit
c745cbb0e5
@ -198,11 +198,15 @@
|
||||
</div>
|
||||
|
||||
<div class="mt-2">
|
||||
<button pButton [disabled]="form.invalid" (click)="updateSystem()"
|
||||
<button pButton [disabled]="!form.dirty || form.invalid" (click)="updateSystem()"
|
||||
class="btn btn-primary mr-2">Save</button>
|
||||
<b style="line-height: 34px;">You must restart this device after saving for changes to take effect.</b>
|
||||
</div>
|
||||
|
||||
<div class="mt-2">
|
||||
<button pButton [disabled]="!savedChanges" (click)="restart()">Restart</button>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</ng-container>
|
||||
|
@ -19,7 +19,7 @@ export class EditComponent implements OnInit {
|
||||
public firmwareUpdateProgress: number | null = null;
|
||||
public websiteUpdateProgress: number | null = null;
|
||||
|
||||
|
||||
public savedChanges: boolean = false;
|
||||
public devToolsOpen: boolean = false;
|
||||
public eASICModel = eASICModel;
|
||||
public ASICModel!: eASICModel;
|
||||
@ -205,9 +205,11 @@ export class EditComponent implements OnInit {
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.toastr.success('Success!', 'Saved.');
|
||||
this.savedChanges = true;
|
||||
},
|
||||
error: (err: HttpErrorResponse) => {
|
||||
this.toastr.error('Error.', `Could not save. ${err.message}`);
|
||||
this.savedChanges = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -232,4 +234,17 @@ export class EditComponent implements OnInit {
|
||||
this.showFallbackStratumPassword = !this.showFallbackStratumPassword;
|
||||
}
|
||||
|
||||
public restart() {
|
||||
this.systemService.restart()
|
||||
.pipe(this.loadingService.lockUIUntilComplete())
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.toastr.success('Success!', 'Bitaxe restarted');
|
||||
},
|
||||
error: (err: HttpErrorResponse) => {
|
||||
this.toastr.error('Error', `Could not restart. ${err.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,9 +26,13 @@
|
||||
</div>
|
||||
|
||||
<div class="mt-2">
|
||||
<button pButton [disabled]="form.invalid" (click)="updateSystem()"
|
||||
<button pButton [disabled]="!form.dirty || form.invalid" (click)="updateSystem()"
|
||||
class="btn btn-primary mr-2">Save</button>
|
||||
<b style="line-height: 34px;">You must restart this device after saving for changes to take effect.</b>
|
||||
</div>
|
||||
|
||||
<div class="mt-2">
|
||||
<button pButton [disabled]="!savedChanges" (click)="restart()">Restart</button>
|
||||
</div>
|
||||
</form>
|
||||
</ng-container>
|
||||
|
@ -14,6 +14,7 @@ import { SystemService } from 'src/app/services/system.service';
|
||||
export class NetworkEditComponent implements OnInit {
|
||||
|
||||
public form!: FormGroup;
|
||||
public savedChanges: boolean = false;
|
||||
|
||||
@Input() uri = '';
|
||||
|
||||
@ -56,9 +57,11 @@ export class NetworkEditComponent implements OnInit {
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.toastr.success('Success!', 'Saved.');
|
||||
this.savedChanges = true;
|
||||
},
|
||||
error: (err: HttpErrorResponse) => {
|
||||
this.toastr.error('Error.', `Could not save. ${err.message}`);
|
||||
this.savedChanges = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -67,4 +70,17 @@ export class NetworkEditComponent implements OnInit {
|
||||
toggleWifiPasswordVisibility() {
|
||||
this.showWifiPassword = !this.showWifiPassword;
|
||||
}
|
||||
|
||||
public restart() {
|
||||
this.systemService.restart()
|
||||
.pipe(this.loadingService.lockUIUntilComplete())
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.toastr.success('Success!', 'Bitaxe restarted');
|
||||
},
|
||||
error: (err: HttpErrorResponse) => {
|
||||
this.toastr.error('Error', `Could not restart. ${err.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user