From 3dedf1e3e1ff35f0b1ee479444b7c6887ca246f8 Mon Sep 17 00:00:00 2001 From: softsimon Date: Sat, 26 Sep 2020 22:46:26 +0700 Subject: [PATCH] Adding mini-graphs on dashboard. --- backend/src/routes.ts | 4 +- frontend/src/app/app.module.ts | 5 +- .../app/components/block/block.component.ts | 3 + .../master-page/master-page.component.html | 6 +- .../mempool-block/mempool-block.component.ts | 4 + .../mempool-graph/mempool-graph.component.ts | 23 ++++-- .../app/components/start/start.component.ts | 13 +--- .../statistics/statistics.component.ts | 6 +- .../transaction/transaction.component.ts | 1 + .../app/dashboard/dashboard.component.html | 37 ++++++++-- .../app/dashboard/dashboard.component.scss | 6 +- .../src/app/dashboard/dashboard.component.ts | 74 ++++++++++++++++++- .../src/app/services/websocket.service.ts | 3 + 13 files changed, 148 insertions(+), 37 deletions(-) diff --git a/backend/src/routes.ts b/backend/src/routes.ts index ecf827dee..22205a3a9 100644 --- a/backend/src/routes.ts +++ b/backend/src/routes.ts @@ -15,8 +15,8 @@ class Routes { constructor() { if (!config.DB_DISABLED) { - this.createCache(); - setInterval(this.createCache.bind(this), 600000); + // this.createCache(); + // setInterval(this.createCache.bind(this), 600000); } } diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 00b9282b6..8482e8df1 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -43,7 +43,7 @@ import { NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap'; import { FeesBoxComponent } from './components/fees-box/fees-box.component'; import { DashboardComponent } from './dashboard/dashboard.component'; import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome'; -import { faChartArea, faCube, faDatabase, faInfo, faInfoCircle, faList, faQuestion, faQuestionCircle, faSearch, faTachometerAlt, faThList, faTv } from '@fortawesome/free-solid-svg-icons'; +import { faChartArea, faCube, faCubes, faDatabase, faInfo, faInfoCircle, faList, faQuestion, faQuestionCircle, faSearch, faTachometerAlt, faThList, faTv } from '@fortawesome/free-solid-svg-icons'; @NgModule({ declarations: [ @@ -101,7 +101,8 @@ export class AppModule { library.addIcons(faInfoCircle); library.addIcons(faChartArea); library.addIcons(faTv); - library.addIcons(faCube); + library.addIcons(faTachometerAlt); + library.addIcons(faCubes); library.addIcons(faThList); library.addIcons(faList); library.addIcons(faTachometerAlt); diff --git a/frontend/src/app/components/block/block.component.ts b/frontend/src/app/components/block/block.component.ts index 735e258c7..4a27ccf06 100644 --- a/frontend/src/app/components/block/block.component.ts +++ b/frontend/src/app/components/block/block.component.ts @@ -8,6 +8,7 @@ import { of, Subscription } from 'rxjs'; import { StateService } from '../../services/state.service'; import { SeoService } from 'src/app/services/seo.service'; import { env } from 'src/app/app.constants'; +import { WebsocketService } from 'src/app/services/websocket.service'; @Component({ selector: 'app-block', @@ -39,9 +40,11 @@ export class BlockComponent implements OnInit, OnDestroy { private electrsApiService: ElectrsApiService, private stateService: StateService, private seoService: SeoService, + private websocketService: WebsocketService, ) { } ngOnInit() { + this.websocketService.want(['blocks', 'mempool-blocks']); this.paginationMaxSize = window.matchMedia('(max-width: 700px)').matches ? 3 : 5; this.network = this.stateService.network; diff --git a/frontend/src/app/components/master-page/master-page.component.html b/frontend/src/app/components/master-page/master-page.component.html index 4f15e99c6..21afec088 100644 --- a/frontend/src/app/components/master-page/master-page.component.html +++ b/frontend/src/app/components/master-page/master-page.component.html @@ -29,7 +29,7 @@