mirror of
https://github.com/everoddandeven/monerod-gui.git
synced 2024-12-22 19:49:27 +00:00
Better notifications
This commit is contained in:
parent
5996037153
commit
4cde79e322
3 changed files with 38 additions and 14 deletions
|
@ -410,8 +410,8 @@ export class DaemonService {
|
||||||
this.delay(3000).then(() => {
|
this.delay(3000).then(() => {
|
||||||
this.isRunning(true).then((running: boolean) => {
|
this.isRunning(true).then((running: boolean) => {
|
||||||
window.electronAPI.showNotification({
|
window.electronAPI.showNotification({
|
||||||
title: 'Daemon started',
|
title: this.enablingSync ? 'Enabled blockchain sync' : this.restarting ? 'Daemon restarted' : 'Daemon started',
|
||||||
body: 'Successfully started daemon',
|
body: this.enablingSync ? 'Successfully enabled node blockchain sync' : this.restarting ? 'Successfully restarted daemon' : 'Successfully started daemon',
|
||||||
closeButtonText: 'Dismiss'
|
closeButtonText: 'Dismiss'
|
||||||
});
|
});
|
||||||
this.onDaemonStatusChanged.emit(running);
|
this.onDaemonStatusChanged.emit(running);
|
||||||
|
@ -439,7 +439,7 @@ export class DaemonService {
|
||||||
console.log("Daemon not started");
|
console.log("Daemon not started");
|
||||||
window.electronAPI.showNotification({
|
window.electronAPI.showNotification({
|
||||||
title: 'Daemon Error',
|
title: 'Daemon Error',
|
||||||
body: 'Could not start monerod'
|
body: this.enablingSync ? 'Could not enable node blockchain sync' : this.restarting ? 'Could not restart monerod' : 'Could not start monerod'
|
||||||
});
|
});
|
||||||
this.onDaemonStatusChanged.emit(false);
|
this.onDaemonStatusChanged.emit(false);
|
||||||
this.startedAt = undefined;
|
this.startedAt = undefined;
|
||||||
|
@ -960,6 +960,11 @@ export class DaemonService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.electronAPI.showNotification({
|
||||||
|
title: this.quitting ? 'Quiting monero daemon' : this.restarting ? 'Restarting monero daemon' : 'Stopping monero daemon',
|
||||||
|
body: this.quitting ? 'Monero daemon is quiting' : this.restarting ? 'Monero daemon is restarting' : 'Monero daemon is stopping'
|
||||||
|
});
|
||||||
|
|
||||||
this.stopping = true;
|
this.stopping = true;
|
||||||
this.onDaemonStopStart.emit();
|
this.onDaemonStopStart.emit();
|
||||||
|
|
||||||
|
@ -967,6 +972,10 @@ export class DaemonService {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|
||||||
if (typeof response.status == 'string' && response.status != 'OK') {
|
if (typeof response.status == 'string' && response.status != 'OK') {
|
||||||
|
window.electronAPI.showNotification({
|
||||||
|
title: 'Error',
|
||||||
|
body: 'Could not stop daemon'
|
||||||
|
});
|
||||||
throw new Error(`Could not stop daemon: ${response.status}`);
|
throw new Error(`Could not stop daemon: ${response.status}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,11 +984,23 @@ export class DaemonService {
|
||||||
for(let i = 0; i < maxChecks; i++) {
|
for(let i = 0; i < maxChecks; i++) {
|
||||||
if (!await this.isRunning(true)) {
|
if (!await this.isRunning(true)) {
|
||||||
this.stopping = false;
|
this.stopping = false;
|
||||||
|
|
||||||
|
if (!this.restarting) {
|
||||||
|
window.electronAPI.showNotification({
|
||||||
|
title: 'Daemon stopped',
|
||||||
|
body: 'Successfully stopped monero daemon'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.delay(5000);
|
await this.delay(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.electronAPI.showNotification({
|
||||||
|
title: 'Error',
|
||||||
|
body: 'Could not stop daemon'
|
||||||
|
});
|
||||||
throw new Error('Could not stop daemon');
|
throw new Error('Could not stop daemon');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<div *ngIf="upgradeSuccess" class="alert alert-success d-flex align-items-center justify-content-center text-center" role="alert">
|
<div *ngIf="upgradeSuccess" class="alert alert-success d-flex align-items-center justify-content-center text-center" role="alert">
|
||||||
<h4><i class="bi bi-check-circle m-2"></i></h4>
|
<h4><i class="bi bi-check-circle m-2"></i></h4>
|
||||||
<div>
|
<div>
|
||||||
Successfully upgraded monerod
|
Successfully installed last monerod version
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -57,10 +57,10 @@
|
||||||
|
|
||||||
<hr class="my-4">
|
<hr class="my-4">
|
||||||
|
|
||||||
<button *ngIf="!upgrading" class="w-100 btn btn-primary btn-lg" type="submit" (click)="upgrade()" [disabled]="buttonDisabled">{{ buttonTitle }}</button>
|
<button *ngIf="!upgrading && !installing" class="w-100 btn btn-primary btn-lg" type="submit" (click)="upgrade()" [disabled]="buttonDisabled">{{ buttonTitle }}</button>
|
||||||
<button *ngIf="upgrading" class="w-100 btn btn-primary btn-lg" type="button" disabled>
|
<button *ngIf="upgrading || installing" class="w-100 btn btn-primary btn-lg" type="button" disabled>
|
||||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||||
Upgrading monerod
|
{{ upgrading ? 'Upgrading' : 'Installing' }} monerod
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -75,7 +75,6 @@ export class VersionComponent implements AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngAfterViewInit(): void {
|
public ngAfterViewInit(): void {
|
||||||
this.upgrading = this.moneroInstaller.upgrading;
|
|
||||||
this.load()
|
this.load()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.cards = this.createCards();
|
this.cards = this.createCards();
|
||||||
|
@ -98,19 +97,25 @@ export class VersionComponent implements AfterViewInit {
|
||||||
this.latestVersion = latestVersion;
|
this.latestVersion = latestVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public upgrading: boolean = false;
|
public get upgrading(): boolean {
|
||||||
|
return this.moneroInstaller.upgrading;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get installing(): boolean {
|
||||||
|
return this.moneroInstaller.installing;
|
||||||
|
}
|
||||||
|
|
||||||
public upgradeSuccess: boolean = false;
|
public upgradeSuccess: boolean = false;
|
||||||
public upgradeError: string = '';
|
public upgradeError: string = '';
|
||||||
public downloadProgress: number = 100;
|
public downloadProgress: number = 100;
|
||||||
public downloadStatus : string = '';
|
public downloadStatus : string = '';
|
||||||
|
|
||||||
public async upgrade(): Promise<void> {
|
public async upgrade(): Promise<void> {
|
||||||
if (this.upgrading) {
|
if (this.upgrading || this.installing) {
|
||||||
console.warn("Already upgrading");
|
console.warn("Already upgrading");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.upgrading = true;
|
|
||||||
try {
|
try {
|
||||||
await this.daemonService.upgrade();
|
await this.daemonService.upgrade();
|
||||||
|
|
||||||
|
@ -122,7 +127,5 @@ export class VersionComponent implements AfterViewInit {
|
||||||
this.upgradeSuccess = false;
|
this.upgradeSuccess = false;
|
||||||
this.upgradeError = `${error}`;
|
this.upgradeError = `${error}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.upgrading = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue