From 8c3a62d6705795da55eda16f66ebde913fdb35a1 Mon Sep 17 00:00:00 2001 From: everoddandeven Date: Thu, 17 Oct 2024 18:16:17 +0200 Subject: [PATCH] General improvements and fixes --- .../services/daemon/daemon-data.service.ts | 5 +++- .../core/services/daemon/daemon.service.ts | 19 +++++++++++++- .../daemon-not-running.component.html | 25 ++++++++++++------- .../daemon-not-running.component.ts | 14 +++++++---- .../components/navbar/navbar.component.html | 8 +++--- .../components/navbar/navbar.component.ts | 12 ++++----- src/polyfills.ts | 1 + 7 files changed, 57 insertions(+), 27 deletions(-) diff --git a/src/app/core/services/daemon/daemon-data.service.ts b/src/app/core/services/daemon/daemon-data.service.ts index e6dbde6..ec6ab98 100644 --- a/src/app/core/services/daemon/daemon-data.service.ts +++ b/src/app/core/services/daemon/daemon-data.service.ts @@ -458,9 +458,10 @@ export class DaemonDataService { this._gettingIsBlockchainPruned = true; - //if (firstRefresh) this._isBlockchainPruned = (await this.daemonService.pruneBlockchain(true)).pruned; + const settings = await this.daemonService.getSettings(); this._isBlockchainPruned = settings.pruneBlockchain; + /* if (firstRefresh) { this.daemonService.pruneBlockchain(true).then((info) => { this._isBlockchainPruned = info.pruned; @@ -468,6 +469,8 @@ export class DaemonDataService { console.error(error); }); } + */ + this._gettingIsBlockchainPruned = false; if (this._daemonInfo.synchronized) await this.refreshAltChains(); diff --git a/src/app/core/services/daemon/daemon.service.ts b/src/app/core/services/daemon/daemon.service.ts index fd61c46..9bba1b2 100644 --- a/src/app/core/services/daemon/daemon.service.ts +++ b/src/app/core/services/daemon/daemon.service.ts @@ -1143,7 +1143,24 @@ export class DaemonService { window.electronAPI.monitorMonerod(); return await getProcessStatsPromise; - } + } + + private _quitting: boolean = false; + + public get quitting(): boolean { + return this._quitting; + } + + public async quit(): Promise { + this._quitting = true; + const running: boolean = await this.isRunning(); + + if (running) { + await this.stopDaemon(); + } + + window.electronAPI.quit(); + } } diff --git a/src/app/shared/components/daemon-not-running/daemon-not-running.component.html b/src/app/shared/components/daemon-not-running/daemon-not-running.component.html index 7b4e975..a3d9925 100644 --- a/src/app/shared/components/daemon-not-running/daemon-not-running.component.html +++ b/src/app/shared/components/daemon-not-running/daemon-not-running.component.html @@ -1,19 +1,21 @@
-

Daemon not running

-

Daemon not configured or installed

+

Daemon not running

+

Daemon not configured or installed

Daemon restarting

-

Daemon is stopping

+

Daemon is stopping

Daemon is upgrading

+

Daemon is quiting

-

Start monero daemon

-

Configure or install monero daemon

+

Start monero daemon

+

Configure or install monero daemon

Daemon is starting

Starting monero daemon

Restarting monero daemon

Upgrading monero daemon to latest version

+

Quiting monero daemon

- + - + +   - +   - +
\ No newline at end of file diff --git a/src/app/shared/components/daemon-not-running/daemon-not-running.component.ts b/src/app/shared/components/daemon-not-running/daemon-not-running.component.ts index 8ea8ee0..416c1eb 100644 --- a/src/app/shared/components/daemon-not-running/daemon-not-running.component.ts +++ b/src/app/shared/components/daemon-not-running/daemon-not-running.component.ts @@ -10,25 +10,25 @@ import { DaemonDataService, MoneroInstallerService } from '../../../core/service export class DaemonNotRunningComponent { public get upgrading(): boolean { - return this.installer.upgrading; + return this.installer.upgrading && !this.quittingDaemon; } public get daemonRunning(): boolean { - return this.daemonData.running && !this.startingDaemon && !this.stoppingDaemon && !this.restartingDaemon && !this.upgrading; + return this.daemonData.running && !this.startingDaemon && !this.stoppingDaemon && !this.restartingDaemon && !this.upgrading && !this.quittingDaemon; } public daemonConfigured: boolean = true; public get startingDaemon(): boolean { - return this.daemonService.starting && !this.restartingDaemon && !this.stoppingDaemon && !this.upgrading; + return this.daemonService.starting && !this.restartingDaemon && !this.stoppingDaemon && !this.upgrading && !this.quittingDaemon; } public get stoppingDaemon(): boolean{ - return this.daemonData.stopping && !this.restartingDaemon && !this.startingDaemon && !this.upgrading; + return this.daemonData.stopping && !this.restartingDaemon && !this.startingDaemon && !this.upgrading && !this.quittingDaemon; } public get restartingDaemon(): boolean { - return this.daemonService.restarting && ! this.upgrading; + return this.daemonService.restarting && ! this.upgrading && !this.quittingDaemon; } public get progressStatus(): string { @@ -41,6 +41,10 @@ export class DaemonNotRunningComponent { return progress.status; } + public get quittingDaemon(): boolean { + return this.daemonService.quitting; + } + constructor(private installer: MoneroInstallerService, private daemonData: DaemonDataService, private daemonService: DaemonService, private ngZone: NgZone) { this.daemonService.getSettings().then((settings) => { this.daemonConfigured = settings.monerodPath != ''; diff --git a/src/app/shared/components/navbar/navbar.component.html b/src/app/shared/components/navbar/navbar.component.html index 2c2d6d6..9ea14fb 100644 --- a/src/app/shared/components/navbar/navbar.component.html +++ b/src/app/shared/components/navbar/navbar.component.html @@ -24,21 +24,21 @@