From d350f1c0f98d5a97e6c39de59e38712388eafda9 Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Mon, 17 Oct 2022 09:33:45 -0700 Subject: [PATCH] CLN Payments tiny adjustments CLN Payments tiny adjustments --- .../payments/lightning-payments.component.scss | 6 +++--- .../payments/lightning-payments.component.ts | 10 ++++------ .../page-settings/page-settings.component.html | 2 +- src/app/shared/services/consts-enums-functions.ts | 8 ++++---- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/app/cln/transactions/payments/lightning-payments.component.scss b/src/app/cln/transactions/payments/lightning-payments.component.scss index 9c7cd9e5..4369ddc7 100644 --- a/src/app/cln/transactions/payments/lightning-payments.component.scss +++ b/src/app/cln/transactions/payments/lightning-payments.component.scss @@ -12,15 +12,15 @@ @include for_screensize(tab-port) { width:0.6rem; height: 0.6rem; - left: 0; - margin-top: 0; + left: 4rem; + margin-top: -0.4rem; position: absolute; } @include for_screensize(phone) { width:0.6rem; height: 0.6rem; left: 0; - margin-top: 0; + margin-top: -0.2rem; position: absolute; } } diff --git a/src/app/cln/transactions/payments/lightning-payments.component.ts b/src/app/cln/transactions/payments/lightning-payments.component.ts index a7d4c675..d7d1ea66 100644 --- a/src/app/cln/transactions/payments/lightning-payments.component.ts +++ b/src/app/cln/transactions/payments/lightning-payments.component.ts @@ -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([...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); diff --git a/src/app/shared/components/node-config/page-settings/page-settings.component.html b/src/app/shared/components/node-config/page-settings/page-settings.component.html index 2e00daa1..e2fe36eb 100644 --- a/src/app/shared/components/node-config/page-settings/page-settings.component.html +++ b/src/app/shared/components/node-config/page-settings/page-settings.component.html @@ -28,7 +28,7 @@ - {{so}} + {{so === 'desc' ? 'Descending' : 'Ascending'}} diff --git a/src/app/shared/services/consts-enums-functions.ts b/src/app/shared/services/consts-enums-functions.ts index 0f7fb256..22c34a7b 100644 --- a/src/app/shared/services/consts-enums-functions.ts +++ b/src/app/shared/services/consts-enums-functions.ts @@ -675,10 +675,10 @@ export enum SortOrderEnum { export const SORT_ORDERS = ['asc', 'desc']; export const CLN_DEFAULT_PAGE_SETTINGS: PageSettingsCLN[] = [ - { pageId: 'payments', tables: [{ tableId: 'payments', recordsPerPage: 10, sortBy: 'created_at', sortOrder: SortOrderEnum.DESCENDING, + { pageId: 'payments', tables: [{ tableId: 'payments', recordsPerPage: PAGE_SIZE, sortBy: 'created_at', sortOrder: SortOrderEnum.DESCENDING, showColumnsSM: ['created_at', 'msatoshi'], showColumns: ['created_at', 'type', 'payment_hash', 'msatoshi_sent', 'msatoshi'] }] }, - { pageId: 'invoices', tables: [{ tableId: 'invoices', recordsPerPage: 10, sortBy: 'expires_at', sortOrder: SortOrderEnum.DESCENDING, + { pageId: 'invoices', tables: [{ tableId: 'invoices', recordsPerPage: PAGE_SIZE, sortBy: 'expires_at', sortOrder: SortOrderEnum.DESCENDING, showColumnsSM: ['expires_at', 'msatoshi'], showColumns: ['expires_at', 'paid_at', 'type', 'description', 'msatoshi', 'msatoshi_received'] }] } ]; @@ -686,10 +686,10 @@ export const CLN_DEFAULT_PAGE_SETTINGS: PageSettingsCLN[] = [ export const CLN_TABLES_DEF = { payments: { maxColumns: 5, - allowedColumns: ['created_at', 'type', 'payment_hash', 'msatoshi_sent', 'msatoshi', 'bolt11', 'destination', 'memo', 'label'] + allowedColumns: ['created_at', 'type', 'payment_hash', 'bolt11', 'destination', 'memo', 'label', 'msatoshi_sent', 'msatoshi'] }, invoices: { maxColumns: 6, - allowedColumns: ['expires_at', 'paid_at', 'type', 'description', 'msatoshi', 'msatoshi_received', 'label', 'payment_hash', 'status'] + allowedColumns: ['expires_at', 'paid_at', 'type', 'description', 'label', 'payment_hash', 'bolt11', 'msatoshi', 'msatoshi_received'] } };