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 2857c1eb..c49660ac 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 @@ -150,7 +150,7 @@ export class OnChainUTXOsComponent implements OnInit, OnChanges, OnDestroy { 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 === 'is_dust' ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); + return (this.selFilterBy === 'is_dust' || this.selFilterBy === 'address_type') ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); }; } 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 212fa4aa..0a826ac8 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 @@ -125,7 +125,7 @@ export class ChannelClosedTableComponent implements OnInit, AfterViewInit, OnDes 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 === 'close_type' ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); }; } diff --git a/src/app/lnd/transactions/payments/lightning-payments.component.ts b/src/app/lnd/transactions/payments/lightning-payments.component.ts index 9587704a..3c008edd 100644 --- a/src/app/lnd/transactions/payments/lightning-payments.component.ts +++ b/src/app/lnd/transactions/payments/lightning-payments.component.ts @@ -448,6 +448,7 @@ export class LightningPaymentsComponent implements OnInit, AfterViewInit, OnDest break; case 'status': + case 'group_status': rowToFilter = rowData?.status === 'SUCCEEDED' ? 'succeeded' : 'failed'; break; @@ -456,6 +457,7 @@ export class LightningPaymentsComponent implements OnInit, AfterViewInit, OnDest break; case 'failure_reason': + case 'group_failure_reason': rowToFilter = this.camelCaseWithReplace.transform((rowData.failure_reason || ''), 'failure_reason', '_'); break; 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 ae2a0951..73f4ec56 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 @@ -121,30 +121,23 @@ export class BoltzSwapsComponent implements OnInit, AfterViewInit, OnChanges, On } setFilterPredicate() { - 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': - // 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?..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); - // }; + this.listSwaps.filterPredicate = (rowData: Swap, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = JSON.stringify(rowData).toLowerCase(); + break; + + case 'status': + rowToFilter = rowData?.status ? this.swapStateEnum[rowData?.status] : ''; + 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' ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); + }; } onSwapClick(selSwap: Swap | ReverseSwap, event: any) { 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 2ce5901e..980344f9 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 @@ -19,6 +19,7 @@ import { ColumnDefinition, PageSettings, TableSetting } from '../../../../models import { lndPageSettings } from '../../../../../lnd/store/lnd.selector'; import { ApiCallStatusPayload } from '../../../../models/apiCallsPayload'; import { CamelCaseWithReplacePipe } from '../../../../pipes/app.pipe'; +import { DatePipe } from '@angular/common'; @Component({ selector: 'rtl-swaps', @@ -53,7 +54,7 @@ export class SwapsComponent implements OnInit, AfterViewInit, OnChanges, OnDestr public screenSizeEnum = ScreenSizeEnum; private unSubs: Array> = [new Subject(), new Subject(), new Subject()]; - constructor(private logger: LoggerService, private commonService: CommonService, private store: Store, private loopService: LoopService, private camelCaseWithReplace: CamelCaseWithReplacePipe) { + constructor(private logger: LoggerService, private commonService: CommonService, private store: Store, private loopService: LoopService, private datePipe: DatePipe, private camelCaseWithReplace: CamelCaseWithReplacePipe) { this.screenSize = this.commonService.getScreenSize(); } @@ -97,30 +98,28 @@ export class SwapsComponent implements OnInit, AfterViewInit, OnChanges, OnDestr } setFilterPredicate() { - 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': - // 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?..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); - // }; + this.listSwaps.filterPredicate = (rowData: LoopSwapStatus, fltr: string) => { + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = JSON.stringify(rowData).toLowerCase(); + break; + + case 'state': + rowToFilter = rowData?.state ? this.LoopStateEnum[rowData?.state] : ''; + break; + + case 'initiation_time': + case 'last_update_time': + rowToFilter = this.datePipe.transform(new Date((rowData[this.selFilterBy] || 0) / 1000000), 'dd/MMM/YYYY HH:mm')?.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 this.selFilterBy === 'state' ? rowToFilter.indexOf(fltr) === 0 : rowToFilter.includes(fltr); + }; } onSwapClick(selSwap: LoopSwapStatus, event: any) { 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 84336401..2adf8107 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 @@ -104,32 +104,22 @@ export class TransactionsReportTableComponent implements OnInit, AfterViewInit, setFilterPredicate() { this.transactions.filterPredicate = (rowData: any, fltr: string) => { - const newRowData = ((rowData.date) ? (this.datePipe.transform(rowData.date, 'dd/MMM') + '/' + rowData.date.getFullYear()).toLowerCase() : '') + JSON.stringify(rowData).toLowerCase(); - return newRowData.includes(fltr); + let rowToFilter = ''; + switch (this.selFilterBy) { + case 'all': + rowToFilter = ((rowData.date) ? (this.datePipe.transform(rowData.date, 'dd/MMM') + '/' + rowData.date.getFullYear()).toLowerCase() : '') + JSON.stringify(rowData).toLowerCase(); + break; + + case 'date': + rowToFilter = this.datePipe.transform(new Date(rowData[this.selFilterBy] || 0), this.dataRange === this.scrollRanges[1] ? 'MMM/yyyy' : 'dd/MMM/yyyy')?.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); }; - // this.transactions.filterPredicate = (rowData: LoopSwapStatus, 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?..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); - // }; } loadTransactionsTable(trans: any[]) {