diff --git a/frontend/src/app/components/statistics/statistics.component.ts b/frontend/src/app/components/statistics/statistics.component.ts
index 35137bff1..eebee5bce 100644
--- a/frontend/src/app/components/statistics/statistics.component.ts
+++ b/frontend/src/app/components/statistics/statistics.component.ts
@@ -72,8 +72,10 @@ export class StatisticsComponent implements OnInit {
this.route
.fragment
.subscribe((fragment) => {
- if (['2h', '24h', '1w', '1m', '3m', '6m', '1y', '2y', '3y', '4y'].indexOf(fragment) > -1) {
+ if (['2h', '24h', '1w', '1m', '3m', '6m', '1y', '2y', '3y', '4y', 'all'].indexOf(fragment) > -1) {
this.radioGroupForm.controls.dateSpan.setValue(fragment, { emitEvent: false });
+ } else {
+ this.radioGroupForm.controls.dateSpan.setValue('2h', { emitEvent: false });
}
});
@@ -114,7 +116,12 @@ export class StatisticsComponent implements OnInit {
if (this.radioGroupForm.controls.dateSpan.value === '3y') {
return this.apiService.list3YStatistics$();
}
- return this.apiService.list4YStatistics$();
+ if (this.radioGroupForm.controls.dateSpan.value === '4y') {
+ return this.apiService.list4YStatistics$();
+ }
+ if (this.radioGroupForm.controls.dateSpan.value === 'all') {
+ return this.apiService.listAllTimeStatistics$();
+ }
})
)
.subscribe((mempoolStats: any) => {
diff --git a/frontend/src/app/services/api.service.ts b/frontend/src/app/services/api.service.ts
index 8521ddc83..029d2183c 100644
--- a/frontend/src/app/services/api.service.ts
+++ b/frontend/src/app/services/api.service.ts
@@ -72,6 +72,10 @@ export class ApiService {
return this.httpClient.get(this.apiBaseUrl + this.apiBasePath + '/api/v1/statistics/4y');
}
+ listAllTimeStatistics$(): Observable {
+ return this.httpClient.get(this.apiBaseUrl + this.apiBasePath + '/api/v1/statistics/all');
+ }
+
getTransactionTimes$(txIds: string[]): Observable {
let params = new HttpParams();
txIds.forEach((txId: string) => {
From d4ed238ae176a362d5decf48715a748fad5fd08f Mon Sep 17 00:00:00 2001
From: Mononaut
Date: Wed, 21 Jun 2023 09:49:54 -0400
Subject: [PATCH 18/21] Add statistics/all to cache warmer, change query
keyword
---
backend/src/api/statistics/statistics-api.ts | 6 +++---
production/nginx-cache-warmer | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/backend/src/api/statistics/statistics-api.ts b/backend/src/api/statistics/statistics-api.ts
index 77bf66a2c..837d0ae44 100644
--- a/backend/src/api/statistics/statistics-api.ts
+++ b/backend/src/api/statistics/statistics-api.ts
@@ -211,7 +211,7 @@ class StatisticsApi {
CAST(avg(vsize_1800) as DOUBLE) as vsize_1800,
CAST(avg(vsize_2000) as DOUBLE) as vsize_2000 \
FROM statistics \
- ${interval === 'ALL TIME' ? '' : `WHERE added BETWEEN DATE_SUB(NOW(), INTERVAL ${interval}) AND NOW()`} \
+ ${interval === 'ALL' ? '' : `WHERE added BETWEEN DATE_SUB(NOW(), INTERVAL ${interval}) AND NOW()`} \
GROUP BY UNIX_TIMESTAMP(added) DIV ${div} \
ORDER BY statistics.added DESC;`;
}
@@ -259,7 +259,7 @@ class StatisticsApi {
vsize_1800,
vsize_2000 \
FROM statistics \
- ${interval === 'ALL TIME' ? '' : `WHERE added BETWEEN DATE_SUB(NOW(), INTERVAL ${interval}) AND NOW()`} \
+ ${interval === 'ALL' ? '' : `WHERE added BETWEEN DATE_SUB(NOW(), INTERVAL ${interval}) AND NOW()`} \
GROUP BY UNIX_TIMESTAMP(added) DIV ${div} \
ORDER BY statistics.added DESC;`;
}
@@ -388,7 +388,7 @@ class StatisticsApi {
public async $listAll(): Promise {
try {
- const query = this.getQueryForDays(43200, 'ALL TIME'); // 12h interval
+ const query = this.getQueryForDays(43200, 'ALL'); // 12h interval
const [rows] = await DB.query({ sql: query, timeout: this.queryTimeout });
return this.mapStatisticToOptimizedStatistic(rows as Statistic[]);
} catch (e) {
diff --git a/production/nginx-cache-warmer b/production/nginx-cache-warmer
index 6b58e5b78..6a82871a5 100755
--- a/production/nginx-cache-warmer
+++ b/production/nginx-cache-warmer
@@ -21,6 +21,7 @@ do for url in / \
'/api/v1/statistics/2y' \
'/api/v1/statistics/3y' \
'/api/v1/statistics/4y' \
+ '/api/v1/statistics/all' \
'/api/v1/mining/pools/24h' \
'/api/v1/mining/pools/3d' \
'/api/v1/mining/pools/1w' \
From ca1a1228a97f043a6e687816ca596144ef70ded9 Mon Sep 17 00:00:00 2001
From: Mononaut
Date: Wed, 21 Jun 2023 09:52:06 -0400
Subject: [PATCH 19/21] break graph toggles into two rows on small screens
---
.../statistics/statistics.component.html | 76 ++++++++++---------
.../statistics/statistics.component.scss | 40 ++++++++++
2 files changed, 80 insertions(+), 36 deletions(-)
diff --git a/frontend/src/app/components/statistics/statistics.component.html b/frontend/src/app/components/statistics/statistics.component.html
index f36d74963..29089e43d 100644
--- a/frontend/src/app/components/statistics/statistics.component.html
+++ b/frontend/src/app/components/statistics/statistics.component.html
@@ -20,42 +20,46 @@
-