Removed list forwards from dashboard and pagination

Removed list forwards from dashboard and pagination
pull/1062/head v0.13.0-rc2
Shahana Farooqui 2 years ago committed by ShahanaFarooqui
parent da405a866b
commit 9165ae6a58

@ -110,10 +110,7 @@ export const listForwards = (req, res, next) => {
}
options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listForwards?status=' + (req.query.status ? req.query.status : 'settled');
request.get(options).then((body) => {
if (body && body.length > 0) {
body = common.sortDescByKey(body, 'received_time');
}
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Forwarding History Received For Status' + req.query.status, data: body });
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Forwarding History Received For Status ' + req.query.status, data: body });
res.status(200).json(body);
}).catch((errRes) => {
const err = common.handleError(errRes, 'Channels', 'Forwarding History Error', req.session.selectedNode);
@ -154,7 +151,7 @@ export const listForwardsPaginated = (req, res, next) => {
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) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Paginated Forwarding History Received For Status ' + req.query.status, data: body });
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', 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);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -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.76b4c7ddb718ef83.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.76b4c7ddb718ef83.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.053e1c7068c6feb4.js" type="module"></script><script src="polyfills.eddc63f1737a019a.js" type="module"></script><script src="main.bb5386d8aa345a5a.js" type="module"></script>
<script src="runtime.aaa2a40c5f2b2f06.js" type="module"></script><script src="polyfills.eddc63f1737a019a.js" type="module"></script><script src="main.a45f905361ad3a22.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

@ -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,d=0;d<t.length;d++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[d]))?t.splice(d--,1):(s=!1,o<a&&(a=o));if(s){e.splice(i--,1);var l=f();void 0!==l&&(n=l)}}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:"0428ec771d033752",636:"2179ed55de2143bc",893:"9a615c46b89a5a79",924:"5f21f58ee3917b8b"}[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 d=document.getElementsByTagName("script"),l=0;l<d.length;l++){var u=d[l];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==n+o){a=u;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((u,c)=>i=e[f]=[u,c]);o.push(i[2]=a);var s=r.p+r.u(f),d=new Error;r.l(s,u=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var c=u&&("load"===u.type?"missing":u.type),p=u&&u.target&&u.target.src;d.message="Loading chunk "+f+" failed.\n("+c+": "+p+")",d.name="ChunkLoadError",d.type=c,d.request=p,i[1](d)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,o)=>{var d,l,[i,a,s]=o,u=0;if(i.some(p=>0!==e[p])){for(d in a)r.o(a,d)&&(r.m[d]=a[d]);if(s)var c=s(r)}for(f&&f(o);u<i.length;u++)r.o(e,l=i[u])&&e[l]&&e[l][0](),e[l]=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],c=!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):(c=!1,o<a&&(a=o));if(c){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:"5eb6603768afa44f",636:"2179ed55de2143bc",893:"9a615c46b89a5a79",924:"5f21f58ee3917b8b"}[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,c;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||(c=!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 s=(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(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&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,s)=>i=e[f]=[l,s]);o.push(i[2]=a);var c=r.p+r.u(f),u=new Error;r.l(c,l=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var s=l&&("load"===l.type?"missing":l.type),p=l&&l.target&&l.target.src;u.message="Loading chunk "+f+" failed.\n("+s+": "+p+")",u.name="ChunkLoadError",u.type=s,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,c]=o,l=0;if(i.some(p=>0!==e[p])){for(u in a)r.o(a,u)&&(r.m[u]=a[u]);if(c)var s=c(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(s)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})();

@ -98,8 +98,7 @@ export const listForwards = (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/channel/listForwards?status=' + (req.query.status ? req.query.status : 'settled');
request.get(options).then((body) => {
if (body && body.length > 0) { body = common.sortDescByKey(body, 'received_time'); }
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Forwarding History Received For Status' + req.query.status, data: body });
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Forwarding History Received For Status ' + req.query.status, data: body });
res.status(200).json(body);
}).catch((errRes) => {
const err = common.handleError(errRes, 'Channels', 'Forwarding History Error', req.session.selectedNode);
@ -138,7 +137,7 @@ export const listForwardsPaginated = (req, res, next) => {
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) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Paginated Forwarding History Received For Status ' + req.query.status, data: body });
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', 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);

@ -1,12 +1,12 @@
<div fxLayout="row" fxFlex="100" fxLayoutAlign="start stretch" *ngIf="errorMessage?.trim() === ''; else errorBlock">
<div fxLayout="column" fxFlex="50" fxLayoutAlign="space-between stretch">
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Total</h4>
<div class="overflow-wrap dashboard-info-value">{{fees?.feeCollected/1000 | number}} Sats</div>
</div>
</div>
<div fxLayout="column" fxFlex="50" fxLayoutAlign="space-between stretch">
<div>
<div *ngIf="fees?.totalTxCount">
<h4 fxLayoutAlign="start" class="dashboard-info-title">Transactions</h4>
<div class="overflow-wrap dashboard-info-value">{{fees?.totalTxCount | number}}</div>
</div>

@ -63,12 +63,12 @@ export class CLNHomeComponent implements OnInit, OnDestroy {
public merchantCardHeight = '65px';
public sortField = 'Balance Score';
public errorMessages = ['', '', '', '', '', ''];
public apiCallStatusNodeInfo: ApiCallStatusPayload = null;
public apiCallStatusFees: ApiCallStatusPayload = null;
public apiCallStatusBalance: ApiCallStatusPayload = null;
public apiCallStatusLRBal: ApiCallStatusPayload = null;
public apiCallStatusChannels: ApiCallStatusPayload = null;
public apiCallStatusFHistory: ApiCallStatusPayload = null;
public apiCallStatusNodeInfo: ApiCallStatusPayload | null = null;
public apiCallStatusFees: ApiCallStatusPayload | null = null;
public apiCallStatusBalance: ApiCallStatusPayload | null = null;
public apiCallStatusLRBal: ApiCallStatusPayload | null = null;
public apiCallStatusChannels: ApiCallStatusPayload | null = null;
public apiCallStatusFHistory: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
@ -127,10 +127,10 @@ export class CLNHomeComponent implements OnInit, OnDestroy {
this.apiCallStatusNodeInfo = infoSettingsStatusSelector.apisCallStatus[0];
this.apiCallStatusFHistory = infoSettingsStatusSelector.apisCallStatus[1];
if (this.apiCallStatusNodeInfo.status === APICallStatusEnum.ERROR) {
this.errorMessages[0] = (typeof (this.apiCallStatusNodeInfo.message) === 'object') ? JSON.stringify(this.apiCallStatusNodeInfo.message) : this.apiCallStatusNodeInfo.message;
this.errorMessages[0] = !this.apiCallStatusNodeInfo.message ? '' : (typeof (this.apiCallStatusNodeInfo.message) === 'object') ? JSON.stringify(this.apiCallStatusNodeInfo.message) : this.apiCallStatusNodeInfo.message;
}
if (this.apiCallStatusFHistory.status === APICallStatusEnum.ERROR) {
this.errorMessages[5] = (typeof (this.apiCallStatusFHistory.message) === 'object') ? JSON.stringify(this.apiCallStatusFHistory.message) : this.apiCallStatusFHistory.message;
this.errorMessages[5] = !this.apiCallStatusFHistory.message ? '' : (typeof (this.apiCallStatusFHistory.message) === 'object') ? JSON.stringify(this.apiCallStatusFHistory.message) : this.apiCallStatusFHistory.message;
}
this.selNode = infoSettingsStatusSelector.nodeSettings;
this.information = infoSettingsStatusSelector.information;
@ -140,7 +140,7 @@ export class CLNHomeComponent implements OnInit, OnDestroy {
this.errorMessages[1] = '';
this.apiCallStatusFees = feesSeletor.apiCallStatus;
if (this.apiCallStatusFees.status === APICallStatusEnum.ERROR) {
this.errorMessages[1] = (typeof (this.apiCallStatusFees.message) === 'object') ? JSON.stringify(this.apiCallStatusFees.message) : this.apiCallStatusFees.message;
this.errorMessages[1] = !this.apiCallStatusFees.message ? '' : (typeof (this.apiCallStatusFees.message) === 'object') ? JSON.stringify(this.apiCallStatusFees.message) : this.apiCallStatusFees.message;
}
this.fees = feesSeletor.fees;
this.logger.info(feesSeletor);
@ -150,17 +150,17 @@ export class CLNHomeComponent implements OnInit, OnDestroy {
this.errorMessages[4] = '';
this.apiCallStatusChannels = channelsSeletor.apiCallStatus;
if (this.apiCallStatusChannels.status === APICallStatusEnum.ERROR) {
this.errorMessages[4] = (typeof (this.apiCallStatusChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusChannels.message) : this.apiCallStatusChannels.message;
this.errorMessages[4] = !this.apiCallStatusChannels.message ? '' : (typeof (this.apiCallStatusChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusChannels.message) : this.apiCallStatusChannels.message;
}
this.totalInboundLiquidity = 0;
this.totalOutboundLiquidity = 0;
this.activeChannels = channelsSeletor.activeChannels;
this.activeChannelsCapacity = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.activeChannels, 'balancedness'))) || [];
this.allInboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.activeChannels.filter((channel) => channel.msatoshi_to_them > 0), 'msatoshi_to_them'))) || [];
this.allOutboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.activeChannels.filter((channel) => channel.msatoshi_to_us > 0), 'msatoshi_to_us'))) || [];
this.allInboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.activeChannels.filter((channel) => channel.msatoshi_to_them ? channel.msatoshi_to_them > 0 : false), 'msatoshi_to_them'))) || [];
this.allOutboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.activeChannels.filter((channel) => channel.msatoshi_to_us ? channel.msatoshi_to_us > 0 : false), 'msatoshi_to_us'))) || [];
this.activeChannels.forEach((channel) => {
this.totalInboundLiquidity = this.totalInboundLiquidity + Math.ceil(channel.msatoshi_to_them / 1000);
this.totalOutboundLiquidity = this.totalOutboundLiquidity + Math.floor(channel.msatoshi_to_us / 1000);
this.totalInboundLiquidity = this.totalInboundLiquidity + Math.ceil((channel.msatoshi_to_them || 0) / 1000);
this.totalOutboundLiquidity = this.totalOutboundLiquidity + Math.floor((channel.msatoshi_to_us || 0) / 1000);
});
this.channelsStatus.active.channels = channelsSeletor.activeChannels.length || 0;
this.channelsStatus.pending.channels = channelsSeletor.pendingChannels.length || 0;
@ -173,15 +173,15 @@ export class CLNHomeComponent implements OnInit, OnDestroy {
this.errorMessages[2] = '';
this.apiCallStatusBalance = balanceSeletor.apiCallStatus;
if (this.apiCallStatusBalance.status === APICallStatusEnum.ERROR) {
this.errorMessages[2] = (typeof (this.apiCallStatusBalance.message) === 'object') ? JSON.stringify(this.apiCallStatusBalance.message) : this.apiCallStatusBalance.message;
this.errorMessages[2] = !this.apiCallStatusBalance.message ? '' : (typeof (this.apiCallStatusBalance.message) === 'object') ? JSON.stringify(this.apiCallStatusBalance.message) : this.apiCallStatusBalance.message;
}
this.errorMessages[3] = '';
this.apiCallStatusLRBal = lrBalanceSeletor.apiCallStatus;
if (this.apiCallStatusLRBal.status === APICallStatusEnum.ERROR) {
this.errorMessages[3] = (typeof (this.apiCallStatusLRBal.message) === 'object') ? JSON.stringify(this.apiCallStatusLRBal.message) : this.apiCallStatusLRBal.message;
this.errorMessages[3] = !this.apiCallStatusLRBal.message ? '' : (typeof (this.apiCallStatusLRBal.message) === 'object') ? JSON.stringify(this.apiCallStatusLRBal.message) : this.apiCallStatusLRBal.message;
}
this.totalBalance = balanceSeletor.balance;
this.balances.onchain = balanceSeletor.balance.totalBalance;
this.balances.onchain = balanceSeletor.balance.totalBalance || 0;
this.balances.lightning = lrBalanceSeletor.localRemoteBalance.localBalance;
this.balances.total = this.balances.lightning + this.balances.onchain;
this.balances = Object.assign({}, this.balances);
@ -206,8 +206,8 @@ export class CLNHomeComponent implements OnInit, OnDestroy {
if (this.sortField === 'Balance Score') {
this.sortField = 'Capacity';
this.activeChannelsCapacity = this.activeChannels.sort((a, b) => {
const x = +a.msatoshi_to_us + +a.msatoshi_to_them;
const y = +b.msatoshi_to_them + +b.msatoshi_to_them;
const x = (a.msatoshi_to_us ? +a.msatoshi_to_us : 0) + (a.msatoshi_to_them ? +a.msatoshi_to_them : 0);
const y = (b.msatoshi_to_them ? +b.msatoshi_to_them : 0) + (b.msatoshi_to_them ? +b.msatoshi_to_them : 0);
return ((x > y) ? -1 : ((x < y) ? 1 : 0));
});
} else {
@ -218,7 +218,7 @@ export class CLNHomeComponent implements OnInit, OnDestroy {
ngOnDestroy() {
this.unSubs.forEach((completeSub) => {
completeSub.next(null);
completeSub.next(<any>null);
completeSub.complete();
});
}

@ -1,9 +1,9 @@
import { Component, OnInit, OnDestroy, HostListener } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil, withLatestFrom } from 'rxjs/operators';
import { takeUntil, take } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { ForwardingEvent, GetInfo, ListForwards } from '../../../shared/models/clnModels';
import { ForwardingEvent, ListForwards } from '../../../shared/models/clnModels';
import { APICallStatusEnum, CLNForwardingEventsStatusEnum, MONTHS, ReportBy, ScreenSizeEnum, SCROLL_RANGES } from '../../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
@ -11,7 +11,8 @@ import { CommonService } from '../../../shared/services/common.service';
import { fadeIn } from '../../../shared/animation/opacity-animation';
import { RTLState } from '../../../store/rtl.state';
import { clnNodeInformation, forwardingHistory } from '../../store/cln.selector';
import { forwardingHistory } from '../../store/cln.selector';
import { getForwardingHistory } from '../../store/cln.actions';
import { DataService } from '../../../shared/services/data.service';
@Component({
@ -29,7 +30,7 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
public eventFilterValue = '';
public reportBy = ReportBy;
public selReportBy = ReportBy.FEES;
public totalFeeMsat = null;
public totalFeeMsat: number | null = null;
public today = new Date(Date.now());
public startDate = new Date(this.today.getFullYear(), this.today.getMonth(), 1, 0, 0, 0);
public endDate = new Date(this.today.getFullYear(), this.today.getMonth(), this.getMonthDays(this.today.getMonth(), this.today.getFullYear()), 23, 59, 59);
@ -43,7 +44,7 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apiCallStatus: ApiCallStatusPayload = null;
public apiCallStatus: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
@ -52,27 +53,23 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
ngOnInit() {
this.screenSize = this.commonService.getScreenSize();
this.showYAxisLabel = !(this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM);
this.store.select(forwardingHistory).pipe(takeUntil(this.unSubs[0]),
withLatestFrom(this.store.select(clnNodeInformation))).
subscribe(([fhSeletor, nodeInfo]: [{ forwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }, GetInfo]) => {
if (fhSeletor.forwardingHistory.status === CLNForwardingEventsStatusEnum.SETTLED && (fhSeletor.apiCallStatus.status === APICallStatusEnum.COMPLETED || fhSeletor.apiCallStatus.status === APICallStatusEnum.ERROR)) {
if (nodeInfo.api_version && this.commonService.isVersionCompatible(nodeInfo.api_version, '0.7.3')) {
this.dataService.getForwardingHistory('CLN', '', '', CLNForwardingEventsStatusEnum.SETTLED).pipe(takeUntil(this.unSubs[0])).
subscribe((response: ForwardingEvent[]) => {
this.events = response || [];
this.filterForwardingEvents(this.startDate, this.endDate);
this.logger.info(response);
});
} else {
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.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(forwardingHistory).pipe(takeUntil(this.unSubs[0])).
subscribe((fhSeletor: { forwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }) => {
if (fhSeletor.forwardingHistory.status === CLNForwardingEventsStatusEnum.SETTLED) {
this.errorMessage = '';
this.apiCallStatus = fhSeletor.apiCallStatus;
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
this.errorMessage = !this.apiCallStatus.message ? '' : (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
} else if (this.apiCallStatus.status === APICallStatusEnum.COMPLETED) {
this.events = fhSeletor.forwardingHistory.listForwards || [];
this.filterForwardingEvents(this.startDate, this.endDate);
this.logger.info(fhSeletor);
}
this.logger.info(fhSeletor);
}
});
this.commonService.containerSizeUpdated.pipe(takeUntil(this.unSubs[1])).subscribe((CONTAINER_SIZE) => {
@ -103,7 +100,7 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
this.totalFeeMsat = null;
if (this.events && this.events.length > 0) {
this.events.forEach((event) => {
if (event.received_time >= startDateInSeconds && event.received_time < endDateInSeconds) {
if (event.received_time && event.received_time >= startDateInSeconds && event.received_time < endDateInSeconds) {
this.filteredEventsBySelectedPeriod.push(event);
}
});
@ -127,17 +124,17 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
prepareFeeReport(start: Date) {
const startDateInSeconds = Math.round(start.getTime() / 1000);
const feeReport = [];
const feeReport: any[] = [];
this.totalFeeMsat = 0;
if (this.reportPeriod === SCROLL_RANGES[1]) {
for (let i = 0; i < 12; i++) {
feeReport.push({ name: MONTHS[i].name, value: 0.0, extra: { totalEvents: 0 } });
}
this.filteredEventsBySelectedPeriod.map((event) => {
const monthNumber = new Date((+event.received_time) * 1000).getMonth();
feeReport[monthNumber].value = feeReport[monthNumber].value + (+event.fee / 1000);
const monthNumber = event.received_time ? new Date((+event.received_time) * 1000).getMonth() : 12;
feeReport[monthNumber].value = event.fee ? feeReport[monthNumber].value + (+event.fee / 1000) : feeReport[monthNumber].value;
feeReport[monthNumber].extra.totalEvents = feeReport[monthNumber].extra.totalEvents + 1;
this.totalFeeMsat = (this.totalFeeMsat ? this.totalFeeMsat : 0) + +event.fee;
this.totalFeeMsat = event.fee ? (this.totalFeeMsat ? this.totalFeeMsat : 0) + +event.fee : this.totalFeeMsat;
return this.filteredEventsBySelectedPeriod;
});
} else {
@ -145,10 +142,10 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
feeReport.push({ name: i + 1, value: 0.0, extra: { totalEvents: 0 } });
}
this.filteredEventsBySelectedPeriod.map((event) => {
const dateNumber = Math.floor((+event.received_time - startDateInSeconds) / this.secondsInADay);
feeReport[dateNumber].value = feeReport[dateNumber].value + (+event.fee / 1000);
const dateNumber = event.received_time ? Math.floor((+event.received_time - startDateInSeconds) / this.secondsInADay) : 0;
feeReport[dateNumber].value = event.fee ? feeReport[dateNumber].value + (+event.fee / 1000) : feeReport[dateNumber].value;
feeReport[dateNumber].extra.totalEvents = feeReport[dateNumber].extra.totalEvents + 1;
this.totalFeeMsat = (this.totalFeeMsat ? this.totalFeeMsat : 0) + +event.fee;
this.totalFeeMsat = event.fee ? (this.totalFeeMsat ? this.totalFeeMsat : 0) + +event.fee : this.totalFeeMsat;
return this.filteredEventsBySelectedPeriod;
});
}
@ -157,17 +154,17 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
prepareEventsReport(start: Date) {
const startDateInSeconds = Math.round(start.getTime() / 1000);
const eventsReport = [];
const eventsReport: any[] = [];
this.totalFeeMsat = 0;
if (this.reportPeriod === SCROLL_RANGES[1]) {
for (let i = 0; i < 12; i++) {
eventsReport.push({ name: MONTHS[i].name, value: 0, extra: { totalFees: 0.0 } });
}
this.filteredEventsBySelectedPeriod.map((event) => {
const monthNumber = new Date((+event.received_time) * 1000).getMonth();
const monthNumber = event.received_time ? new Date((+event.received_time) * 1000).getMonth() : 12;
eventsReport[monthNumber].value = eventsReport[monthNumber].value + 1;
eventsReport[monthNumber].extra.totalFees = eventsReport[monthNumber].extra.totalFees + (+event.fee / 1000);
this.totalFeeMsat = (this.totalFeeMsat ? this.totalFeeMsat : 0) + +event.fee;
eventsReport[monthNumber].extra.totalFees = event.fee ? eventsReport[monthNumber].extra.totalFees + (+event.fee / 1000) : eventsReport[monthNumber].extra.totalFees;
this.totalFeeMsat = event.fee ? (this.totalFeeMsat ? this.totalFeeMsat : 0) + +event.fee : this.totalFeeMsat;
return this.filteredEventsBySelectedPeriod;
});
} else {
@ -175,10 +172,10 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
eventsReport.push({ name: i + 1, value: 0, extra: { totalFees: 0.0 } });
}
this.filteredEventsBySelectedPeriod.map((event) => {
const dateNumber = Math.floor((+event.received_time - startDateInSeconds) / this.secondsInADay);
const dateNumber = event.received_time ? Math.floor((+event.received_time - startDateInSeconds) / this.secondsInADay) : 0;
eventsReport[dateNumber].value = eventsReport[dateNumber].value + 1;
eventsReport[dateNumber].extra.totalFees = eventsReport[dateNumber].extra.totalFees + (+event.fee / 1000);
this.totalFeeMsat = (this.totalFeeMsat ? this.totalFeeMsat : 0) + +event.fee;
eventsReport[dateNumber].extra.totalFees = event.fee ? eventsReport[dateNumber].extra.totalFees + (+event.fee / 1000) : eventsReport[dateNumber].extra.totalFees;
this.totalFeeMsat = event.fee ? (this.totalFeeMsat ? this.totalFeeMsat : 0) + +event.fee : this.totalFeeMsat;
return this.filteredEventsBySelectedPeriod;
});
}
@ -211,7 +208,7 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
ngOnDestroy() {
this.unSubs.forEach((completeSub) => {
completeSub.next(null);
completeSub.next(<any>null);
completeSub.complete();
});
}

@ -2,13 +2,13 @@ import { Component, OnInit, ViewChild, OnDestroy, AfterViewInit } from '@angular
import { Router } from '@angular/router';
import { DatePipe } from '@angular/common';
import { Subject } from 'rxjs';
import { takeUntil, withLatestFrom } from 'rxjs/operators';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { MatPaginator, MatPaginatorIntl, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { ForwardingEvent, GetInfo, ListForwards } from '../../../shared/models/clnModels';
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';
@ -17,7 +17,7 @@ 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 { clnNodeInformation, failedForwardingHistory } from '../../store/cln.selector';
import { failedForwardingHistory } from '../../store/cln.selector';
@Component({
selector: 'rtl-cln-failed-history',
@ -31,8 +31,6 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
public flgCompatible = true;
public information: GetInfo = {};
public failedEvents: any;
public errorMessage = '';
public displayedColumns: any[] = [];
@ -45,7 +43,7 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public apiCallStatus: ApiCallStatusPayload = null;
public apiCallStatus: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
@ -66,26 +64,18 @@ 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 } }));
this.store.select(failedForwardingHistory).pipe(takeUntil(this.unSubs[0]),
withLatestFrom(this.store.select(clnNodeInformation))).
subscribe(([ffhSeletor, nodeInfo]: [{ failedForwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }, GetInfo]) => {
this.information = nodeInfo;
this.flgCompatible = (this.information.api_version) ? this.commonService.isVersionCompatible(this.information.api_version, '0.7.3') : true;
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED } }));
this.store.select(failedForwardingHistory).pipe(takeUntil(this.unSubs[0])).
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.errorMessage = !this.apiCallStatus.message ? '' : (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
this.totalFailedTransactions = ffhSeletor.failedForwardingHistory.totalForwards;
this.indexOffset = ffhSeletor.failedForwardingHistory.offset;
this.totalFailedTransactions = ffhSeletor.failedForwardingHistory.totalForwards || 0;
this.failedEvents = ffhSeletor.failedForwardingHistory.listForwards || [];
if (this.failedEvents.length > 0 && this.sort && this.paginator) {
if (this.flgCompatible) {
this.loadFailedEventsTable(this.failedEvents);
} else {
this.loadFailedEventsTable(this.failedEvents.slice(0, this.pageSize));
}
this.loadFailedEventsTable(this.failedEvents.slice(0, this.pageSize));
}
this.logger.info(ffhSeletor);
});
@ -93,11 +83,7 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
ngAfterViewInit() {
if (this.failedEvents.length > 0) {
if (this.flgCompatible) {
this.loadFailedEventsTable(this.failedEvents);
} else {
this.loadFailedEventsTable(this.failedEvents.slice(0, this.pageSize));
}
this.loadFailedEventsTable(this.failedEvents.slice(0, this.pageSize));
}
}
@ -130,13 +116,13 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
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.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() : '') +
(event.resolved_time ? this.datePipe.transform(new Date(event.resolved_time * 1000), 'dd/MMM/YYYY HH:mm').toLowerCase() : '') +
const newEvent = (event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '' +
(event.resolved_time ? this.datePipe.transform(new Date(event.resolved_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') +
(event.payment_hash ? event.payment_hash.toLowerCase() : '') +
(event.in_channel ? event.in_channel.toLowerCase() : '') + (event.out_channel ? event.out_channel.toLowerCase() : '') +
(event.in_channel_alias ? event.in_channel_alias.toLowerCase() : '') + (event.out_channel_alias ? event.out_channel_alias.toLowerCase() : '') +
(event.in_msatoshi ? (event.in_msatoshi / 1000) : '') + (event.out_msatoshi ? (event.out_msatoshi / 1000) : '') + (event.fee ? event.fee : ''));
return newEvent.includes(fltr);
return newEvent?.includes(fltr) || false;
};
this.applyFilter();
this.logger.info(this.failedForwardingEvents);
@ -159,16 +145,12 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
} else {
this.indexOffset = event.pageIndex * this.pageSize;
}
if (this.flgCompatible) {
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED, maxLen: this.pageSize, offset: this.indexOffset } }));
} else {
this.loadFailedEventsTable(this.failedEvents.slice(this.indexOffset, (this.indexOffset + this.pageSize)));
}
this.loadFailedEventsTable(this.failedEvents.slice(this.indexOffset, (this.indexOffset + this.pageSize)));
}
ngOnDestroy() {
this.unSubs.forEach((completeSub) => {
completeSub.next(null);
completeSub.next(<any>null);
completeSub.complete();
});
}

@ -1,13 +1,14 @@
import { Component, OnInit, OnChanges, ViewChild, OnDestroy, SimpleChanges, Input, AfterViewInit } from '@angular/core';
import { Router } from '@angular/router';
import { DatePipe } from '@angular/common';
import { Subject } from 'rxjs';
import { takeUntil, withLatestFrom } from 'rxjs/operators';
import { takeUntil, take } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { MatPaginator, MatPaginatorIntl, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { ForwardingEvent, GetInfo, ListForwards } from '../../../shared/models/clnModels';
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';
@ -15,7 +16,7 @@ import { CommonService } from '../../../shared/services/common.service';
import { RTLState } from '../../../store/rtl.state';
import { openAlert } from '../../../store/rtl.actions';
import { clnNodeInformation, forwardingHistory } from '../../store/cln.selector';
import { forwardingHistory } from '../../store/cln.selector';
import { getForwardingHistory } from '../../store/cln.actions';
@Component({
@ -32,9 +33,7 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
@Input() eventsData = [];
@Input() filterValue = '';
public flgCompatible = true;
public information: GetInfo = {};
public successfulEvents = [];
public successfulEvents: ForwardingEvent[] = [];
public displayedColumns: any[] = [];
public forwardingHistoryEvents: any;
public flgSticky = false;
@ -45,11 +44,11 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apiCallStatus: ApiCallStatusPayload = null;
public apiCallStatus: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<RTLState>, private datePipe: DatePipe) {
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.flgSticky = false;
@ -64,26 +63,25 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
}
ngOnInit() {
this.store.select(forwardingHistory).pipe(takeUntil(this.unSubs[0]),
withLatestFrom(this.store.select(clnNodeInformation))).
subscribe(([fhSeletor, nodeInfo]: [{ forwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }, GetInfo]) => {
this.information = nodeInfo;
this.flgCompatible = (this.information.api_version) ? this.commonService.isVersionCompatible(this.information.api_version, '0.7.3') : true;
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
this.router.onSameUrlNavigation = 'reload';
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(forwardingHistory).pipe(takeUntil(this.unSubs[0])).
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.errorMessage = !this.apiCallStatus.message ? '' : (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.totalForwards;
this.indexOffset = fhSeletor.forwardingHistory.offset;
this.totalForwardedTransactions = fhSeletor.forwardingHistory.totalForwards || 0;
this.successfulEvents = fhSeletor.forwardingHistory.listForwards || [];
if (this.successfulEvents.length > 0 && this.sort && this.paginator) {
if (this.flgCompatible) {
this.loadForwardingEventsTable(this.successfulEvents);
} else {
this.loadForwardingEventsTable(this.successfulEvents.slice(0, this.pageSize));
}
this.loadForwardingEventsTable(this.successfulEvents.slice(0, this.pageSize));
}
this.logger.info(fhSeletor);
}
@ -92,11 +90,7 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
ngAfterViewInit() {
if (this.successfulEvents.length > 0) {
if (this.flgCompatible) {
this.loadForwardingEventsTable(this.successfulEvents);
} else {
this.loadForwardingEventsTable(this.successfulEvents.slice(0, this.pageSize));
}
this.loadForwardingEventsTable(this.successfulEvents.slice(0, this.pageSize));
}
}
@ -145,8 +139,8 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
this.forwardingHistoryEvents.sort = this.sort;
this.forwardingHistoryEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
this.forwardingHistoryEvents.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() + ' ' : '') +
(event.resolved_time ? this.datePipe.transform(new Date(event.resolved_time * 1000), 'dd/MMM/YYYY HH:mm').toLowerCase() + ' ' : '') +
const newEvent = (event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() + ' ' : '') +
(event.resolved_time ? this.datePipe.transform(new Date(event.resolved_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() + ' ' : '') +
(event.in_channel ? event.in_channel.toLowerCase() + ' ' : '') + (event.out_channel ? event.out_channel.toLowerCase() + ' ' : '') +
(event.in_channel_alias ? event.in_channel_alias.toLowerCase() + ' ' : '') + (event.out_channel_alias ? event.out_channel_alias.toLowerCase() + ' ' : '') +
(event.in_msatoshi ? (event.in_msatoshi / 1000) + ' ' : '') + (event.out_msatoshi ? (event.out_msatoshi / 1000) + ' ' : '') + (event.fee ? event.fee + ' ' : '');
@ -174,16 +168,12 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
} else {
this.indexOffset = event.pageIndex * this.pageSize;
}
if (this.flgCompatible) {
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.SETTLED, maxLen: this.pageSize, offset: this.indexOffset } }));
} else {
this.loadForwardingEventsTable(this.successfulEvents.slice(this.indexOffset, (this.indexOffset + this.pageSize)));
}
this.loadForwardingEventsTable(this.successfulEvents.slice(this.indexOffset, (this.indexOffset + this.pageSize)));
}
ngOnDestroy() {
this.unSubs.forEach((completeSub) => {
completeSub.next(null);
completeSub.next(<any>null);
completeSub.complete();
});
}

@ -2,13 +2,13 @@ import { Component, OnInit, ViewChild, OnDestroy, AfterViewInit } from '@angular
import { Router } from '@angular/router';
import { DatePipe } from '@angular/common';
import { Subject } from 'rxjs';
import { takeUntil, withLatestFrom } from 'rxjs/operators';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { MatPaginator, MatPaginatorIntl, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { GetInfo, ListForwards, LocalFailedEvent } from '../../../shared/models/clnModels';
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';
@ -17,7 +17,7 @@ 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 { clnNodeInformation, localFailedForwardingHistory } from '../../store/cln.selector';
import { localFailedForwardingHistory } from '../../store/cln.selector';
@Component({
selector: 'rtl-cln-local-failed-history',
@ -31,8 +31,6 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
public flgCompatible = true;
public information: GetInfo = {};
public CLNFailReason = CLNFailReason;
public failedLocalEvents: any;
public errorMessage = '';
@ -40,13 +38,13 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
public failedLocalForwardingEvents: any;
public flgSticky = false;
public selFilter = '';
private indexOffset = -1;
private indexOffset = 0;
public totalLocalFailedTransactions = 0;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public apiCallStatus: ApiCallStatusPayload = null;
public apiCallStatus: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
@ -67,26 +65,18 @@ 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 } }));
this.store.select(localFailedForwardingHistory).pipe(takeUntil(this.unSubs[0]),
withLatestFrom(this.store.select(clnNodeInformation))).
subscribe(([lffhSeletor, nodeInfo]: [{ localFailedForwardingHistory: ListForwards, apiCallStatus: ApiCallStatusPayload }, GetInfo]) => {
this.information = nodeInfo;
this.flgCompatible = (this.information.api_version) ? this.commonService.isVersionCompatible(this.information.api_version, '0.7.3') : true;
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED } }));
this.store.select(localFailedForwardingHistory).pipe(takeUntil(this.unSubs[0])).
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.errorMessage = !this.apiCallStatus.message ? '' : (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
this.totalLocalFailedTransactions = lffhSeletor.localFailedForwardingHistory.totalForwards;
this.indexOffset = lffhSeletor.localFailedForwardingHistory.offset;
this.totalLocalFailedTransactions = lffhSeletor.localFailedForwardingHistory.totalForwards || 0;
this.failedLocalEvents = lffhSeletor.localFailedForwardingHistory.listForwards || [];
if (this.failedLocalEvents.length > 0 && this.sort && this.paginator) {
if (this.flgCompatible) {
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents);
} else {
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents.slice(0, this.pageSize));
}
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents.slice(0, this.pageSize));
}
this.logger.info(lffhSeletor);
});
@ -94,11 +84,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
ngAfterViewInit() {
if (this.failedLocalEvents.length > 0) {
if (this.flgCompatible) {
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents);
} else {
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents.slice(0, this.pageSize));
}
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents.slice(0, this.pageSize));
}
}
@ -107,7 +93,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
[{ key: 'received_time', value: selFEvent.received_time, title: 'Received Time', width: 50, type: DataTypeEnum.DATE_TIME },
{ key: 'in_channel_alias', value: selFEvent.in_channel_alias, title: 'Inbound Channel', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'in_msatoshi', value: selFEvent.in_msatoshi, title: 'Amount In (mSats)', width: 100, type: DataTypeEnum.NUMBER }],
[{ key: 'failreason', value: this.CLNFailReason[selFEvent.failreason], title: 'Reason for Failure', width: 100, type: DataTypeEnum.STRING }]
[{ key: 'failreason', value: selFEvent.failreason ? this.CLNFailReason[selFEvent.failreason] : '', title: 'Reason for Failure', width: 100, type: DataTypeEnum.STRING }]
];
this.store.dispatch(openAlert({
payload: {
@ -123,17 +109,17 @@ 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() : '') +
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);
(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) {
case 'failreason':
return this.CLNFailReason[data.failreason];
return data.failreason ? this.CLNFailReason[data.failreason] : '';
default:
return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;
@ -160,16 +146,12 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
} else {
this.indexOffset = event.pageIndex * this.pageSize;
}
if (this.flgCompatible) {
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED, maxLen: this.pageSize, offset: this.indexOffset } }));
} else {
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents.slice(this.indexOffset, (this.indexOffset + this.pageSize)));
}
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents.slice(this.indexOffset, (this.indexOffset + this.pageSize)));
}
ngOnDestroy() {
this.unSubs.forEach((completeSub) => {
completeSub.next(null);
completeSub.next(<any>null);
completeSub.complete();
});
}

