General improvements and fixes

This commit is contained in:
everoddandeven 2024-10-17 18:16:17 +02:00
parent 0e5c483205
commit 8c3a62d670
7 changed files with 57 additions and 27 deletions

View file

@ -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();

View file

@ -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<void> {
this._quitting = true;
const running: boolean = await this.isRunning();
if (running) {
await this.stopDaemon();
}
window.electronAPI.quit();
}
}

View file

@ -1,19 +1,21 @@
<div *ngIf="!daemonRunning || stoppingDaemon || restartingDaemon" class="h-100 p-5 text-bg-dark rounded-3 m-4 text-center">
<h2 *ngIf="!daemonRunning && !startingDaemon && !stoppingDaemon && !restartingDaemon && !upgrading && daemonConfigured"><i class="bi bi-exclamation-diamond m-4"></i> Daemon not running</h2>
<h2 *ngIf="!daemonRunning && !startingDaemon && !stoppingDaemon && !restartingDaemon && !upgrading && !daemonConfigured"><i class="bi bi-exclamation-diamond m-4"></i> Daemon not configured or installed</h2>
<h2 *ngIf="!daemonRunning && !startingDaemon && !stoppingDaemon && !restartingDaemon && !upgrading && daemonConfigured && !quittingDaemon"><i class="bi bi-exclamation-diamond m-4"></i> Daemon not running</h2>
<h2 *ngIf="!daemonRunning && !startingDaemon && !stoppingDaemon && !restartingDaemon && !upgrading && !daemonConfigured && !quittingDaemon"><i class="bi bi-exclamation-diamond m-4"></i> Daemon not configured or installed</h2>
<h2 *ngIf="restartingDaemon && !upgrading"><i class="bi bi-arrow-clockwise m-4"></i> Daemon restarting</h2>
<h2 *ngIf="stoppingDaemon && !upgrading"><i class="bi bi-stop-fill m-4"></i> Daemon is stopping</h2>
<h2 *ngIf="stoppingDaemon && !upgrading && !quittingDaemon"><i class="bi bi-stop-fill m-4"></i> Daemon is stopping</h2>
<h2 *ngIf="upgrading"><i class="bi bi-cloud-download m-4"></i> Daemon is upgrading</h2>
<h2 *ngIf="quittingDaemon"><i class="bi bi-power m-4"></i> Daemon is quiting</h2>
<p *ngIf="!daemonRunning && !startingDaemon && !stoppingDaemon && !restartingDaemon && daemonConfigured && !upgrading">Start monero daemon</p>
<p *ngIf="!startingDaemon && !startingDaemon && !stoppingDaemon && !restartingDaemon && !daemonConfigured && !upgrading">Configure or install monero daemon</p>
<p *ngIf="!daemonRunning && !startingDaemon && !stoppingDaemon && !restartingDaemon && daemonConfigured && !upgrading && !quittingDaemon">Start monero daemon</p>
<p *ngIf="!startingDaemon && !startingDaemon && !stoppingDaemon && !restartingDaemon && !daemonConfigured && !upgrading && !quittingDaemon">Configure or install monero daemon</p>
<h2 *ngIf="startingDaemon"><i class="bi bi-play-fill m-4"></i> Daemon is starting</h2>
<p *ngIf="startingDaemon">Starting monero daemon</p>
<p *ngIf="restartingDaemon">Restarting monero daemon</p>
<p *ngIf="upgrading">Upgrading monero daemon to latest version</p>
<p *ngIf="quittingDaemon">Quiting monero daemon</p>
<button *ngIf="!startingDaemon && !stoppingDaemon && !restartingDaemon && !upgrading && daemonConfigured" class="btn btn-outline-light" type="button" (click)="startDaemon()"><i class="bi bi-play-fill"></i> Start</button>
<button *ngIf="!startingDaemon && !stoppingDaemon && !restartingDaemon && !upgrading && daemonConfigured && !quittingDaemon" class="btn btn-outline-light" type="button" (click)="startDaemon()"><i class="bi bi-play-fill"></i> Start</button>
<button *ngIf="startingDaemon" class="btn btn-outline-light" type="button" disabled>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Starting monerod
@ -24,10 +26,15 @@
Restarting monerod
</button>
<button *ngIf="stoppingDaemon" class="btn btn-outline-light" type="button" disabled>
<button *ngIf="stoppingDaemon && !quittingDaemon" class="btn btn-outline-light" type="button" disabled>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Stopping monerod
</button>
<button *ngIf="quittingDaemon" class="btn btn-outline-light" type="button" disabled>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Quiting monerod
</button>
<button *ngIf="upgrading" class="btn btn-outline-light" type="button" disabled>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
@ -35,7 +42,7 @@
</button>
&nbsp;
<button *ngIf="!startingDaemon && !stoppingDaemon && !restartingDaemon && !upgrading" routerLink="/settings" class="btn btn-outline-light" type="button"><i class="bi bi-gear"></i> Configure</button>
<button *ngIf="!startingDaemon && !stoppingDaemon && !restartingDaemon && !upgrading && !quittingDaemon" routerLink="/settings" class="btn btn-outline-light" type="button"><i class="bi bi-gear"></i> Configure</button>
&nbsp;
<button *ngIf="!startingDaemon && !stoppingDaemon && !restartingDaemon && !upgrading && !daemonConfigured" routerLink="/version" class="btn btn-outline-light" type="button"><i class="bi bi-arrow-down-circle"></i> Install</button>
<button *ngIf="!startingDaemon && !stoppingDaemon && !restartingDaemon && !upgrading && !daemonConfigured && !quittingDaemon" routerLink="/version" class="btn btn-outline-light" type="button"><i class="bi bi-arrow-down-circle"></i> Install</button>
</div>

