From 45ea6342db2ecf467a197a00f7417d39def12d4b Mon Sep 17 00:00:00 2001 From: mrv777 Date: Mon, 18 Nov 2024 12:43:49 -0600 Subject: [PATCH 1/3] fix: Add restart to settings & better disabled state --- .../axe-os/src/app/components/edit/edit.component.html | 6 +++++- .../axe-os/src/app/components/edit/edit.component.ts | 10 +++++++++- 2 files changed, 14 insertions(+), 2 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 d1d4adf66..68d9b208d 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 @@ -198,11 +198,15 @@
- You must restart this device after saving for changes to take effect.
+
+ +
+ 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 6b4fe4bab..1d506da2b 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 @@ -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,10 @@ export class EditComponent implements OnInit { this.showFallbackStratumPassword = !this.showFallbackStratumPassword; } + public restart() { + this.systemService.restart().subscribe(res => { + this.toastr.success('Success!', 'Bitaxe restarted'); + }); +} + } From 900325c93324c7268f0836c210e0db510dc9bf88 Mon Sep 17 00:00:00 2001 From: mrv777 Date: Thu, 21 Nov 2024 14:54:16 -0600 Subject: [PATCH 2/3] fix: Correct function call and better handling --- .../src/app/components/edit/edit.component.html | 2 +- .../src/app/components/edit/edit.component.ts | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 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 68d9b208d..1d1db9098 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 @@ -204,7 +204,7 @@
- +
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 1d506da2b..8e207c18a 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 @@ -235,9 +235,16 @@ export class EditComponent implements OnInit { } public restart() { - this.systemService.restart().subscribe(res => { - this.toastr.success('Success!', 'Bitaxe restarted'); - }); -} + 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}`); + } + }); + } } From 2a2bf16e8eda6acdfcf388c6b91ae01a0eb5b464 Mon Sep 17 00:00:00 2001 From: mrv777 Date: Thu, 21 Nov 2024 20:25:18 -0600 Subject: [PATCH 3/3] fix: Add to network restart and form dirty check --- .../network-edit/network.edit.component.html | 6 +++++- .../network-edit/network.edit.component.ts | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/main/http_server/axe-os/src/app/components/network-edit/network.edit.component.html b/main/http_server/axe-os/src/app/components/network-edit/network.edit.component.html index 071c31f1e..647643aa4 100644 --- a/main/http_server/axe-os/src/app/components/network-edit/network.edit.component.html +++ b/main/http_server/axe-os/src/app/components/network-edit/network.edit.component.html @@ -26,9 +26,13 @@
- You must restart this device after saving for changes to take effect.
+ +
+ +
diff --git a/main/http_server/axe-os/src/app/components/network-edit/network.edit.component.ts b/main/http_server/axe-os/src/app/components/network-edit/network.edit.component.ts index c4ad4e2e4..ff07b2380 100644 --- a/main/http_server/axe-os/src/app/components/network-edit/network.edit.component.ts +++ b/main/http_server/axe-os/src/app/components/network-edit/network.edit.component.ts @@ -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}`); + } + }); + } }