@ -1,6 +1,6 @@
import { createAction, props } from '@ngrx/store';
import { CLNActions, CLNForwardingEventsStatusEnum } from '../../shared/services/consts-enums-functions';
import { CLNActions } 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, Invoice, ListInvoices, OnChain, UTXO, SaveChannel, GetNewAddress, DetachPeer, UpdateChannel, CloseChannel, SendPayment, GetQueryRoutes, ChannelLookup, OfferInvoice, Offer, OfferBookmark, ListForwards, FetchListForwards, LocalFailedEvent, ForwardingEvent } from '../../shared/models/clnModels';

@ -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, takeUntil, withLatestFrom } from 'rxjs/operators';
import { map, mergeMap, catchError, takeUntil } from 'rxjs/operators';
import { Location } from '@angular/common';
import { environment, API_URL } from '../../../environments/environment';
@ -328,7 +328,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 } }));
// this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.SETTLED } }));
const sortedChannels = { activeChannels: <Channel[]>[], pendingChannels: <Channel[]>[], inactiveChannels: <Channel[]>[] };
channels.forEach((channel) => {
if (channel.state === 'CHANNELD_NORMAL') {
@ -656,57 +656,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: FetchListForwards }, GetInfo]) => {
const status = (action.payload.status) ? action.payload.status : 'settled';
const maxLen = (action.payload.maxLen) ? action.payload.maxLen : 10;
const offset = (action.payload.offset) ? action.payload.offset : 0;
const statusInitial = status.charAt(0).toUpperCase();
mergeMap((action: { type: string, payload: { status: string } }) => {
const statusInitial = action.payload.status.charAt(0).toUpperCase();
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory' + statusInitial, status: APICallStatusEnum.INITIATED } }));
const isNewerVersion = (nodeInfo.api_version) ? this.commonService.isVersionCompatible(nodeInfo.api_version, '0.7.3') : false;
let listForwardsUrl = '';
if (isNewerVersion) {
listForwardsUrl = this.CHILD_API_URL + environment.CHANNELS_API + '/listForwardsPaginated?status=' + status + '&maxLen=' + maxLen + '&offset=' + offset;
} else {
listForwardsUrl = this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards?status=' + status;
}
return this.httpClient.get(listForwardsUrl).pipe(
map((fhRes: ListForwards) => {
this.logger.info(fhRes);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory' + statusInitial, status: APICallStatusEnum.COMPLETED } }));
if (!isNewerVersion) {
const filteredLocalFailedEvents: LocalFailedEvent[] = [];
const filteredFailedEvents: ForwardingEvent[] = [];
const filteredSuccessfulEvents: ForwardingEvent[] = [];
(<any[]>fhRes).forEach((event: ForwardingEvent | LocalFailedEvent) => {
if (event.status === CLNForwardingEventsStatusEnum.SETTLED) {
filteredSuccessfulEvents.push(event);
} else if (event.status === CLNForwardingEventsStatusEnum.FAILED) {
filteredFailedEvents.push(event);
} else if (event.status === CLNForwardingEventsStatusEnum.LOCAL_FAILED) {
filteredLocalFailedEvents.push(event);
}
});
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' + statusInitial, status: APICallStatusEnum.COMPLETED } }));
if (action.payload.status === CLNForwardingEventsStatusEnum.FAILED) {
this.store.dispatch(setForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED, offset: offset, maxLen: maxLen, totalForwards: filteredFailedEvents.length, listForwards: filteredFailedEvents } }));
this.store.dispatch(setForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED, totalForwards: fhRes.length, listForwards: fhRes } }));
} else if (action.payload.status === CLNForwardingEventsStatusEnum.LOCAL_FAILED) {
this.store.dispatch(setForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED, offset: offset, maxLen: maxLen, totalForwards: filteredLocalFailedEvents.length, listForwards: filteredLocalFailedEvents } }));
this.store.dispatch(setForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED, totalForwards: fhRes.length, listForwards: fhRes } }));
} else if (action.payload.status === CLNForwardingEventsStatusEnum.SETTLED) {
this.store.dispatch(setForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.SETTLED, offset: offset, maxLen: maxLen, totalForwards: filteredSuccessfulEvents.length, listForwards: filteredSuccessfulEvents } }));
this.store.dispatch(setForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.SETTLED, totalForwards: fhRes.length, listForwards: fhRes } }));
}
return { type: RTLActions.VOID };
} else {
return {
type: CLNActions.SET_FORWARDING_HISTORY_CLN,
payload: fhRes
};
}
}),
catchError((err: any) => {
this.handleErrorWithAlert('FetchForwardingHistory' + statusInitial, 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 });
})
);
}),
catchError((err: any) => {
this.handleErrorWithAlert('FetchForwardingHistory' + statusInitial, UI_MESSAGES.NO_SPINNER, 'Get ' + action.payload.status + ' Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards?status=' + action.payload.status, err);
return of({ type: RTLActions.VOID });
})
);
})
));

