Balance Score |
diff --git a/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.scss b/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.scss
index 0a4bdf06..f8c972b5 100644
--- a/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.scss
+++ b/src/app/eclair/peers-channels/channels/channels-tables/channel-inactive-table/channel-inactive-table.component.scss
@@ -1,14 +1,10 @@
@import "../../../../../shared/theme/styles/mixins.scss";
-.mat-column-state {
- flex: 0 0 15%;
- width: 15%;
- & .ellipsis-parent {
- display: flex;
- }
+.mat-column-announceChannel {
+ width: 2rem;
}
-.mat-column-alias {
+.mat-column-alias, .mat-column-channelId, .mat-column-nodeId {
flex: 0 0 15%;
width: 15%;
& .ellipsis-parent {
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 0df1b042..75b8a37c 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
@@ -8,7 +8,7 @@ import { MatTableDataSource } from '@angular/material/table';
import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
import { Channel, ChannelsStatus, GetInfo, LightningBalance, OnChainBalance, Peer } from '../../../../../shared/models/eclModels';
-import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, AlertTypeEnum, APICallStatusEnum } from '../../../../../shared/services/consts-enums-functions';
+import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, AlertTypeEnum, APICallStatusEnum, SortOrderEnum, ECL_DEFAULT_PAGE_SETTINGS } from '../../../../../shared/services/consts-enums-functions';
import { LoggerService } from '../../../../../shared/services/logger.service';
import { CommonService } from '../../../../../shared/services/common.service';
@@ -18,7 +18,8 @@ import { ApiCallStatusPayload } from '../../../../../shared/models/apiCallsPaylo
import { openAlert, openConfirmation } from '../../../../../store/rtl.actions';
import { RTLState } from '../../../../../store/rtl.state';
import { closeChannel } from '../../../../store/ecl.actions';
-import { allChannelsInfo, eclNodeInformation, onchainBalance, peers } from '../../../../store/ecl.selector';
+import { allChannelsInfo, eclNodeInformation, eclPageSettings, onchainBalance, peers } from '../../../../store/ecl.selector';
+import { PageSettings, TableSetting } from '../../../../../shared/models/pageSettings';
@Component({
selector: 'rtl-ecl-channel-inactive-table',
@@ -34,6 +35,8 @@ export class ECLChannelInactiveTableComponent implements OnInit, AfterViewInit,
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
public faEye = faEye;
public faEyeSlash = faEyeSlash;
+ public PAGE_ID = 'peers_channels';
+ public tableSetting: TableSetting = { tableId: 'inactive_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING };
public inactiveChannels: Channel[];
public totalBalance = 0;
public displayedColumns: any[] = [];
@@ -50,23 +53,32 @@ export class ECLChannelInactiveTableComponent implements OnInit, AfterViewInit,
public errorMessage = '';
public apiCallStatus: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
- private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
+ private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store, private rtlEffects: RTLEffects, private commonService: CommonService) {
this.screenSize = this.commonService.getScreenSize();
- if (this.screenSize === ScreenSizeEnum.XS) {
- this.displayedColumns = ['state', 'alias', 'toLocal', 'toRemote', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.SM) {
- this.displayedColumns = ['state', 'alias', 'toLocal', 'toRemote', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.MD) {
- this.displayedColumns = ['state', 'shortChannelId', 'alias', 'toLocal', 'toRemote', 'actions'];
- } else {
- this.displayedColumns = ['state', 'shortChannelId', 'alias', 'toLocal', 'toRemote', 'balancedness', 'actions'];
- }
}
ngOnInit() {
- this.store.select(allChannelsInfo).pipe(takeUntil(this.unSubs[0])).
+ this.store.select(eclPageSettings).pipe(takeUntil(this.unSubs[0])).
+ subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
+ this.errorMessage = '';
+ this.apiCallStatus = settings.apiCallStatus;
+ if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
+ this.errorMessage = this.apiCallStatus.message || '';
+ }
+ this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || ECL_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
+ if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelectionSM));
+ } else {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelection));
+ }
+ this.displayedColumns.unshift('announceChannel');
+ this.displayedColumns.push('actions');
+ this.pageSize = this.tableSetting.recordsPerPage ? +this.tableSetting.recordsPerPage : PAGE_SIZE;
+ this.logger.info(this.displayedColumns);
+ });
+ this.store.select(allChannelsInfo).pipe(takeUntil(this.unSubs[1])).
subscribe((allChannelsSelector: ({ activeChannels: Channel[], pendingChannels: Channel[], inactiveChannels: Channel[], lightningBalance: LightningBalance, channelsStatus: ChannelsStatus, apiCallStatus: ApiCallStatusPayload })) => {
this.errorMessage = '';
this.apiCallStatus = allChannelsSelector.apiCallStatus;
@@ -77,15 +89,15 @@ export class ECLChannelInactiveTableComponent implements OnInit, AfterViewInit,
this.loadChannelsTable();
this.logger.info(allChannelsSelector);
});
- this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[1])).
+ this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[2])).
subscribe((nodeInfo: GetInfo) => {
this.information = nodeInfo;
});
- this.store.select(peers).pipe(takeUntil(this.unSubs[2])).
+ this.store.select(peers).pipe(takeUntil(this.unSubs[3])).
subscribe((peersSelector: { peers: Peer[], apiCallStatus: ApiCallStatusPayload }) => {
this.numPeers = (peersSelector.peers && peersSelector.peers.length) ? peersSelector.peers.length : 0;
});
- this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[3])).
+ this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[4])).
subscribe((ocBalSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.totalBalance = ocBalSelector.onchainBalance.total || 0;
});
@@ -115,7 +127,7 @@ export class ECLChannelInactiveTableComponent implements OnInit, AfterViewInit,
}
}));
this.rtlEffects.closeConfirm.
- pipe(takeUntil(this.unSubs[4])).
+ pipe(takeUntil(this.unSubs[5])).
subscribe((confirmRes) => {
if (confirmRes) {
this.store.dispatch(closeChannel({ payload: { channelId: channelToClose.channelId || '', force: forceClose } }));
@@ -140,10 +152,10 @@ export class ECLChannelInactiveTableComponent implements OnInit, AfterViewInit,
}
loadChannelsTable() {
- this.inactiveChannels.sort((a, b) => ((a.alias === b.alias) ? 0 : ((b.alias) ? 1 : -1)));
this.channels = new MatTableDataSource([...this.inactiveChannels]);
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.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
this.channels.filterPredicate = (channel: Channel, fltr: string) => JSON.stringify(channel).toLowerCase().includes(fltr);
this.channels.paginator = this.paginator;
this.applyFilter();
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 7b149c37..82d463b0 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
@@ -8,13 +8,22 @@
+
+ |
+
+
+
+ |
+
Short Channel ID |
+ {{channel?.shortChannelId}} |
+
+
+ Channel Id |
-
-
- {{channel?.shortChannelId}}
+ {{channel?.channelId}}
|
@@ -22,10 +31,26 @@
Alias |
- {{channel.alias}}
+ {{channel?.alias}}
|
+
+ Node Id |
+
+
+ {{channel?.nodeId}}
+
+ |
+
+
+ Funder |
+ {{channel?.isFunder ? 'Yes' : 'No'}} |
+
+
+ Buried |
+ {{channel?.buried ? 'Yes' : 'No'}} |
+
Base Fee (mSats) |
@@ -46,13 +71,23 @@
|
{{channel?.toRemote | number:'1.0-0'}} |
+
+ Local Fee/KW |
+
+ {{channel?.feeRatePerKwLocal | number:'1.0-0'}} |
+
+
+ Remote Fee/KW |
+
+ {{channel?.feeRatePerKwRemote | number:'1.0-0'}} |
+
Balance Score |
{{channel?.balancedness || 0 | number}}
-
+
|
@@ -79,7 +114,7 @@
- No peers connected. Add a peer in order to open a channel.
+ No peers connected. Add a peer in order to open a channel?.
0 && (!channels?.data || channels?.data?.length<1) && apiCallStatus.status === apiCallStatusEnum.COMPLETED">No channel available.
Getting channels...
{{errorMessage}}
diff --git a/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.scss b/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.scss
index 3be0e417..6303fc00 100644
--- a/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.scss
+++ b/src/app/eclair/peers-channels/channels/channels-tables/channel-open-table/channel-open-table.component.scss
@@ -1,15 +1,10 @@
@import "../../../../../shared/theme/styles/mixins.scss";
-.mat-column-shortChannelId {
- flex: 0 0 15%;
- width: 15%;
- & .ellipsis-parent {
- display: flex;
- }
+.mat-column-announceChannel {
+ width: 2rem;
}
-.mat-column-alias {
- padding-left: 1rem;
+.mat-column-alias, .mat-column-channelId, .mat-column-nodeId {
flex: 0 0 15%;
width: 15%;
& .ellipsis-parent {
@@ -17,12 +12,6 @@
}
}
-.mat-column-balancedness {
- padding-left: 2rem;
- flex: 0 0 17%;
- width: 17%;
-}
-
.mat-column-state, .mat-column-feeBaseMsat, .mat-column-feeProportionalMillionths, .mat-column-toLocal, .mat-column-toRemote {
flex: 1 1 10%;
width: 10%;
@@ -39,6 +28,12 @@
}
}
+.mat-column-balancedness {
+ padding-left: 2rem;
+ flex: 0 0 17%;
+ width: 17%;
+}
+
.mat-column-actions {
min-height: 4.8rem;
}
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 7c0f3855..71e020cc 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
@@ -9,7 +9,7 @@ import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Channel, ChannelsStatus, GetInfo, LightningBalance, OnChainBalance, Peer } from '../../../../../shared/models/eclModels';
-import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, AlertTypeEnum, APICallStatusEnum } from '../../../../../shared/services/consts-enums-functions';
+import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, AlertTypeEnum, APICallStatusEnum, SortOrderEnum, ECL_DEFAULT_PAGE_SETTINGS } from '../../../../../shared/services/consts-enums-functions';
import { LoggerService } from '../../../../../shared/services/logger.service';
import { CommonService } from '../../../../../shared/services/common.service';
@@ -19,7 +19,8 @@ import { ApiCallStatusPayload } from '../../../../../shared/models/apiCallsPaylo
import { openAlert, openConfirmation } from '../../../../../store/rtl.actions';
import { RTLState } from '../../../../../store/rtl.state';
import { closeChannel, updateChannel } from '../../../../store/ecl.actions';
-import { allChannelsInfo, eclNodeInformation, onchainBalance, peers } from '../../../../store/ecl.selector';
+import { allChannelsInfo, eclNodeInformation, eclPageSettings, onchainBalance, peers } from '../../../../store/ecl.selector';
+import { PageSettings, TableSetting } from '../../../../../shared/models/pageSettings';
@Component({
selector: 'rtl-ecl-channel-open-table',
@@ -35,6 +36,8 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
public faEye = faEye;
public faEyeSlash = faEyeSlash;
+ public PAGE_ID = 'peers_channels';
+ public tableSetting: TableSetting = { tableId: 'open_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING };
public activeChannels: Channel[];
public totalBalance = 0;
public displayedColumns: any[] = [];
@@ -51,24 +54,33 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
public errorMessage = '';
public apiCallStatus: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
- private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
+ private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store, private rtlEffects: RTLEffects, private commonService: CommonService, private router: Router) {
this.screenSize = this.commonService.getScreenSize();
- if (this.screenSize === ScreenSizeEnum.XS) {
- this.displayedColumns = ['alias', 'toLocal', 'toRemote', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.SM) {
- this.displayedColumns = ['shortChannelId', 'alias', 'toLocal', 'toRemote', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.MD) {
- this.displayedColumns = ['shortChannelId', 'alias', 'feeBaseMsat', 'feeProportionalMillionths', 'toLocal', 'toRemote', 'actions'];
- } else {
- this.displayedColumns = ['shortChannelId', 'alias', 'feeBaseMsat', 'feeProportionalMillionths', 'toLocal', 'toRemote', 'balancedness', 'actions'];
- }
this.selFilter = this.router.getCurrentNavigation()?.extras?.state?.filter ? this.router.getCurrentNavigation()?.extras?.state?.filter : '';
}
ngOnInit() {
- this.store.select(allChannelsInfo).pipe(takeUntil(this.unSubs[0])).
+ this.store.select(eclPageSettings).pipe(takeUntil(this.unSubs[0])).
+ subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
+ this.errorMessage = '';
+ this.apiCallStatus = settings.apiCallStatus;
+ if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
+ this.errorMessage = this.apiCallStatus.message || '';
+ }
+ this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || ECL_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
+ if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelectionSM));
+ } else {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelection));
+ }
+ this.displayedColumns.unshift('announceChannel');
+ this.displayedColumns.push('actions');
+ this.pageSize = this.tableSetting.recordsPerPage ? +this.tableSetting.recordsPerPage : PAGE_SIZE;
+ this.logger.info(this.displayedColumns);
+ });
+ this.store.select(allChannelsInfo).pipe(takeUntil(this.unSubs[1])).
subscribe((allChannelsSelector: ({ activeChannels: Channel[], pendingChannels: Channel[], inactiveChannels: Channel[], lightningBalance: LightningBalance, channelsStatus: ChannelsStatus, apiCallStatus: ApiCallStatusPayload })) => {
this.errorMessage = '';
this.apiCallStatus = allChannelsSelector.apiCallStatus;
@@ -81,15 +93,15 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
}
this.logger.info(allChannelsSelector);
});
- this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[1])).
+ this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[2])).
subscribe((nodeInfo: any) => {
this.information = nodeInfo;
});
- this.store.select(peers).pipe(takeUntil(this.unSubs[2])).
+ this.store.select(peers).pipe(takeUntil(this.unSubs[3])).
subscribe((peersSelector: { peers: Peer[], apiCallStatus: ApiCallStatusPayload }) => {
this.numPeers = (peersSelector.peers && peersSelector.peers.length) ? peersSelector.peers.length : 0;
});
- this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[3])).
+ this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[4])).
subscribe((ocBalSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.totalBalance = ocBalSelector.onchainBalance.total || 0;
});
@@ -126,7 +138,7 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
}
}));
this.rtlEffects.closeConfirm.
- pipe(takeUntil(this.unSubs[4])).
+ pipe(takeUntil(this.unSubs[5])).
subscribe((confirmRes) => {
if (confirmRes) {
const base_fee = confirmRes[0].inputValue;
@@ -183,7 +195,7 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
}
}));
this.rtlEffects.closeConfirm.
- pipe(takeUntil(this.unSubs[5])).
+ pipe(takeUntil(this.unSubs[6])).
subscribe((confirmRes) => {
if (confirmRes) {
this.store.dispatch(closeChannel({ payload: { channelId: channelToClose.channelId, force: forceClose } }));
@@ -208,10 +220,10 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
}
loadChannelsTable() {
- this.activeChannels.sort((a, b) => ((a.alias === b.alias) ? 0 : ((b.alias) ? 1 : -1)));
this.channels = new MatTableDataSource([...this.activeChannels]);
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.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
this.channels.filterPredicate = (channel: Channel, fltr: string) => JSON.stringify(channel).toLowerCase().includes(fltr);
this.channels.paginator = this.paginator;
this.applyFilter();
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 8287c19b..7b146391 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
@@ -12,10 +12,38 @@
State |
{{channel?.state | titlecase}} |
+
+ Short Channel ID |
+ {{channel?.shortChannelId}} |
+
+
+ Channel Id |
+
+
+ {{channel?.channelId}}
+
+ |
+
Alias |
{{channel?.alias}} |
+
+ Node Id |
+
+
+ {{channel?.nodeId}}
+
+ |
+
+
+ Funder |
+ {{channel?.isFunder ? 'Yes' : 'No'}} |
+
+
+ Buried |
+ {{channel?.buried ? 'Yes' : 'No'}} |
+
Local Balance (Sats) |
@@ -26,6 +54,16 @@
|
{{channel?.toRemote | number:'1.0-0'}} |
+
+ Local Fee/KW |
+
+ {{channel?.feeRatePerKwLocal | number:'1.0-0'}} |
+
+
+ Remote Fee/KW |
+
+ {{channel?.feeRatePerKwRemote | number:'1.0-0'}} |
+
diff --git a/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.scss b/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.scss
index 0ad983c7..95a009fe 100644
--- a/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.scss
+++ b/src/app/eclair/peers-channels/channels/channels-tables/channel-pending-table/channel-pending-table.component.scss
@@ -1,3 +1,11 @@
+.mat-column-alias, .mat-column-channelId, .mat-column-nodeId {
+ flex: 0 0 15%;
+ width: 15%;
+ & .ellipsis-parent {
+ display: flex;
+ }
+}
+
.mat-column-actions {
min-height: 4.8rem;
}
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 806b1950..80154b0b 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
@@ -8,7 +8,7 @@ import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Channel, ChannelsStatus, GetInfo, LightningBalance, OnChainBalance, Peer } from '../../../../../shared/models/eclModels';
-import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, APICallStatusEnum } from '../../../../../shared/services/consts-enums-functions';
+import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, APICallStatusEnum, SortOrderEnum, ECL_DEFAULT_PAGE_SETTINGS } from '../../../../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../../../../shared/models/apiCallsPayload';
import { ECLChannelInformationComponent } from '../../channel-information-modal/channel-information.component';
import { LoggerService } from '../../../../../shared/services/logger.service';
@@ -16,7 +16,8 @@ import { CommonService } from '../../../../../shared/services/common.service';
import { openAlert } from '../../../../../store/rtl.actions';
import { RTLState } from '../../../../../store/rtl.state';
-import { allChannelsInfo, eclNodeInformation, onchainBalance, peers } from '../../../../store/ecl.selector';
+import { allChannelsInfo, eclNodeInformation, eclPageSettings, onchainBalance, peers } from '../../../../store/ecl.selector';
+import { PageSettings, TableSetting } from '../../../../../shared/models/pageSettings';
@Component({
@@ -31,6 +32,8 @@ export class ECLChannelPendingTableComponent implements OnInit, AfterViewInit, O
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
+ public PAGE_ID = 'peers_channels';
+ public tableSetting: TableSetting = { tableId: 'pending_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING };
public pendingChannels: Channel[];
public totalBalance = 0;
public displayedColumns: any[] = [];
@@ -51,19 +54,27 @@ export class ECLChannelPendingTableComponent implements OnInit, AfterViewInit, O
constructor(private logger: LoggerService, private store: Store , private commonService: CommonService) {
this.screenSize = this.commonService.getScreenSize();
- if (this.screenSize === ScreenSizeEnum.XS) {
- this.displayedColumns = ['state', 'alias', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.SM) {
- this.displayedColumns = ['state', 'alias', 'toLocal', 'toRemote', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.MD) {
- this.displayedColumns = ['state', 'alias', 'toLocal', 'toRemote', 'actions'];
- } else {
- this.displayedColumns = ['state', 'alias', 'toLocal', 'toRemote', 'actions'];
- }
}
ngOnInit() {
- this.store.select(allChannelsInfo).pipe(takeUntil(this.unSubs[0])).
+ this.store.select(eclPageSettings).pipe(takeUntil(this.unSubs[0])).
+ subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
+ this.errorMessage = '';
+ this.apiCallStatus = settings.apiCallStatus;
+ if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
+ this.errorMessage = this.apiCallStatus.message || '';
+ }
+ this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || ECL_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
+ if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelectionSM));
+ } else {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelection));
+ }
+ this.displayedColumns.push('actions');
+ this.pageSize = this.tableSetting.recordsPerPage ? +this.tableSetting.recordsPerPage : PAGE_SIZE;
+ this.logger.info(this.displayedColumns);
+ });
+ this.store.select(allChannelsInfo).pipe(takeUntil(this.unSubs[1])).
subscribe((allChannelsSelector: ({ activeChannels: Channel[], pendingChannels: Channel[], inactiveChannels: Channel[], lightningBalance: LightningBalance, channelsStatus: ChannelsStatus, apiCallStatus: ApiCallStatusPayload })) => {
this.errorMessage = '';
this.apiCallStatus = allChannelsSelector.apiCallStatus;
@@ -74,15 +85,15 @@ export class ECLChannelPendingTableComponent implements OnInit, AfterViewInit, O
this.loadChannelsTable();
this.logger.info(allChannelsSelector);
});
- this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[1])).
+ this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[2])).
subscribe((nodeInfo: GetInfo) => {
this.information = nodeInfo;
});
- this.store.select(peers).pipe(takeUntil(this.unSubs[4])).
+ this.store.select(peers).pipe(takeUntil(this.unSubs[3])).
subscribe((peersSelector: { peers: Peer[], apiCallStatus: ApiCallStatusPayload }) => {
this.numPeers = (peersSelector.peers && peersSelector.peers.length) ? peersSelector.peers.length : 0;
});
- this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[5])).
+ this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[4])).
subscribe((oCBalanceSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.totalBalance = oCBalanceSelector.onchainBalance.total || 0;
});
@@ -111,10 +122,10 @@ export class ECLChannelPendingTableComponent implements OnInit, AfterViewInit, O
}
loadChannelsTable() {
- this.pendingChannels.sort((a, b) => ((a.alias === b.alias) ? 0 : ((b.alias) ? 1 : -1)));
this.channels = new MatTableDataSource([...this.pendingChannels]);
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.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
this.channels.filterPredicate = (channel: Channel, fltr: string) => JSON.stringify(channel).toLowerCase().includes(fltr);
this.channels.paginator = this.paginator;
this.applyFilter();
diff --git a/src/app/eclair/peers-channels/peers/peers.component.html b/src/app/eclair/peers-channels/peers/peers.component.html
index cdae653f..7c14380f 100644
--- a/src/app/eclair/peers-channels/peers/peers.component.html
+++ b/src/app/eclair/peers-channels/peers/peers.component.html
@@ -17,36 +17,41 @@
-
- ID |
-
- {{peer?.nodeId}}
+
+ |
+
+
+
|
- Alias |
-
-
-
- {{peer?.alias}}
+ | Alias |
+
+
+ {{peer?.alias}}
+
|
-
- State |
- {{peer?.state}} |
+
+ ID |
+
+
+ {{peer?.nodeId}}
+
+ |
- Network Address |
-
+ | Network Address |
+
{{peer?.address}}
|
- Channels |
- {{peer?.channels}} |
+ Channels |
+ {{peer?.channels}} |
-
+ |
@@ -54,7 +59,7 @@
|
-
+ |
diff --git a/src/app/eclair/peers-channels/peers/peers.component.scss b/src/app/eclair/peers-channels/peers/peers.component.scss
index 9c8718e3..ecfaeded 100644
--- a/src/app/eclair/peers-channels/peers/peers.component.scss
+++ b/src/app/eclair/peers-channels/peers/peers.component.scss
@@ -1,22 +1,13 @@
-.mat-column-alias {
- flex: 1 1 10%;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
+.mat-column-state {
+ width: 2rem;
}
-.mat-column-nodeId {
- flex: 1 1 10%;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- padding-right: 2rem;
-}
-
-.mat-column-address {
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
+.mat-column-alias, .mat-column-nodeId, .mat-column-address {
+ flex: 0 0 20%;
+ width: 20%;
+ & .ellipsis-parent {
+ display: flex;
+ }
}
.mat-column-actions {
diff --git a/src/app/eclair/peers-channels/peers/peers.component.ts b/src/app/eclair/peers-channels/peers/peers.component.ts
index 369476de..03bce18a 100644
--- a/src/app/eclair/peers-channels/peers/peers.component.ts
+++ b/src/app/eclair/peers-channels/peers/peers.component.ts
@@ -10,7 +10,7 @@ import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Peer, GetInfo, OnChainBalance } from '../../../shared/models/eclModels';
-import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, ScreenSizeEnum, APICallStatusEnum, ECLActions } from '../../../shared/services/consts-enums-functions';
+import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, ScreenSizeEnum, APICallStatusEnum, ECLActions, SortOrderEnum, ECL_DEFAULT_PAGE_SETTINGS } from '../../../shared/services/consts-enums-functions';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
@@ -21,7 +21,8 @@ import { RTLEffects } from '../../../store/rtl.effects';
import { RTLState } from '../../../store/rtl.state';
import { openAlert, openConfirmation } from '../../../store/rtl.actions';
import { disconnectPeer } from '../../store/ecl.actions';
-import { eclNodeInformation, onchainBalance, peers } from '../../store/ecl.selector';
+import { eclNodeInformation, eclPageSettings, onchainBalance, peers } from '../../store/ecl.selector';
+import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
@Component({
selector: 'rtl-ecl-peers',
@@ -35,6 +36,8 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
+ public PAGE_ID = 'peers_channels';
+ public tableSetting: TableSetting = { tableId: 'peers', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING };
public faUsers = faUsers;
public newlyAddedPeer = '';
public displayedColumns: any[] = [];
@@ -51,19 +54,10 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
public selFilter = '';
public apiCallStatus: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
- private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
+ private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store, private rtlEffects: RTLEffects, private actions: Actions, private commonService: CommonService) {
this.screenSize = this.commonService.getScreenSize();
- if (this.screenSize === ScreenSizeEnum.XS) {
- this.displayedColumns = ['alias', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.SM) {
- this.displayedColumns = ['alias', 'nodeId', 'address', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.MD) {
- this.displayedColumns = ['alias', 'nodeId', 'address', 'channels', 'actions'];
- } else {
- this.displayedColumns = ['alias', 'nodeId', 'address', 'channels', 'actions'];
- }
}
ngOnInit() {
@@ -71,7 +65,26 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
subscribe((nodeInfo: any) => {
this.information = nodeInfo;
});
- this.store.select(peers).pipe(takeUntil(this.unSubs[1])).
+ this.store.select(eclPageSettings).pipe(takeUntil(this.unSubs[1])).
+ subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
+ this.errorMessage = '';
+ this.apiCallStatus = settings.apiCallStatus;
+ if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
+ this.errorMessage = this.apiCallStatus.message || '';
+ }
+ this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || ECL_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
+ if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelectionSM));
+ } else {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelection));
+ }
+ this.displayedColumns.unshift('state');
+ this.displayedColumns.push('actions');
+ this.pageSize = this.tableSetting.recordsPerPage ? +this.tableSetting.recordsPerPage : PAGE_SIZE;
+ this.logger.info(this.displayedColumns);
+ });
+
+ this.store.select(peers).pipe(takeUntil(this.unSubs[2])).
subscribe((peersSelector: { peers: Peer[], apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = peersSelector.apiCallStatus;
@@ -82,11 +95,11 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
this.loadPeersTable(this.peersData);
this.logger.info(peersSelector);
});
- this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[2])).
+ this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[3])).
subscribe((oCBalanceSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.availableBalance = oCBalanceSelector.onchainBalance.total || 0;
});
- this.actions.pipe(takeUntil(this.unSubs[3]), filter((action) => action.type === ECLActions.SET_PEERS_ECL)).
+ this.actions.pipe(takeUntil(this.unSubs[4]), filter((action) => action.type === ECLActions.SET_PEERS_ECL)).
subscribe((setPeers: any) => {
this.peerAddress = null;
});
@@ -177,7 +190,7 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
}));
}
this.rtlEffects.closeConfirm.
- pipe(takeUntil(this.unSubs[4])).
+ pipe(takeUntil(this.unSubs[5])).
subscribe((confirmRes) => {
if (confirmRes) {
this.store.dispatch(disconnectPeer({ payload: { nodeId: (peerToDetach.nodeId || '') } }));
@@ -193,6 +206,7 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
this.peers = (peers) ? new MatTableDataSource([...peers]) : new MatTableDataSource([]);
this.peers.sort = this.sort;
this.peers.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
+ this.peers.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
this.peers.filterPredicate = (peer: Peer, fltr: string) => JSON.stringify(peer).toLowerCase().includes(fltr);
this.peers.paginator = this.paginator;
this.applyFilter();
diff --git a/src/app/eclair/reports/routing/routing-report.component.html b/src/app/eclair/reports/routing/routing-report.component.html
index 980391b9..0bc2c1fb 100644
--- a/src/app/eclair/reports/routing/routing-report.component.html
+++ b/src/app/eclair/reports/routing/routing-report.component.html
@@ -37,7 +37,7 @@
- 0" [eventsData]="filteredEventsBySelectedPeriod" [filterValue]="eventFilterValue">
+ 0" [pageId]="'reports'" [tableId]="'routing'"[eventsData]="filteredEventsBySelectedPeriod" [filterValue]="eventFilterValue">
diff --git a/src/app/eclair/reports/transactions/transactions-report.component.html b/src/app/eclair/reports/transactions/transactions-report.component.html
index 1f660910..4424a581 100644
--- a/src/app/eclair/reports/transactions/transactions-report.component.html
+++ b/src/app/eclair/reports/transactions/transactions-report.component.html
@@ -35,7 +35,7 @@
- 0" [dataList]="transactionsNonZeroReportData" [dataRange]="reportPeriod" [filterValue]="transactionFilterValue">
+ 0" [displayedColumns]="displayedColumns" [tableSetting]="tableSetting" [dataList]="transactionsNonZeroReportData" [dataRange]="reportPeriod" [filterValue]="transactionFilterValue">
diff --git a/src/app/eclair/reports/transactions/transactions-report.component.ts b/src/app/eclair/reports/transactions/transactions-report.component.ts
index 4306a31b..5e76c85a 100644
--- a/src/app/eclair/reports/transactions/transactions-report.component.ts
+++ b/src/app/eclair/reports/transactions/transactions-report.component.ts
@@ -5,13 +5,14 @@ import { Store } from '@ngrx/store';
import { PaymentSent, Invoice, Payments } from '../../../shared/models/eclModels';
import { CommonService } from '../../../shared/services/common.service';
-import { MONTHS, ScreenSizeEnum, SCROLL_RANGES } from '../../../shared/services/consts-enums-functions';
+import { APICallStatusEnum, ECL_DEFAULT_PAGE_SETTINGS, MONTHS, PAGE_SIZE, ScreenSizeEnum, SCROLL_RANGES, SortOrderEnum } from '../../../shared/services/consts-enums-functions';
import { fadeIn } from '../../../shared/animation/opacity-animation';
import { RTLState } from '../../../store/rtl.state';
-import { invoices, payments } from '../../store/ecl.selector';
+import { eclPageSettings, invoices, payments } from '../../store/ecl.selector';
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
+import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
@Component({
selector: 'rtl-ecl-transactions-report',
@@ -26,6 +27,9 @@ export class ECLTransactionsReportComponent implements OnInit, OnDestroy {
public secondsInADay = 24 * 60 * 60;
public payments: PaymentSent[] = [];
public invoices: Invoice[] = [];
+ public PAGE_ID = 'reports';
+ public tableSetting: TableSetting = { tableId: 'transactions', recordsPerPage: PAGE_SIZE, sortBy: 'date', sortOrder: SortOrderEnum.DESCENDING };
+ public displayedColumns: any[] = ['date', 'amount_paid', 'num_payments', 'amount_received', 'num_invoices'];
public transactionsReportSummary = { paymentsSelectedPeriod: 0, invoicesSelectedPeriod: 0, amountPaidSelectedPeriod: 0, amountReceivedSelectedPeriod: 0 };
public transactionFilterValue = '';
public today = new Date(Date.now());
@@ -41,14 +45,34 @@ export class ECLTransactionsReportComponent implements OnInit, OnDestroy {
public showYAxisLabel = true;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
- private unSubs: Array> = [new Subject(), new Subject()];
+ private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store) { }
ngOnInit() {
this.screenSize = this.commonService.getScreenSize();
this.showYAxisLabel = !(this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM);
- this.store.select(payments).pipe(takeUntil(this.unSubs[0]),
+ this.store.select(eclPageSettings).pipe(takeUntil(this.unSubs[0])).
+ subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
+ if (settings.apiCallStatus.status === APICallStatusEnum.ERROR) {
+ if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
+ this.displayedColumns = ['date', 'amount_paid', 'amount_received'];
+ } else {
+ this.displayedColumns = ['date', 'amount_paid', 'num_payments', 'amount_received', 'num_invoices'];
+ }
+ } else {
+ this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || ECL_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
+ if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelectionSM));
+ } else {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelection));
+ }
+ }
+ this.displayedColumns.push('actions');
+ this.logger.info(this.displayedColumns);
+ });
+
+ this.store.select(payments).pipe(takeUntil(this.unSubs[1]),
withLatestFrom(this.store.select(invoices))).
subscribe(([paymentsSelector, invoicesSelector]: [({ payments: Payments, apiCallStatus: ApiCallStatusPayload }), ({ invoices: Invoice[], apiCallStatus: ApiCallStatusPayload })]) => {
this.payments = paymentsSelector.payments.sent ? paymentsSelector.payments.sent : [];
@@ -58,7 +82,7 @@ export class ECLTransactionsReportComponent implements OnInit, OnDestroy {
this.transactionsNonZeroReportData = this.prepareTableData();
}
});
- this.commonService.containerSizeUpdated.pipe(takeUntil(this.unSubs[1])).subscribe((CONTAINER_SIZE) => {
+ this.commonService.containerSizeUpdated.pipe(takeUntil(this.unSubs[2])).subscribe((CONTAINER_SIZE) => {
switch (this.screenSize) {
case ScreenSizeEnum.MD:
this.screenPaddingX = CONTAINER_SIZE.width / 10;
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 1c1fa251..4ccf7a31 100644
--- a/src/app/eclair/routing/forwarding-history/forwarding-history.component.html
+++ b/src/app/eclair/routing/forwarding-history/forwarding-history.component.html
@@ -16,28 +16,48 @@
{{fhEvent?.timestamp | date:'dd/MMM/y HH:mm'}}
|
+
+ In Channel Id |
+ {{fhEvent?.fromChannelId}} |
+
+
+ In Channel Short Id |
+ {{fhEvent?.fromShortChannelId}} |
+
In Channel |
{{fhEvent?.fromChannelAlias}} |
+
+ Out Channel Id |
+ {{fhEvent?.toChannelId}} |
+
+
+ Out Channel Short Id |
+ {{fhEvent?.toShortChannelId}} |
+
Out Channel |
{{fhEvent?.toChannelAlias}} |
- Amount In (Sats) |
- {{fhEvent?.amountIn | number}} |
+ Amount In (Sats) |
+ {{fhEvent?.amountIn | number}} |
- Amount Out (Sats) |
- {{fhEvent?.amountOut | number}} |
+ Amount Out (Sats) |
+ {{fhEvent?.amountOut | number}} |
- Fee Earned (Sats) |
- {{(fhEvent?.amountIn - fhEvent?.amountOut) | number}} |
+ Fee Earned (Sats) |
+ {{(fhEvent?.amountIn - fhEvent?.amountOut) | number}} |
+
+
+ Payment Hash |
+ {{fhEvent?.paymentHash}} |
-
+ |
@@ -45,7 +65,7 @@
|
-
+ |
|
diff --git a/src/app/eclair/routing/forwarding-history/forwarding-history.component.scss b/src/app/eclair/routing/forwarding-history/forwarding-history.component.scss
index c96dde9e..160d0806 100644
--- a/src/app/eclair/routing/forwarding-history/forwarding-history.component.scss
+++ b/src/app/eclair/routing/forwarding-history/forwarding-history.component.scss
@@ -1,16 +1,7 @@
-.mat-column-fromAlias {
- padding-left: 2rem;
- flex: 1 1 20%;
- width: 20%;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.mat-column-toAlias {
+.mat-column-fromChannelId, .mat-column-fromAlias, .mat-column-toChannelId, .mat-column-toAlias, .mat-column-paymentHash {
padding-left: 1rem;
- flex: 1 1 20%;
- width: 20%;
+ flex: 1 1 15%;
+ width: 15%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
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 0452b04a..13c2a582 100644
--- a/src/app/eclair/routing/forwarding-history/forwarding-history.component.ts
+++ b/src/app/eclair/routing/forwarding-history/forwarding-history.component.ts
@@ -8,14 +8,15 @@ import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { PaymentRelayed, Payments } from '../../../shared/models/eclModels';
-import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
+import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum, SortOrderEnum, ECL_DEFAULT_PAGE_SETTINGS } from '../../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
import { RTLState } from '../../../store/rtl.state';
import { openAlert } from '../../../store/rtl.actions';
-import { payments } from '../../store/ecl.selector';
+import { eclPageSettings, payments } from '../../store/ecl.selector';
+import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
@Component({
selector: 'rtl-ecl-forwarding-history',
@@ -29,8 +30,11 @@ export class ECLForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
+ @Input() pageId = 'routing';
+ @Input() tableId = 'forwarding_history';
@Input() eventsData: PaymentRelayed[] = [];
@Input() filterValue = '';
+ public tableSetting: TableSetting = { tableId: 'forwarding_history', recordsPerPage: PAGE_SIZE, sortBy: 'timestamp', sortOrder: SortOrderEnum.DESCENDING };
public displayedColumns: any[] = [];
public forwardingHistoryEvents: any;
public pageSize = PAGE_SIZE;
@@ -44,19 +48,28 @@ export class ECLForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store, private datePipe: DatePipe) {
this.screenSize = this.commonService.getScreenSize();
- if (this.screenSize === ScreenSizeEnum.XS) {
- this.displayedColumns = ['timestamp', 'amountIn', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.SM) {
- this.displayedColumns = ['timestamp', 'amountIn', 'fee', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.MD) {
- this.displayedColumns = ['timestamp', 'amountIn', 'amountOut', 'fee', 'actions'];
- } else {
- this.displayedColumns = ['timestamp', 'fromChannelAlias', 'toChannelAlias', 'amountIn', 'amountOut', 'fee', 'actions'];
- }
}
ngOnInit() {
- this.store.select(payments).pipe(takeUntil(this.unSubs[0])).
+ this.store.select(eclPageSettings).pipe(takeUntil(this.unSubs[0])).
+ subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
+ this.errorMessage = '';
+ this.apiCallStatus = settings.apiCallStatus;
+ if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
+ this.errorMessage = this.apiCallStatus.message || '';
+ }
+ this.tableSetting.tableId = this.tableId;
+ this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.pageId)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || ECL_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.pageId)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
+ if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelectionSM));
+ } else {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelection));
+ }
+ this.displayedColumns.push('actions');
+ this.pageSize = this.tableSetting.recordsPerPage ? +this.tableSetting.recordsPerPage : PAGE_SIZE;
+ this.logger.info(this.displayedColumns);
+ });
+ this.store.select(payments).pipe(takeUntil(this.unSubs[1])).
subscribe((paymentsSelector: { payments: Payments, apiCallStatus: ApiCallStatusPayload }) => {
if (this.eventsData.length === 0) {
this.errorMessage = '';
@@ -132,6 +145,7 @@ export class ECLForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;
}
};
+ this.forwardingHistoryEvents.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
this.forwardingHistoryEvents.filterPredicate = (rowData: PaymentRelayed, fltr: string) => {
const newRowData = ((rowData.timestamp) ? this.datePipe.transform(new Date(rowData.timestamp), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(rowData).toLowerCase();
return newRowData.includes(fltr);
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 cd69120f..ce7dd592 100644
--- a/src/app/eclair/routing/routing-peers/routing-peers.component.ts
+++ b/src/app/eclair/routing/routing-peers/routing-peers.component.ts
@@ -7,13 +7,14 @@ import { MatSort } from '@angular/material/sort';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
import { PaymentRelayed, Payments, RoutingPeers } from '../../../shared/models/eclModels';
-import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
+import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum, SortOrderEnum, ECL_DEFAULT_PAGE_SETTINGS } from '../../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
import { RTLState } from '../../../store/rtl.state';
-import { payments } from '../../store/ecl.selector';
+import { eclPageSettings, payments } from '../../store/ecl.selector';
+import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
@Component({
selector: 'rtl-ecl-routing-peers',
@@ -29,6 +30,8 @@ export class ECLRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro
@ViewChild('tableOut', { read: MatSort, static: false }) sortOut: MatSort;
@ViewChild('paginatorIn', { static: false }) paginatorIn: MatPaginator | undefined;
@ViewChild('paginatorOut', { static: false }) paginatorOut: MatPaginator | undefined;
+ public PAGE_ID = 'routing';
+ public tableSetting: TableSetting = { tableId: 'routing_peers', recordsPerPage: PAGE_SIZE, sortBy: 'totalFee', sortOrder: SortOrderEnum.DESCENDING };
public routingPeersData: PaymentRelayed[] = [];
public displayedColumns: any[] = [];
public RoutingPeersIncoming: any;
@@ -46,20 +49,26 @@ export class ECLRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store) {
this.screenSize = this.commonService.getScreenSize();
- if (this.screenSize === ScreenSizeEnum.XS) {
- this.displayedColumns = ['alias', 'totalFee'];
- } else if (this.screenSize === ScreenSizeEnum.SM) {
- this.displayedColumns = ['alias', 'events', 'totalFee'];
- } else if (this.screenSize === ScreenSizeEnum.MD) {
- this.displayedColumns = ['alias', 'events', 'totalAmount', 'totalFee'];
- } else {
- this.displayedColumns = ['channelId', 'alias', 'events', 'totalAmount', 'totalFee'];
- }
}
ngOnInit() {
- this.store.select(payments).
- pipe(takeUntil(this.unSubs[0])).
+ this.store.select(eclPageSettings).pipe(takeUntil(this.unSubs[0])).
+ subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
+ this.errorMessage = '';
+ this.apiCallStatus = settings.apiCallStatus;
+ if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
+ this.errorMessage = this.apiCallStatus.message || '';
+ }
+ this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || ECL_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
+ if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelectionSM));
+ } else {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelection));
+ }
+ this.pageSize = this.tableSetting.recordsPerPage ? +this.tableSetting.recordsPerPage : PAGE_SIZE;
+ this.logger.info(this.displayedColumns);
+ });
+ this.store.select(payments).pipe(takeUntil(this.unSubs[1])).
subscribe((paymentsSelector: { payments: Payments, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = paymentsSelector.apiCallStatus;
@@ -85,11 +94,13 @@ export class ECLRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro
const results = this.groupRoutingPeers(forwardingEvents);
this.RoutingPeersIncoming = new MatTableDataSource(results[0]);
this.RoutingPeersIncoming.sort = this.sortIn;
+ this.RoutingPeersIncoming.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
this.RoutingPeersIncoming.filterPredicate = (rpIn: RoutingPeers, fltr: string) => JSON.stringify(rpIn).toLowerCase().includes(fltr);
this.RoutingPeersIncoming.paginator = this.paginatorIn;
this.logger.info(this.RoutingPeersIncoming);
this.RoutingPeersOutgoing = new MatTableDataSource(results[1]);
this.RoutingPeersOutgoing.sort = this.sortOut;
+ this.RoutingPeersOutgoing.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
this.RoutingPeersOutgoing.filterPredicate = (rpOut: RoutingPeers, fltr: string) => JSON.stringify(rpOut).toLowerCase().includes(fltr);
this.RoutingPeersOutgoing.paginator = this.paginatorOut;
this.logger.info(this.RoutingPeersOutgoing);
diff --git a/src/app/eclair/transactions/invoices/lightning-invoices.component.html b/src/app/eclair/transactions/invoices/lightning-invoices.component.html
index cc4da0ec..b334dc02 100644
--- a/src/app/eclair/transactions/invoices/lightning-invoices.component.html
+++ b/src/app/eclair/transactions/invoices/lightning-invoices.component.html
@@ -30,41 +30,64 @@
-
- Date Created |
+
+ |
-
-
-
- {{(invoice.timestamp * 1000) | date:'dd/MMM/y HH:mm'}}
+
+
+
|
+
+ Date Created |
+ {{(invoice?.timestamp * 1000) | date:'dd/MMM/y HH:mm'}} |
+
+
+ Date Expiry |
+ {{((invoice?.expiresAt * 1000) | date:'dd/MMM/y HH:mm') || '-'}} |
+
- Date Settled |
- {{((invoice.receivedAt * 1000) | date:'dd/MMM/y HH:mm') || '-'}} |
+ Date Settled |
+ {{((invoice?.receivedAt * 1000) | date:'dd/MMM/y HH:mm') || '-'}} |
+
+
+ Node Id |
+
+
+ {{invoice?.nodeId}}
+
+ |
- Description |
-
-
- {{invoice.description}}
+ Description |
+
+
+ {{invoice?.description}}
+
+ |
+
+
+ Payment Hash |
+
+
+ {{invoice?.paymentHash}}
|
- Amount (Sats) |
-
- {{invoice.amount ? (invoice.amount | number:'1.0-0') : '-'}}
+ | Amount (Sats) |
+
+ {{invoice?.amount ? (invoice?.amount | number:'1.0-0') : '-'}}
|
- Amount Settled (Sats) |
-
- {{invoice.amountSettled ? (invoice.amountSettled | number:'1.0-0') : '-'}}
+ | Amount Settled (Sats) |
+
+ {{invoice?.amountSettled ? (invoice?.amountSettled | number:'1.0-0') : '-'}}
|
-
+ |
@@ -72,7 +95,7 @@
|
-
+ |
diff --git a/src/app/eclair/transactions/invoices/lightning-invoices.component.scss b/src/app/eclair/transactions/invoices/lightning-invoices.component.scss
index 2ce046dc..d967b4bd 100644
--- a/src/app/eclair/transactions/invoices/lightning-invoices.component.scss
+++ b/src/app/eclair/transactions/invoices/lightning-invoices.component.scss
@@ -1,4 +1,8 @@
-.mat-column-description {
+.mat-column-status {
+ width: 2rem;
+}
+
+.mat-column-nodeId, .mat-column-paymentHash, .mat-column-description {
flex: 0 0 15%;
width: 15%;
& .ellipsis-parent {
diff --git a/src/app/eclair/transactions/invoices/lightning-invoices.component.ts b/src/app/eclair/transactions/invoices/lightning-invoices.component.ts
index b5c5d8ae..81cf758d 100644
--- a/src/app/eclair/transactions/invoices/lightning-invoices.component.ts
+++ b/src/app/eclair/transactions/invoices/lightning-invoices.component.ts
@@ -9,7 +9,7 @@ import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
-import { CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum, ECLActions } from '../../../shared/services/consts-enums-functions';
+import { CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum, ECLActions, SortOrderEnum, ECL_DEFAULT_PAGE_SETTINGS } from '../../../shared/services/consts-enums-functions';
import { SelNodeChild } from '../../../shared/models/RTLconfig';
import { GetInfo, Invoice } from '../../../shared/models/eclModels';
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
@@ -22,7 +22,8 @@ import { ECLInvoiceInformationComponent } from '../invoice-information-modal/inv
import { RTLState } from '../../../store/rtl.state';
import { openAlert } from '../../../store/rtl.actions';
import { createInvoice, invoiceLookup } from '../../store/ecl.actions';
-import { eclNodeInformation, eclNodeSettings, invoices } from '../../store/ecl.selector';
+import { eclNodeInformation, eclNodeSettings, eclPageSettings, invoices } from '../../store/ecl.selector';
+import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
@Component({
selector: 'rtl-ecl-lightning-invoices',
@@ -38,6 +39,8 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
faHistory = faHistory;
+ public PAGE_ID = 'transactions';
+ public tableSetting: TableSetting = { tableId: 'invoices', recordsPerPage: PAGE_SIZE, sortBy: 'expiresAt', sortOrder: SortOrderEnum.DESCENDING };
public selNode: SelNodeChild | null = {};
public newlyAddedInvoiceMemo: string | null = '';
public newlyAddedInvoiceValue: number | null = 0;
@@ -58,19 +61,10 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
public errorMessage = '';
public apiCallStatus: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
- private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
+ private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store, private decimalPipe: DecimalPipe, private commonService: CommonService, private datePipe: DatePipe, private actions: Actions) {
this.screenSize = this.commonService.getScreenSize();
- if (this.screenSize === ScreenSizeEnum.XS) {
- this.displayedColumns = ['timestamp', 'amount', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.SM) {
- this.displayedColumns = ['timestamp', 'amount', 'amountSettled', 'actions'];
- } else if (this.screenSize === ScreenSizeEnum.MD) {
- this.displayedColumns = ['timestamp', 'amount', 'amountSettled', 'actions'];
- } else {
- this.displayedColumns = ['timestamp', 'receivedAt', 'description', 'amount', 'amountSettled', 'actions'];
- }
}
ngOnInit() {
@@ -82,7 +76,25 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
subscribe((nodeInfo: any) => {
this.information = nodeInfo;
});
- this.store.select(invoices).pipe(takeUntil(this.unSubs[2])).
+ this.store.select(eclPageSettings).pipe(takeUntil(this.unSubs[2])).
+ subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
+ this.errorMessage = '';
+ this.apiCallStatus = settings.apiCallStatus;
+ if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
+ this.errorMessage = this.apiCallStatus.message || '';
+ }
+ this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || ECL_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
+ if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelectionSM));
+ } else {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelection));
+ }
+ this.displayedColumns.unshift('status');
+ this.displayedColumns.push('actions');
+ this.pageSize = this.tableSetting.recordsPerPage ? +this.tableSetting.recordsPerPage : PAGE_SIZE;
+ this.logger.info(this.displayedColumns);
+ });
+ this.store.select(invoices).pipe(takeUntil(this.unSubs[3])).
subscribe((invoicesSelector: { invoices: Invoice[], apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = invoicesSelector.apiCallStatus;
@@ -95,7 +107,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
}
this.logger.info(invoicesSelector);
});
- this.actions.pipe(takeUntil(this.unSubs[3]), filter((action) => (action.type === ECLActions.SET_LOOKUP_ECL || action.type === ECLActions.UPDATE_API_CALL_STATUS_ECL))).
+ this.actions.pipe(takeUntil(this.unSubs[4]), filter((action) => (action.type === ECLActions.SET_LOOKUP_ECL || action.type === ECLActions.UPDATE_API_CALL_STATUS_ECL))).
subscribe((resLookup: any) => {
if (resLookup.type === ECLActions.SET_LOOKUP_ECL) {
if (this.invoiceJSONArr.length > 0 && this.sort && this.paginator && resLookup.payload) {
@@ -164,6 +176,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
this.invoices = invs ? new MatTableDataSource([...invs]) : new MatTableDataSource([]);
this.invoices.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
this.invoices.sort = this.sort;
+ this.invoices.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => {
const newRowData = ((rowData.timestamp) ? this.datePipe.transform(new Date(rowData.timestamp * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(rowData).toLowerCase();
return newRowData.includes(fltr);
@@ -187,7 +200,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
if (this.selNode && this.selNode.fiatConversion && this.invoiceValue && this.invoiceValue > 99) {
this.invoiceValueHint = '';
this.commonService.convertCurrency(this.invoiceValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
- pipe(takeUntil(this.unSubs[4])).
+ pipe(takeUntil(this.unSubs[5])).
subscribe({
next: (data) => {
this.invoiceValueHint = '= ' + data.symbol + this.decimalPipe.transform(data.OTHER, CURRENCY_UNIT_FORMATS.OTHER) + ' ' + data.unit;
diff --git a/src/app/eclair/transactions/payments/lightning-payments.component.html b/src/app/eclair/transactions/payments/lightning-payments.component.html
index 1662295f..a9e6af25 100644
--- a/src/app/eclair/transactions/payments/lightning-payments.component.html
+++ b/src/app/eclair/transactions/payments/lightning-payments.component.html
@@ -34,16 +34,24 @@
ID |
-
- {{payment.id}}
+
+ {{payment?.id}}
+
+ |
+
+
+ Destination Node Id |
+
+
+ {{payment?.recipientNodeId}}
|
Destination |
-
- {{payment.recipientNodeAlias}}
+
+ {{payment?.recipientNodeAlias}}
|
@@ -51,6 +59,30 @@
Amount (Sats) |
{{(payment?.recipientAmount) | number}} |
+
+ Description |
+
+
+ {{payment?.description}}
+
+ |
+
+
+ Payment Hash |
+
+
+ {{payment?.paymentHash}}
+
+ |
+
+
+ Preimage |
+
+
+ {{payment?.paymentPreimage}}
+
+ |
+
@@ -78,7 +110,7 @@
Total Attempts: {{payment?.parts?.length}}
-
+
{{part.timestamp | date:'dd/MMM/y HH:mm'}}
@@ -87,12 +119,12 @@
-
- {{payment.id}}
+
+ {{payment?.id}}
-
+
-
+
{{part.id}}
@@ -101,12 +133,12 @@
-
+
{{payment?.recipientNodeAlias}}
-
+
-
+
{{part.toChannelAlias}}
@@ -116,7 +148,7 @@
{{payment?.recipientAmount | number:'1.0-0'}}
-
+
{{part.amount | number:'1.0-0'}}
@@ -126,9 +158,9 @@
-
+
-
+
diff --git a/src/app/eclair/transactions/payments/lightning-payments.component.scss b/src/app/eclair/transactions/payments/lightning-payments.component.scss
index 73841d01..2e838620 100644
--- a/src/app/eclair/transactions/payments/lightning-payments.component.scss
+++ b/src/app/eclair/transactions/payments/lightning-payments.component.scss
@@ -1,8 +1,9 @@
.mat-column-id, .mat-column-recipientNodeAlias,
+.mat-column-recipientNodeId, .mat-column-description,
+.mat-column-paymentHash, .mat-column-paymentPreimage,
.mat-column-groupId, .mat-column-groupChannelAlias {
- padding: 0 1rem;
- flex: 0 0 25%;
- width: 25%;
+ flex: 1 1 12%;
+ width: 12%;
& .ellipsis-parent {
display: flex;
}
diff --git a/src/app/eclair/transactions/payments/lightning-payments.component.ts b/src/app/eclair/transactions/payments/lightning-payments.component.ts
index bfddae18..85223021 100644
--- a/src/app/eclair/transactions/payments/lightning-payments.component.ts
+++ b/src/app/eclair/transactions/payments/lightning-payments.component.ts
@@ -9,7 +9,7 @@ import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { GetInfo, PayRequest, PaymentSent, PaymentSentPart, Payments } from '../../../shared/models/eclModels';
-import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
+import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, APICallStatusEnum, SortOrderEnum, ECL_DEFAULT_PAGE_SETTINGS } from '../../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
@@ -23,7 +23,8 @@ import { RTLEffects } from '../../../store/rtl.effects';
import { RTLState } from '../../../store/rtl.state';
import { openAlert, openConfirmation } from '../../../store/rtl.actions';
import { sendPayment } from '../../store/ecl.actions';
-import { eclNodeInformation, eclNodeSettings, payments } from '../../store/ecl.selector';
+import { eclNodeInformation, eclNodeSettings, eclPageSettings, payments } from '../../store/ecl.selector';
+import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
@Component({
selector: 'rtl-ecl-lightning-payments',
@@ -39,6 +40,8 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
@ViewChild('sendPaymentForm', { static: false }) form;
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
+ public PAGE_ID = 'transactions';
+ public tableSetting: TableSetting = { tableId: 'payments', recordsPerPage: PAGE_SIZE, sortBy: 'firstPartTimestamp', sortOrder: SortOrderEnum.DESCENDING };
public faHistory = faHistory;
public newlyAddedPayment = '';
public selNode: SelNodeChild | null = {};
@@ -58,23 +61,19 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
public selFilter = '';
public apiCallStatus: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
- private unSubs: Array > = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
+ private unSubs: Array> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store, private rtlEffects: RTLEffects, private decimalPipe: DecimalPipe, private dataService: DataService, private datePipe: DatePipe) {
this.screenSize = this.commonService.getScreenSize();
- if (this.screenSize === ScreenSizeEnum.XS) {
- this.displayedColumns = ['firstPartTimestamp', 'actions'];
- this.partColumns = ['groupTotal', 'groupActions'];
- } else if (this.screenSize === ScreenSizeEnum.SM) {
- this.displayedColumns = ['firstPartTimestamp', 'recipientAmount', 'actions'];
- this.partColumns = ['groupTotal', 'groupAmount', 'groupActions'];
- } else if (this.screenSize === ScreenSizeEnum.MD) {
- this.displayedColumns = ['firstPartTimestamp', 'id', 'recipientAmount', 'actions'];
- this.partColumns = ['groupTotal', 'groupId', 'groupAmount', 'groupActions'];
- } else {
- this.displayedColumns = ['firstPartTimestamp', 'id', 'recipientNodeAlias', 'recipientAmount', 'actions'];
- this.partColumns = ['groupTotal', 'groupId', 'groupChannelAlias', 'groupAmount', 'groupActions'];
- }
+ // if (this.screenSize === ScreenSizeEnum.XS) {
+ // this.partColumns = ['groupTotal', 'groupActions'];
+ // } else if (this.screenSize === ScreenSizeEnum.SM) {
+ // this.partColumns = ['groupTotal', 'groupAmount', 'groupActions'];
+ // } else if (this.screenSize === ScreenSizeEnum.MD) {
+ // this.partColumns = ['groupTotal', 'groupId', 'groupAmount', 'groupActions'];
+ // } else {
+ // this.partColumns = ['groupTotal', 'groupId', 'groupChannelAlias', 'groupAmount', 'groupActions'];
+ // }
}
ngOnInit() {
@@ -86,7 +85,24 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
subscribe((nodeInfo: GetInfo) => {
this.information = nodeInfo;
});
- this.store.select(payments).pipe(takeUntil(this.unSubs[2])).
+ this.store.select(eclPageSettings).pipe(takeUntil(this.unSubs[2])).
+ subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
+ this.errorMessage = '';
+ this.apiCallStatus = settings.apiCallStatus;
+ if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
+ this.errorMessage = this.apiCallStatus.message || '';
+ }
+ this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || ECL_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
+ if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelectionSM));
+ } else {
+ this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelection));
+ }
+ this.displayedColumns.push('actions');
+ this.pageSize = this.tableSetting.recordsPerPage ? +this.tableSetting.recordsPerPage : PAGE_SIZE;
+ this.logger.info(this.displayedColumns);
+ });
+ this.store.select(payments).pipe(takeUntil(this.unSubs[3])).
subscribe((paymentsSeletor: { payments: Payments, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = paymentsSeletor.apiCallStatus;
@@ -152,6 +168,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
return (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: true });
this.payments.filterPredicate = (rowData: PaymentSent, fltr: string) => {
const newRowData = ((rowData.firstPartTimestamp) ? this.datePipe.transform(new Date(rowData.firstPartTimestamp), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(rowData).toLowerCase();
return newRowData.includes(fltr);
@@ -261,7 +278,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
if (this.paymentDecoded.amount) {
if (this.selNode && this.selNode.fiatConversion) {
this.commonService.convertCurrency(+this.paymentDecoded.amount, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
- pipe(takeUntil(this.unSubs[3])).
+ pipe(takeUntil(this.unSubs[4])).
subscribe({
next: (data) => {
this.paymentDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount ? this.paymentDecoded.amount : 0) + ' Sats (' + data.symbol + this.decimalPipe.transform((data.OTHER ? data.OTHER : 0), CURRENCY_UNIT_FORMATS.OTHER) + ') | Memo: ' + this.paymentDecoded.description;
@@ -385,7 +402,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
return paymentReqs;
}, '');
this.dataService.decodePayments(paymentRequests).
- pipe(takeUntil(this.unSubs[4])).
+ pipe(takeUntil(this.unSubs[5])).
subscribe((decodedPayments: any[][]) => {
decodedPayments.forEach((decodedPayment, idx) => {
if (decodedPayment.length > 0 && decodedPayment[0].paymentRequest && decodedPayment[0].paymentRequest.description && decodedPayment[0].paymentRequest.description !== '') {
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 3237a360..806096ac 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
@@ -42,7 +42,7 @@ export class ChannelClosedTableComponent implements OnInit, AfterViewInit, OnDes
public selFilter = '';
public apiCallStatus: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
- private unsub: Array> = [new Subject(), new Subject(), new Subject()];
+ private unSubs: Array> = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store, private commonService: CommonService) {
this.screenSize = this.commonService.getScreenSize();
@@ -56,7 +56,7 @@ export class ChannelClosedTableComponent implements OnInit, AfterViewInit, OnDes
}
ngOnInit() {
- this.store.select(closedChannels).pipe(takeUntil(this.unsub[0])).
+ this.store.select(closedChannels).pipe(takeUntil(this.unSubs[0])).
subscribe((closedChannelsSelector: { closedChannels: ClosedChannel[], apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = closedChannelsSelector.apiCallStatus;
@@ -122,7 +122,7 @@ export class ChannelClosedTableComponent implements OnInit, AfterViewInit, OnDes
}
ngOnDestroy() {
- this.unsub.forEach((completeSub) => {
+ this.unSubs.forEach((completeSub) => {
completeSub.next(null);
completeSub.complete();
});
diff --git a/src/app/shared/services/consts-enums-functions.ts b/src/app/shared/services/consts-enums-functions.ts
index 6ff740a8..fc0c890a 100644
--- a/src/app/shared/services/consts-enums-functions.ts
+++ b/src/app/shared/services/consts-enums-functions.ts
@@ -889,11 +889,11 @@ export const ECL_DEFAULT_PAGE_SETTINGS: PageSettings[] = [
{ tableId: 'open_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING,
columnSelectionSM: ['alias', 'toLocal', 'toRemote'],
columnSelection: ['shortChannelId', 'alias', 'feeBaseMsat', 'feeProportionalMillionths', 'toLocal', 'toRemote', 'balancedness'] },
- { tableId: 'pending_channels', recordsPerPage: PAGE_SIZE, sortBy: 'state', sortOrder: SortOrderEnum.DESCENDING,
+ { tableId: 'pending_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING,
columnSelectionSM: ['state', 'alias', 'toLocal'],
columnSelection: ['state', 'alias', 'toLocal', 'toRemote'] },
- { tableId: 'inactive_channels', recordsPerPage: PAGE_SIZE, sortBy: 'state', sortOrder: SortOrderEnum.DESCENDING,
- columnSelectionSM: ['state', 'alias', 'toLocal', 'toRemote'],
+ { tableId: 'inactive_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING,
+ columnSelectionSM: ['state', 'alias', 'toLocal'],
columnSelection: ['state', 'shortChannelId', 'alias', 'toLocal', 'toRemote', 'balancedness'] },
{ tableId: 'peers', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.ASCENDING,
columnSelectionSM: ['alias', 'nodeId'],
@@ -935,7 +935,7 @@ export const ECL_TABLES_DEF = {
peers_channels: {
open_channels: {
maxColumns: 8,
- allowedColumns: ['state', 'shortChannelId', 'channelId', 'alias', 'nodeId', 'isFunder', 'buried', 'feeBaseMsat', 'feeProportionalMillionths', 'toLocal', 'toRemote', 'feeRatePerKwLocal', 'feeRatePerKwRemote', 'balancedness']
+ allowedColumns: ['shortChannelId', 'channelId', 'alias', 'nodeId', 'isFunder', 'buried', 'feeBaseMsat', 'feeProportionalMillionths', 'toLocal', 'toRemote', 'feeRatePerKwLocal', 'feeRatePerKwRemote', 'balancedness']
},
pending_channels: {
maxColumns: 8,
@@ -962,8 +962,8 @@ export const ECL_TABLES_DEF = {
},
routing: {
forwarding_history: {
- maxColumns: 8,
- allowedColumns: ['timestamp', 'fromChannelId', 'fromShortChannelId', 'fromChannelAlias', 'toChannelId', 'toShortChannelId', 'toChannelAlias', 'amountIn', 'amountOut', 'paymentHash', 'fee']
+ maxColumns: 7,
+ allowedColumns: ['timestamp', 'fromChannelId', 'fromShortChannelId', 'fromChannelAlias', 'toChannelId', 'toShortChannelId', 'toChannelAlias', 'amountIn', 'amountOut', 'fee', 'paymentHash']
},
routing_peers: {
maxColumns: 5,
@@ -972,8 +972,8 @@ export const ECL_TABLES_DEF = {
},
reports: {
routing: {
- maxColumns: 8,
- allowedColumns: ['timestamp', 'fromChannelId', 'fromShortChannelId', 'fromChannelAlias', 'toChannelId', 'toShortChannelId', 'toChannelAlias', 'amountIn', 'amountOut', 'paymentHash', 'fee']
+ maxColumns: 7,
+ allowedColumns: ['timestamp', 'fromChannelId', 'fromShortChannelId', 'fromChannelAlias', 'toChannelId', 'toShortChannelId', 'toChannelAlias', 'amountIn', 'amountOut', 'fee', 'paymentHash']
},
transactions: {
maxColumns: 5,
| | | | | | | | | | |