Forwarding events pagination incomplete

Forwarding events pagination incomplete
pull/1033/head^2
Shahana Farooqui 2 years ago committed by ShahanaFarooqui
parent c7fd9fad08
commit 1580c296cd

@ -141,3 +141,27 @@ export const funderUpdatePolicy = (req, res, next) => {
return res.status(err.statusCode).json({ message: err.message, error: err.error });
});
};
export const listForwardsPaginated = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Getting Paginated List Forwards..' });
options = common.getOptions(req);
if (options.error) {
return res.status(options.statusCode).json({ message: options.message, error: options.error });
}
let queryStr = '';
if (req.query && Object.keys(req.query).length > 0) {
queryStr = req.query.status ? '&status=' + req.query.status : '';
queryStr = req.query.maxLen ? (queryStr + '&maxLen=' + req.query.maxLen) : '';
queryStr = req.query.offset ? (queryStr + '&offset=' + req.query.offset) : '';
queryStr = req.query.reverse ? (queryStr + '&reverse=' + req.query.reverse) : '';
queryStr = queryStr.replace('&', '?');
}
options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listForwardsFilter' + queryStr;
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Paginated Forwarding History url' + options.url });
request.get(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Paginated Forwarding History Received For Status' + req.query.status, data: body });
res.status(200).json(body);
}).catch((errRes) => {
const err = common.handleError(errRes, 'Channels', 'Paginated Forwarding History Error', req.session.selectedNode);
return res.status(err.statusCode).json({ message: err.message, error: err.error });
});
};

