diff --git a/angular.json b/angular.json index 3e79d4b..f247748 100644 --- a/angular.json +++ b/angular.json @@ -38,7 +38,7 @@ ], "scripts": [ "node_modules/jquery/dist/jquery.min.js", - "node_modules/bootstrap/dist/js/bootstrap.bundle.min.js", + "node_modules/bootstrap/dist/js/bootstrap.min.js", "node_modules/bootstrap-table/dist/bootstrap-table.min.js" ], "styles": [ diff --git a/app/main.ts b/app/main.ts index 6405011..f47b4d5 100644 --- a/app/main.ts +++ b/app/main.ts @@ -311,12 +311,10 @@ function isConnectedToWiFi(): Promise { return new Promise((resolve, reject) => { network.get_active_interface((err: any | null, obj: { name: string, ip_address: string, mac_address: string, type: string, netmask: string, gateway_ip: string }) => { if (err) { - console.error("Errore durante il controllo della connessione Wi-Fi:", err); + console.error(err); reject(err); } else { - console.log('isConnectedToWifi:'); - console.log(obj); resolve(obj.type == 'Wireless'); } }) diff --git a/app/package-lock.json b/app/package-lock.json index 736e10d..2c43f39 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -1,12 +1,12 @@ { "name": "monerod-gui", - "version": "0.1.2", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "monerod-gui", - "version": "0.1.2", + "version": "1.0.0", "dependencies": { "adm-zip": "^0.5.16", "applescript": "^1.0.0", @@ -19,7 +19,7 @@ "winreg": "^1.2.5" }, "devDependencies": { - "@types/adm-zip": "^0.5.5", + "@types/adm-zip": "^0.5.6", "@types/auto-launch": "^5.0.5", "@types/battery-level": "^3.0.2", "@types/pidusage": "^2.0.5", @@ -63,9 +63,9 @@ } }, "node_modules/@types/adm-zip": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.5.5.tgz", - "integrity": "sha512-YCGstVMjc4LTY5uK9/obvxBya93axZOVOyf2GSUulADzmLhYE45u2nAssCs/fWBs1Ifq5Vat75JTPwd5XZoPJw==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.5.6.tgz", + "integrity": "sha512-lRlcSLg5Yoo7C2H2AUiAoYlvifWoCx/se7iUNiCBTfEVVYFVn+Tr9ZGed4K73tYgLe9O4PjdJvbxlkdAOx/qiw==", "dev": true, "dependencies": { "@types/node": "*" diff --git a/app/package.json b/app/package.json index d23ab93..d0e1d4c 100644 --- a/app/package.json +++ b/app/package.json @@ -21,7 +21,7 @@ "winreg": "^1.2.5" }, "devDependencies": { - "@types/adm-zip": "^0.5.5", + "@types/adm-zip": "^0.5.6", "@types/auto-launch": "^5.0.5", "@types/battery-level": "^3.0.2", "@types/pidusage": "^2.0.5", diff --git a/package-lock.json b/package-lock.json index 7057b7c..5768fd3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "monerod-gui", - "version": "0.1.2", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "monerod-gui", - "version": "0.1.2", + "version": "1.0.0", "funding": [ { "type": "individual", @@ -24,6 +24,7 @@ "@angular/platform-browser": "18.2.11", "@angular/platform-browser-dynamic": "18.2.11", "@angular/router": "18.2.11", + "@popperjs/core": "2.11.8", "bootstrap": "5.3.3", "bootstrap-icons": "1.11.3", "bootstrap-table": "1.23.5", diff --git a/package.json b/package.json index 6bb4e47..a6dfa8d 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,7 @@ "@angular/platform-browser": "18.2.11", "@angular/platform-browser-dynamic": "18.2.11", "@angular/router": "18.2.11", + "@popperjs/core": "2.11.8", "bootstrap": "5.3.3", "bootstrap-icons": "1.11.3", "bootstrap-table": "1.23.5", diff --git a/src/app/core/services/daemon/daemon-tray.service.ts b/src/app/core/services/daemon/daemon-tray.service.ts index 15ecc55..ef163ce 100644 --- a/src/app/core/services/daemon/daemon-tray.service.ts +++ b/src/app/core/services/daemon/daemon-tray.service.ts @@ -59,7 +59,7 @@ export class DaemonTrayService { console.debug(event); this.disableAllItems(); - this.daemonService.quit().then(() => this.disableAllItems()).catch((error: any) => console.error(error)); + this.daemonService.quit().then().catch((error: any) => console.error(error)); }); window.electronAPI.onTrayStartSync((event: any) => { diff --git a/src/app/pages/base-page/base-page.component.ts b/src/app/pages/base-page/base-page.component.ts index 051c3ae..32bb679 100644 --- a/src/app/pages/base-page/base-page.component.ts +++ b/src/app/pages/base-page/base-page.component.ts @@ -37,13 +37,7 @@ export abstract class BasePageComponent implements AfterContentInit, OnDestroy { const $table = $(`#${id}`); - $table.bootstrapTable({ - search: true, - showSearchButton: true, - showColumnsSearch: true, - showColumns: true, - pagination: true - }); + $table.bootstrapTable({}); $table.bootstrapTable('refreshOptions', { classes: 'table table-bordered table-hover table-dark table-striped' }); diff --git a/src/app/pages/mining/mining.component.html b/src/app/pages/mining/mining.component.html index 468d6d3..6794aff 100644 --- a/src/app/pages/mining/mining.component.html +++ b/src/app/pages/mining/mining.component.html @@ -166,7 +166,7 @@
-

Current Hashrate: {{networkHashRate}} GH/s

+

Current Hashrate: {{networkHashRate}}

diff --git a/src/app/pages/mining/mining.component.ts b/src/app/pages/mining/mining.component.ts index b077f31..75a6a8d 100644 --- a/src/app/pages/mining/mining.component.ts +++ b/src/app/pages/mining/mining.component.ts @@ -98,10 +98,32 @@ export class MiningComponent extends BasePageComponent implements AfterViewInit, return this.daemonData.altChains; } - public get networkHashRate(): number { - const origValue = this.daemonData.info ? this.daemonData.info.gigaHashRate : 0; - - return parseFloat(origValue.toFixed(2)); + public get networkHashRate(): string { + const info = this.daemonData.info; + + if (!info) { + return "0 GH/s"; + } + + const origGHs = parseFloat(info.gigaHashRate.toFixed(2)); + const origMHs = parseFloat(info.megaHashRate.toFixed(2)); + const origKHs = parseFloat(info.kiloHashRate.toFixed(2)); + const origHs = parseFloat(info.hashRate.toFixed(2)); + + if (origGHs >= 1) { + return `${origGHs} GH/s`; + } + else if (origMHs >= 1) { + return `${origMHs} MH/s`; + } + else if (origKHs >= 1) { + return `${origKHs} KH/s`; + } + else if (origHs >= 1) { + return `${origHs} H/s`; + } + + return "0 GH/s"; } private netHashRateChart?: Chart; diff --git a/src/app/pages/network/network.component.ts b/src/app/pages/network/network.component.ts index 165033f..df8c24a 100644 --- a/src/app/pages/network/network.component.ts +++ b/src/app/pages/network/network.component.ts @@ -80,6 +80,10 @@ export class NetworkComponent extends BasePageComponent implements AfterViewInit } public async refreshConnectionsTable(): Promise { + if (!await this.daemonService.isRunning()) { + return; + } + this.refreshingConnectionsTable = true; try { diff --git a/src/app/pages/peers/peers.component.ts b/src/app/pages/peers/peers.component.ts index 36e526f..1b618c1 100644 --- a/src/app/pages/peers/peers.component.ts +++ b/src/app/pages/peers/peers.component.ts @@ -84,6 +84,10 @@ export class PeersComponent extends BasePageComponent implements AfterViewInit { } public async refreshPeerListTable(): Promise { + if (!await this.daemonService.isRunning()) { + return; + } + this.refreshingPeerList = true; try { @@ -100,6 +104,10 @@ export class PeersComponent extends BasePageComponent implements AfterViewInit { } public async refreshPublicNodesTable(): Promise { + if (!await this.daemonService.isRunning()) { + return; + } + this.refreshingPublicNodes = true; try { diff --git a/src/app/pages/settings/settings.component.html b/src/app/pages/settings/settings.component.html index f05b236..56a0733 100644 --- a/src/app/pages/settings/settings.component.html +++ b/src/app/pages/settings/settings.component.html @@ -670,11 +670,6 @@ Set maximum size of block download queue in bytes (0 for default) - -
- - -
@@ -699,6 +694,44 @@
+
+ +
+

Database Sync Mode

+ +
+ + +
+ +
+ + +
+ +
+ + + Number of bytes/blocks +
+ +
+ + +
+ +
+ diff --git a/src/app/pages/settings/settings.component.ts b/src/app/pages/settings/settings.component.ts index 1ad0ccd..e898a6f 100644 --- a/src/app/pages/settings/settings.component.ts +++ b/src/app/pages/settings/settings.component.ts @@ -26,6 +26,15 @@ export class SettingsComponent { public networkType: 'mainnet' | 'testnet' | 'stagenet' = 'mainnet'; public successMessage: string = ''; + + public databaseSyncSpeed: 'safe' | 'fast' | 'fastest' = 'fast'; + public databaseSyncMode: 'sync' | 'async' = 'async'; + public databaseSyncNBytesOrBlocks: number = 250000000; + public databaseSyncNPerMode: 'bytes' | 'blocks' = 'bytes'; + + private get dbSyncMode(): string { + return `${this.databaseSyncSpeed}:${this.databaseSyncMode}:${this.databaseSyncNBytesOrBlocks}${this.databaseSyncNPerMode}`; + } constructor(private daemonService: DaemonService, private electronService: ElectronService, private ngZone: NgZone) { this.loading = true; @@ -61,14 +70,46 @@ export class SettingsComponent { public isAppImage: boolean = true; + public refreshSyncMode(): void { + this.currentSettings.dbSyncMode = this.dbSyncMode; + } + + private initSyncMode(): void { + if (!this.currentSettings) { + return; + } + + const dbSyncMode = this.currentSettings.dbSyncMode; + + if (dbSyncMode == '') { + return; + } + + const cmps = dbSyncMode.split(":"); + + if (cmps.length != 3) { + return; + } + + const speed: 'safe' | 'fast' | 'fastest' = (cmps[0] == 'safe' || cmps[0] == 'fast' || cmps[0] == 'fastest') ? cmps[0] : 'fast'; + const mode: 'sync' | 'async' = (cmps[1] == 'sync' || cmps[1] == 'async') ? cmps[1] : 'async'; + const nPerMode: 'bytes' | 'blocks' = cmps[2].endsWith('blocks') ? 'blocks' : 'bytes'; + const n: number = parseInt(cmps[2].replace(nPerMode, '')); + + this.databaseSyncSpeed = speed; + this.databaseSyncMode = mode; + this.databaseSyncNPerMode = nPerMode; + this.databaseSyncNBytesOrBlocks = n; + } + private async load(): Promise { - console.log("getting settings"); this.originalSettings = await this.daemonService.getSettings(); this.currentSettings = this.originalSettings.clone(); + this.initSyncMode(); + this.loading = false; this.isAppImage = await this.electronService.isAppImage(); - this.networkType = this.currentSettings.mainnet ? 'mainnet' : this.currentSettings.testnet ? 'testnet' : this.currentSettings.stagenet ? 'stagenet' : 'mainnet'; } 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 afdeee3..a099aea 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 @@ -21,7 +21,9 @@ export class DaemonNotRunningComponent implements OnDestroy { return this.statusService.daemonRunning; } - public daemonConfigured: boolean = true; + public get daemonConfigured(): boolean { + return this.statusService.daemonConfigured; + } public get disablingSync(): boolean { return this.statusService.disablingSync; diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 72edd23..84ccc26 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -9,7 +9,6 @@ import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; import { NavbarComponent } from './components/navbar/navbar.component'; -import 'jquery'; import 'bootstrap'; import 'bootstrap-table'; diff --git a/src/styles.scss b/src/styles.scss index 7062056..fbf7912 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -1,6 +1,7 @@ $primary: #ff5733; @import "/node_modules/bootstrap/scss/bootstrap"; +@import "/node_modules/bootstrap-table/dist/bootstrap-table.min.css"; .bi { display: inline-block;