Forwarding events pagination

Forwarding events pagination
This commit is contained in:
Shahana Farooqui 2022-05-24 15:52:10 -04:00 committed by ShahanaFarooqui
parent 3a9c436c32
commit 976b6f0e27
16 changed files with 48 additions and 107 deletions

View File

@ -147,14 +147,10 @@ export const listForwardsPaginated = (req, res, next) => {
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('&', '?');
}
const { status, maxLen, offset } = req.query;
let queryStr = '?status=' + (status ? status : 'settled');
queryStr = queryStr + '&maxLen=' + (maxLen ? maxLen : '10');
queryStr = queryStr + '&offset=' + (offset ? offset : '0');
options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listForwardsPaginated' + queryStr;
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Paginated Forwarding History url' + options.url });
request.get(options).then((body) => {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,6 @@
<style>@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:62.5%}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}</style><link rel="stylesheet" href="styles.2872d180f488fe2c.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.2872d180f488fe2c.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.dae90b7a05c6a024.js" type="module"></script><script src="polyfills.c0773154203456c6.js" type="module"></script><script src="main.1300125d72833537.js" type="module"></script>
<script src="runtime.4044bb587d7fc143.js" type="module"></script><script src="polyfills.c0773154203456c6.js" type="module"></script><script src="main.e9a1704f9917b7a1.js" type="module"></script>
</body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
(()=>{"use strict";var e,v={},g={};function r(e){var n=g[e];if(void 0!==n)return n.exports;var t=g[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(n,t,f,o)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,o]=e[i],s=!0,u=0;u<t.length;u++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[u]))?t.splice(u--,1):(s=!1,o<a&&(a=o));if(s){e.splice(i--,1);var d=f();void 0!==d&&(n=d)}}return n}o=o||0;for(var i=e.length;i>0&&e[i-1][2]>o;i--)e[i]=e[i-1];e[i]=[t,f,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>e+"."+{564:"d41ab2b8bdd42ac9",636:"f8c5bc0215761948",893:"355edadcb4ce94f4",924:"ff524ffae95c311b"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="RTLApp:";r.l=(t,f,o,i)=>{if(e[t])e[t].push(f);else{var a,s;if(void 0!==o)for(var u=document.getElementsByTagName("script"),d=0;d<u.length;d++){var l=u[d];if(l.getAttribute("src")==t||l.getAttribute("data-webpack")==n+o){a=l;break}}a||(s=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+o),a.src=r.tu(t)),e[t]=[f];var c=(m,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(_=>_(b)),m)return m(b)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=c.bind(null,a.onerror),a.onload=c.bind(null,a.onload),s&&document.head.appendChild(a)}}})(),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(f,o)=>{var i=r.o(e,f)?e[f]:void 0;if(0!==i)if(i)o.push(i[2]);else if(666!=f){var a=new Promise((l,c)=>i=e[f]=[l,c]);o.push(i[2]=a);var s=r.p+r.u(f),u=new Error;r.l(s,l=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var c=l&&("load"===l.type?"missing":l.type),p=l&&l.target&&l.target.src;u.message="Loading chunk "+f+" failed.\n("+c+": "+p+")",u.name="ChunkLoadError",u.type=c,u.request=p,i[1](u)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,o)=>{var u,d,[i,a,s]=o,l=0;if(i.some(p=>0!==e[p])){for(u in a)r.o(a,u)&&(r.m[u]=a[u]);if(s)var c=s(r)}for(f&&f(o);l<i.length;l++)r.o(e,d=i[l])&&e[d]&&e[d][0](),e[d]=0;return r.O(c)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})();
(()=>{"use strict";var e,v={},g={};function r(e){var n=g[e];if(void 0!==n)return n.exports;var t=g[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(n,t,f,o)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,o]=e[i],s=!0,u=0;u<t.length;u++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[u]))?t.splice(u--,1):(s=!1,o<a&&(a=o));if(s){e.splice(i--,1);var d=f();void 0!==d&&(n=d)}}return n}o=o||0;for(var i=e.length;i>0&&e[i-1][2]>o;i--)e[i]=e[i-1];e[i]=[t,f,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>e+"."+{564:"b12bb2ed125c558f",636:"b549737f890c9793",893:"355edadcb4ce94f4",924:"ff524ffae95c311b"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="RTLApp:";r.l=(t,f,o,i)=>{if(e[t])e[t].push(f);else{var a,s;if(void 0!==o)for(var u=document.getElementsByTagName("script"),d=0;d<u.length;d++){var l=u[d];if(l.getAttribute("src")==t||l.getAttribute("data-webpack")==n+o){a=l;break}}a||(s=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+o),a.src=r.tu(t)),e[t]=[f];var c=(m,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(_=>_(b)),m)return m(b)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=c.bind(null,a.onerror),a.onload=c.bind(null,a.onload),s&&document.head.appendChild(a)}}})(),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(f,o)=>{var i=r.o(e,f)?e[f]:void 0;if(0!==i)if(i)o.push(i[2]);else if(666!=f){var a=new Promise((l,c)=>i=e[f]=[l,c]);o.push(i[2]=a);var s=r.p+r.u(f),u=new Error;r.l(s,l=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var c=l&&("load"===l.type?"missing":l.type),p=l&&l.target&&l.target.src;u.message="Loading chunk "+f+" failed.\n("+c+": "+p+")",u.name="ChunkLoadError",u.type=c,u.request=p,i[1](u)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,o)=>{var u,d,[i,a,s]=o,l=0;if(i.some(p=>0!==e[p])){for(u in a)r.o(a,u)&&(r.m[u]=a[u]);if(s)var c=s(r)}for(f&&f(o);l<i.length;l++)r.o(e,d=i[l])&&e[d]&&e[d][0](),e[d]=0;return r.O(c)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})();

View File

@ -131,14 +131,10 @@ 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('&', '?');
}
const { status, maxLen, offset } = req.query;
let queryStr = '?status=' + (status ? status : 'settled');
queryStr = queryStr + '&maxLen=' + (maxLen ? maxLen : '10');
queryStr = queryStr + '&offset=' + (offset ? offset : '0');
options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listForwardsPaginated' + queryStr;
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Paginated Forwarding History url' + options.url });
request.get(options).then((body) => {

View File

@ -37,8 +37,7 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
public failedForwardingEvents: any;
public flgSticky = false;
public selFilter = '';
private firstOffset = -1;
private lastOffset = -1;
private indexOffset = -1;
public totalFailedTransactions = 0;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
@ -65,7 +64,7 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
ngOnInit() {
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
this.router.onSameUrlNavigation = 'reload';
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED, maxLen: this.pageSize, offset: 0, reverse: true } }));
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED, maxLen: this.pageSize, offset: 0 } }));
this.store.select(failedForwardingHistory).pipe(takeUntil(this.unSubs[0])).
subscribe((ffhSeletor: { failedForwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
@ -73,9 +72,8 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
this.totalFailedTransactions = ffhSeletor.failedForwardingHistory.totalEvents;
this.firstOffset = ffhSeletor.failedForwardingHistory.firstIndexOffset;
this.lastOffset = ffhSeletor.failedForwardingHistory.lastIndexOffset;
this.totalFailedTransactions = ffhSeletor.failedForwardingHistory.totalForwards;
this.indexOffset = ffhSeletor.failedForwardingHistory.offset;
this.failedEvents = ffhSeletor.failedForwardingHistory.listForwards || [];
if (this.failedEvents.length > 0 && this.sort && this.paginator) {
this.loadFailedEventsTable(this.failedEvents);
@ -142,23 +140,13 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
}
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;
if (this.pageSize !== event.pageSize) {
this.pageSize = event.pageSize;
this.indexOffset = 0;
} else {
this.indexOffset = event.pageIndex * this.pageSize;
}
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED, maxLen: event.pageSize, offset: index_offset, reverse: reverse } }));
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED, maxLen: this.pageSize, offset: this.indexOffset } }));
}
ngOnDestroy() {

View File

@ -36,8 +36,7 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
public displayedColumns: any[] = [];
public forwardingHistoryEvents: any;
public flgSticky = false;
private firstOffset = -1;
private lastOffset = -1;
private indexOffset = -1;
public totalForwardedTransactions = 0;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
@ -71,9 +70,8 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
this.errorMessage = (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
if (this.eventsData.length <= 0 && fhSeletor.forwardingHistory.listForwards) {
this.totalForwardedTransactions = fhSeletor.forwardingHistory.totalEvents;
this.firstOffset = fhSeletor.forwardingHistory.firstIndexOffset;
this.lastOffset = fhSeletor.forwardingHistory.lastIndexOffset;
this.totalForwardedTransactions = fhSeletor.forwardingHistory.totalForwards;
this.indexOffset = fhSeletor.forwardingHistory.offset;
this.successfulEvents = fhSeletor.forwardingHistory.listForwards || [];
if (this.successfulEvents.length > 0 && this.sort && this.paginator) {
this.loadForwardingEventsTable(this.successfulEvents);
@ -154,23 +152,13 @@ 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;
if (this.pageSize !== event.pageSize) {
this.pageSize = event.pageSize;
this.indexOffset = 0;
} else {
this.indexOffset = event.pageIndex * this.pageSize;
}
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.SETTLED, maxLen: event.pageSize, offset: index_offset, reverse: reverse } }));
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.SETTLED, maxLen: this.pageSize, offset: this.indexOffset } }));
}
ngOnDestroy() {

View File

@ -38,8 +38,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
public failedLocalForwardingEvents: any;
public flgSticky = false;
public selFilter = '';
private firstOffset = -1;
private lastOffset = -1;
private indexOffset = -1;
public totalLocalFailedTransactions = 0;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
@ -66,7 +65,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
ngOnInit() {
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
this.router.onSameUrlNavigation = 'reload';
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED, maxLen: this.pageSize, offset: 0, reverse: true } }));
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED, maxLen: this.pageSize, offset: 0 } }));
this.store.select(localFailedForwardingHistory).pipe(takeUntil(this.unSubs[0])).
subscribe((lffhSeletor: { localFailedForwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
@ -74,9 +73,8 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
this.totalLocalFailedTransactions = lffhSeletor.localFailedForwardingHistory.totalEvents;
this.firstOffset = lffhSeletor.localFailedForwardingHistory.firstIndexOffset;
this.lastOffset = lffhSeletor.localFailedForwardingHistory.lastIndexOffset;
this.totalLocalFailedTransactions = lffhSeletor.localFailedForwardingHistory.totalForwards;
this.indexOffset = lffhSeletor.localFailedForwardingHistory.offset;
this.failedLocalEvents = lffhSeletor.localFailedForwardingHistory.listForwards || [];
if (this.failedLocalEvents.length > 0 && this.sort && this.paginator) {
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents);
@ -143,24 +141,13 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
}
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 = true;
index_offset = this.lastOffset;
} else if (event.pageIndex > event.previousPageIndex) {
reverse = true;
if (event.length <= (event.pageIndex + 1) * event.pageSize) {
index_offset = this.totalLocalFailedTransactions - (event.pageIndex * event.pageSize);
} else {
index_offset = this.firstOffset;
}
if (this.pageSize !== event.pageSize) {
this.pageSize = event.pageSize;
this.indexOffset = 0;
} else {
this.indexOffset = event.pageIndex * this.pageSize;
}
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED, maxLen: event.pageSize, offset: index_offset, reverse: reverse } }));
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED, maxLen: this.pageSize, offset: this.indexOffset } }));
}
ngOnDestroy() {

View File

@ -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: CLNForwardingEventsStatusEnum.SETTLED, maxLen: 10, offset: 0, reverse: true } }));
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.SETTLED, maxLen: 10, offset: 0 } }));
const sortedChannels = { activeChannels: [], pendingChannels: [], inactiveChannels: [] };
channels.forEach((channel) => {
if (channel.state === 'CHANNELD_NORMAL') {
@ -658,16 +658,12 @@ export class CLNEffects implements OnDestroy {
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;
const statusInitial = status.charAt(0).toUpperCase();
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory' + statusInitial, status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/listForwardsPaginated?status=' + status + '&maxLen=' + maxLen + '&offset=' + offset + '&reverse=' + reverse).pipe(
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/listForwardsPaginated?status=' + status + '&maxLen=' + maxLen + '&offset=' + offset).pipe(
map((fhRes: ListForwards) => {
this.logger.info(fhRes);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory' + statusInitial, status: APICallStatusEnum.COMPLETED } }));
if (reverse && offset === 0) {
fhRes['totalEvents'] = +fhRes.lastIndexOffset | 0;
}
return {
type: CLNActions.SET_FORWARDING_HISTORY_CLN,
payload: { status: status, response: fhRes }

View File

@ -113,28 +113,19 @@ export const CLNReducer = createReducer(initCLNState,
payload.response.listForwards = forwardsWithAlias;
switch (payload.status) {
case CLNForwardingEventsStatusEnum.SETTLED:
if (!payload.response.totalEvents) {
payload.response.totalEvents = state.forwardingHistory.totalEvents | 0;
}
const modifiedFeeWithTxCount = state.fees;
modifiedFeeWithTxCount.totalTxCount = payload.response.totalEvents | 0;
modifiedFeeWithTxCount.totalTxCount = payload.response.totalForwards | 0;
return {
...state,
fees: modifiedFeeWithTxCount,
forwardingHistory: payload.response
};
case CLNForwardingEventsStatusEnum.FAILED:
if (!payload.response.totalEvents) {
payload.response.totalEvents = state.failedForwardingHistory.totalEvents;
}
return {
...state,
failedForwardingHistory: payload.response
};
case CLNForwardingEventsStatusEnum.LOCAL_FAILED:
if (!payload.response.totalEvents) {
payload.response.totalEvents = state.localFailedForwardingHistory.totalEvents;
}
return {
...state,
localFailedForwardingHistory: payload.response

View File

@ -284,9 +284,9 @@ export interface LocalFailedEvent {
}
export interface ListForwards {
firstIndexOffset?: number;
lastIndexOffset?: number;
totalEvents?: number;
offset?: number;
maxLen?: number;
totalForwards?: number;
listForwards?: ForwardingEvent[] | LocalFailedEvent[];
}
@ -498,5 +498,4 @@ export interface FetchListForwards {
status?: string;
maxLen?: number;
offset?: number;
reverse?: boolean;
}