@ -70,7 +70,8 @@ export const listNodes = (req, res, next) => {
if (options.error) {
return res.status(options.statusCode).json({ message: options.message, error: options.error });
}
options.url = req.session.selectedNode.ln_server_url + '/v1/network/listNodes' + (req.query !== {} ? (JSON.stringify(req.query).replace('{', '?').replace('}', '').replace(/:/g, '=').replace(/,/g, '&').replace(/"/g, '')) : '');
const queryStr = req.query.liquidity_ads ? '?liquidity_ads=' + req.query.liquidity_ads : '';
options.url = req.session.selectedNode.ln_server_url + '/v1/network/listNodes' + queryStr;
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Network', msg: 'List Nodes URL' + options.url });
request(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Network', msg: 'List Nodes Finished', data: body });

@ -1,7 +1,7 @@
import exprs from 'express';
const { Router } = exprs;
import { isAuthenticated } from '../../utils/authCheck.js';
import { listChannels, openChannel, setChannelFee, closeChannel, getLocalRemoteBalance, listForwards, funderUpdatePolicy } from '../../controllers/cln/channels.js';
import { listChannels, openChannel, setChannelFee, closeChannel, getLocalRemoteBalance, listForwards, funderUpdatePolicy, listForwardsPaginated } from '../../controllers/cln/channels.js';
const router = Router();
router.get('/listChannels', isAuthenticated, listChannels);
router.post('/', isAuthenticated, openChannel);
@ -9,5 +9,6 @@ router.post('/setChannelFee', isAuthenticated, setChannelFee);
router.delete('/:channelId', isAuthenticated, closeChannel);
router.get('/localRemoteBalance', isAuthenticated, getLocalRemoteBalance);
router.get('/listForwards', isAuthenticated, listForwards);
router.get('/listForwardsPaginated', isAuthenticated, listForwardsPaginated);
router.post('/funderUpdate', isAuthenticated, funderUpdatePolicy);
export default router;

@ -126,3 +126,26 @@ export const funderUpdatePolicy = (req, res, next) => {
return res.status(err.statusCode).json({ message: err.message, error: err.error });
});
};
export const listForwardsPaginated = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Getting Paginated List Forwards..' });
options = common.getOptions(req);
if (options.error) { return res.status(options.statusCode).json({ message: options.message, error: options.error }); }
let queryStr = '';
if (req.query && Object.keys(req.query).length > 0) {
queryStr = req.query.status ? '&status=' + req.query.status : '';
queryStr = req.query.maxLen ? (queryStr + '&maxLen=' + req.query.maxLen) : '';
queryStr = req.query.offset ? (queryStr + '&offset=' + req.query.offset) : '';
queryStr = req.query.reverse ? (queryStr + '&reverse=' + req.query.reverse) : '';
queryStr = queryStr.replace('&', '?');
}
options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listForwardsFilter' + queryStr;
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Paginated Forwarding History url' + options.url });
request.get(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Paginated Forwarding History Received For Status' + req.query.status, data: body });
res.status(200).json(body);
}).catch((errRes) => {
const err = common.handleError(errRes, 'Channels', 'Paginated Forwarding History Error', req.session.selectedNode);
return res.status(err.statusCode).json({ message: err.message, error: err.error });
});
};

@ -65,7 +65,8 @@ export const listNodes = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Network', msg: 'List Nodes..' });
options = common.getOptions(req);
if (options.error) { return res.status(options.statusCode).json({ message: options.message, error: options.error }); }
options.url = req.session.selectedNode.ln_server_url + '/v1/network/listNodes' + (req.query !== {} ? (JSON.stringify(req.query).replace('{', '?').replace('}', '').replace(/:/g, '=').replace(/,/g, '&').replace(/"/g, '')) : '');
const queryStr = req.query.liquidity_ads ? '?liquidity_ads=' + req.query.liquidity_ads : '';
options.url = req.session.selectedNode.ln_server_url + '/v1/network/listNodes' + queryStr;
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Network', msg: 'List Nodes URL' + options.url });
request(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Network', msg: 'List Nodes Finished', data: body });

@ -1,7 +1,7 @@
import exprs from 'express';
const { Router } = exprs;
import { isAuthenticated } from '../../utils/authCheck.js';
import { listChannels, openChannel, setChannelFee, closeChannel, getLocalRemoteBalance, listForwards, funderUpdatePolicy } from '../../controllers/cln/channels.js';
import { listChannels, openChannel, setChannelFee, closeChannel, getLocalRemoteBalance, listForwards, funderUpdatePolicy, listForwardsPaginated } from '../../controllers/cln/channels.js';
const router = Router();
@ -12,6 +12,7 @@ router.delete('/:channelId', isAuthenticated, closeChannel);
router.get('/localRemoteBalance', isAuthenticated, getLocalRemoteBalance);
router.get('/listForwards', isAuthenticated, listForwards);
router.get('/listForwardsPaginated', isAuthenticated, listForwardsPaginated);
router.post('/funderUpdate', isAuthenticated, funderUpdatePolicy);

@ -5,7 +5,7 @@ import { Store } from '@ngrx/store';
import { faBolt, faServer, faNetworkWired, faLink } from '@fortawesome/free-solid-svg-icons';
import { SelNodeChild } from '../../shared/models/RTLconfig';
import { GetInfo, Fees, ChannelsStatus, FeeRates, ForwardingEvent, LocalRemoteBalance, Channel } from '../../shared/models/clnModels';
import { GetInfo, Fees, ChannelsStatus, FeeRates, ForwardingEvent, LocalRemoteBalance, Channel, ListForwards } from '../../shared/models/clnModels';
import { APICallStatusEnum, ScreenSizeEnum, UserPersonaEnum } from '../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../shared/models/apiCallsPayload';
import { LoggerService } from '../../shared/services/logger.service';
@ -122,14 +122,14 @@ export class CLNNetworkInfoComponent implements OnInit, OnDestroy {
this.fees = feesSeletor.fees;
});
this.store.select(forwardingHistory).pipe(takeUntil(this.unSubs[3])).
subscribe((fhSeletor: { forwardingHistory: ForwardingEvent[], apiCallStatus: ApiCallStatusPayload }) => {
subscribe((fhSeletor: { forwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessages[4] = '';
this.apiCallStatusFHistory = fhSeletor.apiCallStatus;
if (this.apiCallStatusFHistory.status === APICallStatusEnum.ERROR) {
this.errorMessages[4] = (typeof (this.apiCallStatusFHistory.message) === 'object') ? JSON.stringify(this.apiCallStatusFHistory.message) : this.apiCallStatusFHistory.message;
}
if (fhSeletor.forwardingHistory && fhSeletor.forwardingHistory.length) {
this.fees.totalTxCount = fhSeletor.forwardingHistory.length;
if (fhSeletor.forwardingHistory && fhSeletor.forwardingHistory.listForwards.length) {
this.fees.totalTxCount = fhSeletor.forwardingHistory.listForwards.length;
}
});
this.store.select(feeRatesPerKB).pipe(takeUntil(this.unSubs[4])).

@ -3,7 +3,7 @@ import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { ForwardingEvent } from '../../../shared/models/clnModels';
import { ForwardingEvent, ListForwards } from '../../../shared/models/clnModels';
import { APICallStatusEnum, MONTHS, ReportBy, ScreenSizeEnum, SCROLL_RANGES } from '../../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
@ -52,13 +52,13 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
this.screenSize = this.commonService.getScreenSize();
this.showYAxisLabel = !(this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM);
this.store.select(forwardingHistory).pipe(takeUntil(this.unSubs[0])).
subscribe((fhSeletor: { forwardingHistory: ForwardingEvent[], apiCallStatus: ApiCallStatusPayload }) => {
subscribe((fhSeletor: { forwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = fhSeletor.apiCallStatus;
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
this.events = fhSeletor.forwardingHistory || [];
this.events = fhSeletor.forwardingHistory.listForwards || [];
this.filterForwardingEvents(this.startDate, this.endDate);
this.logger.info(fhSeletor);
});

@ -62,5 +62,5 @@
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
<mat-paginator *ngIf="errorMessage === ''" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator>
<mat-paginator *ngIf="errorMessage === ''" [length]="totalFailedTransactions" (page)="onPageChange($event)" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator>
</div>

@ -4,19 +4,19 @@ import { DatePipe } from '@angular/common';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatPaginator, MatPaginatorIntl, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { ForwardingEvent } from '../../../shared/models/clnModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
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 { 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 { getFailedForwardingHistory } from '../../store/cln.actions';
import { getForwardingHistory } from '../../store/cln.actions';
import { failedForwardingHistory } from '../../store/cln.selector';
@Component({
@ -37,6 +37,9 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
public failedForwardingEvents: any;
public flgSticky = false;
public selFilter = '';
private firstOffset = -1;
private lastOffset = -1;
public totalFailedTransactions = 0;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
@ -62,15 +65,18 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
ngOnInit() {
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
this.router.onSameUrlNavigation = 'reload';
this.store.dispatch(getFailedForwardingHistory());
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED, maxLen: this.pageSize, offset: 0, reverse: true } }));
this.store.select(failedForwardingHistory).pipe(takeUntil(this.unSubs[0])).
subscribe((ffhSeletor: { failedForwardingHistory: ForwardingEvent[], apiCallStatus: ApiCallStatusPayload }) => {
subscribe((ffhSeletor: { failedForwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = ffhSeletor.apiCallStatus;
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
this.failedEvents = ffhSeletor.failedForwardingHistory || [];
this.totalFailedTransactions = ffhSeletor.failedForwardingHistory.totalEvents;
this.firstOffset = ffhSeletor.failedForwardingHistory.firstIndexOffset;
this.lastOffset = ffhSeletor.failedForwardingHistory.lastIndexOffset;
this.failedEvents = ffhSeletor.failedForwardingHistory.listForwards || [];
if (this.failedEvents.length > 0 && this.sort && this.paginator) {
this.loadFailedEventsTable(this.failedEvents);
}
@ -136,6 +142,26 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
this.failedForwardingEvents.filter = this.selFilter.trim().toLowerCase();
}
onPageChange(event: PageEvent) {
let reverse = true;
let index_offset = this.lastOffset;
this.pageSize = event.pageSize;
if (event.pageIndex === 0) {
reverse = true;
index_offset = 0;
} else if (event.pageIndex < event.previousPageIndex) {
reverse = false;
index_offset = this.lastOffset;
} else if (event.pageIndex > event.previousPageIndex && (event.length > ((event.pageIndex + 1) * event.pageSize))) {
reverse = true;
index_offset = this.firstOffset;
} else if (event.length <= ((event.pageIndex + 1) * event.pageSize)) {
reverse = false;
index_offset = 0;
}
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED, maxLen: event.pageSize, offset: index_offset, reverse: reverse } }));
}
ngOnDestroy() {
this.unSubs.forEach((completeSub) => {
completeSub.next(null);

@ -66,5 +66,5 @@
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
<mat-paginator *ngIf="errorMessage === ''" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator>
<mat-paginator *ngIf="errorMessage === ''" [length]="totalForwardedTransactions" (page)="onPageChange($event)" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator>
</div>

@ -3,12 +3,12 @@ import { DatePipe } from '@angular/common';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatPaginator, MatPaginatorIntl, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { ForwardingEvent } from '../../../shared/models/clnModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
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 { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
@ -16,6 +16,7 @@ import { CommonService } from '../../../shared/services/common.service';
import { RTLState } from '../../../store/rtl.state';
import { openAlert } from '../../../store/rtl.actions';
import { forwardingHistory } from '../../store/cln.selector';
import { getForwardingHistory } from '../../store/cln.actions';
@Component({
selector: 'rtl-cln-forwarding-history',
@ -35,6 +36,9 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
public displayedColumns: any[] = [];
public forwardingHistoryEvents: any;
public flgSticky = false;
private firstOffset = -1;
private lastOffset = -1;
public totalForwardedTransactions = 0;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
@ -60,14 +64,17 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
ngOnInit() {
this.store.select(forwardingHistory).pipe(takeUntil(this.unSubs[0])).
subscribe((fhSeletor: { forwardingHistory: ForwardingEvent[], apiCallStatus: ApiCallStatusPayload }) => {
subscribe((fhSeletor: { forwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = fhSeletor.apiCallStatus;
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
if (this.eventsData.length <= 0) {
this.errorMessage = '';
this.apiCallStatus = fhSeletor.apiCallStatus;
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
this.successfulEvents = fhSeletor.forwardingHistory || [];
this.totalForwardedTransactions = fhSeletor.forwardingHistory.totalEvents;
this.firstOffset = fhSeletor.forwardingHistory.firstIndexOffset;
this.lastOffset = fhSeletor.forwardingHistory.lastIndexOffset;
this.successfulEvents = fhSeletor.forwardingHistory.listForwards || [];
if (this.successfulEvents.length > 0 && this.sort && this.paginator) {
this.loadForwardingEventsTable(this.successfulEvents);
}
@ -147,6 +154,26 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
}
}
onPageChange(event: PageEvent) {
let reverse = true;
let index_offset = this.lastOffset;
this.pageSize = event.pageSize;
if (event.pageIndex === 0) {
reverse = true;
index_offset = 0;
} else if (event.pageIndex < event.previousPageIndex) {
reverse = false;
index_offset = this.lastOffset;
} else if (event.pageIndex > event.previousPageIndex && (event.length > ((event.pageIndex + 1) * event.pageSize))) {
reverse = true;
index_offset = this.firstOffset;
} else if (event.length <= ((event.pageIndex + 1) * event.pageSize)) {
reverse = false;
index_offset = 0;
}
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.SETTLED, maxLen: event.pageSize, offset: index_offset, reverse: reverse } }));
}
ngOnDestroy() {
this.unSubs.forEach((completeSub) => {
completeSub.next(null);

@ -50,5 +50,5 @@
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
<mat-paginator *ngIf="errorMessage === ''" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator>
<mat-paginator *ngIf="errorMessage === ''" [length]="totalLocalFailedTransactions" (page)="onPageChange($event)" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator>
</div>

@ -4,19 +4,19 @@ import { DatePipe } from '@angular/common';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatPaginator, MatPaginatorIntl, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { LocalFailedEvent } from '../../../shared/models/clnModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum, CLNFailReason } from '../../../shared/services/consts-enums-functions';
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 { 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 { getLocalFailedForwardingHistory } from '../../store/cln.actions';
import { getForwardingHistory } from '../../store/cln.actions';
import { localFailedForwardingHistory } from '../../store/cln.selector';
@Component({
@ -38,6 +38,9 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
public failedLocalForwardingEvents: any;
public flgSticky = false;
public selFilter = '';
private firstOffset = -1;
private lastOffset = -1;
public totalLocalFailedTransactions = 0;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
@ -63,15 +66,18 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
ngOnInit() {
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
this.router.onSameUrlNavigation = 'reload';
this.store.dispatch(getLocalFailedForwardingHistory());
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED, maxLen: this.pageSize, offset: 0, reverse: true } }));
this.store.select(localFailedForwardingHistory).pipe(takeUntil(this.unSubs[0])).
subscribe((lffhSeletor: { localFailedForwardingHistory: LocalFailedEvent[], apiCallStatus: ApiCallStatusPayload }) => {
subscribe((lffhSeletor: { localFailedForwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = lffhSeletor.apiCallStatus;
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
this.failedLocalEvents = lffhSeletor.localFailedForwardingHistory || [];
this.totalLocalFailedTransactions = lffhSeletor.localFailedForwardingHistory.totalEvents;
this.firstOffset = lffhSeletor.localFailedForwardingHistory.firstIndexOffset;
this.lastOffset = lffhSeletor.localFailedForwardingHistory.lastIndexOffset;
this.failedLocalEvents = lffhSeletor.localFailedForwardingHistory.listForwards || [];
if (this.failedLocalEvents.length > 0 && this.sort && this.paginator) {
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents);
}
@ -137,6 +143,26 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
this.failedLocalForwardingEvents.filter = this.selFilter.trim().toLowerCase();
}
onPageChange(event: PageEvent) {
let reverse = true;
let index_offset = this.lastOffset;
this.pageSize = event.pageSize;
if (event.pageIndex === 0) {
reverse = true;
index_offset = 0;
} else if (event.pageIndex < event.previousPageIndex) {
reverse = false;
index_offset = this.lastOffset;
} else if (event.pageIndex > event.previousPageIndex && (event.length > ((event.pageIndex + 1) * event.pageSize))) {
reverse = true;
index_offset = this.firstOffset;
} else if (event.length <= ((event.pageIndex + 1) * event.pageSize)) {
reverse = false;
index_offset = 0;
}
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED, maxLen: event.pageSize, offset: index_offset, reverse: reverse } }));
}
ngOnDestroy() {
this.unSubs.forEach((completeSub) => {
completeSub.next(null);

@ -7,7 +7,7 @@ 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 { ForwardingEvent, RoutingPeer } from '../../../shared/models/clnModels';
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';
@ -66,14 +66,14 @@ export class CLNRoutingPeersComponent implements OnInit, OnChanges, AfterViewIni
ngOnInit() {
this.store.select(forwardingHistory).pipe(takeUntil(this.unSubs[0])).
subscribe((fhSeletor: { forwardingHistory: ForwardingEvent[], apiCallStatus: ApiCallStatusPayload }) => {
subscribe((fhSeletor: { forwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
if (this.eventsData.length <= 0) {
this.errorMessage = '';
this.apiCallStatus = fhSeletor.apiCallStatus;
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
this.successfulEvents = fhSeletor.forwardingHistory || [];
this.successfulEvents = fhSeletor.forwardingHistory.listForwards || [];
if (this.successfulEvents.length > 0 && this.sortIn && this.paginatorIn && this.sortOut && this.paginatorOut) {
this.loadRoutingPeersTable(this.successfulEvents);
}

@ -1,9 +1,9 @@
import { createAction, props } from '@ngrx/store';
import { CLNActions } from '../../shared/services/consts-enums-functions';
import { CLNActions, CLNForwardingEventsStatusEnum } from '../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../shared/models/apiCallsPayload';
import { SelNodeChild } from '../../shared/models/RTLconfig';
import { GetInfo, Fees, Peer, Payment, QueryRoutes, Channel, FeeRates, ForwardingEvent, Invoice, ListInvoices, OnChain, UTXO, SaveChannel, GetNewAddress, DetachPeer, UpdateChannel, CloseChannel, SendPayment, GetQueryRoutes, ChannelLookup, OfferInvoice, Offer, OfferBookmark, LocalFailedEvent } from '../../shared/models/clnModels';
import { GetInfo, Fees, Peer, Payment, QueryRoutes, Channel, FeeRates, Invoice, ListInvoices, OnChain, UTXO, SaveChannel, GetNewAddress, DetachPeer, UpdateChannel, CloseChannel, SendPayment, GetQueryRoutes, ChannelLookup, OfferInvoice, Offer, OfferBookmark, ListForwards, FetchListForwards } from '../../shared/models/clnModels';
export const updateCLAPICallStatus = createAction(CLNActions.UPDATE_API_CALL_STATUS_CLN, props<{ payload: ApiCallStatusPayload }>());
@ -81,17 +81,9 @@ export const invoiceLookup = createAction(CLNActions.INVOICE_LOOKUP_CLN, props<{
export const setLookup = createAction(CLNActions.SET_LOOKUP_CLN, props<{ payload: any }>());
export const getForwardingHistory = createAction(CLNActions.GET_FORWARDING_HISTORY_CLN, props<{ payload: { status: string } }>());
export const getForwardingHistory = createAction(CLNActions.GET_FORWARDING_HISTORY_CLN, props<{ payload: FetchListForwards }>());
export const setForwardingHistory = createAction(CLNActions.SET_FORWARDING_HISTORY_CLN, props<{ payload: ForwardingEvent[] }>());
export const getFailedForwardingHistory = createAction(CLNActions.GET_FAILED_FORWARDING_HISTORY_CLN);
export const setFailedForwardingHistory = createAction(CLNActions.SET_FAILED_FORWARDING_HISTORY_CLN, props<{ payload: ForwardingEvent[] }>());
export const getLocalFailedForwardingHistory = createAction(CLNActions.GET_LOCAL_FAILED_FORWARDING_HISTORY_CLN);
export const setLocalFailedForwardingHistory = createAction(CLNActions.SET_LOCAL_FAILED_FORWARDING_HISTORY_CLN, props<{ payload: LocalFailedEvent[] }>());
export const setForwardingHistory = createAction(CLNActions.SET_FORWARDING_HISTORY_CLN, props<{ payload: { status: CLNForwardingEventsStatusEnum, response: ListForwards } }>());
export const fetchInvoices = createAction(CLNActions.FETCH_INVOICES_CLN, props<{ payload: { num_max_invoices?: number, index_offset?: number, reversed?: boolean } }>());

@ -4,7 +4,7 @@ import { Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { Subject, of } from 'rxjs';
import { map, mergeMap, catchError, withLatestFrom, takeUntil } from 'rxjs/operators';
import { map, mergeMap, catchError, takeUntil } from 'rxjs/operators';
import { Location } from '@angular/common';
import { environment, API_URL } from '../../../environments/environment';
@ -14,13 +14,13 @@ import { SessionService } from '../../shared/services/session.service';
import { WebSocketClientService } from '../../shared/services/web-socket.service';
import { ErrorMessageComponent } from '../../shared/components/data-modal/error-message/error-message.component';
import { CLNInvoiceInformationComponent } from '../transactions/invoices/invoice-information-modal/invoice-information.component';
import { GetInfo, Fees, Balance, LocalRemoteBalance, Payment, FeeRates, ListInvoices, Invoice, Peer, ForwardingEvent, OnChain, QueryRoutes, PayRequest, SaveChannel, GetNewAddress, DetachPeer, UpdateChannel, CloseChannel, DecodePayment, SendPayment, GetQueryRoutes, ChannelLookup, FetchInvoices, Channel, OfferInvoice, Offer } from '../../shared/models/clnModels';
import { AlertTypeEnum, APICallStatusEnum, UI_MESSAGES, CLNWSEventTypeEnum, CLNActions, RTLActions } from '../../shared/services/consts-enums-functions';
import { GetInfo, Fees, Balance, LocalRemoteBalance, Payment, FeeRates, ListInvoices, Invoice, Peer, OnChain, QueryRoutes, SaveChannel, GetNewAddress, DetachPeer, UpdateChannel, CloseChannel, SendPayment, GetQueryRoutes, ChannelLookup, FetchInvoices, Channel, OfferInvoice, Offer, ListForwards, FetchListForwards } from '../../shared/models/clnModels';
import { AlertTypeEnum, APICallStatusEnum, UI_MESSAGES, CLNWSEventTypeEnum, CLNActions, RTLActions, CLNForwardingEventsStatusEnum } from '../../shared/services/consts-enums-functions';
import { closeAllDialogs, closeSpinner, logout, openAlert, openSnackBar, openSpinner, setApiUrl, setNodeData } from '../../store/rtl.actions';
import { RTLState } from '../../store/rtl.state';
import { addUpdateOfferBookmark, fetchBalance, fetchChannels, fetchFeeRates, fetchFees, fetchInvoices, fetchLocalRemoteBalance, fetchPayments, fetchPeers, fetchUTXOs, getForwardingHistory, setFailedForwardingHistory, setLookup, setPeers, setQueryRoutes, updateCLAPICallStatus, updateInvoice, setOfferInvoice, sendPaymentStatus } from './cln.actions';
import { allAPIsCallStatus, clnNodeInformation } from './cln.selector';
import { addUpdateOfferBookmark, fetchBalance, fetchChannels, fetchFeeRates, fetchFees, fetchInvoices, fetchLocalRemoteBalance, fetchPayments, fetchPeers, fetchUTXOs, getForwardingHistory, setLookup, setPeers, setQueryRoutes, updateCLAPICallStatus, updateInvoice, setOfferInvoice, sendPaymentStatus } from './cln.actions';
import { allAPIsCallStatus } from './cln.selector';
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload';
import { CLNOfferInformationComponent } from '../transactions/offers/offer-information-modal/offer-information.component';
@ -326,7 +326,7 @@ export class CLNEffects implements OnDestroy {
map((channels: Channel[]) => {
this.logger.info(channels);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchChannels', status: APICallStatusEnum.COMPLETED } }));
this.store.dispatch(getForwardingHistory({ payload: { status: 'settled' } }));
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.SETTLED, maxLen: 10, offset: 0, reverse: true } }));
const sortedChannels = { activeChannels: [], pendingChannels: [], inactiveChannels: [] };
channels.forEach((channel) => {
if (channel.state === 'CHANNELD_NORMAL') {
@ -654,100 +654,28 @@ export class CLNEffects implements OnDestroy {
fetchForwardingHistoryCL = createEffect(() => this.actions.pipe(
ofType(CLNActions.GET_FORWARDING_HISTORY_CLN),
withLatestFrom(this.store.select(clnNodeInformation)),
mergeMap(([action, nodeInfo]: [{ type: string, payload: { status: string } }, GetInfo]) => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards?status=' + action.payload.status).
pipe(
map((fhRes: any) => {
this.logger.info(fhRes);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory', status: APICallStatusEnum.COMPLETED } }));
const isNewerVersion = (nodeInfo.api_version) ? this.commonService.isVersionCompatible(nodeInfo.api_version, '0.5.0') : false;
if (!isNewerVersion) {
const filteredLocalFailedEvents = [];
const filteredFailedEvents = [];
const filteredSuccesfulEvents = [];
fhRes.forEach((event: ForwardingEvent) => {
if (event.status === 'settled') {
filteredSuccesfulEvents.push(event);
} else if (event.status === 'failed') {
filteredFailedEvents.push(event);
} else if (event.status === 'local_failed') {
filteredLocalFailedEvents.push(event);
}
});
fhRes = JSON.parse(JSON.stringify(filteredSuccesfulEvents));
if (action.payload.status === 'failed') {
this.store.dispatch(setFailedForwardingHistory({ payload: filteredFailedEvents }));
}
if (action.payload.status === 'local_failed') {
this.store.dispatch(setFailedForwardingHistory({ payload: filteredLocalFailedEvents }));
}
}
return {
type: CLNActions.SET_FORWARDING_HISTORY_CLN,
payload: fhRes
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('FetchForwardingHistory', UI_MESSAGES.NO_SPINNER, 'Get Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards?status=' + action.payload.status, err);
return of({ type: RTLActions.VOID });
})
);
})
));
fetchFailedForwardingHistoryCL = createEffect(() => this.actions.pipe(
ofType(CLNActions.GET_FAILED_FORWARDING_HISTORY_CLN),
withLatestFrom(this.store.select(clnNodeInformation)),
mergeMap(([action, nodeInfo]: [{ type: string, payload: any }, GetInfo]) => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchFailedForwardingHistory', status: APICallStatusEnum.INITIATED } }));
// For backwards compatibility < 0.5.0 START
const isNewerVersion = (nodeInfo.api_version) ? this.commonService.isVersionCompatible(nodeInfo.api_version, '0.5.0') : false;
if (!isNewerVersion) {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchFailedForwardingHistory', status: APICallStatusEnum.COMPLETED } }));
return of({ type: RTLActions.VOID });
} // For backwards compatibility < 0.5.0 END
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards?status=failed').
pipe(map((ffhRes: any) => {
this.logger.info(ffhRes);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchFailedForwardingHistory', status: APICallStatusEnum.COMPLETED } }));
return {
type: CLNActions.SET_FAILED_FORWARDING_HISTORY_CLN,
payload: ffhRes
};
}), catchError((err) => {
this.handleErrorWithAlert('FetchFailedForwardingHistory', UI_MESSAGES.NO_SPINNER, 'Get Failed Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards?status=failed', err);
return of({ type: RTLActions.VOID });
}));
}))
);
fetchLocalFailedForwardingHistoryCL = createEffect(() => this.actions.pipe(
ofType(CLNActions.GET_LOCAL_FAILED_FORWARDING_HISTORY_CLN),
withLatestFrom(this.store.select(clnNodeInformation)),
mergeMap(([action, nodeInfo]: [{ type: string, payload: any }, GetInfo]) => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchLocalFailedForwardingHistory', status: APICallStatusEnum.INITIATED } }));
// For backwards compatibility < 0.5.0 START
const isNewerVersion = (nodeInfo.api_version) ? this.commonService.isVersionCompatible(nodeInfo.api_version, '0.5.0') : false;
if (!isNewerVersion) {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchLocalFailedForwardingHistory', status: APICallStatusEnum.COMPLETED } }));
return of({ type: RTLActions.VOID });
} // For backwards compatibility < 0.5.0 END
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards?status=local_failed').
pipe(map((lffhRes: any) => {
this.logger.info(lffhRes);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchLocalFailedForwardingHistory', status: APICallStatusEnum.COMPLETED } }));
mergeMap((action: { type: string, payload: FetchListForwards }) => {
const status = (action.payload.status) ? action.payload.status : 'settled';
const maxLen = (action.payload.maxLen) ? action.payload.maxLen : 100;
const offset = (action.payload.offset) ? action.payload.offset : 0;
const reverse = (action.payload.reverse) ? action.payload.reverse : false;
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory' + status, status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/listForwardsPaginated?status=' + status + '&maxLen=' + maxLen + '&offset=' + offset + '&reverse=' + reverse).pipe(
map((fhRes: ListForwards) => {
this.logger.info(fhRes);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory' + status, status: APICallStatusEnum.COMPLETED } }));
return {
type: CLNActions.SET_LOCAL_FAILED_FORWARDING_HISTORY_CLN,
payload: lffhRes
type: CLNActions.SET_FORWARDING_HISTORY_CLN,
payload: { status: status, response: fhRes }
};
}), catchError((err) => {
this.handleErrorWithAlert('FetchLocalFailedForwardingHistory', UI_MESSAGES.NO_SPINNER, 'Get Local Failed Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards?status=local_failed', err);
}),
catchError((err: any) => {
this.handleErrorWithAlert('FetchForwardingHistory' + status, UI_MESSAGES.NO_SPINNER, 'Get ' + status + ' Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwardsPaginated?status=' + status, err);
return of({ type: RTLActions.VOID });
}));
}))
);
})
);
})
));
deleteExpiredInvoiceCL = createEffect(() => this.actions.pipe(
ofType(CLNActions.DELETE_EXPIRED_INVOICE_CLN),

@ -2,11 +2,12 @@ import { createReducer, on } from '@ngrx/store';
import { initCLNState } from './cln.state';
import {
addInvoice, addPeer, removeChannel, removePeer, resetCLStore, setBalance, setChannels,
setChildNodeSettingsCL, setFailedForwardingHistory, setLocalFailedForwardingHistory, setFeeRates, setFees, setForwardingHistory,
setChildNodeSettingsCL, setFeeRates, setFees, setForwardingHistory,
setInfo, setInvoices, setLocalRemoteBalance, setOffers, addOffer, setPayments, setPeers, setUTXOs,
updateCLAPICallStatus, updateInvoice, updateOffer, setOfferBookmarks, addUpdateOfferBookmark, removeOfferBookmark
} from './cln.actions';
import { Channel, OfferBookmark } from '../../shared/models/clnModels';
import { CLNForwardingEventsStatusEnum } from '../../shared/services/consts-enums-functions';
export const CLNReducer = createReducer(initCLNState,
on(updateCLAPICallStatus, (state, { payload }) => {
@ -107,31 +108,31 @@ export const CLNReducer = createReducer(initCLNState,
payments: payload
})),
on(setForwardingHistory, (state, { payload }) => {
const modifiedFeeWithTxCount = state.fees;
const storedChannels = [...state.activeChannels, ...state.pendingChannels, ...state.inactiveChannels];
payload = mapAliases(payload, storedChannels);
modifiedFeeWithTxCount.totalTxCount = payload.length;
return {
...state,
fee: modifiedFeeWithTxCount,
forwardingHistory: payload
};
}),
on(setFailedForwardingHistory, (state, { payload }) => {
const storedChannels = [...state.activeChannels, ...state.pendingChannels, ...state.inactiveChannels];
payload = mapAliases(payload, storedChannels);
return {
...state,
failedForwardingHistory: payload
};
}),
on(setLocalFailedForwardingHistory, (state, { payload }) => {
const storedChannels = [...state.activeChannels, ...state.pendingChannels, ...state.inactiveChannels];
payload = mapAliases(payload, storedChannels);
return {
...state,
localFailedForwardingHistory: payload
};
const forwardsWithAlias = mapAliases(payload.response.listForwards, storedChannels);
payload.response.listForwards = forwardsWithAlias;
switch (payload.status) {
case CLNForwardingEventsStatusEnum.SETTLED:
const modifiedFeeWithTxCount = state.fees;
modifiedFeeWithTxCount.totalTxCount = payload.response.totalEvents | 0;
return {
...state,
fee: modifiedFeeWithTxCount,
forwardingHistory: payload.response
};
case CLNForwardingEventsStatusEnum.FAILED:
return {
...state,
failedForwardingHistory: payload.response
};
case CLNForwardingEventsStatusEnum.LOCAL_FAILED:
return {
...state,
localFailedForwardingHistory: payload.response
};
default:
return { ...state };
}
}),
on(addInvoice, (state, { payload }) => {
const newInvoices = state.invoices;

@ -1,6 +1,6 @@
import { SelNodeChild } from '../../shared/models/RTLconfig';
import { APICallStatusEnum, UserPersonaEnum } from '../../shared/services/consts-enums-functions';
import { GetInfo, Fees, Balance, LocalRemoteBalance, Peer, Payment, Channel, FeeRates, ForwardingEvent, ListInvoices, UTXO, Offer, OfferBookmark, LocalFailedEvent } from '../../shared/models/clnModels';
import { GetInfo, Fees, Balance, LocalRemoteBalance, Peer, Payment, Channel, FeeRates, ListInvoices, UTXO, Offer, OfferBookmark, ListForwards } from '../../shared/models/clnModels';
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload';
export interface CLNState {
@ -17,9 +17,9 @@ export interface CLNState {
pendingChannels: Channel[];
inactiveChannels: Channel[];
payments: Payment[];
forwardingHistory: ForwardingEvent[];
failedForwardingHistory: ForwardingEvent[];
localFailedForwardingHistory: LocalFailedEvent[];
forwardingHistory: ListForwards;
failedForwardingHistory: ListForwards;
localFailedForwardingHistory: ListForwards;
invoices: ListInvoices;
utxos: UTXO[];
offers: Offer[];
@ -57,9 +57,9 @@ export const initCLNState: CLNState = {
pendingChannels: [],
inactiveChannels: [],
payments: [],
forwardingHistory: [],
failedForwardingHistory: [],
localFailedForwardingHistory: [],
forwardingHistory: {},
failedForwardingHistory: {},
localFailedForwardingHistory: {},
invoices: { invoices: [] },
utxos: [],
offers: [],

@ -58,7 +58,7 @@ export class LightningInvoicesComponent implements OnInit, AfterViewInit, OnDest
public pageSizeOptions = PAGE_SIZE_OPTIONS;
private firstOffset = -1;
private lastOffset = -1;
public totalInvoices = 100;
public totalInvoices = 0;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
@ -179,7 +179,7 @@ export class LightningInvoicesComponent implements OnInit, AfterViewInit, OnDest
onPageChange(event: PageEvent) {
let reverse = true;
let index_offset = this.lastOffset;
let page_size = event.pageSize;
this.pageSize = event.pageSize;
if (event.pageIndex === 0) {
reverse = true;
index_offset = 0;
@ -192,7 +192,6 @@ export class LightningInvoicesComponent implements OnInit, AfterViewInit, OnDest
} else if (event.length <= ((event.pageIndex + 1) * event.pageSize)) {
reverse = false;
index_offset = 0;
page_size = event.length - (event.pageIndex * event.pageSize);
}
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: event.pageSize, index_offset: index_offset, reversed: reverse } }));
}

@ -259,7 +259,7 @@ export class LightningPaymentsComponent implements OnInit, AfterViewInit, OnDest
onPageChange(event: any) {
let reverse = true;
let index_offset = this.lastOffset;
let page_size = event.pageSize;
this.pageSize = event.pageSize;
if (event.pageIndex === 0) {
reverse = true;
index_offset = 0;
@ -272,7 +272,6 @@ export class LightningPaymentsComponent implements OnInit, AfterViewInit, OnDest
} else if (event.length <= ((event.pageIndex + 1) * event.pageSize)) {
reverse = false;
index_offset = 0;
page_size = event.length - (event.pageIndex * event.pageSize);
}
const starting_index = event.pageIndex * this.pageSize;
this.loadPaymentsTable(this.paymentJSONArr.slice(starting_index, (starting_index + this.pageSize)));

@ -283,6 +283,13 @@ export interface LocalFailedEvent {
failreason?: string;
}
export interface ListForwards {
firstIndexOffset?: number;
lastIndexOffset?: number;
totalEvents?: number;
listForwards?: ForwardingEvent[] | LocalFailedEvent[];
}
export interface Routes {
id?: string;
channel?: string;
@ -486,3 +493,10 @@ export interface FunderPolicy {
channel_fee_max_base_msat?: number;
channel_fee_max_proportional_thousandths?: number;
}
export interface FetchListForwards {
status?: string;
maxLen?: number;
offset?: number;
reverse?: boolean;
}

@ -624,3 +624,9 @@ export const LADS_POLICY = [
{ id: 'available', placeholder: 'Policy Available (%age)', min: 0, max: 100 },
{ id: 'fixed', placeholder: 'Fixed Policy (Sats)', min: 0, max: 100 }
];
export enum CLNForwardingEventsStatusEnum {
SETTLED = 'settled',
FAILED = 'failed',
LOCAL_FAILED = 'local_failed'
}

Loading…
Cancel
Save