mirror of
https://github.com/everoddandeven/monerod-gui.git
synced 2025-01-03 09:29:36 +00:00
General fixes
This commit is contained in:
parent
8ed6bb7036
commit
bbcea66905
12 changed files with 108 additions and 69 deletions
|
@ -69,7 +69,7 @@ function createWindow(): BrowserWindow {
|
|||
icon: wdwIcon
|
||||
});
|
||||
|
||||
win.webContents.openDevTools();
|
||||
//win.webContents.openDevTools();
|
||||
//win.setIcon()
|
||||
|
||||
if (serve) {
|
||||
|
@ -365,6 +365,11 @@ try {
|
|||
isQuitting = true;
|
||||
});
|
||||
|
||||
ipcMain.handle('quit', (event) => {
|
||||
isQuitting = true;
|
||||
app.quit();
|
||||
});
|
||||
|
||||
ipcMain.handle('start-monerod', (event, configFilePath: string[]) => {
|
||||
startMoneroDaemon(configFilePath);
|
||||
})
|
||||
|
|
|
@ -44,5 +44,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
|||
},
|
||||
gotOsType: (callback) => {
|
||||
ipcRenderer.on('got-os-type', callback);
|
||||
},
|
||||
quit: () => {
|
||||
ipcRenderer.invoke('quit');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { EventEmitter, Injectable } from '@angular/core';
|
||||
import { EventEmitter, Injectable, NgZone } from '@angular/core';
|
||||
import { DaemonService } from './daemon.service';
|
||||
import { BlockCount, BlockHeader, Chain, Connection, CoreIsBusyError, DaemonInfo, MinerData, MiningStatus, NetStats, NetStatsHistory, PeerInfo, PublicNode, SyncInfo, TxPool } from '../../../../common';
|
||||
import { BlockCount, BlockHeader, Chain, Connection, CoreIsBusyError, DaemonInfo, MinerData, MiningStatus, NetStats, NetStatsHistory, PeerInfo, PublicNode, SyncInfo, TxBacklogEntry, TxPool } from '../../../../common';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -57,6 +57,9 @@ export class DaemonDataService {
|
|||
private _peerList: PeerInfo[] = [];
|
||||
private _gettingPeerList: boolean = false;
|
||||
|
||||
private _txPoolBacklog: TxBacklogEntry[] = [];
|
||||
private _gettingTxPoolBackLog: boolean = false;
|
||||
|
||||
public readonly syncStart: EventEmitter<void> = new EventEmitter<void>();
|
||||
public readonly syncEnd: EventEmitter<void> = new EventEmitter<void>();
|
||||
public readonly syncError: EventEmitter<Error> = new EventEmitter<Error>();
|
||||
|
@ -67,15 +70,19 @@ export class DaemonDataService {
|
|||
public readonly netStatsRefreshStart: EventEmitter<void> = new EventEmitter<void>();
|
||||
public readonly netStatsRefreshEnd: EventEmitter<void> = new EventEmitter<void>();
|
||||
|
||||
constructor(private daemonService: DaemonService) {
|
||||
constructor(private daemonService: DaemonService, private ngZone: NgZone) {
|
||||
|
||||
this.daemonService.onDaemonStatusChanged.subscribe((running: boolean) => {
|
||||
if (running) {
|
||||
this.startLoop();
|
||||
}
|
||||
else {
|
||||
this.stopLoop();
|
||||
}
|
||||
this.ngZone.run(() => {
|
||||
if (running) {
|
||||
this._daemonRunning = true;
|
||||
this.startLoop();
|
||||
}
|
||||
else {
|
||||
this.stopLoop();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -215,6 +222,14 @@ export class DaemonDataService {
|
|||
return this._gettingPeerList;
|
||||
}
|
||||
|
||||
public get txPoolBacklog(): TxBacklogEntry[] {
|
||||
return this._txPoolBacklog;
|
||||
}
|
||||
|
||||
public get gettingTxPoolBacklog(): boolean {
|
||||
return this._gettingTxPoolBackLog;
|
||||
}
|
||||
|
||||
public setRefreshTimeout(ms: number = 5000): void {
|
||||
this.refreshTimeoutMs = ms;
|
||||
}
|
||||
|
@ -313,6 +328,7 @@ export class DaemonDataService {
|
|||
this._firstRefresh = false;
|
||||
|
||||
if (!this._daemonRunning) {
|
||||
this.stopLoop();
|
||||
this.syncEnd.emit();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,14 @@ export class BansComponent implements AfterViewInit {
|
|||
let _bans: Ban[] = [];
|
||||
|
||||
try {
|
||||
_bans = await this.daemonService.getBans();
|
||||
const running = await this.daemonService.isRunning();
|
||||
|
||||
if (running) {
|
||||
_bans = await this.daemonService.getBans();
|
||||
}
|
||||
else {
|
||||
_bans = [];
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
|
|
|
@ -21,7 +21,10 @@ export class BlockchainComponent implements AfterViewInit {
|
|||
return this.daemonData.stopping;
|
||||
}
|
||||
|
||||
public lastBlockHeader?: BlockHeader;
|
||||
public get lastBlockHeader(): BlockHeader | undefined {
|
||||
return this.daemonData.lastBlockHeader;
|
||||
}
|
||||
|
||||
public getLastBlockError: string = '';
|
||||
public block?: Block;
|
||||
public getBlockByHash: boolean = false;
|
||||
|
@ -64,28 +67,8 @@ export class BlockchainComponent implements AfterViewInit {
|
|||
];
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
public ngAfterViewInit(): void {
|
||||
this.navbarService.setLinks(this.navbarLinks);
|
||||
this.load().then().catch((error: any) => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
public async load(): Promise<void> {
|
||||
await this.getLastBlockHeader();
|
||||
}
|
||||
|
||||
private async getLastBlockHeader(): Promise<void> {
|
||||
this.gettingLastBlock = true;
|
||||
try {
|
||||
this.lastBlockHeader = await this.daemonService.getLastBlockHeader(true);
|
||||
this.getLastBlockError = '';
|
||||
}
|
||||
catch(error: any) {
|
||||
console.error(error);
|
||||
this.getLastBlockError = `${error}`;
|
||||
}
|
||||
this.gettingLastBlock = false;
|
||||
}
|
||||
|
||||
public async getBlock(): Promise<void> {
|
||||
|
|
|
@ -25,8 +25,8 @@ export class LogsService {
|
|||
}
|
||||
|
||||
public cleanLog(message: string): string {
|
||||
//return message.replace(/\u001b\[[0-9;]*m/g, '').replace(/[\r\n]+/g, '\n').trim();
|
||||
return message.replace(/[\r\n]+/g, '\n').trim();
|
||||
return message.replace(/\u001b\[[0-9;]*m/g, '').replace(/[\r\n]+/g, '\n').trim();
|
||||
//return message.replace(/[\r\n]+/g, '\n').trim();
|
||||
}
|
||||
|
||||
public log(message: string): void {
|
||||
|
|
|
@ -201,6 +201,27 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-tx-pool-backlog" role="tabpanel" aria-labelledby="pills-tx-pool-backlog-tab" tabindex="0">
|
||||
<h4 class="mb-3">All transactions pool backlog</h4>
|
||||
<br>
|
||||
|
||||
<table
|
||||
id="txPoolBacklogTable"
|
||||
data-toggle="txPoolBacklogTable"
|
||||
data-toolbar="#toolbar"
|
||||
data-paged="true"
|
||||
data-height="460"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-field="height">Blob Size</th>
|
||||
<th data-field="key">Fee</th>
|
||||
<th data-field="mask">Time In Pool</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-coinbase-tx-sum" role="tabpanel" aria-labelledby="pills-coinbase-tx-sum-tab" tabindex="0">
|
||||
<div class="row g-5 p-2">
|
||||
<div class="col-md-7 col-lg-12">
|
||||
|
|
|
@ -17,7 +17,11 @@ export class TransactionsComponent implements AfterViewInit, OnDestroy {
|
|||
public readonly navbarLinks: NavbarLink[];
|
||||
|
||||
public canRelay: boolean;
|
||||
public txPoolBacklog: TxBacklogEntry[];
|
||||
|
||||
public get txPoolBacklog(): TxBacklogEntry[] {
|
||||
return this.daemonData.txPoolBacklog;
|
||||
}
|
||||
|
||||
public height: number;
|
||||
public count: number;
|
||||
|
||||
|
@ -80,14 +84,13 @@ export class TransactionsComponent implements AfterViewInit, OnDestroy {
|
|||
new NavbarLink('pills-relay-tx-tab', '#pills-relay-tx', 'pills-relay-tx', false, 'Relay Tx'),
|
||||
new NavbarLink('pills-send-raw-tx-tab', '#pills-send-raw-tx', 'pills-send-raw-tx', false, 'Send Raw Tx'),
|
||||
new NavbarLink('pills-get-fee-estimate-tab', '#pills-get-fee-estimate', 'pills-get-fee-estimate', false, 'Get Fee Estimate'),
|
||||
new NavbarLink('pills-tx-backlog-tab', '#pills-tx-backlog', 'pills-tx-backlog', false, 'Tx Backlog'),
|
||||
new NavbarLink('pills-tx-pool-backlog-tab', '#pills-tx-pool-backlog', 'pills-tx-pool-backlog', false, 'Tx Pool Backlog'),
|
||||
new NavbarLink('pills-coinbase-tx-sum-tab', '#pills-coinbase-tx-sum', 'pills-coinbase-tx-sum', false, 'Coinbase Tx Sum'),
|
||||
new NavbarLink('pills-flush-tx-pool-tab', '#pills-flush-tx-pool', 'pills-flush-tx-pool', false, 'Flush Tx Pool'),
|
||||
new NavbarLink('pills-flush-cahe-tab', '#pills-flush-cache', 'pills-flush-cache', false, 'Flush Cache')
|
||||
];
|
||||
this.height = 0;
|
||||
this.count = 0;
|
||||
this.txPoolBacklog = [];
|
||||
|
||||
this.canRelay = false;
|
||||
}
|
||||
|
@ -95,18 +98,11 @@ export class TransactionsComponent implements AfterViewInit, OnDestroy {
|
|||
public ngAfterViewInit(): void {
|
||||
this.ngZone.run(() => {
|
||||
this.navbarService.setLinks(this.navbarLinks);
|
||||
|
||||
|
||||
this.initTables();
|
||||
this.subscriptions.push(this.daemonData.syncEnd.subscribe(() => {
|
||||
this.refreshTables();
|
||||
}));
|
||||
|
||||
this.load().then(() => {
|
||||
this.navbarService.enableLinks();
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
this.navbarService.disableLinks();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -130,6 +126,7 @@ export class TransactionsComponent implements AfterViewInit, OnDestroy {
|
|||
private initTables(): void {
|
||||
this.initTable('spentKeyImagesTable');
|
||||
this.initTable('transactionsTable');
|
||||
this.initTable('txPoolBacklogTable');
|
||||
}
|
||||
|
||||
private loadTransactionsTable(): void {
|
||||
|
@ -144,19 +141,16 @@ export class TransactionsComponent implements AfterViewInit, OnDestroy {
|
|||
$table.bootstrapTable('load', this.spentKeyImages);
|
||||
}
|
||||
|
||||
private loadTxPoolBacklogTable(): void {
|
||||
const $table = $('#txPoolBacklogTable');
|
||||
|
||||
$table.bootstrapTable('load', this.txPoolBacklog)
|
||||
}
|
||||
|
||||
private refreshTables(): void {
|
||||
this.loadSpentKeyImagesTable();
|
||||
this.loadTransactionsTable();
|
||||
}
|
||||
|
||||
private async load(): Promise<void> {
|
||||
try {
|
||||
this.txPoolBacklog = await this.daemonService.getTxPoolBacklog();
|
||||
console.log(this.txPoolBacklog)
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
this.loadTxPoolBacklogTable();
|
||||
}
|
||||
|
||||
public validTxIds(): boolean {
|
||||
|
|
|
@ -47,7 +47,9 @@ export class DaemonNotRunningComponent {
|
|||
}).catch((error: any) => {
|
||||
console.error(error);
|
||||
this.daemonConfigured = false;
|
||||
})
|
||||
});
|
||||
|
||||
this.daemonService.isRunning().then().catch((error: any) => console.error(error));
|
||||
}
|
||||
|
||||
public async startDaemon(): Promise<void> {
|
||||
|
|
|
@ -72,6 +72,12 @@ export class NavbarComponent {
|
|||
}
|
||||
|
||||
public async quit(): Promise<void> {
|
||||
const running: boolean = await this.daemonService.isRunning();
|
||||
|
||||
if (running) {
|
||||
await this.stopDaemon();
|
||||
}
|
||||
|
||||
window.electronAPI.quit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
export class TxBacklogEntry {
|
||||
public readonly blobSize: number;
|
||||
public readonly fee: number;
|
||||
public readonly timeInPool: number;
|
||||
public readonly blobSize: number;
|
||||
public readonly fee: number;
|
||||
public readonly timeInPool: number;
|
||||
|
||||
constructor(blobSize: number, fee: number, timeInPool: number) {
|
||||
this.blobSize = blobSize;
|
||||
this.fee = fee;
|
||||
this.timeInPool = timeInPool;
|
||||
}
|
||||
constructor(blobSize: number, fee: number, timeInPool: number) {
|
||||
this.blobSize = blobSize;
|
||||
this.fee = fee;
|
||||
this.timeInPool = timeInPool;
|
||||
}
|
||||
|
||||
public static fromBinary(binary: string): TxBacklogEntry[] {
|
||||
console.debug(binary);
|
||||
throw new Error("TxBacklogEntry.fromBinary(): not implemented");
|
||||
}
|
||||
public static fromBinary(binary: string): TxBacklogEntry[] {
|
||||
console.debug(binary);
|
||||
throw new Error("TxBacklogEntry.fromBinary(): not implemented");
|
||||
}
|
||||
}
|
|
@ -58,8 +58,10 @@ import 'bootstrap-table';
|
|||
declare global {
|
||||
interface Window {
|
||||
electronAPI: {
|
||||
startMonerod: (args: string[]) => void;
|
||||
getOsType: () => void;
|
||||
gotOsType: (callback: (event: any, osType: { platform: string, arch: string }) => void) => void;
|
||||
quit: () => void;
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue