From e25429168b75328960c6568e29b64fba30ed346f Mon Sep 17 00:00:00 2001 From: AnthonyLaw Date: Tue, 15 Jul 2025 05:11:59 +0800 Subject: [PATCH 01/15] [explorer] task: migrate statistic service to node watch --- src/infrastructure/NodeService.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/infrastructure/NodeService.js b/src/infrastructure/NodeService.js index 5865b3b9..65c41b6f 100644 --- a/src/infrastructure/NodeService.js +++ b/src/infrastructure/NodeService.js @@ -16,6 +16,7 @@ * */ +import { NodeWatchService } from '../infrastructure'; import http from './http'; import Constants from '../config/constants'; import helper from '../helper'; From f635dc1a4becea6f9a663c49e1f42934800fecb3 Mon Sep 17 00:00:00 2001 From: AnthonyLaw Date: Thu, 17 Jul 2025 03:55:47 +0800 Subject: [PATCH 02/15] [explorer] task: lint fix --- src/infrastructure/NodeService.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/infrastructure/NodeService.js b/src/infrastructure/NodeService.js index 65c41b6f..5865b3b9 100644 --- a/src/infrastructure/NodeService.js +++ b/src/infrastructure/NodeService.js @@ -16,7 +16,6 @@ * */ -import { NodeWatchService } from '../infrastructure'; import http from './http'; import Constants from '../config/constants'; import helper from '../helper'; From 0687b3727b53b6f62fb42297ea0568600a2d07f8 Mon Sep 17 00:00:00 2001 From: AnthonyLaw Date: Wed, 16 Jul 2025 05:39:06 +0800 Subject: [PATCH 03/15] [explorer] task: removed statistic service url, and npm library --- package-lock.json | 6 ------ package.json | 1 - src/config/default.json | 1 - src/infrastructure/StatisticService.js | 19 ------------------- src/infrastructure/http.js | 21 --------------------- 5 files changed, 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5494798a..90ed4f71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,6 @@ "nem-sdk": "^1.6.8", "net": "^1.0.2", "symbol-sdk": "^2.0.3", - "symbol-statistics-service-typescript-fetch-client": "^1.1.5", "tls": "^0.0.1", "url-parse": "^1.5.10", "vue": "^2.6.14", @@ -23939,11 +23938,6 @@ "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", "license": "Unlicense" }, - "node_modules/symbol-statistics-service-typescript-fetch-client": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/symbol-statistics-service-typescript-fetch-client/-/symbol-statistics-service-typescript-fetch-client-1.1.5.tgz", - "integrity": "sha512-hcVD9jq+S2kZCYaXTDglU43y3Dn5K6W3O45Y/pMAfiuYDCdVaHczAPDE/ZKGo0kZXy69e1sn/riAzfDfn8yFBw==" - }, "node_modules/symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", diff --git a/package.json b/package.json index bfc436d3..eb06c82e 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "nem-sdk": "^1.6.8", "net": "^1.0.2", "symbol-sdk": "^2.0.3", - "symbol-statistics-service-typescript-fetch-client": "^1.1.5", "tls": "^0.0.1", "url-parse": "^1.5.10", "vue": "^2.6.14", diff --git a/src/config/default.json b/src/config/default.json index 34a3a9a0..5188f549 100644 --- a/src/config/default.json +++ b/src/config/default.json @@ -2,7 +2,6 @@ "apiNodePort": 3001, "endpoints": { "marketData": "https://min-api.cryptocompare.com/", - "statisticsService": "https://symbol.services", "nodeWatch": "https://nodewatch.symbol.tools" }, "networkConfig": { diff --git a/src/infrastructure/StatisticService.js b/src/infrastructure/StatisticService.js index b0707987..4d6549be 100644 --- a/src/infrastructure/StatisticService.js +++ b/src/infrastructure/StatisticService.js @@ -16,8 +16,6 @@ * */ import Constants from '../config/constants'; -import globalConfig from '../config/globalConfig'; -import Axios from 'axios'; class StatisticService { /** @@ -151,14 +149,6 @@ class StatisticService { return chartData.map(el => ({ ...el, name: Constants.RoleType[el.name] || el.name })); } - static fetchFromStatisticsService = async route => { - if (this.isUrlProvided()) - return (await Axios.get(globalConfig.endpoints.statisticsService + route)).data; - - else - throw Error('Statistics service endpoint is not provided'); - } - static formatChartData = (data, includeKeys) => { const aggreagatedData = {}; const isKeyIncluded = key => !includeKeys || includeKeys.includes(key); @@ -189,15 +179,6 @@ class StatisticService { return chartData; } - - static isUrlProvided () { - try { - new URL(globalConfig?.endpoints?.statisticsService); // eslint-disable-line no-new - return true; - } catch (e) { - return false; - } - } } export default StatisticService; diff --git a/src/infrastructure/http.js b/src/infrastructure/http.js index 3e2ce43b..c99de2ce 100644 --- a/src/infrastructure/http.js +++ b/src/infrastructure/http.js @@ -20,10 +20,6 @@ import accountLabels from '../config/accountLabels'; import globalConfig from '../config/globalConfig'; import { NamespaceService } from '../infrastructure'; import * as symbol from 'symbol-sdk'; -import { - Configuration, - NodeApi -} from 'symbol-statistics-service-typescript-fetch-client'; let NODE_URL; @@ -190,21 +186,4 @@ export default class http { static get transactionPaginationStreamer() { return new symbol.TransactionPaginationStreamer(this.createRepositoryFactory.createTransactionRepository()); } - - static statisticServiceRestClient() { - try { - const statisticsServiceUrl = globalConfig.endpoints.statisticsService; - - if (statisticsServiceUrl && statisticsServiceUrl.length) { - return new NodeApi(new Configuration({ - fetchApi: fetch, - basePath: statisticsServiceUrl - })); - } else { - throw Error('Statistics service endpoint is not provided'); - } - } catch (error) { - console.error(error); - } - } } From e9feb47d56806d0c6e1622562ca2952655862324 Mon Sep 17 00:00:00 2001 From: AnthonyLaw Date: Thu, 17 Jul 2025 03:59:31 +0800 Subject: [PATCH 04/15] [explorer] task: added query node count endpoint --- src/infrastructure/NodeWatchService.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/infrastructure/NodeWatchService.js b/src/infrastructure/NodeWatchService.js index 3198ce97..d482b568 100644 --- a/src/infrastructure/NodeWatchService.js +++ b/src/infrastructure/NodeWatchService.js @@ -19,6 +19,11 @@ class NodeWatchService { return response.data; } + static async getNodeCount() { + const response = await this.get(`/api/symbol/nodes/count`); + return response.data; + } + static async get(route) { try { const response = await Axios.get(`${globalConfig.endpoints.nodeWatch}${route}`); From a320279afefcab7bb04735d3a9fe8cc9dd3e8f98 Mon Sep 17 00:00:00 2001 From: AnthonyLaw Date: Thu, 17 Jul 2025 06:47:30 +0800 Subject: [PATCH 05/15] [explorer] task: update test helper --- __tests__/TestHelper.js | 5 +++- __tests__/infrastructure/NodeService.spec.js | 24 ++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/__tests__/TestHelper.js b/__tests__/TestHelper.js index 6adcce7b..3de8ded5 100644 --- a/__tests__/TestHelper.js +++ b/__tests__/TestHelper.js @@ -375,7 +375,10 @@ const TestHelper = { finalizedPoint: 1, geoLocation: null, height: 120, - name: 'node' + name: 'node', + restVersion: null, + isHealthy: null, + isSslEnabled: null }, geoLocationCommonField: { city: 'ABC City', diff --git a/__tests__/infrastructure/NodeService.spec.js b/__tests__/infrastructure/NodeService.spec.js index a1d465dd..70102529 100644 --- a/__tests__/infrastructure/NodeService.spec.js +++ b/__tests__/infrastructure/NodeService.spec.js @@ -10,46 +10,46 @@ describe('Node Service', () => { const nodeWatchServiceNodeResponse = [ { + ...nodeCommonField, roles: 1, restVersion: null, isHealthy: null, - isSslEnabled: null, - ...nodeCommonField + isSslEnabled: null }, { + ...nodeCommonField, roles: 1, // Peer node (light) restVersion: '2.4.4', isHealthy: null, - isSslEnabled: true, - ...nodeCommonField + isSslEnabled: true }, { + ...nodeCommonField, roles: 3, restVersion: '2.4.4', isHealthy: true, - isSslEnabled: true, - ...nodeCommonField + isSslEnabled: true }, { + ...nodeCommonField, roles: 5, // Peer Voting node (light) restVersion: '2.4.4', isHealthy: null, - isSslEnabled: true, - ...nodeCommonField + isSslEnabled: true }, { + ...nodeCommonField, roles: 5, restVersion: null, isHealthy: null, - isSslEnabled: null, - ...nodeCommonField + isSslEnabled: null }, { + ...nodeCommonField, roles: 7, restVersion: '2.4.4', isHealthy: true, - isSslEnabled: true, - ...nodeCommonField + isSslEnabled: true } ]; From 54e10164569e00596ac90354ee930ecbd69c41f4 Mon Sep 17 00:00:00 2001 From: AnthonyLaw Date: Thu, 17 Jul 2025 06:48:42 +0800 Subject: [PATCH 06/15] [explorer] task: lint fix --- src/infrastructure/NodeWatchService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/infrastructure/NodeWatchService.js b/src/infrastructure/NodeWatchService.js index d482b568..609866cf 100644 --- a/src/infrastructure/NodeWatchService.js +++ b/src/infrastructure/NodeWatchService.js @@ -20,7 +20,7 @@ class NodeWatchService { } static async getNodeCount() { - const response = await this.get(`/api/symbol/nodes/count`); + const response = await this.get('/api/symbol/nodes/count'); return response.data; } From 155ced8c9e752911f1862a0c1f53594b8a8ef08f Mon Sep 17 00:00:00 2001 From: AnthonyLaw Date: Thu, 17 Jul 2025 06:49:53 +0800 Subject: [PATCH 07/15] [explorer] task: migrate to nodewatch services --- src/infrastructure/StatisticService.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/infrastructure/StatisticService.js b/src/infrastructure/StatisticService.js index 4d6549be..5669723b 100644 --- a/src/infrastructure/StatisticService.js +++ b/src/infrastructure/StatisticService.js @@ -16,6 +16,7 @@ * */ import Constants from '../config/constants'; +import { NodeWatchService } from '../infrastructure'; class StatisticService { /** @@ -143,7 +144,7 @@ class StatisticService { } static getNodeCountSeries = async () => { - const data = await StatisticService.fetchFromStatisticsService('/timeSeries/nodeCount'); + const data = await NodeWatchService.getNodeCount(); const chartData = StatisticService.formatChartData(data, ['1', '2', '3', '4', '5', '6', '7', 'total']); return chartData.map(el => ({ ...el, name: Constants.RoleType[el.name] || el.name })); From a5a243555e4703b7d9bcdc69e6fd059035e94a34 Mon Sep 17 00:00:00 2001 From: AnthonyLaw Date: Fri, 18 Jul 2025 04:09:45 +0800 Subject: [PATCH 08/15] [explorer] task: Added bubble chart config to chart components --- src/components/Chart.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/Chart.vue b/src/components/Chart.vue index 74d413f9..ecb41597 100644 --- a/src/components/Chart.vue +++ b/src/components/Chart.vue @@ -149,6 +149,11 @@ export default { dataLabels: { position: 'top' } + }, + bubble: { + zScaling: true, + minBubbleRadius: 10, + maxBubbleRadius: 50 } }, title: { @@ -189,7 +194,10 @@ export default { : {} }, tooltip: { - enabled: true + enabled: true, + z: { + title: 'Count: ' + }, }, legend: { show: true, From 1429d136e2c8da5449dc923f51b04f808bbd23dd Mon Sep 17 00:00:00 2001 From: AnthonyLaw Date: Fri, 18 Jul 2025 04:10:16 +0800 Subject: [PATCH 09/15] [explorer] task: convert chart bar to bubble --- .../widgets/NodeHeightStatsWidget.vue | 64 ++----------------- src/views/Statistics.vue | 8 +-- 2 files changed, 7 insertions(+), 65 deletions(-) diff --git a/src/components/widgets/NodeHeightStatsWidget.vue b/src/components/widgets/NodeHeightStatsWidget.vue index f44b0d58..b631e05f 100644 --- a/src/components/widgets/NodeHeightStatsWidget.vue +++ b/src/components/widgets/NodeHeightStatsWidget.vue @@ -1,20 +1,17 @@