|
|
|
@ -41,7 +41,7 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
|
|
|
|
|
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
|
|
|
|
|
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
|
|
|
|
|
public PAGE_ID = 'payments';
|
|
|
|
|
public tableSetting: TableSetting = { tableId: 'payments' };
|
|
|
|
|
public tableSetting: TableSetting = { tableId: 'payments', recordsPerPage: PAGE_SIZE, sortBy: 'created_at', sortOrder: SortOrderEnum.DESCENDING };
|
|
|
|
|
public faHistory = faHistory;
|
|
|
|
|
public newlyAddedPayment = '';
|
|
|
|
|
public selNode: SelNodeChild | null = {};
|
|
|
|
@ -58,7 +58,6 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
|
|
|
|
|
public screenSize = '';
|
|
|
|
|
public screenSizeEnum = ScreenSizeEnum;
|
|
|
|
|
public errorMessage = '';
|
|
|
|
|
public pageSettings: PageSettingsCLN[] = [];
|
|
|
|
|
public selFilter = '';
|
|
|
|
|
public apiCallStatus: ApiCallStatusPayload | null = null;
|
|
|
|
|
public apiCallStatusEnum = APICallStatusEnum;
|
|
|
|
@ -82,8 +81,7 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
|
|
|
|
|
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
|
|
|
|
this.errorMessage = this.apiCallStatus.message || '';
|
|
|
|
|
}
|
|
|
|
|
this.pageSettings = settings.pageSettings;
|
|
|
|
|
this.tableSetting = this.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || CLN_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
|
|
|
|
|
this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || CLN_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
|
|
|
|
|
if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
|
|
|
|
|
this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.showColumnsSM));
|
|
|
|
|
} else {
|
|
|
|
@ -299,9 +297,9 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
|
|
|
|
|
|
|
|
|
|
loadPaymentsTable(payments: Payment[]) {
|
|
|
|
|
this.payments = (payments) ? new MatTableDataSource<Payment>([...payments]) : new MatTableDataSource([]);
|
|
|
|
|
this.payments.sort = this.sort;
|
|
|
|
|
this.payments.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
|
|
|
|
|
this.payments.sort.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: false });
|
|
|
|
|
this.payments.sort = this.sort;
|
|
|
|
|
this.payments.sort.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
|
|
|
|
|
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);
|
|
|
|
|