mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-06-20 02:01:19 +02: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>
|
||||||
|
|
||||||
<div class="mt-2">
|
<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>
|
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>
|
<b style="line-height: 34px;">You must restart this device after saving for changes to take effect.</b>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-2">
|
||||||
|
<button pButton [disabled]="!savedChanges" (click)="restart()">Restart</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@ -19,7 +19,7 @@ export class EditComponent implements OnInit {
|
|||||||
public firmwareUpdateProgress: number | null = null;
|
public firmwareUpdateProgress: number | null = null;
|
||||||
public websiteUpdateProgress: number | null = null;
|
public websiteUpdateProgress: number | null = null;
|
||||||
|
|
||||||
|
public savedChanges: boolean = false;
|
||||||
public devToolsOpen: boolean = false;
|
public devToolsOpen: boolean = false;
|
||||||
public eASICModel = eASICModel;
|
public eASICModel = eASICModel;
|
||||||
public ASICModel!: eASICModel;
|
public ASICModel!: eASICModel;
|
||||||
@ -205,9 +205,11 @@ export class EditComponent implements OnInit {
|
|||||||
.subscribe({
|
.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.toastr.success('Success!', 'Saved.');
|
this.toastr.success('Success!', 'Saved.');
|
||||||
|
this.savedChanges = true;
|
||||||
},
|
},
|
||||||
error: (err: HttpErrorResponse) => {
|
error: (err: HttpErrorResponse) => {
|
||||||
this.toastr.error('Error.', `Could not save. ${err.message}`);
|
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;
|
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>
|
||||||
|
|
||||||
<div class="mt-2">
|
<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>
|
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>
|
<b style="line-height: 34px;">You must restart this device after saving for changes to take effect.</b>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-2">
|
||||||
|
<button pButton [disabled]="!savedChanges" (click)="restart()">Restart</button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@ -14,6 +14,7 @@ import { SystemService } from 'src/app/services/system.service';
|
|||||||
export class NetworkEditComponent implements OnInit {
|
export class NetworkEditComponent implements OnInit {
|
||||||
|
|
||||||
public form!: FormGroup;
|
public form!: FormGroup;
|
||||||
|
public savedChanges: boolean = false;
|
||||||
|
|
||||||
@Input() uri = '';
|
@Input() uri = '';
|
||||||
|
|
||||||
@ -56,9 +57,11 @@ export class NetworkEditComponent implements OnInit {
|
|||||||
.subscribe({
|
.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.toastr.success('Success!', 'Saved.');
|
this.toastr.success('Success!', 'Saved.');
|
||||||
|
this.savedChanges = true;
|
||||||
},
|
},
|
||||||
error: (err: HttpErrorResponse) => {
|
error: (err: HttpErrorResponse) => {
|
||||||
this.toastr.error('Error.', `Could not save. ${err.message}`);
|
this.toastr.error('Error.', `Could not save. ${err.message}`);
|
||||||
|
this.savedChanges = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -67,4 +70,17 @@ export class NetworkEditComponent implements OnInit {
|
|||||||
toggleWifiPasswordVisibility() {
|
toggleWifiPasswordVisibility() {
|
||||||
this.showWifiPassword = !this.showWifiPassword;
|
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