From 7fea447975e60c7d3dd5a9b9bbd056733bc1bb10 Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Wed, 2 Nov 2022 15:59:37 -0700 Subject: [PATCH] CLN Filter by selected column --- backend/controllers/shared/pageSettings.js | 2 +- backend/utils/common.js | 35 +++++++--- backend/utils/database.js | 12 ++-- server/controllers/shared/pageSettings.ts | 4 +- server/utils/common.ts | 38 ++++++---- server/utils/database.ts | 12 ++-- .../liquidity-ads-list.component.html | 2 +- .../liquidity-ads-list.component.ts | 70 ++++++++++--------- .../utxo-tables/utxos/utxos.component.html | 5 +- .../utxo-tables/utxos/utxos.component.ts | 41 ++++------- .../channel-open-table.component.html | 4 +- .../channel-open-table.component.ts | 65 ++++++++--------- .../channel-pending-table.component.html | 4 +- .../channel-pending-table.component.ts | 67 +++++++++--------- .../peers-channels/peers/peers.component.html | 2 +- .../peers-channels/peers/peers.component.ts | 45 ++++++------ .../failed-transactions.component.html | 2 +- .../failed-transactions.component.ts | 63 ++++++++--------- .../forwarding-history.component.html | 2 +- .../forwarding-history.component.ts | 60 ++++++++-------- .../local-failed-transactions.component.html | 2 +- .../local-failed-transactions.component.ts | 60 ++++++++-------- .../routing-peers.component.html | 4 +- .../routing-peers/routing-peers.component.ts | 68 ++++++++++-------- src/app/cln/store/cln.effects.ts | 2 +- .../lightning-invoices-table.component.html | 4 +- .../lightning-invoices-table.component.ts | 60 ++++++++-------- .../offer-bookmarks-table.component.html | 2 +- .../offer-bookmarks-table.component.ts | 52 +++++++------- .../offers-table/offers-table.component.html | 2 +- .../offers-table/offers-table.component.ts | 48 +++++-------- .../lightning-payments.component.html | 4 +- .../payments/lightning-payments.component.ts | 55 ++++++++------- ...n-chain-transaction-history.component.html | 2 +- .../on-chain-transaction-history.component.ts | 10 +-- .../channel-inactive-table.component.html | 4 +- .../channel-inactive-table.component.ts | 16 +++-- .../channel-open-table.component.html | 4 +- .../channel-open-table.component.ts | 16 +++-- .../channel-pending-table.component.html | 4 +- .../channel-pending-table.component.ts | 16 +++-- .../peers-channels/peers/peers.component.html | 2 +- .../peers-channels/peers/peers.component.ts | 12 ++-- .../forwarding-history.component.html | 2 +- .../forwarding-history.component.ts | 10 +-- .../routing-peers.component.html | 4 +- .../routing-peers/routing-peers.component.ts | 16 ++--- src/app/eclair/store/ecl.effects.ts | 2 +- .../lightning-invoices.component.html | 2 +- .../invoices/lightning-invoices.component.ts | 10 +-- .../lightning-payments.component.html | 2 +- .../payments/lightning-payments.component.ts | 10 +-- .../channel-backup-table.component.ts | 2 +- .../channel-restore-table.component.ts | 2 +- ...n-chain-transaction-history.component.html | 2 +- .../on-chain-transaction-history.component.ts | 10 +-- .../utxo-tables/utxos/utxos.component.html | 4 +- .../utxo-tables/utxos/utxos.component.ts | 16 +++-- .../channel-active-htlcs-table.component.html | 2 +- .../channel-active-htlcs-table.component.ts | 18 ++--- .../channel-closed-table.component.html | 2 +- .../channel-closed-table.component.ts | 12 ++-- .../channel-open-table.component.html | 2 +- .../channel-open-table.component.ts | 36 ++++++---- .../peers-channels/peers/peers.component.html | 2 +- .../peers-channels/peers/peers.component.ts | 12 ++-- .../forwarding-history.component.html | 2 +- .../forwarding-history.component.ts | 10 +-- .../non-routing-peers.component.html | 2 +- .../non-routing-peers.component.ts | 12 ++-- .../routing-peers.component.html | 4 +- .../routing-peers/routing-peers.component.ts | 16 ++--- src/app/lnd/store/lnd.effects.ts | 2 +- .../lightning-invoices.component.html | 2 +- .../invoices/lightning-invoices.component.ts | 18 ++--- .../lightning-payments.component.html | 2 +- .../payments/lightning-payments.component.ts | 20 +++--- .../boltz/swaps/swaps.component.html | 2 +- .../boltz/swaps/swaps.component.ts | 12 ++-- .../loop/swaps/swaps.component.html | 2 +- .../ln-services/loop/swaps/swaps.component.ts | 12 ++-- .../transactions-report-table.component.html | 2 +- .../transactions-report-table.component.ts | 10 +-- src/app/shared/models/clnModels.ts | 3 +- 84 files changed, 670 insertions(+), 627 deletions(-) diff --git a/backend/controllers/shared/pageSettings.js b/backend/controllers/shared/pageSettings.js index d56b983c..9ded7b70 100644 --- a/backend/controllers/shared/pageSettings.js +++ b/backend/controllers/shared/pageSettings.js @@ -24,7 +24,7 @@ export const savePageSettings = (req, res, next) => { res.status(201).json(insertRes); }).catch((insertErrRes) => { const err = common.handleError(insertErrRes, 'Page Settings', 'Page Settings Update Error', req.session.selectedNode); - throw new Error(JSON.stringify({ message: err.message, error: err.error })); + return res.status(err.statusCode).json({ message: err.message, error: err.error }); }); }).catch((errRes) => { const err = common.handleError(errRes, 'Page Settings', 'Page Settings Validation Error', req.session.selectedNode); diff --git a/backend/utils/common.js b/backend/utils/common.js index 3927ea2b..d12e2439 100644 --- a/backend/utils/common.js +++ b/backend/utils/common.js @@ -24,7 +24,10 @@ export class CommonService { this.read_dummy_data = false; this.baseHref = '/rtl'; this.dummy_data_array_from_file = []; - this.MONTHS = [{ name: 'JAN', days: 31 }, { name: 'FEB', days: 28 }, { name: 'MAR', days: 31 }, { name: 'APR', days: 30 }, { name: 'MAY', days: 31 }, { name: 'JUN', days: 30 }, { name: 'JUL', days: 31 }, { name: 'AUG', days: 31 }, { name: 'SEP', days: 30 }, { name: 'OCT', days: 31 }, { name: 'NOV', days: 30 }, { name: 'DEC', days: 31 }]; + this.MONTHS = [ + { name: 'JAN', days: 31 }, { name: 'FEB', days: 28 }, { name: 'MAR', days: 31 }, { name: 'APR', days: 30 }, { name: 'MAY', days: 31 }, { name: 'JUN', days: 30 }, + { name: 'JUL', days: 31 }, { name: 'AUG', days: 31 }, { name: 'SEP', days: 30 }, { name: 'OCT', days: 31 }, { name: 'NOV', days: 30 }, { name: 'DEC', days: 31 } + ]; this.getSwapServerOptions = (req) => { const swapOptions = { url: req.session.selectedNode.swap_server_url, @@ -253,16 +256,26 @@ export class CommonService { break; } this.logger.log({ selectedNode: selectedNode, level: 'ERROR', fileName: fileName, msg: errMsg, error: (typeof err === 'object' ? JSON.stringify(err) : (typeof err === 'string') ? err : 'Unknown Error') }); - const newErrorObj = { - statusCode: err.statusCode ? err.statusCode : err.status ? err.status : (err.error && err.error.code && err.error.code === 'ECONNREFUSED') ? 503 : 500, - message: (err.error && err.error.message) ? err.error.message : err.message ? err.message : errMsg, - error: ((err.error && err.error.error && err.error.error.error && typeof err.error.error.error === 'string') ? err.error.error.error : - (err.error && err.error.error && typeof err.error.error === 'string') ? err.error.error : - (err.error && err.error.error && err.error.error.message && typeof err.error.error.message === 'string') ? err.error.error.message : - (err.error && err.error.message && typeof err.error.message === 'string') ? err.error.message : - (err.error && typeof err.error === 'string') ? err.error : - (err.message && typeof err.message === 'string') ? err.message : (typeof err === 'string') ? err : 'Unknown Error') - }; + let newErrorObj = {}; + if (err.code && err.code === 'ENOENT') { + newErrorObj = { + statusCode: 500, + message: 'No such file or directory ' + (err.path ? err.path : ''), + error: 'No such file or directory ' + (err.path ? err.path : '') + }; + } + else { + newErrorObj = { + statusCode: err.statusCode ? err.statusCode : err.status ? err.status : (err.error && err.error.code && err.error.code === 'ECONNREFUSED') ? 503 : 500, + message: (err.error && err.error.message) ? err.error.message : err.message ? err.message : errMsg, + error: ((err.error && err.error.error && err.error.error.error && typeof err.error.error.error === 'string') ? err.error.error.error : + (err.error && err.error.error && typeof err.error.error === 'string') ? err.error.error : + (err.error && err.error.error && err.error.error.message && typeof err.error.error.message === 'string') ? err.error.error.message : + (err.error && err.error.message && typeof err.error.message === 'string') ? err.error.message : + (err.error && typeof err.error === 'string') ? err.error : + (err.message && typeof err.message === 'string') ? err.message : (typeof err === 'string') ? err : 'Unknown Error') + }; + } return newErrorObj; }; this.getRequestIP = (req) => ((typeof req.headers['x-forwarded-for'] === 'string' && req.headers['x-forwarded-for'].split(',').shift()) || diff --git a/backend/utils/database.js b/backend/utils/database.js index ca756ec7..b6c228a1 100644 --- a/backend/utils/database.js +++ b/backend/utils/database.js @@ -173,7 +173,7 @@ export class DatabaseService { catch (err) { const selNode = this.nodeDatabase[nodeIndex] && this.nodeDatabase[nodeIndex].adapter && this.nodeDatabase[nodeIndex].adapter.selNode ? this.nodeDatabase[nodeIndex].adapter.selNode : null; this.logger.log({ selectedNode: selNode, level: 'ERROR', fileName: 'Database', msg: 'Database Save Error', error: err }); - return new Error(err); + throw err; } } unloadDatabase(nodeIndex, sessionID) { @@ -220,11 +220,11 @@ export class DatabaseAdapter { fetchData(collectionName) { try { if (!fs.existsSync(this.dbFilePath)) { - fs.mkdirSync(this.dbFilePath); + this.common.createDirectory(this.dbFilePath); } } catch (err) { - return new Error('Unable to Create Directory Error ' + JSON.stringify(err)); + throw new Error(JSON.stringify(err)); } const collectionFilePath = this.dbFilePath + sep + 'rtldb-' + this.selNode.ln_implementation + '-' + collectionName + '.json'; try { @@ -233,7 +233,7 @@ export class DatabaseAdapter { } } catch (err) { - return new Error('Unable to Create Database File Error ' + JSON.stringify(err)); + throw new Error(JSON.stringify(err)); } try { const otherFiles = fs.readdirSync(this.dbFilePath); @@ -252,7 +252,7 @@ export class DatabaseAdapter { return dataObj; } catch (err) { - return new Error('Database Read Error ' + JSON.stringify(err)); + throw new Error(JSON.stringify(err)); } } getSelNode() { @@ -269,7 +269,7 @@ export class DatabaseAdapter { return true; } catch (err) { - return new Error('Database Write Error ' + JSON.stringify(err)); + throw err; } } insertSession(id = '') { diff --git a/server/controllers/shared/pageSettings.ts b/server/controllers/shared/pageSettings.ts index 8e74bf6e..acf05a7f 100644 --- a/server/controllers/shared/pageSettings.ts +++ b/server/controllers/shared/pageSettings.ts @@ -1,7 +1,7 @@ import { Database, DatabaseService } from '../../utils/database.js'; import { Logger, LoggerService } from '../../utils/logger.js'; import { Common, CommonService } from '../../utils/common.js'; -import { CollectionFieldsEnum, CollectionsEnum, PageSettings } from '../../models/database.model.js'; +import { CollectionsEnum, PageSettings } from '../../models/database.model.js'; const logger: LoggerService = Logger; const common: CommonService = Common; @@ -27,7 +27,7 @@ export const savePageSettings = (req, res, next) => { res.status(201).json(insertRes); }).catch((insertErrRes) => { const err = common.handleError(insertErrRes, 'Page Settings', 'Page Settings Update Error', req.session.selectedNode); - throw new Error(JSON.stringify({ message: err.message, error: err.error })); + return res.status(err.statusCode).json({ message: err.message, error: err.error }); }); }).catch((errRes) => { const err = common.handleError(errRes, 'Page Settings', 'Page Settings Validation Error', req.session.selectedNode); diff --git a/server/utils/common.ts b/server/utils/common.ts index 52c1b10a..e3a975c2 100644 --- a/server/utils/common.ts +++ b/server/utils/common.ts @@ -26,7 +26,10 @@ export class CommonService { public read_dummy_data = false; public baseHref = '/rtl'; private dummy_data_array_from_file = []; - private MONTHS = [{ name: 'JAN', days: 31 }, { name: 'FEB', days: 28 }, { name: 'MAR', days: 31 }, { name: 'APR', days: 30 }, { name: 'MAY', days: 31 }, { name: 'JUN', days: 30 }, { name: 'JUL', days: 31 }, { name: 'AUG', days: 31 }, { name: 'SEP', days: 30 }, { name: 'OCT', days: 31 }, { name: 'NOV', days: 30 }, { name: 'DEC', days: 31 }]; + private MONTHS = [ + { name: 'JAN', days: 31 }, { name: 'FEB', days: 28 }, { name: 'MAR', days: 31 }, { name: 'APR', days: 30 }, { name: 'MAY', days: 31 }, { name: 'JUN', days: 30 }, + { name: 'JUL', days: 31 }, { name: 'AUG', days: 31 }, { name: 'SEP', days: 30 }, { name: 'OCT', days: 31 }, { name: 'NOV', days: 30 }, { name: 'DEC', days: 31 } + ]; constructor() { } @@ -268,18 +271,27 @@ export class CommonService { break; } this.logger.log({ selectedNode: selectedNode, level: 'ERROR', fileName: fileName, msg: errMsg, error: (typeof err === 'object' ? JSON.stringify(err) : (typeof err === 'string') ? err : 'Unknown Error') }); - const newErrorObj = { - statusCode: err.statusCode ? err.statusCode : err.status ? err.status : (err.error && err.error.code && err.error.code === 'ECONNREFUSED') ? 503 : 500, - message: (err.error && err.error.message) ? err.error.message : err.message ? err.message : errMsg, - error: ( - (err.error && err.error.error && err.error.error.error && typeof err.error.error.error === 'string') ? err.error.error.error : - (err.error && err.error.error && typeof err.error.error === 'string') ? err.error.error : - (err.error && err.error.error && err.error.error.message && typeof err.error.error.message === 'string') ? err.error.error.message : - (err.error && err.error.message && typeof err.error.message === 'string') ? err.error.message : - (err.error && typeof err.error === 'string') ? err.error : - (err.message && typeof err.message === 'string') ? err.message : (typeof err === 'string') ? err : 'Unknown Error' - ) - }; + let newErrorObj = {}; + if (err.code && err.code === 'ENOENT') { + newErrorObj = { + statusCode: 500, + message: 'No such file or directory ' + (err.path ? err.path : ''), + error: 'No such file or directory ' + (err.path ? err.path : '') + }; + } else { + newErrorObj = { + statusCode: err.statusCode ? err.statusCode : err.status ? err.status : (err.error && err.error.code && err.error.code === 'ECONNREFUSED') ? 503 : 500, + message: (err.error && err.error.message) ? err.error.message : err.message ? err.message : errMsg, + error: ( + (err.error && err.error.error && err.error.error.error && typeof err.error.error.error === 'string') ? err.error.error.error : + (err.error && err.error.error && typeof err.error.error === 'string') ? err.error.error : + (err.error && err.error.error && err.error.error.message && typeof err.error.error.message === 'string') ? err.error.error.message : + (err.error && err.error.message && typeof err.error.message === 'string') ? err.error.message : + (err.error && typeof err.error === 'string') ? err.error : + (err.message && typeof err.message === 'string') ? err.message : (typeof err === 'string') ? err : 'Unknown Error' + ) + }; + } return newErrorObj; }; diff --git a/server/utils/database.ts b/server/utils/database.ts index 6c680a11..a51df46c 100644 --- a/server/utils/database.ts +++ b/server/utils/database.ts @@ -175,7 +175,7 @@ export class DatabaseService { } catch (err) { const selNode = this.nodeDatabase[nodeIndex] && this.nodeDatabase[nodeIndex].adapter && this.nodeDatabase[nodeIndex].adapter.selNode ? this.nodeDatabase[nodeIndex].adapter.selNode : null; this.logger.log({ selectedNode: selNode, level: 'ERROR', fileName: 'Database', msg: 'Database Save Error', error: err }); - return new Error(err); + throw err; } } @@ -223,10 +223,10 @@ export class DatabaseAdapter { fetchData(collectionName: string) { try { if (!fs.existsSync(this.dbFilePath)) { - fs.mkdirSync(this.dbFilePath); + this.common.createDirectory(this.dbFilePath); } } catch (err) { - return new Error('Unable to Create Directory Error ' + JSON.stringify(err)); + throw new Error(JSON.stringify(err)); } const collectionFilePath = this.dbFilePath + sep + 'rtldb-' + this.selNode.ln_implementation + '-' + collectionName + '.json'; try { @@ -234,7 +234,7 @@ export class DatabaseAdapter { fs.writeFileSync(collectionFilePath, '[]'); } } catch (err) { - return new Error('Unable to Create Database File Error ' + JSON.stringify(err)); + throw new Error(JSON.stringify(err)); } try { const otherFiles = fs.readdirSync(this.dbFilePath); @@ -251,7 +251,7 @@ export class DatabaseAdapter { const dataObj = !dataFromFile ? null : (JSON.parse(dataFromFile)); return dataObj; } catch (err) { - return new Error('Database Read Error ' + JSON.stringify(err)); + throw new Error(JSON.stringify(err)); } } @@ -269,7 +269,7 @@ export class DatabaseAdapter { } return true; } catch (err) { - return new Error('Database Write Error ' + JSON.stringify(err)); + throw err; } } diff --git a/src/app/cln/liquidity-ads/liquidity-ads-list/liquidity-ads-list.component.html b/src/app/cln/liquidity-ads/liquidity-ads-list/liquidity-ads-list.component.html index 34a5c93b..869a3b88 100644 --- a/src/app/cln/liquidity-ads/liquidity-ads-list/liquidity-ads-list.component.html +++ b/src/app/cln/liquidity-ads/liquidity-ads-list/liquidity-ads-list.component.html @@ -54,7 +54,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/cln/liquidity-ads/liquidity-ads-list/liquidity-ads-list.component.ts b/src/app/cln/liquidity-ads/liquidity-ads-list/liquidity-ads-list.component.ts index 71688d15..1990bbc3 100644 --- a/src/app/cln/liquidity-ads/liquidity-ads-list/liquidity-ads-list.component.ts +++ b/src/app/cln/liquidity-ads/liquidity-ads-list/liquidity-ads-list.component.ts @@ -19,7 +19,7 @@ import { RTLState } from '../../../store/rtl.state'; import { RTLEffects } from '../../../store/rtl.effects'; import { CLNOpenLiquidityChannelComponent } from '../open-liquidity-channel-modal/open-liquidity-channel-modal.component'; import { clnPageSettings, nodeInfoAndNodeSettingsAndBalance } from '../../store/cln.selector'; -import { DecimalPipe } from '@angular/common'; +import { DatePipe } from '@angular/common'; import { ColumnDefinition, PageSettings, TableSetting } from '../../../shared/models/pageSettings'; import { CamelCaseWithReplacePipe } from '../../../shared/pipes/app.pipe'; @@ -36,7 +36,7 @@ export class CLNLiquidityAdsListComponent implements OnInit, OnDestroy { @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'liquidity_ads'; public tableSetting: TableSetting = { tableId: 'liquidity_ads', recordsPerPage: PAGE_SIZE, sortBy: 'channel_opening_fee', sortOrder: SortOrderEnum.ASCENDING }; @@ -64,7 +64,7 @@ export class CLNLiquidityAdsListComponent implements OnInit, OnDestroy { public apiCallStatusEnum = APICallStatusEnum; private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()]; - constructor(private logger: LoggerService, private store: Store, private dataService: DataService, private commonService: CommonService, private rtlEffects: RTLEffects, private decimalPipe: DecimalPipe, private camelCaseWithReplace: CamelCaseWithReplacePipe) { + constructor(private logger: LoggerService, private store: Store, private dataService: DataService, private commonService: CommonService, private rtlEffects: RTLEffects, private datePipe: DatePipe, private camelCaseWithReplace: CamelCaseWithReplacePipe) { this.askTooltipMsg = 'Specify the liquidity requirements for your node: \n 1. Channel Amount - Amount in Sats you need on the channel opened to your node \n 2. Channel opening fee rate - Rate in Sats/vByte that you are willing to pay to open the channel to you'; this.nodesTooltipMsg = 'These nodes are advertising their liquidity offering on the network.\nYou should pay attention to the following aspects to evaluate each node offer: \n- The total bitcoin deployed on the node, the more the better\n'; this.nodesTooltipMsg = this.nodesTooltipMsg + '- The number of channels open on the node, the more the better' + @@ -140,40 +140,46 @@ export class CLNLiquidityAdsListComponent implements OnInit, OnDestroy { getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.liquidityNodes.filterPredicate = (node: LookupNode, fltr: string) => { - const newNode = ((node.alias) ? node.alias.toLocaleLowerCase() : '') + (node.channel_opening_fee ? node.channel_opening_fee + ' Sats' : '') + - (node.option_will_fund?.lease_fee_base_msat ? (node.option_will_fund?.lease_fee_base_msat / 1000) + ' Sats' : '') + (node.option_will_fund?.lease_fee_basis ? (this.decimalPipe.transform(node.option_will_fund?.lease_fee_basis / 100, '1.2-2') + '%') : '') + - (node.option_will_fund?.channel_fee_max_base_msat ? (node.option_will_fund?.channel_fee_max_base_msat / 1000) + ' Sats' : '') + (node.option_will_fund?.channel_fee_max_proportional_thousandths ? (node.option_will_fund?.channel_fee_max_proportional_thousandths * 1000) + ' ppm' : '') + - (node.address_types ? node.address_types.reduce((acc, curr) => acc + (curr === 'tor' ? ' tor' : curr === 'ipv' ? ' clearnet' : (' ' + curr.toLowerCase())), '') : ''); - return newNode.includes(fltr); - }; - // this.liquidityNodes.filterPredicate = (rowData: LookupNode, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; + this.liquidityNodes.filterPredicate = (rowData: LookupNode, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = ((rowData.alias) ? rowData.alias.toLocaleLowerCase() : '') + (rowData.channel_opening_fee ? rowData.channel_opening_fee + ' Sats' : '') + + (rowData.option_will_fund?.lease_fee_base_msat ? (rowData.option_will_fund?.lease_fee_base_msat / 1000) + ' Sats' : '') + (rowData.option_will_fund?.lease_fee_basis ? ((rowData.option_will_fund?.lease_fee_basis / 100) + '%') : '') + + (rowData.option_will_fund?.channel_fee_max_base_msat ? (rowData.option_will_fund?.channel_fee_max_base_msat / 1000) + ' Sats' : '') + (rowData.option_will_fund?.channel_fee_max_proportional_thousandths ? (rowData.option_will_fund?.channel_fee_max_proportional_thousandths * 1000) + ' ppm' : '') + + (rowData.address_types ? rowData.address_types.reduce((acc, curr) => acc + (curr === 'tor' ? ' tor' : curr === 'ipv' ? ' clearnet' : (' ' + curr.toLowerCase())), '') : ''); + break; + + case 'alias': + rowToFilter = ((rowData?.alias?.toLowerCase() || ' ') + rowData?.address_types?.reduce((acc, curr) => acc + (!curr ? '' : (curr === 'ipv' ? 'clearnet' : curr)), ' ')) || ''; + break; + + case 'last_timestamp': + rowToFilter = this.datePipe.transform(new Date((rowData.last_timestamp || 0) * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() || ''; + break; + + case 'compact_lease': + rowToFilter = rowData?.option_will_fund?.compact_lease?.toLowerCase() || ''; + break; - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; + case 'lease_fee': + rowToFilter = ((((rowData.option_will_fund?.lease_fee_base_msat || 0) / 1000) + ' sats ' || ' ') + (((rowData.option_will_fund?.lease_fee_basis || 0) / 100) + '%')) || ''; + break; - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; + case 'routing_fee': + rowToFilter = ((((rowData.option_will_fund?.channel_fee_max_base_msat || 0) / 1000) + ' sats ' || ' ') + (((rowData.option_will_fund?.channel_fee_max_proportional_thousandths || 0) * 1000) + ' ppm')) || ''; + break; + + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return rowToFilter.includes(fltr); + }; } loadLiqNodesTable(liqNodes: LookupNode[]) { 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 3a740e80..af6a7455 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 @@ -4,7 +4,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -12,13 +12,12 @@
- {{displayedColumns}}
- +
diff --git a/src/app/cln/on-chain/utxo-tables/utxos/utxos.component.ts b/src/app/cln/on-chain/utxo-tables/utxos/utxos.component.ts index e15073f6..0682e346 100644 --- a/src/app/cln/on-chain/utxo-tables/utxos/utxos.component.ts +++ b/src/app/cln/on-chain/utxo-tables/utxos/utxos.component.ts @@ -34,7 +34,7 @@ export class CLNOnChainUtxosComponent implements OnInit, AfterViewInit, OnDestro @Input() numDustUTXOs = 0; @Input() isDustUTXO = false; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'on_chain'; public tableSetting: TableSetting = { tableId: 'utxos', recordsPerPage: PAGE_SIZE, sortBy: 'status', sortOrder: SortOrderEnum.DESCENDING }; @@ -125,34 +125,23 @@ export class CLNOnChainUtxosComponent implements OnInit, AfterViewInit, OnDestro getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.listUTXOs.filterPredicate = (utxo: UTXO, fltr: string) => JSON.stringify(utxo).toLowerCase().includes(fltr); - // this.listUTXOs.filterPredicate = (rowData: UTXO, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; - - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; - - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; + this.listUTXOs.filterPredicate = (rowData: UTXO, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = JSON.stringify(rowData).toLowerCase(); + break; + + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return rowToFilter.includes(fltr); + }; } loadUTXOsTable(utxos: any[]) { diff --git a/src/app/cln/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html b/src/app/cln/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html index 443a8098..ab2947ec 100644 --- a/src/app/cln/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html +++ b/src/app/cln/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html @@ -4,7 +4,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -16,7 +16,7 @@
- +
diff --git a/src/app/cln/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts b/src/app/cln/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts index 08298f40..5cdb8f9a 100644 --- a/src/app/cln/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts +++ b/src/app/cln/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts @@ -40,7 +40,7 @@ export class CLNChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe public faEye = faEye; public faEyeSlash = faEyeSlash; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'peers_channels'; public tableSetting: TableSetting = { tableId: 'open_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING }; @@ -272,42 +272,43 @@ export class CLNChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.channels.filterPredicate = (channel: Channel, fltr: string) => { - const newChannel = ((channel.connected) ? 'connected' : 'disconnected') + (channel.channel_id ? channel.channel_id.toLowerCase() : '') + - (channel.short_channel_id ? channel.short_channel_id.toLowerCase() : '') + (channel.id ? channel.id.toLowerCase() : '') + (channel.alias ? channel.alias.toLowerCase() : '') + - (channel.private ? 'private' : 'public') + (channel.state ? channel.state.toLowerCase() : '') + - (channel.funding_txid ? channel.funding_txid.toLowerCase() : '') + (channel.msatoshi_to_us ? channel.msatoshi_to_us : '') + - (channel.msatoshi_total ? channel.msatoshi_total : '') + (channel.their_channel_reserve_satoshis ? channel.their_channel_reserve_satoshis : '') + - (channel.our_channel_reserve_satoshis ? channel.our_channel_reserve_satoshis : '') + (channel.spendable_msatoshi ? channel.spendable_msatoshi : ''); - return newChannel.includes(fltr); - }; - // this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; + this.channels.filterPredicate = (rowData: Channel, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = ((rowData.connected) ? 'connected' : 'disconnected') + (rowData.channel_id ? rowData.channel_id.toLowerCase() : '') + + (rowData.short_channel_id ? rowData.short_channel_id.toLowerCase() : '') + (rowData.id ? rowData.id.toLowerCase() : '') + (rowData.alias ? rowData.alias.toLowerCase() : '') + + (rowData.private ? 'private' : 'public') + (rowData.state ? rowData.state.toLowerCase() : '') + + (rowData.funding_txid ? rowData.funding_txid.toLowerCase() : '') + (rowData.msatoshi_to_us ? rowData.msatoshi_to_us : '') + + (rowData.msatoshi_total ? rowData.msatoshi_total : '') + (rowData.their_channel_reserve_satoshis ? rowData.their_channel_reserve_satoshis : '') + + (rowData.our_channel_reserve_satoshis ? rowData.our_channel_reserve_satoshis : '') + (rowData.spendable_msatoshi ? rowData.spendable_msatoshi : ''); + break; + + case 'private': + rowToFilter = rowData?.private ? 'private' : 'public'; + break; + + case 'connected': + rowToFilter = rowData?.connected ? 'connected' : 'disconnected'; + break; - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; + case 'msatoshi_total': + case 'spendable_msatoshi': + case 'msatoshi_to_us': + case 'msatoshi_to_them': + rowToFilter = ((+(rowData[this.selFilterBy] || 0)) / 1000)?.toString() || ''; + break; - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return this.selFilterBy === 'connected' ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); + }; } loadChannelsTable(mychannels) { diff --git a/src/app/cln/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html b/src/app/cln/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html index 380bc3b0..ae1c5711 100644 --- a/src/app/cln/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html +++ b/src/app/cln/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.html @@ -4,7 +4,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -16,7 +16,7 @@
- + - + diff --git a/src/app/cln/transactions/invoices/invoices-table/lightning-invoices-table.component.ts b/src/app/cln/transactions/invoices/invoices-table/lightning-invoices-table.component.ts index e9ac2127..7400c22e 100644 --- a/src/app/cln/transactions/invoices/invoices-table/lightning-invoices-table.component.ts +++ b/src/app/cln/transactions/invoices/invoices-table/lightning-invoices-table.component.ts @@ -42,7 +42,7 @@ export class CLNLightningInvoicesTableComponent implements OnInit, AfterViewInit @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; faHistory = faHistory; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'transactions'; public tableSetting: TableSetting = { tableId: 'invoices', recordsPerPage: PAGE_SIZE, sortBy: 'expires_at', sortOrder: SortOrderEnum.DESCENDING }; @@ -208,39 +208,43 @@ export class CLNLightningInvoicesTableComponent implements OnInit, AfterViewInit getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => { - const newRowData = this.datePipe.transform(new Date((rowData.paid_at || 0) * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase()! + - (this.datePipe.transform(new Date((rowData.expires_at || 0) * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase()) + - ((rowData.bolt12) ? 'bolt12' : (rowData.bolt11) ? 'bolt11' : 'keysend') + JSON.stringify(rowData).toLowerCase(); - return newRowData.includes(fltr); - }; - // this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = this.datePipe.transform(new Date((rowData.paid_at || 0) * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase()! + + (this.datePipe.transform(new Date((rowData.expires_at || 0) * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase()) + + ((rowData.bolt12) ? 'bolt12' : (rowData.bolt11) ? 'bolt11' : 'keysend') + JSON.stringify(rowData).toLowerCase(); + break; + + case 'status': + rowToFilter = rowData?.status === 'paid' ? 'paid' : rowData?.status === 'unpaid' ? 'unpaid' : 'expired'; + break; + + case 'expires_at': + case 'paid_at': + rowToFilter = this.datePipe.transform(new Date((rowData[this.selFilterBy] || 0) * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() || ''; + break; - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; + case 'type': + rowToFilter = rowData?.bolt12 ? 'bolt12' : (rowData?.bolt11 && rowData?.label?.includes('keysend-')) ? 'keysend' : 'bolt11'; + break; - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; + case 'msatoshi': + case 'msatoshi_received': + rowToFilter = ((+(rowData[this.selFilterBy] || 0)) / 1000)?.toString() || ''; + break; + + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return (this.selFilterBy === 'status' || this.selFilterBy === 'type') ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); + }; } onInvoiceValueChange() { diff --git a/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.html b/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.html index 8fec2196..d9fefd36 100644 --- a/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.html +++ b/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.html @@ -9,7 +9,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.ts b/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.ts index 6c06d433..d6d2bab3 100644 --- a/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.ts +++ b/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.ts @@ -22,6 +22,7 @@ import { CLNLightningSendPaymentsComponent } from '../../send-payment-modal/send import { deleteOfferBookmark, sendPayment } from '../../../store/cln.actions'; import { ColumnDefinition, PageSettings, TableSetting } from '../../../../shared/models/pageSettings'; import { CamelCaseWithReplacePipe } from '../../../../shared/pipes/app.pipe'; +import { DatePipe } from '@angular/common'; @Component({ selector: 'rtl-cln-offer-bookmarks-table', @@ -37,7 +38,7 @@ export class CLNOfferBookmarksTableComponent implements OnInit, AfterViewInit, O @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; faHistory = faHistory; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'transactions'; public tableSetting: TableSetting = { tableId: 'offer_bookmarks', recordsPerPage: PAGE_SIZE, sortBy: 'lastUpdatedAt', sortOrder: SortOrderEnum.DESCENDING }; @@ -54,7 +55,7 @@ export class CLNOfferBookmarksTableComponent implements OnInit, AfterViewInit, O public apiCallStatusEnum = APICallStatusEnum; private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject()]; - constructor(private logger: LoggerService, private store: Store, private commonService: CommonService, private rtlEffects: RTLEffects, private camelCaseWithReplace: CamelCaseWithReplacePipe) { + constructor(private logger: LoggerService, private store: Store, private commonService: CommonService, private rtlEffects: RTLEffects, private datePipe: DatePipe, private camelCaseWithReplace: CamelCaseWithReplacePipe) { this.screenSize = this.commonService.getScreenSize(); } @@ -148,34 +149,31 @@ export class CLNOfferBookmarksTableComponent implements OnInit, AfterViewInit, O getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.offersBookmarks.filterPredicate = (Ofrbm: OfferBookmark, fltr: string) => JSON.stringify(Ofrbm).toLowerCase().includes(fltr); - // this.offersBookmarks.filterPredicate = (rowData: OfferBookmark, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; - - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; - - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; + this.offersBookmarks.filterPredicate = (rowData: OfferBookmark, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = JSON.stringify(rowData).toLowerCase(); + break; + + case 'lastUpdatedAt': + rowToFilter = this.datePipe.transform(new Date(rowData.lastUpdatedAt || 0), 'dd/MMM/YYYY HH:mm')?.toLowerCase() || ''; + break; + + case 'amountMSat': + rowToFilter = ((!rowData.amountMSat || rowData.amountMSat === 0) ? 'Open' : (rowData.amountMSat / 1000).toString()) || ''; + break; + + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return rowToFilter.includes(fltr); + }; } loadOffersTable(OffrBMs: OfferBookmark[]) { diff --git a/src/app/cln/transactions/offers/offers-table/offers-table.component.html b/src/app/cln/transactions/offers/offers-table/offers-table.component.html index b9e25372..98f1c725 100644 --- a/src/app/cln/transactions/offers/offers-table/offers-table.component.html +++ b/src/app/cln/transactions/offers/offers-table/offers-table.component.html @@ -11,7 +11,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/cln/transactions/offers/offers-table/offers-table.component.ts b/src/app/cln/transactions/offers/offers-table/offers-table.component.ts index e61c5cae..40a767cc 100644 --- a/src/app/cln/transactions/offers/offers-table/offers-table.component.ts +++ b/src/app/cln/transactions/offers/offers-table/offers-table.component.ts @@ -44,7 +44,7 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; faHistory = faHistory; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'transactions'; public tableSetting: TableSetting = { tableId: 'offers', recordsPerPage: PAGE_SIZE, sortBy: 'offer_id', sortOrder: SortOrderEnum.DESCENDING }; @@ -231,40 +231,30 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { this.offers.filterPredicate = (rowData: Offer, fltr: string) => { - const newRowData = ((rowData.active) ? ' active' : ' inactive') + ((rowData.used) ? ' used' : ' unused') + ((rowData.single_use) ? ' single' : ' multiple') + JSON.stringify(rowData).toLowerCase(); - if (fltr === 'active' || fltr === 'inactive' || fltr === 'used' || fltr === 'unused' || fltr === 'single' || fltr === 'multiple') { - fltr = ' ' + fltr; - } - return newRowData.includes(fltr); - }; - // this.offers.filterPredicate = (rowData: Offer, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = ((rowData.active) ? ' active' : ' inactive') + ((rowData.used) ? ' yes' : ' no') + ((rowData.single_use) ? ' single' : ' multiple') + JSON.stringify(rowData).toLowerCase(); + if (fltr === 'active' || fltr === 'inactive' || fltr === 'single' || fltr === 'multiple') { + fltr = ' ' + fltr; + } + break; - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; + case 'active': + rowToFilter = rowData?.active ? 'active' : 'inactive'; + break; - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return this.selFilterBy === 'active' ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); + }; } loadOffersTable(offrs: Offer[]) { diff --git a/src/app/cln/transactions/payments/lightning-payments.component.html b/src/app/cln/transactions/payments/lightning-payments.component.html index 9897de2b..6f2f9933 100644 --- a/src/app/cln/transactions/payments/lightning-payments.component.html +++ b/src/app/cln/transactions/payments/lightning-payments.component.html @@ -22,7 +22,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -38,7 +38,7 @@
diff --git a/src/app/cln/transactions/payments/lightning-payments.component.ts b/src/app/cln/transactions/payments/lightning-payments.component.ts index c0023937..7da65ef7 100644 --- a/src/app/cln/transactions/payments/lightning-payments.component.ts +++ b/src/app/cln/transactions/payments/lightning-payments.component.ts @@ -42,7 +42,7 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'transactions'; public tableSetting: TableSetting = { tableId: 'payments', recordsPerPage: PAGE_SIZE, sortBy: 'created_at', sortOrder: SortOrderEnum.DESCENDING }; @@ -315,37 +315,40 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { this.payments.filterPredicate = (rowData: Payment, fltr: string) => { - const newRowData = ((rowData.created_at) ? this.datePipe.transform(new Date(rowData.created_at * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + ((rowData.bolt12) ? 'bolt12' : (rowData.bolt11) ? 'bolt11' : 'keysend') + JSON.stringify(rowData).toLowerCase(); - return newRowData.includes(fltr); - }; - // this.payments.filterPredicate = (rowData: Payment, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = ((rowData.created_at) ? this.datePipe.transform(new Date(rowData.created_at * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + ((rowData.bolt12) ? 'bolt12' : (rowData.bolt11) ? 'bolt11' : 'keysend') + JSON.stringify(rowData).toLowerCase(); + break; + + case 'status': + rowToFilter = rowData?.status === 'complete' ? 'completed' : 'incomplete/failed'; + break; + + case 'created_at': + rowToFilter = this.datePipe.transform(new Date((rowData[this.selFilterBy] || 0) * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() || ''; + break; - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; + case 'msatoshi_sent': + case 'msatoshi': + rowToFilter = ((+(rowData[this.selFilterBy] || 0)) / 1000)?.toString() || ''; + break; - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; + case 'type': + rowToFilter = rowData?.bolt12 ? 'bolt12' : rowData?.bolt11 ? 'bolt11' : 'keysend'; + break; + + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return (this.selFilterBy === 'status' || this.selFilterBy === 'type') ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); + }; } loadPaymentsTable(payments: Payment[]) { 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 a27e429e..fd9257fa 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 @@ -7,7 +7,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/eclair/on-chain/on-chain-transaction-history/on-chain-transaction-history.component.ts b/src/app/eclair/on-chain/on-chain-transaction-history/on-chain-transaction-history.component.ts index 4e572048..1fda879a 100644 --- a/src/app/eclair/on-chain/on-chain-transaction-history/on-chain-transaction-history.component.ts +++ b/src/app/eclair/on-chain/on-chain-transaction-history/on-chain-transaction-history.component.ts @@ -35,7 +35,7 @@ export class ECLOnChainTransactionHistoryComponent implements OnInit, OnDestroy @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public faHistory = faHistory; public nodePageDefs = ECL_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'on_chain'; public tableSetting: TableSetting = { tableId: 'transaction', recordsPerPage: PAGE_SIZE, sortBy: 'timestamp', sortOrder: SortOrderEnum.DESCENDING }; @@ -95,7 +95,7 @@ export class ECLOnChainTransactionHistoryComponent implements OnInit, OnDestroy getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { @@ -106,7 +106,7 @@ export class ECLOnChainTransactionHistoryComponent implements OnInit, OnDestroy // this.listTransactions.filterPredicate = (rowData: Transaction, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -117,11 +117,11 @@ export class ECLOnChainTransactionHistoryComponent implements OnInit, OnDestroy // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.html b/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.html index 774cd9bb..7746816f 100644 --- a/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.html +++ b/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.html @@ -4,7 +4,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -16,7 +16,7 @@
diff --git a/src/app/cln/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.ts b/src/app/cln/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.ts index ccccdcc7..29aab4f1 100644 --- a/src/app/cln/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.ts +++ b/src/app/cln/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.ts @@ -38,7 +38,7 @@ export class CLNChannelPendingTableComponent implements OnInit, AfterViewInit, O public faEye = faEye; public faEyeSlash = faEyeSlash; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'peers_channels'; public tableSetting: TableSetting = { tableId: 'pending_inactive_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING }; @@ -170,42 +170,43 @@ export class CLNChannelPendingTableComponent implements OnInit, AfterViewInit, O getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.channels.filterPredicate = (channel: Channel, fltr: string) => { - const newChannel = ((channel.connected) ? 'connected' : 'disconnected') + (channel.channel_id ? channel.channel_id.toLowerCase() : '') + - (channel.short_channel_id ? channel.short_channel_id.toLowerCase() : '') + (channel.id ? channel.id.toLowerCase() : '') + (channel.alias ? channel.alias.toLowerCase() : '') + - (channel.private ? 'private' : 'public') + ((channel.state && this.CLNChannelPendingState[channel.state]) ? this.CLNChannelPendingState[channel.state].toLowerCase() : '') + - (channel.funding_txid ? channel.funding_txid.toLowerCase() : '') + (channel.msatoshi_to_us ? channel.msatoshi_to_us : '') + - (channel.msatoshi_total ? channel.msatoshi_total : '') + (channel.their_channel_reserve_satoshis ? channel.their_channel_reserve_satoshis : '') + - (channel.our_channel_reserve_satoshis ? channel.our_channel_reserve_satoshis : '') + (channel.spendable_msatoshi ? channel.spendable_msatoshi : ''); - return newChannel.includes(fltr); + this.channels.filterPredicate = (rowData: Channel, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = ((rowData.connected) ? 'connected' : 'disconnected') + (rowData.channel_id ? rowData.channel_id.toLowerCase() : '') + + (rowData.short_channel_id ? rowData.short_channel_id.toLowerCase() : '') + (rowData.id ? rowData.id.toLowerCase() : '') + (rowData.alias ? rowData.alias.toLowerCase() : '') + + (rowData.private ? 'private' : 'public') + ((rowData.state && this.CLNChannelPendingState[rowData.state]) ? this.CLNChannelPendingState[rowData.state].toLowerCase() : '') + + (rowData.funding_txid ? rowData.funding_txid.toLowerCase() : '') + (rowData.msatoshi_to_us ? rowData.msatoshi_to_us : '') + + (rowData.msatoshi_total ? rowData.msatoshi_total : '') + (rowData.their_channel_reserve_satoshis ? rowData.their_channel_reserve_satoshis : '') + + (rowData.our_channel_reserve_satoshis ? rowData.our_channel_reserve_satoshis : '') + (rowData.spendable_msatoshi ? rowData.spendable_msatoshi : ''); + break; + + case 'private': + rowToFilter = rowData?.private ? 'private' : 'public'; + break; + + case 'connected': + rowToFilter = rowData?.connected ? 'connected' : 'disconnected'; + break; + + case 'msatoshi_total': + case 'spendable_msatoshi': + case 'msatoshi_to_us': + case 'msatoshi_to_them': + rowToFilter = ((+(rowData[this.selFilterBy] || 0)) / 1000)?.toString() || ''; + break; + + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return this.selFilterBy === 'connected' ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); }; - // this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; - - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; - - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; } loadChannelsTable(mychannels) { diff --git a/src/app/cln/peers-channels/peers/peers.component.html b/src/app/cln/peers-channels/peers/peers.component.html index 9c1be383..482ff4d8 100644 --- a/src/app/cln/peers-channels/peers/peers.component.html +++ b/src/app/cln/peers-channels/peers/peers.component.html @@ -11,7 +11,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/cln/peers-channels/peers/peers.component.ts b/src/app/cln/peers-channels/peers/peers.component.ts index 64717f57..5e1d2c69 100644 --- a/src/app/cln/peers-channels/peers/peers.component.ts +++ b/src/app/cln/peers-channels/peers/peers.component.ts @@ -39,7 +39,7 @@ export class CLNPeersComponent implements OnInit, AfterViewInit, OnDestroy { @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public faUsers = faUsers; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'peers_channels'; public tableSetting: TableSetting = { tableId: 'peers', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING }; @@ -194,34 +194,31 @@ export class CLNPeersComponent implements OnInit, AfterViewInit, OnDestroy { getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.peers.filterPredicate = (peer: Peer, fltr: string) => JSON.stringify(peer).toLowerCase().includes(fltr); - // this.peers.filterPredicate = (rowData: Peer, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; + this.peers.filterPredicate = (rowData: Peer, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = JSON.stringify(rowData).toLowerCase(); + break; - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; + case 'connected': + rowToFilter = rowData?.connected ? 'connected' : 'disconnected'; + break; - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; + case 'netaddr': + rowToFilter = (rowData?.netaddr?.reduce((acc, curr) => acc + curr), ' ') || ''; + break; + + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return this.selFilterBy === 'connected' ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); + }; } loadPeersTable(peersArr: Peer[]) { 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 fe52fb13..f8e206f6 100644 --- a/src/app/cln/routing/failed-transactions/failed-transactions.component.html +++ b/src/app/cln/routing/failed-transactions/failed-transactions.component.html @@ -10,7 +10,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/cln/routing/failed-transactions/failed-transactions.component.ts b/src/app/cln/routing/failed-transactions/failed-transactions.component.ts index 3081995d..e8274f4d 100644 --- a/src/app/cln/routing/failed-transactions/failed-transactions.component.ts +++ b/src/app/cln/routing/failed-transactions/failed-transactions.component.ts @@ -35,7 +35,7 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'routing'; public tableSetting: TableSetting = { tableId: 'failed', recordsPerPage: PAGE_SIZE, sortBy: 'received_time', sortOrder: SortOrderEnum.DESCENDING }; @@ -132,43 +132,38 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.failedForwardingEvents.filterPredicate = (event: ForwardingEvent, fltr: string) => { - const newEvent = - (event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm')!.toLowerCase() : '') + - (event.resolved_time ? this.datePipe.transform(new Date(event.resolved_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + - (event.payment_hash ? event.payment_hash.toLowerCase() : '') + - (event.in_channel ? event.in_channel.toLowerCase() : '') + (event.out_channel ? event.out_channel.toLowerCase() : '') + - (event.in_channel_alias ? event.in_channel_alias.toLowerCase() : '') + (event.out_channel_alias ? event.out_channel_alias.toLowerCase() : '') + - (event.in_msatoshi ? (event.in_msatoshi / 1000) : '') + (event.out_msatoshi ? (event.out_msatoshi / 1000) : '') + (event.fee ? event.fee : ''); - return newEvent?.includes(fltr) || false; + this.failedForwardingEvents.filterPredicate = (rowData: ForwardingEvent, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = (rowData.received_time ? this.datePipe.transform(new Date(rowData.received_time * 1000), 'dd/MMM/YYYY HH:mm')!.toLowerCase() : '') + + (rowData.resolved_time ? this.datePipe.transform(new Date(rowData.resolved_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + + (rowData.payment_hash ? rowData.payment_hash.toLowerCase() : '') + + (rowData.in_channel ? rowData.in_channel.toLowerCase() : '') + (rowData.out_channel ? rowData.out_channel.toLowerCase() : '') + + (rowData.in_channel_alias ? rowData.in_channel_alias.toLowerCase() : '') + (rowData.out_channel_alias ? rowData.out_channel_alias.toLowerCase() : '') + + (rowData.in_msatoshi ? (rowData.in_msatoshi / 1000) : '') + (rowData.out_msatoshi ? (rowData.out_msatoshi / 1000) : '') + (rowData.fee ? rowData.fee : ''); + break; + + case 'received_time': + case 'resolved_time': + rowToFilter = this.datePipe.transform(new Date((rowData[this.selFilterBy] || 0) * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() || ''; + break; + + case 'in_msatoshi': + case 'out_msatoshi': + rowToFilter = ((+(rowData[this.selFilterBy] || 0)) / 1000)?.toString() || ''; + break; + + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return rowToFilter.includes(fltr); }; - // this.failedForwardingEvents.filterPredicate = (rowData: ForwardingEvent, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; - - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; - - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; } loadFailedEventsTable(forwardingEvents: ForwardingEvent[]) { 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 6ec58e00..32a154a9 100644 --- a/src/app/cln/routing/forwarding-history/forwarding-history.component.html +++ b/src/app/cln/routing/forwarding-history/forwarding-history.component.html @@ -5,7 +5,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/cln/routing/forwarding-history/forwarding-history.component.ts b/src/app/cln/routing/forwarding-history/forwarding-history.component.ts index f9038fde..f3318e25 100644 --- a/src/app/cln/routing/forwarding-history/forwarding-history.component.ts +++ b/src/app/cln/routing/forwarding-history/forwarding-history.component.ts @@ -38,7 +38,7 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi @Input() eventsData = []; @Input() selFilter = ''; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public tableSetting: TableSetting = { tableId: 'forwarding_history', recordsPerPage: PAGE_SIZE, sortBy: 'received_time', sortOrder: SortOrderEnum.DESCENDING }; public successfulEvents: ForwardingEvent[] = []; @@ -156,41 +156,37 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.pageId][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.forwardingHistoryEvents.filterPredicate = (event: ForwardingEvent, fltr: string) => { - const newEvent = (event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() + ' ' : '') + - (event.resolved_time ? this.datePipe.transform(new Date(event.resolved_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() + ' ' : '') + - (event.in_channel ? event.in_channel.toLowerCase() + ' ' : '') + (event.out_channel ? event.out_channel.toLowerCase() + ' ' : '') + - (event.in_channel_alias ? event.in_channel_alias.toLowerCase() + ' ' : '') + (event.out_channel_alias ? event.out_channel_alias.toLowerCase() + ' ' : '') + - (event.in_msatoshi ? (event.in_msatoshi / 1000) + ' ' : '') + (event.out_msatoshi ? (event.out_msatoshi / 1000) + ' ' : '') + (event.fee ? event.fee + ' ' : ''); - return newEvent.includes(fltr); + this.forwardingHistoryEvents.filterPredicate = (rowData: ForwardingEvent, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = (rowData.received_time ? this.datePipe.transform(new Date(rowData.received_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() + ' ' : '') + + (rowData.resolved_time ? this.datePipe.transform(new Date(rowData.resolved_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() + ' ' : '') + + (rowData.in_channel ? rowData.in_channel.toLowerCase() + ' ' : '') + (rowData.out_channel ? rowData.out_channel.toLowerCase() + ' ' : '') + + (rowData.in_channel_alias ? rowData.in_channel_alias.toLowerCase() + ' ' : '') + (rowData.out_channel_alias ? rowData.out_channel_alias.toLowerCase() + ' ' : '') + + (rowData.in_msatoshi ? (rowData.in_msatoshi / 1000) + ' ' : '') + (rowData.out_msatoshi ? (rowData.out_msatoshi / 1000) + ' ' : '') + (rowData.fee ? rowData.fee + ' ' : ''); + break; + + case 'received_time': + case 'resolved_time': + rowToFilter = this.datePipe.transform(new Date((rowData[this.selFilterBy] || 0) * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() || ''; + break; + + case 'in_msatoshi': + case 'out_msatoshi': + rowToFilter = ((+(rowData[this.selFilterBy] || 0)) / 1000)?.toString() || ''; + break; + + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return rowToFilter.includes(fltr); }; - // this.forwardingHistoryEvents.filterPredicate = (rowData: ForwardingEvent, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; - - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; - - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; } loadForwardingEventsTable(forwardingEvents: ForwardingEvent[]) { 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 775352f3..5bc7f072 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 @@ -10,7 +10,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.ts b/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.ts index 5d23d1aa..42764a59 100644 --- a/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.ts +++ b/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.ts @@ -36,7 +36,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public faExclamationTriangle = faExclamationTriangle; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'routing'; public tableSetting: TableSetting = { tableId: 'local_failed', recordsPerPage: PAGE_SIZE, sortBy: 'received_time', sortOrder: SortOrderEnum.DESCENDING }; @@ -127,40 +127,38 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.failedLocalForwardingEvents.filterPredicate = (event: LocalFailedEvent, fltr: string) => { - const newEvent = (event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + - (event.in_channel_alias ? event.in_channel_alias.toLowerCase() : '') + - ((event.failreason && this.CLNFailReason[event.failreason]) ? this.CLNFailReason[event.failreason].toLowerCase() : '') + - (event.in_msatoshi ? (event.in_msatoshi / 1000) : ''); - return newEvent?.includes(fltr) || false; + this.failedLocalForwardingEvents.filterPredicate = (rowData: LocalFailedEvent, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = (rowData.received_time ? this.datePipe.transform(new Date(rowData.received_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + + (rowData.in_channel_alias ? rowData.in_channel_alias.toLowerCase() : '') + + ((rowData.failreason && this.CLNFailReason[rowData.failreason]) ? this.CLNFailReason[rowData.failreason].toLowerCase() : '') + + (rowData.in_msatoshi ? (rowData.in_msatoshi / 1000) : ''); + break; + + case 'received_time': + rowToFilter = this.datePipe.transform(new Date((rowData.received_time || 0) * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() || ''; + break; + + case 'in_msatoshi': + rowToFilter = ((+(rowData.in_msatoshi || 0)) / 1000)?.toString() || ''; + break; + + case 'failreason': + rowToFilter = rowData?.failreason ? this.CLNFailReason[rowData?.failreason] : ''; + break; + + default: + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); + break; + } + return rowToFilter.includes(fltr); }; - // this.failedLocalForwardingEvents.filterPredicate = (rowData: LocalFailedEvent, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; - - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; - - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; } loadLocalfailedLocalEventsTable(forwardingEvents: LocalFailedEvent[]) { diff --git a/src/app/cln/routing/routing-peers/routing-peers.component.html b/src/app/cln/routing/routing-peers/routing-peers.component.html index 52e4ae9e..de0ef04c 100644 --- a/src/app/cln/routing/routing-peers/routing-peers.component.html +++ b/src/app/cln/routing/routing-peers/routing-peers.component.html @@ -7,7 +7,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -67,7 +67,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/cln/routing/routing-peers/routing-peers.component.ts b/src/app/cln/routing/routing-peers/routing-peers.component.ts index 16025919..f49d5fdd 100644 --- a/src/app/cln/routing/routing-peers/routing-peers.component.ts +++ b/src/app/cln/routing/routing-peers/routing-peers.component.ts @@ -35,8 +35,8 @@ export class CLNRoutingPeersComponent implements OnInit, OnChanges, AfterViewIni @Input() eventsData = []; @Input() selFilter = ''; public nodePageDefs = CLN_PAGE_DEFS; - public selFilterByIn = 'All'; - public selFilterByOut = 'All'; + public selFilterByIn = 'all'; + public selFilterByOut = 'all'; public colWidth = '20rem'; public PAGE_ID = 'routing'; public tableSetting: TableSetting = { tableId: 'routing_peers', recordsPerPage: PAGE_SIZE, sortBy: 'total_fee', sortOrder: SortOrderEnum.DESCENDING }; @@ -126,35 +126,47 @@ export class CLNRoutingPeersComponent implements OnInit, OnChanges, AfterViewIni getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.routingPeersIncoming.filterPredicate = (rpIn: RoutingPeer, fltr: string) => JSON.stringify(rpIn).toLowerCase().includes(fltr); - this.routingPeersOutgoing.filterPredicate = (rpOut: RoutingPeer, fltr: string) => JSON.stringify(rpOut).toLowerCase().includes(fltr); - // this.routingPeersIncoming.filterPredicate = (rowData: RoutingPeer, fltr: string) => { - // let rowToFilter = ''; - // switch (this.selFilterBy) { - // case 'All': - // for (let i = 0; i < this.displayedColumns.length - 1; i++) { - // rowToFilter = rowToFilter + ( - // (this.displayedColumns[i] === '') ? - // (rowData ? rowData..toLowerCase() : '') : - // (rowData[this.displayedColumns[i]] ? rowData[this.displayedColumns[i]].toLowerCase() : '') - // ) + ', '; - // } - // break; - - // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); - // break; - - // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); - // break; - // } - // return rowToFilter.includes(fltr); - // }; + this.routingPeersIncoming.filterPredicate = (rowDataIn: RoutingPeer, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterByIn) { + case 'all': + rowToFilter = JSON.stringify(rowDataIn).toLowerCase(); + break; + + case 'total_amount': + case 'total_fee': + rowToFilter = ((+(rowDataIn[this.selFilterByIn] || 0)) / 1000)?.toString() || ''; + break; + + default: + rowToFilter = typeof rowDataIn[this.selFilterByIn] === 'string' ? rowDataIn[this.selFilterByIn].toLowerCase() : typeof rowDataIn[this.selFilterByIn] === 'boolean' ? (rowDataIn[this.selFilterByIn] ? 'yes' : 'no') : rowDataIn[this.selFilterByIn].toString(); + break; + } + return rowToFilter.includes(fltr); + }; + + this.routingPeersIncoming.filterPredicate = (rowDataOut: RoutingPeer, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterByOut) { + case 'all': + rowToFilter = JSON.stringify(rowDataOut).toLowerCase(); + break; + + case 'total_amount': + case 'total_fee': + rowToFilter = ((+(rowDataOut[this.selFilterByOut] || 0)) / 1000)?.toString() || ''; + break; + + default: + rowToFilter = typeof rowDataOut[this.selFilterByOut] === 'string' ? rowDataOut[this.selFilterByOut].toLowerCase() : typeof rowDataOut[this.selFilterByOut] === 'boolean' ? (rowDataOut[this.selFilterByOut] ? 'yes' : 'no') : rowDataOut[this.selFilterByOut].toString(); + break; + } + return rowToFilter.includes(fltr); + }; } loadRoutingPeersTable(events: ForwardingEvent[]) { diff --git a/src/app/cln/store/cln.effects.ts b/src/app/cln/store/cln.effects.ts index 89effca1..c6c85985 100644 --- a/src/app/cln/store/cln.effects.ts +++ b/src/app/cln/store/cln.effects.ts @@ -975,7 +975,7 @@ export class CLNEffects implements OnDestroy { }; }), catchError((err: any) => { - this.handleErrorWithoutAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', err); + this.handleErrorWithAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', environment.PAGE_SETTINGS_API, err); return of({ type: RTLActions.VOID }); }) ); diff --git a/src/app/cln/transactions/invoices/invoices-table/lightning-invoices-table.component.html b/src/app/cln/transactions/invoices/invoices-table/lightning-invoices-table.component.html index cb2235cc..34c1846a 100644 --- a/src/app/cln/transactions/invoices/invoices-table/lightning-invoices-table.component.html +++ b/src/app/cln/transactions/invoices/invoices-table/lightning-invoices-table.component.html @@ -26,7 +26,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -57,7 +57,7 @@
Type{{ invoice?.bolt12 ? 'Bolt12' : (invoice?.bolt11 && !invoice.label.includes('keysend-')) ? 'Bolt11' : 'Keysend' }}{{ invoice?.bolt12 ? 'Bolt12' : (invoice?.bolt11 && invoice.label.includes('keysend-')) ? 'Keysend' : 'Bolt11' }} Description - +
- +
diff --git a/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.ts b/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.ts index 3c092f74..03e59e28 100644 --- a/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.ts +++ b/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.ts @@ -37,7 +37,7 @@ export class ECLChannelInactiveTableComponent implements OnInit, AfterViewInit, public faEye = faEye; public faEyeSlash = faEyeSlash; public nodePageDefs = ECL_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'peers_channels'; public tableSetting: TableSetting = { tableId: 'inactive_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING }; @@ -162,15 +162,15 @@ export class ECLChannelInactiveTableComponent implements OnInit, AfterViewInit, getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : column === 'announceChannel' ? 'Private' : this.commonService.titleCase(column); } setFilterPredicate() { - this.channels.filterPredicate = (channel: Channel, fltr: string) => JSON.stringify(channel).toLowerCase().includes(fltr); + this.channels.filterPredicate = (rowData: Channel, fltr: string) => JSON.stringify(rowData).toLowerCase().includes(fltr); // this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -180,12 +180,16 @@ export class ECLChannelInactiveTableComponent implements OnInit, AfterViewInit, // } // break; + // case 'announceChannel': + // rowToFilter = rowData?.private ? 'private' : 'public'; + // break; + // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html b/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html index c9d7bedf..15bd4c97 100644 --- a/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html +++ b/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html @@ -4,7 +4,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -16,7 +16,7 @@ - +
diff --git a/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts b/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts index a8e825c0..c68be8d6 100644 --- a/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts +++ b/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts @@ -38,7 +38,7 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe public faEye = faEye; public faEyeSlash = faEyeSlash; public nodePageDefs = ECL_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'peers_channels'; public tableSetting: TableSetting = { tableId: 'open_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING }; @@ -232,15 +232,15 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : column === 'announceChannel' ? 'Private' : this.commonService.titleCase(column); } setFilterPredicate() { - this.channels.filterPredicate = (channel: Channel, fltr: string) => JSON.stringify(channel).toLowerCase().includes(fltr); + this.channels.filterPredicate = (rowData: Channel, fltr: string) => JSON.stringify(rowData).toLowerCase().includes(fltr); // this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -250,12 +250,16 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe // } // break; + // case 'announceChannel': + // rowToFilter = rowData?.private ? 'private' : 'public'; + // break; + // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); 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 c63553a1..4048ed75 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 @@ -4,7 +4,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -16,7 +16,7 @@ - +
diff --git a/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.ts b/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.ts index 8ad7b024..465e775e 100644 --- a/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.ts +++ b/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.ts @@ -37,7 +37,7 @@ export class ECLChannelPendingTableComponent implements OnInit, AfterViewInit, O public faEye = faEye; public faEyeSlash = faEyeSlash; public nodePageDefs = ECL_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'peers_channels'; public tableSetting: TableSetting = { tableId: 'pending_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING }; @@ -132,15 +132,15 @@ export class ECLChannelPendingTableComponent implements OnInit, AfterViewInit, O getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : column === 'announceChannel' ? 'Private' : this.commonService.titleCase(column); } setFilterPredicate() { - this.channels.filterPredicate = (channel: Channel, fltr: string) => JSON.stringify(channel).toLowerCase().includes(fltr); + this.channels.filterPredicate = (rowData: Channel, fltr: string) => JSON.stringify(rowData).toLowerCase().includes(fltr); // this.channels.filterPredicate = (rowData: Channel, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -150,12 +150,16 @@ export class ECLChannelPendingTableComponent implements OnInit, AfterViewInit, O // } // break; + // case 'announceChannel': + // rowToFilter = rowData?.private ? 'private' : 'public'; + // break; + // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/eclair/peers-channels/peers/peers.component.html b/src/app/eclair/peers-channels/peers/peers.component.html index 133ed524..f308d86c 100644 --- a/src/app/eclair/peers-channels/peers/peers.component.html +++ b/src/app/eclair/peers-channels/peers/peers.component.html @@ -11,7 +11,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/eclair/peers-channels/peers/peers.component.ts b/src/app/eclair/peers-channels/peers/peers.component.ts index 4b9a774a..2278ca49 100644 --- a/src/app/eclair/peers-channels/peers/peers.component.ts +++ b/src/app/eclair/peers-channels/peers/peers.component.ts @@ -38,7 +38,7 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy { @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = ECL_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'peers_channels'; public tableSetting: TableSetting = { tableId: 'peers', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING }; @@ -209,15 +209,15 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy { getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.peers.filterPredicate = (peer: Peer, fltr: string) => JSON.stringify(peer).toLowerCase().includes(fltr); + this.peers.filterPredicate = (rowData: Peer, fltr: string) => JSON.stringify(rowData).toLowerCase().includes(fltr); // this.peers.filterPredicate = (rowData: Peer, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -228,11 +228,11 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy { // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); 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 9dd7306c..ce55bb99 100644 --- a/src/app/eclair/routing/forwarding-history/forwarding-history.component.html +++ b/src/app/eclair/routing/forwarding-history/forwarding-history.component.html @@ -5,7 +5,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/eclair/routing/forwarding-history/forwarding-history.component.ts b/src/app/eclair/routing/forwarding-history/forwarding-history.component.ts index e6fff23e..f83e91c2 100644 --- a/src/app/eclair/routing/forwarding-history/forwarding-history.component.ts +++ b/src/app/eclair/routing/forwarding-history/forwarding-history.component.ts @@ -36,7 +36,7 @@ export class ECLForwardingHistoryComponent implements OnInit, OnChanges, AfterVi @Input() eventsData: PaymentRelayed[] = []; @Input() selFilter = ''; public nodePageDefs = ECL_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public tableSetting: TableSetting = { tableId: 'forwarding_history', recordsPerPage: PAGE_SIZE, sortBy: 'timestamp', sortOrder: SortOrderEnum.DESCENDING }; public displayedColumns: any[] = []; @@ -147,7 +147,7 @@ export class ECLForwardingHistoryComponent implements OnInit, OnChanges, AfterVi getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.pageId][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { @@ -158,7 +158,7 @@ export class ECLForwardingHistoryComponent implements OnInit, OnChanges, AfterVi // this.forwardingHistoryEvents.filterPredicate = (rowData: PaymentRelayed, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -169,11 +169,11 @@ export class ECLForwardingHistoryComponent implements OnInit, OnChanges, AfterVi // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/eclair/routing/routing-peers/routing-peers.component.html b/src/app/eclair/routing/routing-peers/routing-peers.component.html index 4b744efb..b3a265fb 100644 --- a/src/app/eclair/routing/routing-peers/routing-peers.component.html +++ b/src/app/eclair/routing/routing-peers/routing-peers.component.html @@ -7,7 +7,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -67,7 +67,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/eclair/routing/routing-peers/routing-peers.component.ts b/src/app/eclair/routing/routing-peers/routing-peers.component.ts index 5ac0a6f5..15f8548a 100644 --- a/src/app/eclair/routing/routing-peers/routing-peers.component.ts +++ b/src/app/eclair/routing/routing-peers/routing-peers.component.ts @@ -32,8 +32,8 @@ export class ECLRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro @ViewChild('paginatorIn', { static: false }) paginatorIn: MatPaginator | undefined; @ViewChild('paginatorOut', { static: false }) paginatorOut: MatPaginator | undefined; public nodePageDefs = ECL_PAGE_DEFS; - public selFilterByIn = 'All'; - public selFilterByOut = 'All'; + public selFilterByIn = 'all'; + public selFilterByOut = 'all'; public colWidth = '20rem'; public PAGE_ID = 'routing'; public tableSetting: TableSetting = { tableId: 'routing_peers', recordsPerPage: PAGE_SIZE, sortBy: 'totalFee', sortOrder: SortOrderEnum.DESCENDING }; @@ -105,16 +105,16 @@ export class ECLRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.routingPeersIncoming.filterPredicate = (rpIn: RoutingPeers, fltr: string) => JSON.stringify(rpIn).toLowerCase().includes(fltr); - this.routingPeersOutgoing.filterPredicate = (rpOut: RoutingPeers, fltr: string) => JSON.stringify(rpOut).toLowerCase().includes(fltr); + this.routingPeersIncoming.filterPredicate = (rowDataIn: RoutingPeers, fltr: string) => JSON.stringify(rowDataIn).toLowerCase().includes(fltr); + this.routingPeersOutgoing.filterPredicate = (rowDataOut: RoutingPeers, fltr: string) => JSON.stringify(rowDataOut).toLowerCase().includes(fltr); // this.routingPeersIncoming.filterPredicate = (rowData: RoutingPeer, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -125,11 +125,11 @@ export class ECLRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/eclair/store/ecl.effects.ts b/src/app/eclair/store/ecl.effects.ts index cd727712..d6d2f4bb 100644 --- a/src/app/eclair/store/ecl.effects.ts +++ b/src/app/eclair/store/ecl.effects.ts @@ -691,7 +691,7 @@ export class ECLEffects implements OnDestroy { }; }), catchError((err: any) => { - this.handleErrorWithoutAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', err); + this.handleErrorWithAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', environment.PAGE_SETTINGS_API, err); return of({ type: RTLActions.VOID }); }) ); diff --git a/src/app/eclair/transactions/invoices/lightning-invoices.component.html b/src/app/eclair/transactions/invoices/lightning-invoices.component.html index 325809c5..39f0dbd0 100644 --- a/src/app/eclair/transactions/invoices/lightning-invoices.component.html +++ b/src/app/eclair/transactions/invoices/lightning-invoices.component.html @@ -26,7 +26,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/eclair/transactions/invoices/lightning-invoices.component.ts b/src/app/eclair/transactions/invoices/lightning-invoices.component.ts index c41410e5..a680e3f1 100644 --- a/src/app/eclair/transactions/invoices/lightning-invoices.component.ts +++ b/src/app/eclair/transactions/invoices/lightning-invoices.component.ts @@ -41,7 +41,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; faHistory = faHistory; public nodePageDefs = ECL_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'transactions'; public tableSetting: TableSetting = { tableId: 'invoices', recordsPerPage: PAGE_SIZE, sortBy: 'expiresAt', sortOrder: SortOrderEnum.DESCENDING }; @@ -183,7 +183,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { @@ -194,7 +194,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD // this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -205,11 +205,11 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/eclair/transactions/payments/lightning-payments.component.html b/src/app/eclair/transactions/payments/lightning-payments.component.html index 1182adcd..d0007f32 100644 --- a/src/app/eclair/transactions/payments/lightning-payments.component.html +++ b/src/app/eclair/transactions/payments/lightning-payments.component.html @@ -22,7 +22,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/eclair/transactions/payments/lightning-payments.component.ts b/src/app/eclair/transactions/payments/lightning-payments.component.ts index 10c46fd6..7d58d997 100644 --- a/src/app/eclair/transactions/payments/lightning-payments.component.ts +++ b/src/app/eclair/transactions/payments/lightning-payments.component.ts @@ -42,7 +42,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = ECL_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'transactions'; public tableSetting: TableSetting = { tableId: 'payments', recordsPerPage: PAGE_SIZE, sortBy: 'firstPartTimestamp', sortOrder: SortOrderEnum.DESCENDING }; @@ -127,7 +127,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { @@ -138,7 +138,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD // this.payments.filterPredicate = (rowData: PaymentSent, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -149,11 +149,11 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/lnd/backup/channel-backup-table/channel-backup-table.component.ts b/src/app/lnd/backup/channel-backup-table/channel-backup-table.component.ts index a55d190e..fc2691fa 100644 --- a/src/app/lnd/backup/channel-backup-table/channel-backup-table.component.ts +++ b/src/app/lnd/backup/channel-backup-table/channel-backup-table.component.ts @@ -121,7 +121,7 @@ export class ChannelBackupTableComponent implements OnInit, AfterViewInit, OnDes this.channels.sort = this.sort; this.channels.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null); this.channels.paginator = this.paginator; - this.channels.filterPredicate = (channel: Channel, fltr: string) => (channel.channel_point ? channel.channel_point.toLowerCase() : '').includes(fltr); + this.channels.filterPredicate = (rowData: Channel, fltr: string) => (rowData.channel_point ? rowData.channel_point.toLowerCase() : '').includes(fltr); this.applyFilter(); } diff --git a/src/app/lnd/backup/channel-restore-table/channel-restore-table.component.ts b/src/app/lnd/backup/channel-restore-table/channel-restore-table.component.ts index c210437a..15e7ef3d 100644 --- a/src/app/lnd/backup/channel-restore-table/channel-restore-table.component.ts +++ b/src/app/lnd/backup/channel-restore-table/channel-restore-table.component.ts @@ -83,7 +83,7 @@ export class ChannelRestoreTableComponent implements OnInit, AfterViewInit, OnDe this.channels.sort = this.sort; this.channels.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null); this.channels.paginator = this.paginator; - this.channels.filterPredicate = (channel: Channel, fltr: string) => (channel.channel_point ? channel.channel_point.toLowerCase() : '').includes(fltr); + this.channels.filterPredicate = (rowData: Channel, fltr: string) => (rowData.channel_point ? rowData.channel_point.toLowerCase() : '').includes(fltr); this.applyFilter(); } 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 a9e0556e..1e5e5fa3 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 @@ -3,7 +3,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/lnd/on-chain/utxo-tables/on-chain-transaction-history/on-chain-transaction-history.component.ts b/src/app/lnd/on-chain/utxo-tables/on-chain-transaction-history/on-chain-transaction-history.component.ts index 5020cab2..e364abd7 100644 --- a/src/app/lnd/on-chain/utxo-tables/on-chain-transaction-history/on-chain-transaction-history.component.ts +++ b/src/app/lnd/on-chain/utxo-tables/on-chain-transaction-history/on-chain-transaction-history.component.ts @@ -33,7 +33,7 @@ export class OnChainTransactionHistoryComponent implements OnInit, OnChanges, On @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'on_chain'; public tableSetting: TableSetting = { tableId: 'transactions', recordsPerPage: PAGE_SIZE, sortBy: 'time_stamp', sortOrder: SortOrderEnum.DESCENDING }; @@ -125,7 +125,7 @@ export class OnChainTransactionHistoryComponent implements OnInit, OnChanges, On getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { @@ -136,7 +136,7 @@ export class OnChainTransactionHistoryComponent implements OnInit, OnChanges, On // this.listTransactions.filterPredicate = (rowData: Transaction, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -147,11 +147,11 @@ export class OnChainTransactionHistoryComponent implements OnInit, OnChanges, On // break; // case 'time_stamp': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/lnd/on-chain/utxo-tables/utxos/utxos.component.html b/src/app/lnd/on-chain/utxo-tables/utxos/utxos.component.html index 52f049de..d5309af3 100644 --- a/src/app/lnd/on-chain/utxo-tables/utxos/utxos.component.html +++ b/src/app/lnd/on-chain/utxo-tables/utxos/utxos.component.html @@ -3,7 +3,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -16,7 +16,7 @@ - +
warning diff --git a/src/app/lnd/on-chain/utxo-tables/utxos/utxos.component.ts b/src/app/lnd/on-chain/utxo-tables/utxos/utxos.component.ts index 35be6727..2958213f 100644 --- a/src/app/lnd/on-chain/utxo-tables/utxos/utxos.component.ts +++ b/src/app/lnd/on-chain/utxo-tables/utxos/utxos.component.ts @@ -38,9 +38,9 @@ export class OnChainUTXOsComponent implements OnInit, OnChanges, OnDestroy { @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; @Input() isDustUTXO = false; public faMoneyBillWave = faMoneyBillWave; - public DUST_AMOUNT = 1000; + public DUST_AMOUNT = 50000; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'on_chain'; public tableSetting: TableSetting = { tableId: 'utxos', recordsPerPage: PAGE_SIZE, sortBy: 'tx_id', sortOrder: SortOrderEnum.DESCENDING }; @@ -117,14 +117,14 @@ export class OnChainUTXOsComponent implements OnInit, OnChanges, OnDestroy { getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : column === 'is_dust' ? 'Dust' : this.commonService.titleCase(column); } setFilterPredicate() { this.listUTXOs.filterPredicate = (rowData: UTXO, fltr: string) => { let rowToFilter = ''; switch (this.selFilterBy) { - case 'All': + case 'all': for (let i = 0; i < this.displayedColumns.length - 1; i++) { rowToFilter = rowToFilter + ( (this.displayedColumns[i] === 'tx_id') ? @@ -138,6 +138,10 @@ export class OnChainUTXOsComponent implements OnInit, OnChanges, OnDestroy { } break; + case 'is_dust': + rowToFilter = (rowData?.amount_sat || 0) < this.DUST_AMOUNT ? 'dust' : 'non-dust'; + break; + case 'tx_id': rowToFilter = (rowData.outpoint && rowData.outpoint.txid_str ? rowData.outpoint.txid_str.toLowerCase() : ''); break; @@ -151,10 +155,10 @@ export class OnChainUTXOsComponent implements OnInit, OnChanges, OnDestroy { break; default: - rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); break; } - return rowToFilter.includes(fltr); + return this.selFilterBy === 'is_dust' ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); }; } diff --git a/src/app/lnd/peers-channels/channels/channels-tables/channel-active-htlcs-table/channel-active-htlcs-table.component.html b/src/app/lnd/peers-channels/channels/channels-tables/channel-active-htlcs-table/channel-active-htlcs-table.component.html index d96e85f2..f09e01e1 100644 --- a/src/app/lnd/peers-channels/channels/channels-tables/channel-active-htlcs-table/channel-active-htlcs-table.component.html +++ b/src/app/lnd/peers-channels/channels/channels-tables/channel-active-htlcs-table/channel-active-htlcs-table.component.html @@ -4,7 +4,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/lnd/peers-channels/channels/channels-tables/channel-active-htlcs-table/channel-active-htlcs-table.component.ts b/src/app/lnd/peers-channels/channels/channels-tables/channel-active-htlcs-table/channel-active-htlcs-table.component.ts index 7176c422..d468e516 100644 --- a/src/app/lnd/peers-channels/channels/channels-tables/channel-active-htlcs-table/channel-active-htlcs-table.component.ts +++ b/src/app/lnd/peers-channels/channels/channels-tables/channel-active-htlcs-table/channel-active-htlcs-table.component.ts @@ -32,7 +32,7 @@ export class ChannelActiveHTLCsTableComponent implements OnInit, AfterViewInit, @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'peers_channels'; public tableSetting: TableSetting = { tableId: 'active_HTLCs', recordsPerPage: PAGE_SIZE, sortBy: 'expiration_height', sortOrder: SortOrderEnum.DESCENDING }; @@ -127,19 +127,19 @@ export class ChannelActiveHTLCsTableComponent implements OnInit, AfterViewInit, getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.channels.filterPredicate = (channel: Channel, fltr: string) => { - const newChannel = (channel.remote_alias ? channel.remote_alias.toLowerCase() : '') + - channel.pending_htlcs?.map((htlc) => JSON.stringify(htlc) + (htlc.incoming ? 'yes' : 'no')); - return newChannel.includes(fltr); + this.channels.filterPredicate = (rowData: Channel, fltr: string) => { + const rowToFilter = (rowData.remote_alias ? rowData.remote_alias.toLowerCase() : '') + + rowData.pending_htlcs?.map((htlc) => JSON.stringify(htlc) + (htlc.incoming ? 'yes' : 'no')); + return rowToFilter.includes(fltr); }; // this.channels.filterPredicate = (rowData: Channel, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -150,11 +150,11 @@ export class ChannelActiveHTLCsTableComponent implements OnInit, AfterViewInit, // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); 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 facbcb6b..f4568de1 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 @@ -4,7 +4,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.ts b/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.ts index 6d4bf72c..a25d8410 100644 --- a/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.ts +++ b/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.ts @@ -32,7 +32,7 @@ export class ChannelClosedTableComponent implements OnInit, AfterViewInit, OnDes @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'peers_channels'; public tableSetting: TableSetting = { tableId: 'closed', recordsPerPage: PAGE_SIZE, sortBy: 'close_type', sortOrder: SortOrderEnum.DESCENDING }; @@ -101,15 +101,15 @@ export class ChannelClosedTableComponent implements OnInit, AfterViewInit, OnDes getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.closedChannels.filterPredicate = (channel: ClosedChannel, fltr: string) => JSON.stringify(channel).toLowerCase().includes(fltr); + this.closedChannels.filterPredicate = (rowData: ClosedChannel, fltr: string) => JSON.stringify(rowData).toLowerCase().includes(fltr); // this.closedChannels.filterPredicate = (rowData: ClosedChannel, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -120,11 +120,11 @@ export class ChannelClosedTableComponent implements OnInit, AfterViewInit, OnDes // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/lnd/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html b/src/app/lnd/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html index 68975c9f..bd8364e0 100644 --- a/src/app/lnd/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html +++ b/src/app/lnd/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.html @@ -4,7 +4,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/lnd/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts b/src/app/lnd/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts index bd112eb9..ab751614 100644 --- a/src/app/lnd/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts +++ b/src/app/lnd/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.ts @@ -43,7 +43,7 @@ export class ChannelOpenTableComponent implements OnInit, AfterViewInit, OnDestr @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'peers_channels'; public tableSetting: TableSetting = { tableId: 'open', recordsPerPage: PAGE_SIZE, sortBy: 'balancedness', sortOrder: SortOrderEnum.DESCENDING }; @@ -313,23 +313,23 @@ export class ChannelOpenTableComponent implements OnInit, AfterViewInit, OnDestr getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.channels.filterPredicate = (channel: Channel, fltr: string) => { - const newChannel = ((channel.active) ? 'active' : 'inactive') + (channel.chan_id ? channel.chan_id.toLowerCase() : '') + - (channel.remote_pubkey ? channel.remote_pubkey.toLowerCase() : '') + (channel.remote_alias ? channel.remote_alias.toLowerCase() : '') + - (channel.capacity ? channel.capacity : '') + (channel.local_balance ? channel.local_balance : '') + - (channel.remote_balance ? channel.remote_balance : '') + (channel.total_satoshis_sent ? channel.total_satoshis_sent : '') + - (channel.total_satoshis_received ? channel.total_satoshis_received : '') + (channel.commit_fee ? channel.commit_fee : '') + - (channel.private ? 'private' : 'public'); - return newChannel.includes(fltr); + this.channels.filterPredicate = (rowData: Channel, fltr: string) => { + const rowToFilter = ((rowData.active) ? 'active' : 'inactive') + (rowData.chan_id ? rowData.chan_id.toLowerCase() : '') + + (rowData.remote_pubkey ? rowData.remote_pubkey.toLowerCase() : '') + (rowData.remote_alias ? rowData.remote_alias.toLowerCase() : '') + + (rowData.capacity ? rowData.capacity : '') + (rowData.local_balance ? rowData.local_balance : '') + + (rowData.remote_balance ? rowData.remote_balance : '') + (rowData.total_satoshis_sent ? rowData.total_satoshis_sent : '') + + (rowData.total_satoshis_received ? rowData.total_satoshis_received : '') + (rowData.commit_fee ? rowData.commit_fee : '') + + (rowData.private ? 'private' : 'public'); + return rowToFilter.includes(fltr); }; // this.channels.filterPredicate = (rowData: Channel, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -339,15 +339,23 @@ export class ChannelOpenTableComponent implements OnInit, AfterViewInit, OnDestr // } // break; + // case 'active': + // rowToFilter = rowData?.active ? 'active' : 'inactive'; + // break; + + // case 'private': + // rowToFilter = rowData?.private ? 'private' : 'public'; + // break; + // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } - // return rowToFilter.includes(fltr); + // return this.selFilterBy === 'active' ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); // }; } diff --git a/src/app/lnd/peers-channels/peers/peers.component.html b/src/app/lnd/peers-channels/peers/peers.component.html index c512816f..6568e444 100644 --- a/src/app/lnd/peers-channels/peers/peers.component.html +++ b/src/app/lnd/peers-channels/peers/peers.component.html @@ -11,7 +11,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/lnd/peers-channels/peers/peers.component.ts b/src/app/lnd/peers-channels/peers/peers.component.ts index 74b4c166..b11b9edf 100644 --- a/src/app/lnd/peers-channels/peers/peers.component.ts +++ b/src/app/lnd/peers-channels/peers/peers.component.ts @@ -36,7 +36,7 @@ export class PeersComponent implements OnInit, AfterViewInit, OnDestroy { @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'peers_channels'; public tableSetting: TableSetting = { tableId: 'peers', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING }; @@ -182,15 +182,15 @@ export class PeersComponent implements OnInit, AfterViewInit, OnDestroy { getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.peers.filterPredicate = (peer: Peer, fltr: string) => JSON.stringify(peer).toLowerCase().includes(fltr); + this.peers.filterPredicate = (rowData: Peer, fltr: string) => JSON.stringify(rowData).toLowerCase().includes(fltr); // this.peers.filterPredicate = (rowData: Peer, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -201,11 +201,11 @@ export class PeersComponent implements OnInit, AfterViewInit, OnDestroy { // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); 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 d8c3a0d1..e28a399e 100644 --- a/src/app/lnd/routing/forwarding-history/forwarding-history.component.html +++ b/src/app/lnd/routing/forwarding-history/forwarding-history.component.html @@ -5,7 +5,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/lnd/routing/forwarding-history/forwarding-history.component.ts b/src/app/lnd/routing/forwarding-history/forwarding-history.component.ts index 65723f15..639e5be0 100644 --- a/src/app/lnd/routing/forwarding-history/forwarding-history.component.ts +++ b/src/app/lnd/routing/forwarding-history/forwarding-history.component.ts @@ -36,7 +36,7 @@ export class ForwardingHistoryComponent implements OnInit, AfterViewInit, OnChan @Input() eventsData = []; @Input() selFilter = ''; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'routing'; public tableSetting: TableSetting = { tableId: 'forwarding_history', recordsPerPage: PAGE_SIZE, sortBy: 'timestamp', sortOrder: SortOrderEnum.DESCENDING }; @@ -142,7 +142,7 @@ export class ForwardingHistoryComponent implements OnInit, AfterViewInit, OnChan getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { @@ -153,7 +153,7 @@ export class ForwardingHistoryComponent implements OnInit, AfterViewInit, OnChan // this.forwardingHistoryEvents.filterPredicate = (rowData: ForwardingEvent, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -164,11 +164,11 @@ export class ForwardingHistoryComponent implements OnInit, AfterViewInit, OnChan // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/lnd/routing/non-routing-peers/non-routing-peers.component.html b/src/app/lnd/routing/non-routing-peers/non-routing-peers.component.html index 3133f5b9..cb40b43c 100644 --- a/src/app/lnd/routing/non-routing-peers/non-routing-peers.component.html +++ b/src/app/lnd/routing/non-routing-peers/non-routing-peers.component.html @@ -6,7 +6,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/lnd/routing/non-routing-peers/non-routing-peers.component.ts b/src/app/lnd/routing/non-routing-peers/non-routing-peers.component.ts index 2bc85a1e..a425b6d4 100644 --- a/src/app/lnd/routing/non-routing-peers/non-routing-peers.component.ts +++ b/src/app/lnd/routing/non-routing-peers/non-routing-peers.component.ts @@ -31,7 +31,7 @@ export class NonRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'routing'; public tableSetting: TableSetting = { tableId: 'non_routing_peers', recordsPerPage: PAGE_SIZE, sortBy: 'remote_alias', sortOrder: SortOrderEnum.DESCENDING }; @@ -195,15 +195,15 @@ export class NonRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.nonRoutingPeers.filterPredicate = (nrchnl: Channel, fltr: string) => JSON.stringify(nrchnl).toLowerCase().includes(fltr); + this.nonRoutingPeers.filterPredicate = (rowData: Channel, fltr: string) => JSON.stringify(rowData).toLowerCase().includes(fltr); // this.peers.filterPredicate = (rowData: Peer, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -214,11 +214,11 @@ export class NonRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); 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 a322bdf3..adf444ac 100644 --- a/src/app/lnd/routing/routing-peers/routing-peers.component.html +++ b/src/app/lnd/routing/routing-peers/routing-peers.component.html @@ -7,7 +7,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} @@ -71,7 +71,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/lnd/routing/routing-peers/routing-peers.component.ts b/src/app/lnd/routing/routing-peers/routing-peers.component.ts index e941ee74..3be22246 100644 --- a/src/app/lnd/routing/routing-peers/routing-peers.component.ts +++ b/src/app/lnd/routing/routing-peers/routing-peers.component.ts @@ -32,8 +32,8 @@ export class RoutingPeersComponent implements OnInit, AfterViewInit, OnDestroy { @ViewChild('paginatorIn', { static: false }) paginatorIn: MatPaginator | undefined; @ViewChild('paginatorOut', { static: false }) paginatorOut: MatPaginator | undefined; public nodePageDefs = LND_PAGE_DEFS; - public selFilterByIn = 'All'; - public selFilterByOut = 'All'; + public selFilterByIn = 'all'; + public selFilterByOut = 'all'; public colWidth = '20rem'; public PAGE_ID = 'routing'; public tableSetting: TableSetting = { tableId: 'routing_peers', recordsPerPage: PAGE_SIZE, sortBy: 'total_amount', sortOrder: SortOrderEnum.DESCENDING }; @@ -134,16 +134,16 @@ export class RoutingPeersComponent implements OnInit, AfterViewInit, OnDestroy { getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.routingPeersIncoming.filterPredicate = (rpIn: RoutingPeers, fltr: string) => JSON.stringify(rpIn).toLowerCase().includes(fltr); - this.routingPeersOutgoing.filterPredicate = (rpOut: RoutingPeers, fltr: string) => JSON.stringify(rpOut).toLowerCase().includes(fltr); + this.routingPeersIncoming.filterPredicate = (rowDataIn: RoutingPeers, fltr: string) => JSON.stringify(rowDataIn).toLowerCase().includes(fltr); + this.routingPeersOutgoing.filterPredicate = (rowDataOut: RoutingPeers, fltr: string) => JSON.stringify(rowDataOut).toLowerCase().includes(fltr); // this.routingPeersIncoming.filterPredicate = (rowData: RoutingPeer, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -154,11 +154,11 @@ export class RoutingPeersComponent implements OnInit, AfterViewInit, OnDestroy { // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/lnd/store/lnd.effects.ts b/src/app/lnd/store/lnd.effects.ts index a98c9af8..09203476 100644 --- a/src/app/lnd/store/lnd.effects.ts +++ b/src/app/lnd/store/lnd.effects.ts @@ -1252,7 +1252,7 @@ export class LNDEffects implements OnDestroy { }; }), catchError((err: any) => { - this.handleErrorWithoutAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', err); + this.handleErrorWithAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', environment.PAGE_SETTINGS_API, err); return of({ type: RTLActions.VOID }); }) ); diff --git a/src/app/lnd/transactions/invoices/lightning-invoices.component.html b/src/app/lnd/transactions/invoices/lightning-invoices.component.html index 3395cadb..5ba9a00b 100644 --- a/src/app/lnd/transactions/invoices/lightning-invoices.component.html +++ b/src/app/lnd/transactions/invoices/lightning-invoices.component.html @@ -25,7 +25,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/lnd/transactions/invoices/lightning-invoices.component.ts b/src/app/lnd/transactions/invoices/lightning-invoices.component.ts index b08f8c4a..d0cad424 100644 --- a/src/app/lnd/transactions/invoices/lightning-invoices.component.ts +++ b/src/app/lnd/transactions/invoices/lightning-invoices.component.ts @@ -47,7 +47,7 @@ export class LightningInvoicesComponent implements OnInit, AfterViewInit, OnDest public faBurst = faBurst; public faMoneyBill1 = faMoneyBill1; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'transactions'; public tableSetting: TableSetting = { tableId: 'invoices', recordsPerPage: PAGE_SIZE, sortBy: 'creation_date', sortOrder: SortOrderEnum.DESCENDING }; @@ -179,19 +179,19 @@ export class LightningInvoicesComponent implements OnInit, AfterViewInit, OnDest getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.invoices.filterPredicate = (invoice: Invoice, fltr: string) => { - const newInvoice = (invoice.creation_date ? this.datePipe.transform(new Date(invoice.creation_date * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '')! + - (invoice.settle_date ? this.datePipe.transform(new Date(invoice.settle_date * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(invoice).toLowerCase(); - return newInvoice.includes(fltr); + this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => { + const rowToFilter = (rowData.creation_date ? this.datePipe.transform(new Date(rowData.creation_date * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '')! + + (rowData.settle_date ? this.datePipe.transform(new Date(rowData.settle_date * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(rowData).toLowerCase(); + return rowToFilter.includes(fltr); }; // this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -202,11 +202,11 @@ export class LightningInvoicesComponent implements OnInit, AfterViewInit, OnDest // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/lnd/transactions/payments/lightning-payments.component.html b/src/app/lnd/transactions/payments/lightning-payments.component.html index 023d7a30..f225a06e 100644 --- a/src/app/lnd/transactions/payments/lightning-payments.component.html +++ b/src/app/lnd/transactions/payments/lightning-payments.component.html @@ -22,7 +22,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/lnd/transactions/payments/lightning-payments.component.ts b/src/app/lnd/transactions/payments/lightning-payments.component.ts index 1091e47b..3db5531b 100644 --- a/src/app/lnd/transactions/payments/lightning-payments.component.ts +++ b/src/app/lnd/transactions/payments/lightning-payments.component.ts @@ -42,7 +42,7 @@ export class LightningPaymentsComponent implements OnInit, AfterViewInit, OnDest @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public faHistory = faHistory; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'transactions'; public tableSetting: TableSetting = { tableId: 'payments', recordsPerPage: PAGE_SIZE, sortBy: 'creation_date', sortOrder: SortOrderEnum.DESCENDING }; @@ -436,18 +436,18 @@ export class LightningPaymentsComponent implements OnInit, AfterViewInit, OnDest getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.payments.filterPredicate = (payment: Payment, fltr: string) => { - const newPayment = ((payment.creation_date) ? this.datePipe.transform(new Date(payment.creation_date * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(payment).toLowerCase(); - return newPayment.includes(fltr); + this.payments.filterPredicate = (rowData: Payment, fltr: string) => { + const rowToFilter = ((rowData.creation_date) ? this.datePipe.transform(new Date(rowData.creation_date * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(rowData).toLowerCase(); + return rowToFilter.includes(fltr); }; // this.channels.filterPredicate = (rowData: Channel, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -457,12 +457,16 @@ export class LightningPaymentsComponent implements OnInit, AfterViewInit, OnDest // } // break; + // case 'status': + // rowToFilter = rowData?.status === 'SUCCEEDED' ? 'succeeded' : 'failed'; + // break; + // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); 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 d0a32717..e041d857 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 @@ -7,7 +7,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/shared/components/ln-services/boltz/swaps/swaps.component.ts b/src/app/shared/components/ln-services/boltz/swaps/swaps.component.ts index e570fbc4..ae2a0951 100755 --- a/src/app/shared/components/ln-services/boltz/swaps/swaps.component.ts +++ b/src/app/shared/components/ln-services/boltz/swaps/swaps.component.ts @@ -37,7 +37,7 @@ export class BoltzSwapsComponent implements OnInit, AfterViewInit, OnChanges, On @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'boltz'; public tableSettingSwapOut: TableSetting = { tableId: 'swap_out', recordsPerPage: PAGE_SIZE, sortBy: 'status', sortOrder: SortOrderEnum.DESCENDING }; @@ -117,15 +117,15 @@ export class BoltzSwapsComponent implements OnInit, AfterViewInit, OnChanges, On getLabel(column: string) { const tableId = (this.selectedSwapType === SwapTypeEnum.SWAP_IN) ? this.tableSettingSwapIn.tableId : this.tableSettingSwapOut.tableId; const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.listSwaps.filterPredicate = (swap: Swap, fltr: string) => JSON.stringify(swap).toLowerCase().includes(fltr); + this.listSwaps.filterPredicate = (rowData: Swap, fltr: string) => JSON.stringify(rowData).toLowerCase().includes(fltr); // this.listSwaps.filterPredicate = (rowData: Swap, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -136,11 +136,11 @@ export class BoltzSwapsComponent implements OnInit, AfterViewInit, OnChanges, On // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); 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 ac8b9bf7..2e65b3ef 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 @@ -7,7 +7,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/shared/components/ln-services/loop/swaps/swaps.component.ts b/src/app/shared/components/ln-services/loop/swaps/swaps.component.ts index 8306851d..2ce5901e 100755 --- a/src/app/shared/components/ln-services/loop/swaps/swaps.component.ts +++ b/src/app/shared/components/ln-services/loop/swaps/swaps.component.ts @@ -37,7 +37,7 @@ export class SwapsComponent implements OnInit, AfterViewInit, OnChanges, OnDestr @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public colWidth = '20rem'; public PAGE_ID = 'loop'; public tableSetting: TableSetting = { tableId: 'loop', recordsPerPage: PAGE_SIZE, sortBy: 'initiation_time', sortOrder: SortOrderEnum.DESCENDING }; @@ -93,15 +93,15 @@ export class SwapsComponent implements OnInit, AfterViewInit, OnChanges, OnDestr getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { - this.listSwaps.filterPredicate = (swap: LoopSwapStatus, fltr: string) => JSON.stringify(swap).toLowerCase().includes(fltr); + this.listSwaps.filterPredicate = (rowData: LoopSwapStatus, fltr: string) => JSON.stringify(rowData).toLowerCase().includes(fltr); // this.listSwaps.filterPredicate = (rowData: LoopSwapStatus, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -112,11 +112,11 @@ export class SwapsComponent implements OnInit, AfterViewInit, OnChanges, OnDestr // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); 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 1a51f0b2..9a88c4b7 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 @@ -5,7 +5,7 @@
- {{getLabel(column)}} + {{getLabel(column)}} diff --git a/src/app/shared/components/transactions-report-table/transactions-report-table.component.ts b/src/app/shared/components/transactions-report-table/transactions-report-table.component.ts index 075aa259..84336401 100644 --- a/src/app/shared/components/transactions-report-table/transactions-report-table.component.ts +++ b/src/app/shared/components/transactions-report-table/transactions-report-table.component.ts @@ -33,7 +33,7 @@ export class TransactionsReportTableComponent implements OnInit, AfterViewInit, @ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; public nodePageDefs: any = LND_PAGE_DEFS; - public selFilterBy = 'All'; + public selFilterBy = 'all'; public timezoneOffset = new Date(Date.now()).getTimezoneOffset() * 60; public scrollRanges = SCROLL_RANGES; public transactions: any = new MatTableDataSource([]); @@ -99,7 +99,7 @@ export class TransactionsReportTableComponent implements OnInit, AfterViewInit, getLabel(column: string) { const returnColumn: ColumnDefinition = this.nodePageDefs['reports'][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column); - return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : 'All'; + return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column); } setFilterPredicate() { @@ -110,7 +110,7 @@ export class TransactionsReportTableComponent implements OnInit, AfterViewInit, // this.transactions.filterPredicate = (rowData: LoopSwapStatus, fltr: string) => { // let rowToFilter = ''; // switch (this.selFilterBy) { - // case 'All': + // case 'all': // for (let i = 0; i < this.displayedColumns.length - 1; i++) { // rowToFilter = rowToFilter + ( // (this.displayedColumns[i] === '') ? @@ -121,11 +121,11 @@ export class TransactionsReportTableComponent implements OnInit, AfterViewInit, // break; // case '': - // rowToFilter = (rowData ? rowData..toLowerCase() : ''); + // rowToFilter = rowData?..toLowerCase() || ''; // break; // default: - // rowToFilter = (rowData[this.selFilterBy] ? rowData[this.selFilterBy].toLowerCase() : ''); + // rowToFilter = typeof rowData[this.selFilterBy] === 'string' ? rowData[this.selFilterBy].toLowerCase() : typeof rowData[this.selFilterBy] === 'boolean' ? (rowData[this.selFilterBy] ? 'yes' : 'no') : rowData[this.selFilterBy].toString(); // break; // } // return rowToFilter.includes(fltr); diff --git a/src/app/shared/models/clnModels.ts b/src/app/shared/models/clnModels.ts index 041deaf1..261cd1c4 100644 --- a/src/app/shared/models/clnModels.ts +++ b/src/app/shared/models/clnModels.ts @@ -395,8 +395,9 @@ export interface UTXO { value?: number; status?: string; blockheight?: string; + scriptpubkey?: string; address?: string; - amount_msat?: string; + reserved?: boolean; } export interface RoutingPeer {