View file

@ -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 != '';

View file

@ -24,21 +24,21 @@
</span>
<ul class="navbar-nav flex-row">
<li *ngIf="!running && !stopping && !starting && !restarting" class="nav-item text-nowrap">
<li *ngIf="!quitting && !running && !stopping && !starting && !restarting" class="nav-item text-nowrap">
<button class="btn btn-outline-secondary px-3 text-white" type="button" data-bs-toggle="collapse" aria-expanded="false" aria-label="Start daemon" (click)="startDaemon()">
<i class="bi bi-play-fill"></i>
</button>
&nbsp;
</li>
<li *ngIf="running && !stopping && !starting" class="nav-item text-nowrap">
<li *ngIf="!quitting && running && !stopping && !starting" class="nav-item text-nowrap">
<button class="btn btn-outline-secondary px-3 text-white" type="button" data-bs-toggle="collapse" aria-expanded="false" aria-label="Stop daemon" (click)="stopDaemon()">
<i class="bi bi-stop-fill"></i>
</button>
&nbsp;
</li>
<li *ngIf="running && !stopping && !starting" class="nav-item text-nowrap">
<li *ngIf="!quitting && running && !stopping && !starting" class="nav-item text-nowrap">
<button class="btn btn-outline-secondary px-3 text-white" type="button" data-bs-toggle="collapse" aria-expanded="false" aria-label="Restart daemon" (click)="restartDaemon()">
<i class="bi bi-arrow-clockwise"></i>
</button>
@ -46,7 +46,7 @@
</li>
<li class="nav-item text-nowrap">
<button class="btn btn-outline-secondary px-3 text-white" type="button" data-bs-toggle="offcanvas" aria-label="Quit" [disabled]="stopping || starting" (click)="quit()">
<button class="btn btn-outline-secondary px-3 text-white" type="button" data-bs-toggle="offcanvas" aria-label="Quit" [disabled]="stopping || starting || quitting || restarting" (click)="quit()">
<i class="bi bi-power"></i>
</button>
&nbsp;

View file

@ -12,6 +12,10 @@ export class NavbarComponent {
private _running: boolean = false;
public get quitting(): boolean {
return this.daemonService.quitting;
}
public get navbarLinks(): NavbarLink[] {
return this.navbarService.links;
}
@ -72,12 +76,6 @@ export class NavbarComponent {
}
public async quit(): Promise<void> {
const running: boolean = await this.daemonService.isRunning();
if (running) {
await this.stopDaemon();
}
window.electronAPI.quit();
await this.daemonService.quit();
}
}

View file

@ -74,6 +74,7 @@ declare global {
onMonerodStarted: (callback: (event: any, started: boolean) => void) => void;
unsubscribeOnMonerodStarted: () => void;
onMoneroClose: (callback: (event: any, code: number) => void) => void;
onMoneroStdout: (callbak: (event: any, out: string) => void) => void;
isWifiConnected: () => void;
onIsWifiConnectedResponse: (callback: (event: any, connected: boolean) => void) => void;
selectFolder: () => void;