From ef3d5b616ec52c497dce7787162e05896db815e4 Mon Sep 17 00:00:00 2001 From: everoddandeven Date: Tue, 24 Sep 2024 00:28:24 +0200 Subject: [PATCH] Transactions and outputs pages --- src/app/app-routing.module.ts | 2 ++ src/app/app.component.html | 2 +- src/app/app.module.ts | 5 +++ src/app/detail/detail.component.html | 8 +++-- src/app/detail/detail.component.ts | 35 +++++++++++++++---- src/app/mining/mining.component.html | 4 ++- src/app/mining/mining.component.ts | 5 ++- src/app/navbar/navbar.component.html | 2 +- src/app/outputs/outputs-routing.module.ts | 17 +++++++++ src/app/outputs/outputs.component.html | 1 + src/app/outputs/outputs.component.scss | 0 src/app/outputs/outputs.component.spec.ts | 23 ++++++++++++ src/app/outputs/outputs.component.ts | 26 ++++++++++++++ src/app/outputs/outputs.module.ts | 17 +++++++++ .../page-not-found.component.html | 7 ++-- src/app/sidebar/sidebar.component.html | 2 +- src/app/sidebar/sidebar.component.ts | 3 ++ .../transactions-routing.module.ts | 18 ++++++++++ .../transactions/transactions.component.html | 1 + .../transactions/transactions.component.scss | 0 .../transactions.component.spec.ts | 23 ++++++++++++ .../transactions/transactions.component.ts | 30 ++++++++++++++++ src/app/transactions/transactions.module.ts | 17 +++++++++ src/common/request/GetTransactionsRequest.ts | 27 ++++++++++++++ 24 files changed, 259 insertions(+), 16 deletions(-) create mode 100644 src/app/outputs/outputs-routing.module.ts create mode 100644 src/app/outputs/outputs.component.html create mode 100644 src/app/outputs/outputs.component.scss create mode 100644 src/app/outputs/outputs.component.spec.ts create mode 100644 src/app/outputs/outputs.component.ts create mode 100644 src/app/outputs/outputs.module.ts create mode 100644 src/app/transactions/transactions-routing.module.ts create mode 100644 src/app/transactions/transactions.component.html create mode 100644 src/app/transactions/transactions.component.scss create mode 100644 src/app/transactions/transactions.component.spec.ts create mode 100644 src/app/transactions/transactions.component.ts create mode 100644 src/app/transactions/transactions.module.ts create mode 100644 src/common/request/GetTransactionsRequest.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 1f640a4..559fd95 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -6,6 +6,7 @@ import { HomeRoutingModule } from './home/home-routing.module'; import { DetailRoutingModule } from './detail/detail-routing.module'; import { HardForkInfoRoutingModule } from './hard-fork-info/hard-fork-info-routing.module'; import { SettingsModule } from './settings/settings.module'; +import { TransactionsModule } from './transactions/transactions.module'; const routes: Routes = [ { @@ -24,6 +25,7 @@ const routes: Routes = [ RouterModule.forRoot(routes, {}), HomeRoutingModule, DetailRoutingModule, + TransactionsModule, HardForkInfoRoutingModule, SettingsModule ], diff --git a/src/app/app.component.html b/src/app/app.component.html index e330bae..7836fbc 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,7 +1,7 @@
-
+
diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 015259d..8ad3137 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -20,6 +20,8 @@ import { LoadComponent } from "./load/load.component"; import { BansModule } from './bans/bans.module'; import { NavbarComponent } from "./navbar/navbar.component"; import { MiningModule } from './mining/mining.module'; +import { TransactionsModule } from './transactions/transactions.module'; +import { OutputsModule } from './outputs/outputs.module'; // AoT requires an exported function for factories const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json'); @@ -36,6 +38,9 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl DetailModule, BansModule, MiningModule, + TransactionsModule, + OutputsModule, + TranslateModule, AppRoutingModule, TranslateModule.forRoot({ loader: { diff --git a/src/app/detail/detail.component.html b/src/app/detail/detail.component.html index 9099a33..b4666ac 100644 --- a/src/app/detail/detail.component.html +++ b/src/app/detail/detail.component.html @@ -5,9 +5,13 @@
-

Daemon not running

+

Daemon not running

Start monero daemon

- + +
@for(card of cards; track card.header) { diff --git a/src/app/detail/detail.component.ts b/src/app/detail/detail.component.ts index 2ce99e2..f556c14 100644 --- a/src/app/detail/detail.component.ts +++ b/src/app/detail/detail.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, AfterViewInit, NgZone } from '@angular/core'; +import { Component, OnInit, AfterViewInit, NgZone, OnDestroy } from '@angular/core'; import { DaemonService } from '../core/services/daemon/daemon.service'; import { SyncInfo } from '../../common/SyncInfo'; import { Peer } from '../../common/Peer'; @@ -12,9 +12,10 @@ import { DaemonInfo } from '../../common/DaemonInfo'; templateUrl: './detail.component.html', styleUrls: ['./detail.component.scss'] }) -export class DetailComponent implements OnInit, AfterViewInit { +export class DetailComponent implements OnInit, AfterViewInit, OnDestroy { public daemonRunning: boolean; + public startingDaemon: boolean; private syncInfo?: SyncInfo; private daemonInfo?: DaemonInfo; private readonly navbarLinks: NavbarLink[]; @@ -38,6 +39,8 @@ export class DetailComponent implements OnInit, AfterViewInit { private isLoading: boolean; + private loadInterval?: any; + public get loading(): boolean { return this.isLoading; } @@ -46,6 +49,7 @@ export class DetailComponent implements OnInit, AfterViewInit { constructor(private router: Router,private daemonService: DaemonService, private navbarService: NavbarService, private ngZone: NgZone) { this.daemonRunning = false; + this.startingDaemon = false; this.syncStatus = 'Not synced'; this.height = 0; this.targetHeight = 0; @@ -86,8 +90,11 @@ export class DetailComponent implements OnInit, AfterViewInit { console.log('DetailComponent AFTER VIEW INIT'); this.navbarService.setNavbarLinks(this.navbarLinks); - setTimeout(() => { + this.loadInterval = setInterval(() => { this.ngZone.run(() => { + if (this.isLoading) { + return; + } const $table = $('#table'); $table.bootstrapTable({}); $table.bootstrapTable('refreshOptions', { @@ -95,8 +102,16 @@ export class DetailComponent implements OnInit, AfterViewInit { }); this.load(); - }, 500); }); + }, 5000); + } + + ngOnDestroy(): void { + console.log("DetailComponent ON DESTROY"); + + if(this.loadInterval != null) { + clearInterval(this.loadInterval); + } } public async startDaemon(): Promise { @@ -104,9 +119,17 @@ export class DetailComponent implements OnInit, AfterViewInit { console.warn("Daemon already running"); return; } + this.startingDaemon = true; - await this.daemonService.startDaemon(); - this.daemonRunning = await this.daemonService.isRunning(); + try { + await this.daemonService.startDaemon(); + this.daemonRunning = await this.daemonService.isRunning(); + } + catch(error) { + console.error(error); + } + + this.startingDaemon = false; } private onNavigationEnd(): void { diff --git a/src/app/mining/mining.component.html b/src/app/mining/mining.component.html index 3195148..d23f054 100644 --- a/src/app/mining/mining.component.html +++ b/src/app/mining/mining.component.html @@ -55,11 +55,13 @@
-

Core is busy.

+

Core is busy.

Mining capabilities are not available during daemon sync.

+