From a2e23014f430d4a4e3a2e7f049b6c3ffdd4f7dd1 Mon Sep 17 00:00:00 2001 From: softsimon Date: Tue, 21 Mar 2023 23:14:45 +0900 Subject: [PATCH 1/5] Update channels map indexing indicator --- .../node-statistics-chart.component.ts | 2 +- .../nodes-channels-map/nodes-channels-map.component.ts | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts b/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts index 7518b33da..4416ae297 100644 --- a/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts +++ b/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts @@ -81,7 +81,7 @@ export class NodeStatisticsChartComponent implements OnInit { color: 'grey', fontSize: 15 }, - text: `Loading`, + text: $localize`No data to display yet. Try again later.`, left: 'center', top: 'center' }; diff --git a/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts b/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts index 05e35b6af..3899bb673 100644 --- a/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts +++ b/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts @@ -206,20 +206,13 @@ export class NodesChannelsMap implements OnInit { prepareChartOptions(nodes, channels) { let title: object; if (channels.length === 0 && !this.placeholder) { - this.chartOptions = null; - this.showIndexingInProgress = true; this.isLoading = false; - return; - } - - // empty map fallback - if (channels.length === 0 && this.placeholder) { title = { textStyle: { color: 'white', fontSize: 18 }, - text: $localize`No geolocation data available`, + text: $localize`No data to display yet. Try again later.`, left: 'center', top: 'center' }; From bf5821c8c8512c1d1dcd25dcf5b22579f6085748 Mon Sep 17 00:00:00 2001 From: softsimon Date: Tue, 21 Mar 2023 23:17:09 +0900 Subject: [PATCH 2/5] Remove indexing indicator --- .../nodes-channels-map/nodes-channels-map.component.html | 3 --- .../nodes-channels-map/nodes-channels-map.component.ts | 1 - 2 files changed, 4 deletions(-) diff --git a/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.html b/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.html index 54868fbe6..b262f58fd 100644 --- a/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.html +++ b/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.html @@ -18,8 +18,5 @@
-
- Indexing in progress -
\ No newline at end of file diff --git a/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts b/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts index 3899bb673..5fce18c4e 100644 --- a/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts +++ b/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts @@ -36,7 +36,6 @@ export class NodesChannelsMap implements OnInit { channelCurve = 0; nodeSize = 4; isLoading = false; - showIndexingInProgress = false; chartInstance = undefined; chartOptions: EChartsOption = {}; From 77835bcb9d1d643f70004a4da738a7551fcebae6 Mon Sep 17 00:00:00 2001 From: softsimon Date: Wed, 22 Mar 2023 13:20:22 +0900 Subject: [PATCH 3/5] Restoring Preview component behavior --- .../nodes-channels-map.component.ts | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts b/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts index 5fce18c4e..bf4117b30 100644 --- a/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts +++ b/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts @@ -204,19 +204,33 @@ export class NodesChannelsMap implements OnInit { prepareChartOptions(nodes, channels) { let title: object; - if (channels.length === 0 && !this.placeholder) { - this.isLoading = false; - title = { - textStyle: { - color: 'white', - fontSize: 18 - }, - text: $localize`No data to display yet. Try again later.`, - left: 'center', - top: 'center' - }; - this.zoom = 1.5; - this.center = [0, 20]; + if (channels.length === 0) { + if (!this.placeholder) { + this.isLoading = false; + title = { + textStyle: { + color: 'white', + fontSize: 18 + }, + text: $localize`No data to display yet. Try again later.`, + left: 'center', + top: 'center' + }; + this.zoom = 1.5; + this.center = [0, 20]; + } else { // used for Node and Channel preview components + title = { + textStyle: { + color: 'white', + fontSize: 18 + }, + text: $localize`No geolocation data available`, + left: 'center', + top: 'center' + }; + this.zoom = 1.5; + this.center = [0, 20]; + } } this.chartOptions = { From f1f6c4812870995232e2ac23fae69fcd0005ebbf Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Wed, 22 Mar 2023 13:45:27 +0900 Subject: [PATCH 4/5] Show "No data to display yet" until we have at least two points for node stats charts --- .../node-statistics-chart.component.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts b/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts index 4416ae297..21e3fc2c5 100644 --- a/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts +++ b/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts @@ -75,7 +75,7 @@ export class NodeStatisticsChartComponent implements OnInit { prepareChartOptions(data) { let title: object; - if (data.channels.length === 0) { + if (data.channels.length < 2) { title = { textStyle: { color: 'grey', @@ -135,14 +135,14 @@ export class NodeStatisticsChartComponent implements OnInit { return tooltip; } }, - xAxis: data.channels.length === 0 ? undefined : { + xAxis: data.channels.length < 2 ? undefined : { type: 'time', splitNumber: this.isMobile() ? 5 : 10, axisLabel: { hideOverlap: true, } }, - legend: data.channels.length === 0 ? undefined : { + legend: data.channels.length < 2 ? undefined : { padding: 10, data: [ { @@ -167,7 +167,7 @@ export class NodeStatisticsChartComponent implements OnInit { 'Capacity': true, } }, - yAxis: data.channels.length === 0 ? undefined : [ + yAxis: data.channels.length < 2 ? undefined : [ { type: 'value', axisLabel: { @@ -198,7 +198,7 @@ export class NodeStatisticsChartComponent implements OnInit { } } ], - series: data.channels.length === 0 ? [] : [ + series: data.channels.length < 2 ? [] : [ { zlevel: 1, name: $localize`:@@807cf11e6ac1cde912496f764c176bdfdd6b7e19:Channels`, From ed69591bcf3afe145d08f129e890324af2ef5de8 Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Wed, 22 Mar 2023 14:09:30 +0900 Subject: [PATCH 5/5] Show "No data to display yet" in "Fee distribution" chart on node page when there are no channels yet --- .../node-fee-chart.component.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/lightning/node-fee-chart/node-fee-chart.component.ts b/frontend/src/app/lightning/node-fee-chart/node-fee-chart.component.ts index 242ecc6ed..97268226d 100644 --- a/frontend/src/app/lightning/node-fee-chart/node-fee-chart.component.ts +++ b/frontend/src/app/lightning/node-fee-chart/node-fee-chart.component.ts @@ -101,8 +101,15 @@ export class NodeFeeChartComponent implements OnInit { } prepareChartOptions(outgoingData, incomingData): void { + let sum = outgoingData.reduce((accumulator, object) => { + return accumulator + object.count; + }, 0); + sum += incomingData.reduce((accumulator, object) => { + return accumulator + object.count; + }, 0); + let title: object; - if (outgoingData.length === 0) { + if (sum === 0) { title = { textStyle: { color: 'grey', @@ -115,7 +122,7 @@ export class NodeFeeChartComponent implements OnInit { } this.chartOptions = { - title: outgoingData.length === 0 ? title : undefined, + title: sum === 0 ? title : undefined, animation: false, grid: { top: 30, @@ -151,7 +158,7 @@ export class NodeFeeChartComponent implements OnInit { `; } }, - xAxis: outgoingData.length === 0 ? undefined : { + xAxis: sum === 0 ? undefined : { type: 'category', axisLine: { onZero: true }, axisLabel: { @@ -163,7 +170,7 @@ export class NodeFeeChartComponent implements OnInit { }, data: outgoingData.map(bucket => bucket.label) }, - legend: outgoingData.length === 0 ? undefined : { + legend: sum === 0 ? undefined : { padding: 10, data: [ { @@ -184,7 +191,7 @@ export class NodeFeeChartComponent implements OnInit { }, ], }, - yAxis: outgoingData.length === 0 ? undefined : [ + yAxis: sum === 0 ? undefined : [ { type: 'value', axisLabel: { @@ -202,7 +209,7 @@ export class NodeFeeChartComponent implements OnInit { }, }, ], - series: outgoingData.length === 0 ? undefined : [ + series: sum === 0 ? undefined : [ { zlevel: 0, name: $localize`Outgoing Fees`,