From 6a19acb351b33d80d30d689ff2cb965cf6f62cbf Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Thu, 20 Oct 2022 11:26:57 -0700 Subject: [PATCH] CLN Query Routes Page Layout --- .../node-lookup/node-lookup.component.html | 6 ++- .../node-lookup/node-lookup.component.scss | 9 ++++ .../query-routes/query-routes.component.html | 42 +++++++++++-------- .../query-routes/query-routes.component.scss | 15 +++---- .../query-routes/query-routes.component.ts | 29 ++++++++----- .../utxo-tables/utxos/utxos.component.html | 2 +- .../peers-channels/peers/peers.component.html | 22 ++++++---- .../peers-channels/peers/peers.component.scss | 24 +++-------- .../failed-transactions.component.html | 2 +- .../forwarding-history.component.html | 2 +- .../local-failed-transactions.component.html | 2 +- .../lightning-payments.component.html | 2 +- .../query-routes/query-routes.component.html | 2 +- ...n-chain-transaction-history.component.html | 2 +- .../channel-pending-table.component.html | 2 +- .../forwarding-history.component.html | 2 +- .../lightning-payments.component.html | 2 +- .../query-routes/query-routes.component.html | 2 +- ...n-chain-transaction-history.component.html | 2 +- .../channel-closed-table.component.html | 2 +- .../channel-pending-table.component.html | 8 ++-- .../forwarding-history.component.html | 2 +- .../routing-peers.component.html | 4 +- .../lightning-payments.component.html | 2 +- .../boltz/swaps/swaps.component.html | 2 +- .../loop/swaps/swaps.component.html | 2 +- .../page-settings/page-settings.component.ts | 15 ++++--- .../transactions-report-table.component.html | 2 +- .../shared/services/consts-enums-functions.ts | 22 ++++++++++ 29 files changed, 139 insertions(+), 93 deletions(-) diff --git a/src/app/cln/graph/lookups/node-lookup/node-lookup.component.html b/src/app/cln/graph/lookups/node-lookup/node-lookup.component.html index 8522a5c8..9b52ab15 100644 --- a/src/app/cln/graph/lookups/node-lookup/node-lookup.component.html +++ b/src/app/cln/graph/lookups/node-lookup/node-lookup.component.html @@ -39,10 +39,12 @@ {{address?.port}} - Actions + +
Actions
+ - +
diff --git a/src/app/cln/graph/lookups/node-lookup/node-lookup.component.scss b/src/app/cln/graph/lookups/node-lookup/node-lookup.component.scss index e69de29b..b542b955 100644 --- a/src/app/cln/graph/lookups/node-lookup/node-lookup.component.scss +++ b/src/app/cln/graph/lookups/node-lookup/node-lookup.component.scss @@ -0,0 +1,9 @@ +div.bordered-box.table-actions-select.btn-action { + min-width: 13rem; + width: 13rem; +} + +button.mat-stroked-button.btn-action-copy { + min-width: 13rem; + width: 13rem; +} diff --git a/src/app/cln/graph/query-routes/query-routes.component.html b/src/app/cln/graph/query-routes/query-routes.component.html index 52f85c55..cf760c20 100644 --- a/src/app/cln/graph/query-routes/query-routes.component.html +++ b/src/app/cln/graph/query-routes/query-routes.component.html @@ -28,38 +28,44 @@ - + - - + + - - + + - - + + - - + - - + - - - - - - + diff --git a/src/app/cln/graph/query-routes/query-routes.component.scss b/src/app/cln/graph/query-routes/query-routes.component.scss index 3d0e9c13..dc75eed4 100644 --- a/src/app/cln/graph/query-routes/query-routes.component.scss +++ b/src/app/cln/graph/query-routes/query-routes.component.scss @@ -1,10 +1,11 @@ -.mat-column-actions { - min-height: 4.8rem; +.mat-column-id, .mat-column-alias { + flex: 0 0 22%; + width: 22%; + & .ellipsis-parent { + display: flex; + } } -.mat-column-pubkey_alias { - flex: 1 1 25%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; +.mat-column-actions { + min-height: 4.8rem; } diff --git a/src/app/cln/graph/query-routes/query-routes.component.ts b/src/app/cln/graph/query-routes/query-routes.component.ts index 383c47cb..2329bde2 100644 --- a/src/app/cln/graph/query-routes/query-routes.component.ts +++ b/src/app/cln/graph/query-routes/query-routes.component.ts @@ -7,13 +7,16 @@ import { MatTableDataSource } from '@angular/material/table'; import { faRoute, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; import { Routes } from '../../../shared/models/clnModels'; -import { AlertTypeEnum, DataTypeEnum, ScreenSizeEnum } from '../../../shared/services/consts-enums-functions'; +import { AlertTypeEnum, CLN_DEFAULT_PAGE_SETTINGS, DataTypeEnum, PAGE_SIZE, ScreenSizeEnum, SortOrderEnum } from '../../../shared/services/consts-enums-functions'; import { CommonService } from '../../../shared/services/common.service'; import { CLNEffects } from '../../store/cln.effects'; import { RTLState } from '../../../store/rtl.state'; import { openAlert } from '../../../store/rtl.actions'; import { getQueryRoutes } from '../../store/cln.actions'; +import { PageSettings, TableSetting } from '../../../shared/models/pageSettings'; +import { clnPageSettings } from '../../store/cln.selector'; +import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload'; @Component({ selector: 'rtl-cln-query-routes', @@ -24,6 +27,8 @@ export class CLNQueryRoutesComponent implements OnInit, OnDestroy { @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild('queryRoutesForm', { static: true }) form: any; + public PAGE_ID = 'graph_lookup'; + public tableSetting: TableSetting = { tableId: 'query_routes', recordsPerPage: PAGE_SIZE, sortBy: 'id', sortOrder: SortOrderEnum.ASCENDING }; public destinationPubkey = ''; public amount: number | null = null; public qrHops: any; @@ -33,22 +38,23 @@ export class CLNQueryRoutesComponent implements OnInit, OnDestroy { public faExclamationTriangle = faExclamationTriangle; public screenSize = ''; public screenSizeEnum = ScreenSizeEnum; - private unSubs: Array> = [new Subject(), new Subject()]; + private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject()]; constructor(private store: Store, private clnEffects: CLNEffects, private commonService: CommonService) { this.screenSize = this.commonService.getScreenSize(); - if (this.screenSize === ScreenSizeEnum.XS) { - this.displayedColumns = ['alias', 'msatoshi', 'actions']; - } else if (this.screenSize === ScreenSizeEnum.SM) { - this.displayedColumns = ['alias', 'direction', 'msatoshi', 'actions']; - } else if (this.screenSize === ScreenSizeEnum.MD) { - this.displayedColumns = ['alias', 'direction', 'delay', 'msatoshi', 'actions']; - } else { - this.displayedColumns = ['alias', 'channel', 'direction', 'delay', 'msatoshi', 'actions']; - } } ngOnInit() { + this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])). + subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => { + this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || CLN_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!; + if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) { + this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelectionSM)); + } else { + this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelection)); + } + this.displayedColumns.push('actions'); + }); this.clnEffects.setQueryRoutesCL.pipe(takeUntil(this.unSubs[1])).subscribe((queryRoute) => { this.qrHops = new MatTableDataSource([]); this.qrHops.data = []; @@ -61,6 +67,7 @@ export class CLNQueryRoutesComponent implements OnInit, OnDestroy { } this.qrHops.sort = this.sort; this.qrHops.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null); + this.qrHops.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true }); }); } diff --git a/src/app/cln/on-chain/utxo-tables/utxos/utxos.component.html b/src/app/cln/on-chain/utxo-tables/utxos/utxos.component.html index 5470caae..e027a348 100644 --- a/src/app/cln/on-chain/utxo-tables/utxos/utxos.component.html +++ b/src/app/cln/on-chain/utxo-tables/utxos/utxos.component.html @@ -80,7 +80,7 @@ diff --git a/src/app/cln/peers-channels/peers/peers.component.html b/src/app/cln/peers-channels/peers/peers.component.html index e1ec6aa8..65b0c298 100644 --- a/src/app/cln/peers-channels/peers/peers.component.html +++ b/src/app/cln/peers-channels/peers/peers.component.html @@ -26,20 +26,26 @@ - - - + - - + diff --git a/src/app/cln/peers-channels/peers/peers.component.scss b/src/app/cln/peers-channels/peers/peers.component.scss index e679095b..143350f4 100644 --- a/src/app/cln/peers-channels/peers/peers.component.scss +++ b/src/app/cln/peers-channels/peers/peers.component.scss @@ -2,25 +2,13 @@ width: 2rem; } -.mat-column-alias { - flex: 1 1 20%; +.mat-column-alias, .mat-column-id, .mat-column-netaddr { + flex: 0 0 20%; + width: 20%; white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.mat-column-id { - flex: 1 1 20%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - padding-left: 2rem; -} - -.mat-column-netaddr { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + & .ellipsis-parent { + display: flex; + } } .mat-column-actions { diff --git a/src/app/cln/routing/failed-transactions/failed-transactions.component.html b/src/app/cln/routing/failed-transactions/failed-transactions.component.html index 3df0125f..3af0f89f 100644 --- a/src/app/cln/routing/failed-transactions/failed-transactions.component.html +++ b/src/app/cln/routing/failed-transactions/failed-transactions.component.html @@ -69,7 +69,7 @@ diff --git a/src/app/cln/routing/forwarding-history/forwarding-history.component.html b/src/app/cln/routing/forwarding-history/forwarding-history.component.html index 9aa744a5..11cdfebc 100644 --- a/src/app/cln/routing/forwarding-history/forwarding-history.component.html +++ b/src/app/cln/routing/forwarding-history/forwarding-history.component.html @@ -71,7 +71,7 @@ diff --git a/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.html b/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.html index 35d2f2ef..433ba391 100644 --- a/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.html +++ b/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.html @@ -53,7 +53,7 @@ diff --git a/src/app/cln/transactions/payments/lightning-payments.component.html b/src/app/cln/transactions/payments/lightning-payments.component.html index b981a662..342c7122 100644 --- a/src/app/cln/transactions/payments/lightning-payments.component.html +++ b/src/app/cln/transactions/payments/lightning-payments.component.html @@ -102,7 +102,7 @@ diff --git a/src/app/eclair/graph/query-routes/query-routes.component.html b/src/app/eclair/graph/query-routes/query-routes.component.html index 527185da..41c06059 100644 --- a/src/app/eclair/graph/query-routes/query-routes.component.html +++ b/src/app/eclair/graph/query-routes/query-routes.component.html @@ -48,7 +48,7 @@ diff --git a/src/app/eclair/on-chain/on-chain-transaction-history/on-chain-transaction-history.component.html b/src/app/eclair/on-chain/on-chain-transaction-history/on-chain-transaction-history.component.html index e4d8e400..56e3d025 100644 --- a/src/app/eclair/on-chain/on-chain-transaction-history/on-chain-transaction-history.component.html +++ b/src/app/eclair/on-chain/on-chain-transaction-history/on-chain-transaction-history.component.html @@ -47,7 +47,7 @@ diff --git a/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html b/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html index 1af24c93..8287c19b 100644 --- a/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html +++ b/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html @@ -36,7 +36,7 @@ diff --git a/src/app/eclair/routing/forwarding-history/forwarding-history.component.html b/src/app/eclair/routing/forwarding-history/forwarding-history.component.html index b8099eff..1c1fa251 100644 --- a/src/app/eclair/routing/forwarding-history/forwarding-history.component.html +++ b/src/app/eclair/routing/forwarding-history/forwarding-history.component.html @@ -46,7 +46,7 @@ diff --git a/src/app/eclair/transactions/payments/lightning-payments.component.html b/src/app/eclair/transactions/payments/lightning-payments.component.html index 5df8001f..1662295f 100644 --- a/src/app/eclair/transactions/payments/lightning-payments.component.html +++ b/src/app/eclair/transactions/payments/lightning-payments.component.html @@ -61,7 +61,7 @@ diff --git a/src/app/lnd/graph/query-routes/query-routes.component.html b/src/app/lnd/graph/query-routes/query-routes.component.html index 0ed74c1f..cfa41cfe 100644 --- a/src/app/lnd/graph/query-routes/query-routes.component.html +++ b/src/app/lnd/graph/query-routes/query-routes.component.html @@ -55,7 +55,7 @@ diff --git a/src/app/lnd/on-chain/utxo-tables/on-chain-transaction-history/on-chain-transaction-history.component.html b/src/app/lnd/on-chain/utxo-tables/on-chain-transaction-history/on-chain-transaction-history.component.html index cb6e96c6..703ce9f3 100644 --- a/src/app/lnd/on-chain/utxo-tables/on-chain-transaction-history/on-chain-transaction-history.component.html +++ b/src/app/lnd/on-chain/utxo-tables/on-chain-transaction-history/on-chain-transaction-history.component.html @@ -46,7 +46,7 @@ diff --git a/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.html b/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.html index b55d663d..eb8f36e1 100644 --- a/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.html +++ b/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.html @@ -47,7 +47,7 @@ diff --git a/src/app/lnd/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html b/src/app/lnd/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html index b4723502..1fcea9df 100644 --- a/src/app/lnd/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html +++ b/src/app/lnd/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html @@ -80,7 +80,7 @@
Actions
- + @@ -128,10 +128,10 @@ -
Actions
+
Actions
- +
@@ -188,7 +188,7 @@
Actions
- +
diff --git a/src/app/lnd/routing/forwarding-history/forwarding-history.component.html b/src/app/lnd/routing/forwarding-history/forwarding-history.component.html index 850a5d63..f6664f40 100644 --- a/src/app/lnd/routing/forwarding-history/forwarding-history.component.html +++ b/src/app/lnd/routing/forwarding-history/forwarding-history.component.html @@ -43,7 +43,7 @@ diff --git a/src/app/lnd/routing/routing-peers/routing-peers.component.html b/src/app/lnd/routing/routing-peers/routing-peers.component.html index e68ee735..861852ef 100644 --- a/src/app/lnd/routing/routing-peers/routing-peers.component.html +++ b/src/app/lnd/routing/routing-peers/routing-peers.component.html @@ -31,7 +31,7 @@ @@ -78,7 +78,7 @@ diff --git a/src/app/lnd/transactions/payments/lightning-payments.component.html b/src/app/lnd/transactions/payments/lightning-payments.component.html index cf2d6ccd..435e0483 100644 --- a/src/app/lnd/transactions/payments/lightning-payments.component.html +++ b/src/app/lnd/transactions/payments/lightning-payments.component.html @@ -65,7 +65,7 @@ diff --git a/src/app/shared/components/ln-services/boltz/swaps/swaps.component.html b/src/app/shared/components/ln-services/boltz/swaps/swaps.component.html index caa42654..e4505360 100755 --- a/src/app/shared/components/ln-services/boltz/swaps/swaps.component.html +++ b/src/app/shared/components/ln-services/boltz/swaps/swaps.component.html @@ -117,7 +117,7 @@ diff --git a/src/app/shared/components/ln-services/loop/swaps/swaps.component.html b/src/app/shared/components/ln-services/loop/swaps/swaps.component.html index 3cd619a1..ef044f56 100755 --- a/src/app/shared/components/ln-services/loop/swaps/swaps.component.html +++ b/src/app/shared/components/ln-services/loop/swaps/swaps.component.html @@ -78,7 +78,7 @@ diff --git a/src/app/shared/components/node-config/page-settings/page-settings.component.ts b/src/app/shared/components/node-config/page-settings/page-settings.component.ts index fa7377f7..6f3fce96 100644 --- a/src/app/shared/components/node-config/page-settings/page-settings.component.ts +++ b/src/app/shared/components/node-config/page-settings/page-settings.component.ts @@ -69,11 +69,14 @@ export class PageSettingsComponent implements OnInit, OnDestroy { } else { if (!nodeSettings?.enableOffers) { const transactionsPage = updatedPageSettings.find((pg) => pg.pageId === 'transactions'); - transactionsPage?.tables.splice(transactionsPage?.tables.findIndex((tb) => tb.tableId === 'offers'), 1); - transactionsPage?.tables.splice(transactionsPage?.tables.findIndex((tb) => tb.tableId === 'offer_bookmarks'), 1); + const offerIdx = transactionsPage?.tables.findIndex((tb) => tb.tableId === 'offers'); + const offerBookmarkIdx = transactionsPage?.tables.findIndex((tb) => tb.tableId === 'offer_bookmarks'); + if (offerIdx > -1) { transactionsPage?.tables.splice(offerIdx, 1); } + if (offerBookmarkIdx > -1) { transactionsPage?.tables.splice(offerBookmarkIdx, 1); } } if (!nodeSettings?.enablePeerswap) { - updatedPageSettings.splice(updatedPageSettings.findIndex((pg) => pg.pageId === 'peerswap'), 1); + const psIdx = updatedPageSettings.findIndex((pg) => pg.pageId === 'peerswap'); + if (psIdx > -1) { updatedPageSettings.splice(psIdx, 1); } } this.pageSettings = updatedPageSettings; this.initialPageSettings = updatedPageSettings; @@ -132,10 +135,12 @@ export class PageSettingsComponent implements OnInit, OnDestroy { this.initialPageSettings = updatedPageSettings; } else { if (!nodeSettings?.swapServerUrl || nodeSettings.swapServerUrl.trim() === '') { - updatedPageSettings.splice(updatedPageSettings.findIndex((pg) => pg.pageId === 'loop'), 1); + const loopIdx = updatedPageSettings.findIndex((pg) => pg.pageId === 'loop'); + if (loopIdx > -1) { updatedPageSettings.splice(loopIdx, 1); } } if (!nodeSettings?.boltzServerUrl || nodeSettings.boltzServerUrl.trim() === '') { - updatedPageSettings.splice(updatedPageSettings.findIndex((pg) => pg.pageId === 'boltz'), 1); + const boltzIdx = updatedPageSettings.findIndex((pg) => pg.pageId === 'boltz'); + if (boltzIdx > -1) { updatedPageSettings.splice(boltzIdx, 1); } } this.pageSettings = updatedPageSettings; this.initialPageSettings = updatedPageSettings; diff --git a/src/app/shared/components/transactions-report-table/transactions-report-table.component.html b/src/app/shared/components/transactions-report-table/transactions-report-table.component.html index aadc998e..886db114 100644 --- a/src/app/shared/components/transactions-report-table/transactions-report-table.component.html +++ b/src/app/shared/components/transactions-report-table/transactions-report-table.component.html @@ -39,7 +39,7 @@ diff --git a/src/app/shared/services/consts-enums-functions.ts b/src/app/shared/services/consts-enums-functions.ts index 838a44b2..69c7c780 100644 --- a/src/app/shared/services/consts-enums-functions.ts +++ b/src/app/shared/services/consts-enums-functions.ts @@ -740,6 +740,16 @@ export const CLN_DEFAULT_PAGE_SETTINGS: PageSettings[] = [ { tableId: 'transactions', recordsPerPage: PAGE_SIZE, sortBy: 'date', sortOrder: SortOrderEnum.DESCENDING, columnSelectionSM: ['date', 'amount_paid', 'amount_received'], columnSelection: ['date', 'amount_paid', 'num_payments', 'amount_received', 'num_invoices'] } + ] }, + { pageId: 'graph_lookup', tables: [ + { tableId: 'query_routes', recordsPerPage: PAGE_SIZE, sortBy: 'msatoshi', sortOrder: SortOrderEnum.DESCENDING, + columnSelectionSM: ['alias', 'direction', 'msatoshi'], + columnSelection: ['alias', 'channel', 'direction', 'delay', 'msatoshi'] } + ] }, + { pageId: 'peerswap', tables: [ + { tableId: 'swaps', recordsPerPage: PAGE_SIZE, sortBy: '', sortOrder: SortOrderEnum.DESCENDING, + columnSelectionSM: [], + columnSelection: [] } ] } ]; @@ -819,6 +829,18 @@ export const CLN_TABLES_DEF = { maxColumns: 5, allowedColumns: ['date', 'amount_paid', 'num_payments', 'amount_received', 'num_invoices'] } + }, + graph_lookup: { + query_routes: { + maxColumns: 6, + allowedColumns: ['id', 'alias', 'channel', 'direction', 'delay', 'msatoshi'] + } + }, + peerswap: { + swaps: { + maxColumns: 5, + allowedColumns: [] + } } };
ID {{hop?.id}} +
+ {{hop?.id}} +
+
Alias {{hop?.alias}} Alias +
+ {{hop?.alias}} +
+
Channel {{hop?.channel}} Channel {{hop?.channel}} Direction {{hop?.direction}} Direction {{hop?.direction}} Delay {{hop?.delay | number}} + Delay {{hop?.delay | number}} Amount (Sats) {{hop?.msatoshi/1000 | number}} + Amount (Sats) {{hop?.msatoshi/1000 | number}} Amount mSat {{hop?.amount_msat}} Actions - + +
Actions
+
+
- + Alias - {{peer?.alias}} + +
+ {{peer?.alias}} +
ID - {{peer?.id}} + ID +
+ {{peer?.id}} +
Network Address - {{addr}},
+
Network Address +
+ {{addr}},
+
- + - + - + - + Actions - +
- + - + - + - + Actions - +
- + - + - + Actions - + Actions - + - + + (click)="onSwapClick(swap, $event)" class="table-actions-button">View Info + (click)="onSwapClick(swap, $event)" class="table-actions-button">View Info - +