@ -2,7 +2,7 @@
<div fxLayout="column" fxLayout.gt-xs="row" fxLayoutAlign.gt-xs="start center" fxLayoutAlign="start stretch" fxFlex="100" class="page-sub-title-container w-100">
<div fxFlex="70">
<fa-icon [icon]="faHistory" class="page-title-img mr-1"></fa-icon>
<span class="page-title">{{swapCaption}} History, {{flgLoading}}</span>
<span class="page-title">{{swapCaption}} History</span>
</div>
<mat-form-field fxFlex="30">
<input matInput (keyup)="applyFilter()" [(ngModel)]="selFilter" placeholder="Filter">

@ -1,7 +1,7 @@
import { APICallStatusEnum } from '../services/consts-enums-functions';
export interface ApiCallStatusPayload {
status: APICallStatusEnum;
status?: APICallStatusEnum;
action?: string;
statusCode?: string;
message?: string;

@ -285,8 +285,6 @@ export interface LocalFailedEvent {
export interface ListForwards {
status?: CLNForwardingEventsStatusEnum;
offset?: number;
maxLen?: number;
totalForwards?: number;
listForwards?: ForwardingEvent[] | LocalFailedEvent[];
}
@ -498,6 +496,4 @@ export interface FunderPolicy {
export interface FetchListForwards {
status?: string;
maxLen?: number;
offset?: number;
}

@ -27,4 +27,4 @@ export const environment = {
Web_SOCKET_API: '/ws'
};
export const VERSION = '0.12.4-beta';
export const VERSION = '0.13.0-beta';

@ -27,4 +27,4 @@ export const environment = {
Web_SOCKET_API: '/ws'
};
export const VERSION = '0.12.4-beta';
export const VERSION = '0.13.0-beta';

Loading…
Cancel
Save