mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2025-02-22 14:22:48 +01:00
CLN Routing Page Layout
This commit is contained in:
parent
4f6cebc98d
commit
744775a197
8 changed files with 158 additions and 56 deletions
|
@ -24,13 +24,29 @@
|
|||
<td mat-cell *matCellDef="let fhEvent">{{(fhEvent?.resolved_time * 1000) | date:'dd/MMM/y HH:mm'}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="in_channel">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>In Channel Id</th>
|
||||
<td mat-cell *matCellDef="let fhEvent">{{fhEvent?.in_channel}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="in_channel_alias">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>In Channel</th>
|
||||
<td mat-cell *matCellDef="let fhEvent">{{fhEvent?.in_channel_alias}}</td>
|
||||
<td mat-cell *matCellDef="let fhEvent">
|
||||
<span fxLayout="row" class="ellipsis-parent" [ngStyle]="{'max-width': (screenSize === screenSizeEnum.XS) ? '10rem' : '20rem'}">
|
||||
<span class="ellipsis-child">{{fhEvent?.in_channel_alias}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="out_channel">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Out Channel</th>
|
||||
<td mat-cell *matCellDef="let fhEvent">{{fhEvent?.out_channel_alias}}</td>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Out Channel Id</th>
|
||||
<td mat-cell *matCellDef="let fhEvent">{{fhEvent?.out_channel}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="out_channel_alias">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Out Channel</th>
|
||||
<td mat-cell *matCellDef="let fhEvent">
|
||||
<span fxLayout="row" class="ellipsis-parent" [ngStyle]="{'max-width': (screenSize === screenSizeEnum.XS) ? '10rem' : '20rem'}">
|
||||
<span class="ellipsis-child">{{fhEvent?.out_channel_alias}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="in_msatoshi">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before">Amount In (Sats)</th>
|
||||
<td mat-cell *matCellDef="let fhEvent"><span fxLayoutAlign="end center">{{fhEvent?.in_msatoshi/1000 | number:fhEvent?.in_msatoshi < 1000 ? '1.0-4' : '1.0-0'}}</span></td>
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
.mat-column-in_channel_alias, .mat-column-out_channel_alias {
|
||||
flex: 0 0 10%;
|
||||
width: 10%;
|
||||
& .ellipsis-parent {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
.mat-column-actions {
|
||||
min-height: 4.8rem;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import { MatSort } from '@angular/material/sort';
|
|||
import { MatTableDataSource } from '@angular/material/table';
|
||||
|
||||
import { ForwardingEvent, ListForwards } from '../../../shared/models/clnModels';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum, CLNForwardingEventsStatusEnum } from '../../../shared/services/consts-enums-functions';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum, CLNForwardingEventsStatusEnum, SortOrderEnum, CLN_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';
|
||||
|
@ -17,8 +17,9 @@ import { CommonService } from '../../../shared/services/common.service';
|
|||
import { RTLState } from '../../../store/rtl.state';
|
||||
import { openAlert } from '../../../store/rtl.actions';
|
||||
import { getForwardingHistory } from '../../store/cln.actions';
|
||||
import { failedForwardingHistory } from '../../store/cln.selector';
|
||||
import { clnPageSettings, failedForwardingHistory } from '../../store/cln.selector';
|
||||
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-failed-history',
|
||||
|
@ -32,6 +33,8 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
|
|||
|
||||
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
|
||||
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
|
||||
public PAGE_ID = 'routing';
|
||||
public tableSetting: TableSetting = { tableId: 'failed', recordsPerPage: PAGE_SIZE, sortBy: 'received_time', sortOrder: SortOrderEnum.DESCENDING };
|
||||
public faExclamationTriangle = faExclamationTriangle;
|
||||
public failedEvents: any;
|
||||
public errorMessage = '';
|
||||
|
@ -49,20 +52,30 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
|
|||
|
||||
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<RTLState>, private datePipe: DatePipe, private router: Router) {
|
||||
this.screenSize = this.commonService.getScreenSize();
|
||||
if (this.screenSize === ScreenSizeEnum.XS) {
|
||||
this.displayedColumns = ['received_time', 'in_channel', 'in_msatoshi', 'actions'];
|
||||
} else if (this.screenSize === ScreenSizeEnum.SM || this.screenSize === ScreenSizeEnum.MD) {
|
||||
this.displayedColumns = ['received_time', 'in_channel', 'out_channel', 'in_msatoshi', 'out_msatoshi', 'actions'];
|
||||
} else {
|
||||
this.displayedColumns = ['received_time', 'resolved_time', 'in_channel', 'out_channel', 'in_msatoshi', 'out_msatoshi', 'fee', 'actions'];
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED } }));
|
||||
this.store.select(failedForwardingHistory).pipe(takeUntil(this.unSubs[0])).
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], 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) || 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.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(failedForwardingHistory).pipe(takeUntil(this.unSubs[1])).
|
||||
subscribe((ffhSeletor: { failedForwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = ffhSeletor.apiCallStatus;
|
||||
|
@ -112,6 +125,7 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
|
|||
this.failedForwardingEvents = new MatTableDataSource<ForwardingEvent>([...forwardingEvents]);
|
||||
this.failedForwardingEvents.sort = this.sort;
|
||||
this.failedForwardingEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
|
||||
this.failedForwardingEvents.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
|
||||
this.failedForwardingEvents.filterPredicate = (event: ForwardingEvent, fltr: string) => {
|
||||
const newEvent =
|
||||
(event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm')!.toLowerCase() : '') +
|
||||
|
|
|
@ -20,16 +20,28 @@
|
|||
<td mat-cell *matCellDef="let fhEvent">{{(fhEvent?.received_time * 1000) | date:'dd/MMM/y HH:mm'}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="in_channel">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>In Channel Id</th>
|
||||
<td mat-cell *matCellDef="let fhEvent">{{fhEvent?.in_channel}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="in_channel_alias">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>In Channel</th>
|
||||
<td mat-cell *matCellDef="let fhEvent">{{fhEvent?.in_channel_alias}}</td>
|
||||
<td mat-cell *matCellDef="let fhEvent">
|
||||
<span fxLayout="row" class="ellipsis-parent" [ngStyle]="{'max-width': (screenSize === screenSizeEnum.XS) ? '10rem' : '20rem'}">
|
||||
<span class="ellipsis-child">{{fhEvent?.in_channel_alias}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="in_msatoshi">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before">Amount In (Sats)</th>
|
||||
<td mat-cell *matCellDef="let fhEvent"><span fxLayoutAlign="end center">{{fhEvent?.in_msatoshi/1000 | number:fhEvent?.in_msatoshi < 1000 ? '1.0-4' : '1.0-0'}}</span></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="style">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1">Style</th>
|
||||
<td mat-cell *matCellDef="let fhEvent" class="pl-1">{{fhEvent?.style}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="failreason">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-3">Fail Reason</th>
|
||||
<td mat-cell *matCellDef="let fhEvent" class="pl-3">{{CLNFailReason[fhEvent?.failreason]}}</td>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1">Fail Reason</th>
|
||||
<td mat-cell *matCellDef="let fhEvent" class="pl-1">{{CLNFailReason[fhEvent?.failreason]}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef class="px-3">
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
.mat-column-in_channel_alias {
|
||||
flex: 0 0 10%;
|
||||
width: 10%;
|
||||
& .ellipsis-parent {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
.mat-column-actions {
|
||||
min-height: 4.8rem;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import { MatSort } from '@angular/material/sort';
|
|||
import { MatTableDataSource } from '@angular/material/table';
|
||||
|
||||
import { ListForwards, LocalFailedEvent } from '../../../shared/models/clnModels';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum, CLNFailReason, CLNForwardingEventsStatusEnum } from '../../../shared/services/consts-enums-functions';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum, CLNFailReason, CLNForwardingEventsStatusEnum, SortOrderEnum, CLN_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';
|
||||
|
@ -17,8 +17,9 @@ import { CommonService } from '../../../shared/services/common.service';
|
|||
import { RTLState } from '../../../store/rtl.state';
|
||||
import { openAlert } from '../../../store/rtl.actions';
|
||||
import { getForwardingHistory } from '../../store/cln.actions';
|
||||
import { localFailedForwardingHistory } from '../../store/cln.selector';
|
||||
import { clnPageSettings, localFailedForwardingHistory } from '../../store/cln.selector';
|
||||
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-local-failed-history',
|
||||
|
@ -33,6 +34,8 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
|
|||
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
|
||||
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
|
||||
public faExclamationTriangle = faExclamationTriangle;
|
||||
public PAGE_ID = 'routing';
|
||||
public tableSetting: TableSetting = { tableId: 'local_failed', recordsPerPage: PAGE_SIZE, sortBy: 'received_time', sortOrder: SortOrderEnum.DESCENDING };
|
||||
public CLNFailReason = CLNFailReason;
|
||||
public failedLocalEvents: any;
|
||||
public errorMessage = '';
|
||||
|
@ -50,20 +53,30 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
|
|||
|
||||
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<RTLState>, private datePipe: DatePipe, private router: Router) {
|
||||
this.screenSize = this.commonService.getScreenSize();
|
||||
if (this.screenSize === ScreenSizeEnum.XS) {
|
||||
this.displayedColumns = ['received_time', 'in_channel', 'in_msatoshi', 'actions'];
|
||||
} else if (this.screenSize === ScreenSizeEnum.SM || this.screenSize === ScreenSizeEnum.MD) {
|
||||
this.displayedColumns = ['received_time', 'in_channel', 'in_msatoshi', 'actions'];
|
||||
} else {
|
||||
this.displayedColumns = ['received_time', 'in_channel', 'in_msatoshi', 'failreason', 'actions'];
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED } }));
|
||||
this.store.select(localFailedForwardingHistory).pipe(takeUntil(this.unSubs[0])).
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], 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) || 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.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(localFailedForwardingHistory).pipe(takeUntil(this.unSubs[1])).
|
||||
subscribe((lffhSeletor: { localFailedForwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = lffhSeletor.apiCallStatus;
|
||||
|
@ -105,13 +118,6 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
|
|||
|
||||
loadLocalfailedLocalEventsTable(forwardingEvents: LocalFailedEvent[]) {
|
||||
this.failedLocalForwardingEvents = new MatTableDataSource<LocalFailedEvent>([...forwardingEvents]);
|
||||
this.failedLocalForwardingEvents.filterPredicate = (event: LocalFailedEvent, fltr: string) => {
|
||||
const newEvent = (event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') +
|
||||
(event.in_channel_alias ? event.in_channel_alias.toLowerCase() : '') +
|
||||
((event.failreason && this.CLNFailReason[event.failreason]) ? this.CLNFailReason[event.failreason].toLowerCase() : '') +
|
||||
(event.in_msatoshi ? (event.in_msatoshi / 1000) : '');
|
||||
return newEvent?.includes(fltr) || false;
|
||||
};
|
||||
this.failedLocalForwardingEvents.sort = this.sort;
|
||||
this.failedLocalForwardingEvents.sortingDataAccessor = (data: LocalFailedEvent, sortHeaderId: string) => {
|
||||
switch (sortHeaderId) {
|
||||
|
@ -122,6 +128,14 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
|
|||
return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;
|
||||
}
|
||||
};
|
||||
this.failedLocalForwardingEvents.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
|
||||
this.failedLocalForwardingEvents.filterPredicate = (event: LocalFailedEvent, fltr: string) => {
|
||||
const newEvent = (event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') +
|
||||
(event.in_channel_alias ? event.in_channel_alias.toLowerCase() : '') +
|
||||
((event.failreason && this.CLNFailReason[event.failreason]) ? this.CLNFailReason[event.failreason].toLowerCase() : '') +
|
||||
(event.in_msatoshi ? (event.in_msatoshi / 1000) : '');
|
||||
return newEvent?.includes(fltr) || false;
|
||||
};
|
||||
this.failedLocalForwardingEvents.paginator = this.paginator;
|
||||
this.applyFilter();
|
||||
this.logger.info(this.failedLocalForwardingEvents);
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
import { Component, OnInit, AfterViewInit, ViewChild, OnDestroy, Input, SimpleChanges, OnChanges } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { take, takeUntil } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
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, CLN_DEFAULT_PAGE_SETTINGS, CLNForwardingEventsStatusEnum } from '../../../shared/services/consts-enums-functions';
|
||||
import { ForwardingEvent, ListForwards, RoutingPeer } from '../../../shared/models/clnModels';
|
||||
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 { forwardingHistory } from '../../store/cln.selector';
|
||||
import { clnPageSettings, forwardingHistory } from '../../store/cln.selector';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../shared/models/pageSettings';
|
||||
import { getForwardingHistory } from '../../store/cln.actions';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-routing-peers',
|
||||
|
@ -31,6 +33,8 @@ export class CLNRoutingPeersComponent implements OnInit, OnChanges, AfterViewIni
|
|||
@ViewChild('paginatorOut', { static: false }) paginatorOut: MatPaginator | undefined;
|
||||
@Input() eventsData = [];
|
||||
@Input() filterValue = '';
|
||||
public PAGE_ID = 'routing';
|
||||
public tableSetting: TableSetting = { tableId: 'routing_peers', recordsPerPage: PAGE_SIZE, sortBy: 'total_fee', sortOrder: SortOrderEnum.DESCENDING };
|
||||
public successfulEvents: ForwardingEvent[] = [];
|
||||
public displayedColumns: any[] = [];
|
||||
public RoutingPeersIncoming: any = [];
|
||||
|
@ -48,19 +52,31 @@ export class CLNRoutingPeersComponent implements OnInit, OnChanges, AfterViewIni
|
|||
|
||||
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<RTLState>) {
|
||||
this.screenSize = this.commonService.getScreenSize();
|
||||
if (this.screenSize === ScreenSizeEnum.XS) {
|
||||
this.displayedColumns = ['alias', 'total_fee'];
|
||||
} else if (this.screenSize === ScreenSizeEnum.SM) {
|
||||
this.displayedColumns = ['alias', 'events', 'total_fee'];
|
||||
} else if (this.screenSize === ScreenSizeEnum.MD) {
|
||||
this.displayedColumns = ['alias', 'events', 'total_amount', 'total_fee'];
|
||||
} else {
|
||||
this.displayedColumns = ['channel_id', 'alias', 'events', 'total_amount', 'total_fee'];
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.store.select(forwardingHistory).pipe(takeUntil(this.unSubs[0])).
|
||||
this.store.pipe(take(1)).subscribe((state) => {
|
||||
if (state.cln.apisCallStatus.FetchForwardingHistoryS.status === APICallStatusEnum.UN_INITIATED && !state.cln.forwardingHistory.listForwards?.length) {
|
||||
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.SETTLED } }));
|
||||
}
|
||||
});
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], 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) || 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.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(forwardingHistory).pipe(takeUntil(this.unSubs[1])).
|
||||
subscribe((fhSeletor: { forwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
|
||||
if (this.eventsData.length <= 0) {
|
||||
this.errorMessage = '';
|
||||
|
@ -99,11 +115,13 @@ export class CLNRoutingPeersComponent implements OnInit, OnChanges, AfterViewIni
|
|||
const results = this.groupRoutingPeers(events);
|
||||
this.RoutingPeersIncoming = new MatTableDataSource<RoutingPeer[]>(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: RoutingPeer, fltr: string) => JSON.stringify(rpIn).toLowerCase().includes(fltr);
|
||||
this.RoutingPeersIncoming.paginator = this.paginatorIn;
|
||||
this.logger.info(this.RoutingPeersIncoming);
|
||||
this.RoutingPeersOutgoing = new MatTableDataSource<RoutingPeer[]>(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: RoutingPeer, fltr: string) => JSON.stringify(rpOut).toLowerCase().includes(fltr);
|
||||
this.RoutingPeersOutgoing.paginator = this.paginatorOut;
|
||||
this.logger.info(this.RoutingPeersOutgoing);
|
||||
|
|
|
@ -716,16 +716,16 @@ export const CLN_DEFAULT_PAGE_SETTINGS: PageSettingsCLN[] = [
|
|||
{ pageId: 'routing', tables: [
|
||||
{ tableId: 'forwarding_history', recordsPerPage: PAGE_SIZE, sortBy: 'received_time', sortOrder: SortOrderEnum.DESCENDING,
|
||||
columnSelectionSM: ['received_time', 'in_msatoshi', 'out_msatoshi'],
|
||||
columnSelection: ['received_time', 'resolved_time', 'in_channel_alias', 'out_channel_alias', 'in_msatoshi', 'out_msatoshi', 'fee'] }
|
||||
// { tableId: 'routing_peers', recordsPerPage: PAGE_SIZE, sortBy: 'expires_at', sortOrder: SortOrderEnum.DESCENDING,
|
||||
// columnSelectionSM: ['expires_at', 'msatoshi'],
|
||||
// columnSelection: ['expires_at', 'paid_at', 'type', 'description', 'msatoshi', 'msatoshi_received'] },
|
||||
// { tableId: 'failed', recordsPerPage: PAGE_SIZE, sortBy: 'offer_id', sortOrder: SortOrderEnum.DESCENDING,
|
||||
// columnSelectionSM: ['offer_id', 'single_use'],
|
||||
// columnSelection: ['offer_id', 'single_use', 'used'] },
|
||||
// { tableId: 'local_failed', recordsPerPage: PAGE_SIZE, sortBy: 'lastUpdatedAt', sortOrder: SortOrderEnum.DESCENDING,
|
||||
// columnSelectionSM: ['lastUpdatedAt', 'amountMSat'],
|
||||
// columnSelection: ['lastUpdatedAt', 'title', 'amountMSat', 'description'] }
|
||||
columnSelection: ['received_time', 'resolved_time', 'in_channel_alias', 'out_channel_alias', 'in_msatoshi', 'out_msatoshi', 'fee'] },
|
||||
{ tableId: 'routing_peers', recordsPerPage: PAGE_SIZE, sortBy: 'total_fee', sortOrder: SortOrderEnum.DESCENDING,
|
||||
columnSelectionSM: ['alias', 'events', 'total_fee'],
|
||||
columnSelection: ['channel_id', 'alias', 'events', 'total_amount', 'total_fee'] },
|
||||
{ tableId: 'failed', recordsPerPage: PAGE_SIZE, sortBy: 'received_time', sortOrder: SortOrderEnum.DESCENDING,
|
||||
columnSelectionSM: ['received_time', 'in_channel_alias', 'in_msatoshi'],
|
||||
columnSelection: ['received_time', 'resolved_time', 'in_channel_alias', 'out_channel_alias', 'in_msatoshi', 'out_msatoshi', 'fee'] },
|
||||
{ tableId: 'local_failed', recordsPerPage: PAGE_SIZE, sortBy: 'received_time', sortOrder: SortOrderEnum.DESCENDING,
|
||||
columnSelectionSM: ['received_time', 'in_channel_alias', 'in_msatoshi'],
|
||||
columnSelection: ['received_time', 'in_channel_alias', 'in_msatoshi', 'style', 'failreason'] }
|
||||
] }
|
||||
];
|
||||
|
||||
|
@ -773,5 +773,17 @@ export const CLN_TABLES_DEF = {
|
|||
forwarding_history: {
|
||||
maxColumns: 8,
|
||||
allowedColumns: ['received_time', 'resolved_time', 'in_channel', 'in_channel_alias', 'out_channel', 'out_channel_alias', 'payment_hash', 'in_msatoshi', 'out_msatoshi', 'fee']
|
||||
},
|
||||
routing_peers: {
|
||||
maxColumns: 5,
|
||||
allowedColumns: ['channel_id', 'alias', 'events', 'total_amount', 'total_fee']
|
||||
},
|
||||
failed: {
|
||||
maxColumns: 7,
|
||||
allowedColumns: ['received_time', 'resolved_time', 'in_channel', 'in_channel_alias', 'out_channel', 'out_channel_alias', 'in_msatoshi', 'out_msatoshi', 'fee']
|
||||
},
|
||||
local_failed: {
|
||||
maxColumns: 6,
|
||||
allowedColumns: ['received_time', 'in_channel', 'in_channel_alias', 'in_msatoshi', 'style', 'failreason']
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue