Invoice refresh (#763)

Refresh on Invoices Grid #714
pull/765/head
ShahanaFarooqui 3 years ago committed by GitHub
parent 13ea5389a6
commit 034d1faa41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -10,9 +10,9 @@
<link i18n-rel="" rel="mask-icon" href="assets/images/favicon-light/safari-pinned-tab.svg" color="#5bbad5">
<meta i18n-content="" name="msapplication-TileColor" content="#da532c">
<meta i18n-content="" name="theme-color" content="#ffffff">
<style>@font-face{font-family:Roboto;src:url(Roboto-Thin.dbd56bd3357dc3617fe5.woff2) format("woff2"),url(Roboto-Thin.e7f7c82374bd0ebef14b.woff) format("woff");font-weight:100;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.a8cef84f735ef887abdc.woff2) format("woff2"),url(Roboto-ThinItalic.5dd9349c940073834e9a.woff) format("woff");font-weight:100;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Light.c27d89ac77468ae18f28.woff2) format("woff2"),url(Roboto-Light.d923dfafc0c5183b59aa.woff) format("woff");font-weight:300;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.506274c7228cf81cae4d.woff2) format("woff2"),url(Roboto-LightItalic.d4b8c137518d9d92bb28.woff) format("woff");font-weight:300;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Regular.64cfb66c866ea50cad47.woff2) format("woff2"),url(Roboto-Regular.e02e9d6ff5547f7e9962.woff) format("woff");font-weight:400;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.4dd2af1e8df532f41db8.woff2) format("woff2"),url(Roboto-RegularItalic.5ea38fff9eebef99c5df.woff) format("woff");font-weight:400;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Medium.1d3bced88509b0838984.woff2) format("woff2"),url(Roboto-Medium.092c6130df8fd2199888.woff) format("woff");font-weight:500;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.d620b8f53f75966fe42e.woff2) format("woff2"),url(Roboto-MediumItalic.18ff1628c628080166c1.woff) format("woff");font-weight:500;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Bold.92fbd4e93cf0a5dbebaa.woff2) format("woff2"),url(Roboto-Bold.73288d91c325e82a5b92.woff) format("woff");font-weight:700;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.5f600d98a73d800ae575.woff2) format("woff2"),url(Roboto-BoldItalic.6d89acbd21d7e3fbecb2.woff) format("woff");font-weight:700;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Black.41ed1105a6ebb8ffe34e.woff2) format("woff2"),url(Roboto-Black.937491dfcbe64ca9a9f1.woff) format("woff");font-weight:900;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.50ca4c51ebc27e7e7d2f.woff2) format("woff2"),url(Roboto-BlackItalic.2e1ee657996854c6f427.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;margin:0;}body{height:100%;overflow:hidden;}*{margin:0;padding:0;}</style><link rel="stylesheet" href="styles.8a7bba95e633f72b8334.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.8a7bba95e633f72b8334.css"></noscript></head>
<style>@font-face{font-family:Roboto;src:url(Roboto-Thin.dbd56bd3357dc3617fe5.woff2) format("woff2"),url(Roboto-Thin.e7f7c82374bd0ebef14b.woff) format("woff");font-weight:100;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.a8cef84f735ef887abdc.woff2) format("woff2"),url(Roboto-ThinItalic.5dd9349c940073834e9a.woff) format("woff");font-weight:100;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Light.c27d89ac77468ae18f28.woff2) format("woff2"),url(Roboto-Light.d923dfafc0c5183b59aa.woff) format("woff");font-weight:300;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.506274c7228cf81cae4d.woff2) format("woff2"),url(Roboto-LightItalic.d4b8c137518d9d92bb28.woff) format("woff");font-weight:300;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Regular.64cfb66c866ea50cad47.woff2) format("woff2"),url(Roboto-Regular.e02e9d6ff5547f7e9962.woff) format("woff");font-weight:400;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.4dd2af1e8df532f41db8.woff2) format("woff2"),url(Roboto-RegularItalic.5ea38fff9eebef99c5df.woff) format("woff");font-weight:400;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Medium.1d3bced88509b0838984.woff2) format("woff2"),url(Roboto-Medium.092c6130df8fd2199888.woff) format("woff");font-weight:500;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.d620b8f53f75966fe42e.woff2) format("woff2"),url(Roboto-MediumItalic.18ff1628c628080166c1.woff) format("woff");font-weight:500;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Bold.92fbd4e93cf0a5dbebaa.woff2) format("woff2"),url(Roboto-Bold.73288d91c325e82a5b92.woff) format("woff");font-weight:700;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.5f600d98a73d800ae575.woff2) format("woff2"),url(Roboto-BoldItalic.6d89acbd21d7e3fbecb2.woff) format("woff");font-weight:700;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Black.41ed1105a6ebb8ffe34e.woff2) format("woff2"),url(Roboto-Black.937491dfcbe64ca9a9f1.woff) format("woff");font-weight:900;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.50ca4c51ebc27e7e7d2f.woff2) format("woff2"),url(Roboto-BlackItalic.2e1ee657996854c6f427.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;margin:0;}body{height:100%;overflow:hidden;}*{margin:0;padding:0;}</style><link rel="stylesheet" href="styles.50804d64c130486c55c1.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.50804d64c130486c55c1.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.2e282cc6f811209b3099.js" defer></script><script src="polyfills.a979cbbe16939013cdcf.js" defer></script><script src="main.1e9a1ea238c1e1f66199.js" defer></script>
<script src="runtime.deaf4f8f443fce251eb3.js" defer></script><script src="polyfills.a979cbbe16939013cdcf.js" defer></script><script src="main.3bcd19a001cf53651787.js" defer></script>
</body></html>

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
(()=>{"use strict";var e,r,t,o={},a={};function n(e){var r=a[e];if(void 0!==r)return r.exports;var t=a[e]={id:e,loaded:!1,exports:{}};return o[e].call(t.exports,t,t.exports,n),t.loaded=!0,t.exports}n.m=o,e=[],n.O=(r,t,o,a)=>{if(!t){var l=1/0;for(c=0;c<e.length;c++){for(var[t,o,a]=e[c],i=!0,d=0;d<t.length;d++)(!1&a||l>=a)&&Object.keys(n.O).every(e=>n.O[e](t[d]))?t.splice(d--,1):(i=!1,a<l&&(l=a));i&&(e.splice(c--,1),r=o())}return r}a=a||0;for(var c=e.length;c>0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[t,o,a]},n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+"."+{358:"c23c0f6205af83b3d6c4",432:"edc184470c776a31dec4",891:"5f9b365bcec35211e41e",958:"a55d8156c48e68ddc825"}[e]+".js",n.miniCssF=e=>"styles.8a7bba95e633f72b8334.css",n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},t="rtl:",n.l=(e,o,a,l)=>{if(r[e])r[e].push(o);else{var i,d;if(void 0!==a)for(var c=document.getElementsByTagName("script"),s=0;s<c.length;s++){var u=c[s];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==t+a){i=u;break}}i||(d=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,n.nc&&i.setAttribute("nonce",n.nc),i.setAttribute("data-webpack",t+a),i.src=e),r[e]=[o];var f=(t,o)=>{i.onerror=i.onload=null,clearTimeout(p);var a=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(o)),t)return t(o)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=f.bind(null,i.onerror),i.onload=f.bind(null,i.onload),d&&document.head.appendChild(i)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n.p="",(()=>{var e={666:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else if(666!=r){var a=new Promise((t,a)=>o=e[r]=[t,a]);t.push(o[2]=a);var l=n.p+n.u(r),i=new Error;n.l(l,t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var a=t&&("load"===t.type?"missing":t.type),l=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+a+": "+l+")",i.name="ChunkLoadError",i.type=a,i.request=l,o[1](i)}},"chunk-"+r,r)}else e[r]=0},n.O.j=r=>0===e[r];var r=(r,t)=>{var o,a,[l,i,d]=t,c=0;for(o in i)n.o(i,o)&&(n.m[o]=i[o]);if(d)var s=d(n);for(r&&r(t);c<l.length;c++)n.o(e,a=l[c])&&e[a]&&e[a][0](),e[l[c]]=0;return n.O(s)},t=self.webpackChunkrtl=self.webpackChunkrtl||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();

@ -0,0 +1 @@
(()=>{"use strict";var e,r,t,o={},a={};function n(e){var r=a[e];if(void 0!==r)return r.exports;var t=a[e]={id:e,loaded:!1,exports:{}};return o[e].call(t.exports,t,t.exports,n),t.loaded=!0,t.exports}n.m=o,e=[],n.O=(r,t,o,a)=>{if(!t){var l=1/0;for(s=0;s<e.length;s++){for(var[t,o,a]=e[s],d=!0,i=0;i<t.length;i++)(!1&a||l>=a)&&Object.keys(n.O).every(e=>n.O[e](t[i]))?t.splice(i--,1):(d=!1,a<l&&(l=a));d&&(e.splice(s--,1),r=o())}return r}a=a||0;for(var s=e.length;s>0&&e[s-1][2]>a;s--)e[s]=e[s-1];e[s]=[t,o,a]},n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+"."+{358:"c5627bb1bdae1eed68cb",432:"973189a73bf70118a95c",891:"f50ed5ee955e9ad8b4cf",958:"a55d8156c48e68ddc825"}[e]+".js",n.miniCssF=e=>"styles.50804d64c130486c55c1.css",n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},t="rtl:",n.l=(e,o,a,l)=>{if(r[e])r[e].push(o);else{var d,i;if(void 0!==a)for(var s=document.getElementsByTagName("script"),u=0;u<s.length;u++){var c=s[u];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")==t+a){d=c;break}}d||(i=!0,(d=document.createElement("script")).charset="utf-8",d.timeout=120,n.nc&&d.setAttribute("nonce",n.nc),d.setAttribute("data-webpack",t+a),d.src=e),r[e]=[o];var f=(t,o)=>{d.onerror=d.onload=null,clearTimeout(p);var a=r[e];if(delete r[e],d.parentNode&&d.parentNode.removeChild(d),a&&a.forEach(e=>e(o)),t)return t(o)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:d}),12e4);d.onerror=f.bind(null,d.onerror),d.onload=f.bind(null,d.onload),i&&document.head.appendChild(d)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n.p="",(()=>{var e={666:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else if(666!=r){var a=new Promise((t,a)=>o=e[r]=[t,a]);t.push(o[2]=a);var l=n.p+n.u(r),d=new Error;n.l(l,t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var a=t&&("load"===t.type?"missing":t.type),l=t&&t.target&&t.target.src;d.message="Loading chunk "+r+" failed.\n("+a+": "+l+")",d.name="ChunkLoadError",d.type=a,d.request=l,o[1](d)}},"chunk-"+r,r)}else e[r]=0},n.O.j=r=>0===e[r];var r=(r,t)=>{var o,a,[l,d,i]=t,s=0;for(o in d)n.o(d,o)&&(n.m[o]=d[o]);if(i)var u=i(n);for(r&&r(t);s<l.length;s++)n.o(e,a=l[s])&&e[a]&&e[a][0](),e[l[s]]=0;return n.O(u)},t=self.webpackChunkrtl=self.webpackChunkrtl||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -30,6 +30,25 @@ getReceivedPaymentInfo = (invoice) => {
}
}
exports.getInvoice = (req, res, next) => {
logger.log({level: 'INFO', fileName: 'Channels', msg: 'Getting Invoice..'});
options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/getinvoice';
options.form = { paymentHash: req.params.paymentHash };
request.post(options).then(function (body) {
logger.log({level: 'DEBUG', fileName: 'Invoice', msg: 'Invoice Found', data: body});
let current_time = (Math.round(new Date(Date.now()).getTime()/1000)).toString();
body.amount = body.amount ? body.amount/1000 : 0;
body.expiresAt = body.expiresAt ? body.expiresAt : (body.timestamp + body.expiry);
body.status = body.status ? body.status : (+body.expiresAt < current_time ? "expired" : "unknown");
res.status(200).json(body);
})
.catch(errRes => {
const err = common.handleError(errRes, 'Invoices', 'Get Invoice Error');
return res.status(err.statusCode).json({message: err.message, error: err.error});
});
};
exports.listInvoices = (req, res, next) => {
logger.log({level: 'INFO', fileName: 'Invoices', msg: 'Getting List Invoices..'});
options = common.getOptions();

@ -10,6 +10,9 @@ exports.getInvoice = (req, res, next) => {
request(options).then((body) => {
logger.log({level: 'DEBUG', fileName: 'Invoice', msg: 'Invoice Info Received', data: body});
logger.log({level: 'INFO', fileName: 'Invoice', msg: 'Invoice Information Received'});
body.r_preimage = body.r_preimage ? Buffer.from(body.r_preimage, 'base64').toString('hex') : '';
body.r_hash = body.r_hash ? Buffer.from(body.r_hash, 'base64').toString('hex') : '';
body.description_hash = body.description_hash ? Buffer.from(body.description_hash, 'base64').toString('hex') : null;
res.status(200).json(body);
})
.catch(errRes => {

@ -4,6 +4,7 @@ const router = express.Router();
const authCheck = require("../shared/authCheck");
router.get("/", authCheck, invoicesController.listInvoices);
router.get("/:paymentHash", authCheck, invoicesController.getInvoice);
router.post("/", authCheck, invoicesController.createInvoice);
module.exports = router;

@ -25,6 +25,7 @@ import * as fromCLReducers from '../store/cl.reducers';
export class CLEffects implements OnDestroy {
CHILD_API_URL = API_URL + '/cl';
private flgInitialized = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(
@ -41,12 +42,14 @@ export class CLEffects implements OnDestroy {
pipe(takeUntil(this.unSubs[0])).
subscribe((rtlStore) => {
if (
(rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.ERROR) &&
((rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.ERROR) &&
(rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.ERROR) &&
(rtlStore.apisCallStatus.FetchBalance.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchBalance.status === APICallStatusEnum.ERROR) &&
(rtlStore.apisCallStatus.FetchLocalRemoteBalance.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchLocalRemoteBalance.status === APICallStatusEnum.ERROR)
(rtlStore.apisCallStatus.FetchLocalRemoteBalance.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchLocalRemoteBalance.status === APICallStatusEnum.ERROR)) &&
!this.flgInitialized
) {
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.INITALIZE_NODE_DATA));
this.flgInitialized = true;
}
});
}
@ -55,6 +58,7 @@ export class CLEffects implements OnDestroy {
ofType(CLActions.FETCH_INFO_CL),
withLatestFrom(this.store.select('root')),
mergeMap(([action, store]: [CLActions.FetchInfo, fromRTLReducer.RootState]) => {
this.flgInitialized = false;
this.store.dispatch(new CLActions.UpdateAPICallStatus({ action: 'FetchInfo', status: APICallStatusEnum.INITIATED }));
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.GET_NODE_INFO));
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + environment.GETINFO_API).
@ -568,6 +572,31 @@ export class CLEffects implements OnDestroy {
})
));
invoiceLookupCL = createEffect(() => this.actions.pipe(
ofType(CLActions.INVOICE_LOOKUP_CL),
mergeMap((action: CLActions.InvoiceLookup) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.SEARCHING_INVOICE));
this.store.dispatch(new CLActions.UpdateAPICallStatus({ action: 'Lookup', status: APICallStatusEnum.INITIATED }));
return this.httpClient.get(this.CHILD_API_URL + environment.INVOICES_API + '?label=' + action.payload).
pipe(
map((resInvoice: any) => {
this.logger.info(resInvoice);
this.store.dispatch(new CLActions.UpdateAPICallStatus({ action: 'Lookup', status: APICallStatusEnum.COMPLETED }));
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.SEARCHING_INVOICE));
return {
type: CLActions.SET_LOOKUP_CL,
payload: resInvoice.invoices && resInvoice.invoices.length && resInvoice.invoices.length > 0 ? resInvoice.invoices[0] : resInvoice
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('Lookup', UI_MESSAGES.SEARCHING_INVOICE, 'Invoice Lookup Failed', err);
this.store.dispatch(new RTLActions.OpenSnackBar({ message: 'Invoice Refresh Failed.', type: 'ERROR' }));
return of({ type: RTLActions.VOID });
})
);
})
));
setLookupCL = createEffect(
() => this.actions.pipe(
ofType(CLActions.SET_LOOKUP_CL),

@ -68,7 +68,13 @@
</div>
</th>
<td mat-cell *matCellDef="let invoice" [ngClass]="{'px-3': screenSize !== screenSizeEnum.XS}" fxLayoutAlign="end center">
<button mat-stroked-button color="primary" type="button" tabindex="4" (click)="onInvoiceClick(invoice, $event)">View Info</button>
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">
<mat-select placeholder="Actions" tabindex="4" class="mr-0">
<mat-select-trigger></mat-select-trigger>
<mat-option (click)="onInvoiceClick(invoice)">View Info</mat-option>
<mat-option (click)="onRefreshInvoice(invoice)">Refresh</mat-option>
</mat-select>
</div>
</td>
</ng-container>
<ng-container matColumnDef="no_invoice">

@ -1,8 +1,9 @@
import { Component, OnInit, OnDestroy, ViewChild, Input, AfterViewInit } from '@angular/core';
import { DecimalPipe, DatePipe } from '@angular/common';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { filter, takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { faHistory } from '@fortawesome/free-solid-svg-icons';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
@ -64,7 +65,7 @@ export class CLLightningInvoicesComponent implements OnInit, AfterViewInit, OnDe
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private decimalPipe: DecimalPipe, private commonService: CommonService, private rtlEffects: RTLEffects, private datePipe: DatePipe) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private decimalPipe: DecimalPipe, private commonService: CommonService, private rtlEffects: RTLEffects, private datePipe: DatePipe, private actions: Actions) {
this.screenSize = this.commonService.getScreenSize();
if (this.screenSize === ScreenSizeEnum.XS) {
this.flgSticky = false;
@ -101,6 +102,15 @@ export class CLLightningInvoicesComponent implements OnInit, AfterViewInit, OnDe
}, 5000);
this.logger.info(rtlStore);
});
this.actions.pipe(takeUntil(this.unSubs[1]), filter((action) => (action.type === CLActions.SET_LOOKUP_CL || action.type === CLActions.UPDATE_API_CALL_STATUS_CL))).
subscribe((resLookup: CLActions.SetLookup | CLActions.UpdateAPICallStatus) => {
if (resLookup.type === CLActions.SET_LOOKUP_CL) {
if (this.invoiceJSONArr && this.invoiceJSONArr.length > 0 && this.sort && this.paginator && resLookup.payload) {
this.updateInvoicesData(JSON.parse(JSON.stringify(resLookup.payload)));
this.loadInvoicesTable(this.invoiceJSONArr);
}
}
});
}
ngAfterViewInit() {
@ -135,7 +145,7 @@ export class CLLightningInvoicesComponent implements OnInit, AfterViewInit, OnDe
data: { type: 'CONFIRM', titleMessage: 'Delete Expired Invoices', noBtnText: 'Cancel', yesBtnText: 'Delete Invoices' }
}));
this.rtlEffects.closeConfirm.
pipe(takeUntil(this.unSubs[1])).
pipe(takeUntil(this.unSubs[2])).
subscribe((confirmRes) => {
if (confirmRes) {
this.store.dispatch(new CLActions.DeleteExpiredInvoice());
@ -143,7 +153,7 @@ export class CLLightningInvoicesComponent implements OnInit, AfterViewInit, OnDe
});
}
onInvoiceClick(selInvoice: Invoice, event: any) {
onInvoiceClick(selInvoice: Invoice) {
const reCreatedInvoice: Invoice = {
msatoshi: selInvoice.msatoshi,
label: selInvoice.label,
@ -178,7 +188,7 @@ export class CLLightningInvoicesComponent implements OnInit, AfterViewInit, OnDe
if (this.selNode.fiatConversion && this.invoiceValue > 99) {
this.invoiceValueHint = '';
this.commonService.convertCurrency(this.invoiceValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, this.selNode.currencyUnits[2], this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[1])).
pipe(takeUntil(this.unSubs[3])).
subscribe({ next: (data) => {
this.invoiceValueHint = '= ' + data.symbol + this.decimalPipe.transform(data.OTHER, CURRENCY_UNIT_FORMATS.OTHER) + ' ' + data.unit;
}, error: (err) => {
@ -187,6 +197,14 @@ export class CLLightningInvoicesComponent implements OnInit, AfterViewInit, OnDe
}
}
onRefreshInvoice(selInvoice: Invoice) {
this.store.dispatch(new CLActions.InvoiceLookup(selInvoice.label));
}
updateInvoicesData(newInvoice: Invoice) {
this.invoiceJSONArr = this.invoiceJSONArr.map((invoice) => ((invoice.label === newInvoice.label) ? newInvoice : invoice));
}
loadInvoicesTable(invs: Invoice[]) {
this.invoices = (invs) ? new MatTableDataSource<Invoice>([...invs]) : new MatTableDataSource([]);
this.invoices.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);

@ -51,6 +51,7 @@ export const SET_TOTAL_INVOICES_ECL = 'SET_TOTAL_INVOICES_ECL';
export const CREATE_INVOICE_ECL = 'CREATE_INVOICE_ECL';
export const ADD_INVOICE_ECL = 'ADD_INVOICE_ECL';
export const PEER_LOOKUP_ECL = 'PEER_LOOKUP_ECL';
export const INVOICE_LOOKUP_ECL = 'INVOICE_LOOKUP_ECL';
export const SET_LOOKUP_ECL = 'SET_LOOKUP_ECL';
export class UpdateAPICallStatus implements Action {
@ -360,6 +361,13 @@ export class PeerLookup implements Action {
}
export class InvoiceLookup implements Action {
readonly type = INVOICE_LOOKUP_ECL;
constructor(public payload: string) {} // Payload = paymentHash
}
export class SetLookup implements Action {
readonly type = SET_LOOKUP_ECL;
@ -374,7 +382,7 @@ export type ECLActions = ResetECLStore | UpdateAPICallStatus | SetChildNodeSetti
SetChannelsStatus | FetchChannelStats | SetChannelStats |
FetchOnchainBalance | SetOnchainBalance | GetNewAddress | SetNewAddress |
SendOnchainFunds | SendOnchainFundsRes | FetchTransactions | SetTransactions |
SetLightningBalance | FetchPeers | SetPeers | PeerLookup | SetLookup |
SetLightningBalance | FetchPeers | SetPeers | PeerLookup | InvoiceLookup | SetLookup |
SaveNewChannel | UpdateChannels | CloseChannel | RemoveChannel |
FetchPayments | SetPayments | SendPayment | SendPaymentStatus |
FetchInvoices | SetInvoices | CreateInvoice | AddInvoice;

@ -25,6 +25,7 @@ import * as RTLActions from '../../store/rtl.actions';
export class ECLEffects implements OnDestroy {
CHILD_API_URL = API_URL + '/ecl';
private flgInitialized = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(
@ -41,11 +42,13 @@ export class ECLEffects implements OnDestroy {
pipe(takeUntil(this.unSubs[0])).
subscribe((rtlStore) => {
if (
(rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.ERROR) &&
((rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.ERROR) &&
(rtlStore.apisCallStatus.FetchOnchainBalance.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchOnchainBalance.status === APICallStatusEnum.ERROR) &&
(rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.ERROR)
(rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.ERROR)) &&
!this.flgInitialized
) {
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.INITALIZE_NODE_DATA));
this.flgInitialized = true;
}
});
}
@ -54,6 +57,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.FETCH_INFO_ECL),
withLatestFrom(this.store.select('root')),
mergeMap(([action, store]: [ECLActions.FetchInfo, fromRTLReducer.RootState]) => {
this.flgInitialized = false;
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.GET_NODE_INFO));
this.store.dispatch(new ECLActions.UpdateAPICallStatus({ action: 'FetchInfo', status: APICallStatusEnum.INITIATED }));
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + environment.GETINFO_API).
@ -572,6 +576,31 @@ export class ECLEffects implements OnDestroy {
})
));
invoiceLookup = createEffect(() => this.actions.pipe(
ofType(ECLActions.INVOICE_LOOKUP_ECL),
mergeMap((action: ECLActions.InvoiceLookup) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.SEARCHING_INVOICE));
this.store.dispatch(new ECLActions.UpdateAPICallStatus({ action: 'Lookup', status: APICallStatusEnum.INITIATED }));
return this.httpClient.get(this.CHILD_API_URL + environment.INVOICES_API + '/' + action.payload).
pipe(
map((resInvoice) => {
this.logger.info(resInvoice);
this.store.dispatch(new ECLActions.UpdateAPICallStatus({ action: 'Lookup', status: APICallStatusEnum.COMPLETED }));
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.SEARCHING_INVOICE));
return {
type: ECLActions.SET_LOOKUP_ECL,
payload: resInvoice
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('Lookup', UI_MESSAGES.SEARCHING_INVOICE, 'Invoice Lookup Failed', err);
this.store.dispatch(new RTLActions.OpenSnackBar({ message: 'Invoice Refresh Failed.', type: 'ERROR' }));
return of({ type: RTLActions.VOID });
})
);
})
));
setLookup = createEffect(
() => this.actions.pipe(
ofType(ECLActions.SET_LOOKUP_ECL),

@ -35,7 +35,7 @@
<td mat-cell *matCellDef="let invoice">
<span *ngIf="invoice.status === 'received'" class="dot green" matTooltip="Received" matTooltipPosition="right" [ngClass]="{'mr-0': screenSize === screenSizeEnum.XS}"></span>
<span *ngIf="invoice.status === 'unpaid'" class="dot yellow" matTooltip="Unpaid" matTooltipPosition="right" [ngClass]="{'mr-0': screenSize === screenSizeEnum.XS}"></span>
<span *ngIf="invoice.status === 'expired' || invoice.status === 'unknown'" class="dot red" matTooltip="Expired" matTooltipPosition="right" [ngClass]="{'mr-0': screenSize === screenSizeEnum.XS}"></span>
<span *ngIf="!invoice.status || invoice.status === 'expired' || invoice.status === 'unknown'" class="dot red" matTooltip="Expired/Unknown" matTooltipPosition="right" [ngClass]="{'mr-0': screenSize === screenSizeEnum.XS}"></span>
{{(invoice.timestamp * 1000) | date:'dd/MMM/YYYY HH:mm'}}
</td>
</ng-container>
@ -73,7 +73,13 @@
</div>
</th>
<td mat-cell *matCellDef="let invoice" [ngClass]="{'px-3': screenSize !== screenSizeEnum.XS}" fxLayoutAlign="end center">
<button mat-stroked-button color="primary" type="button" tabindex="4" (click)="onInvoiceClick(invoice, $event)">View Info</button>
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">
<mat-select placeholder="Actions" tabindex="4" class="mr-0">
<mat-select-trigger></mat-select-trigger>
<mat-option (click)="onInvoiceClick(invoice)">View Info</mat-option>
<mat-option (click)="onRefreshInvoice(invoice)">Refresh</mat-option>
</mat-select>
</div>
</td>
</ng-container>
<ng-container matColumnDef="no_invoice">

@ -1,8 +1,9 @@
import { Component, OnInit, OnDestroy, ViewChild, Input, AfterViewInit } from '@angular/core';
import { DecimalPipe, DatePipe } from '@angular/common';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { filter, takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { faHistory } from '@fortawesome/free-solid-svg-icons';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
@ -61,7 +62,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private decimalPipe: DecimalPipe, private commonService: CommonService, private datePipe: DatePipe) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private decimalPipe: DecimalPipe, private commonService: CommonService, private datePipe: DatePipe, private actions: Actions) {
this.screenSize = this.commonService.getScreenSize();
if (this.screenSize === ScreenSizeEnum.XS) {
this.flgSticky = false;
@ -98,6 +99,15 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
}, 5000);
this.logger.info(rtlStore);
});
this.actions.pipe(takeUntil(this.unSubs[1]), filter((action) => (action.type === ECLActions.SET_LOOKUP_ECL || action.type === ECLActions.UPDATE_API_CALL_STATUS_ECL))).
subscribe((resLookup: ECLActions.SetLookup | ECLActions.UpdateAPICallStatus) => {
if (resLookup.type === ECLActions.SET_LOOKUP_ECL) {
if (this.invoiceJSONArr.length > 0 && this.sort && this.paginator && resLookup.payload) {
this.updateInvoicesData(JSON.parse(JSON.stringify(resLookup.payload)));
this.loadInvoicesTable(this.invoiceJSONArr);
}
}
});
}
ngAfterViewInit() {
@ -131,7 +141,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
this.resetData();
}
onInvoiceClick(selInvoice: Invoice, event: any) {
onInvoiceClick(selInvoice: Invoice) {
this.store.dispatch(new RTLActions.OpenAlert({ data: {
invoice: selInvoice,
newlyAdded: false,
@ -139,6 +149,14 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
} }));
}
onRefreshInvoice(selInvoice: Invoice) {
this.store.dispatch(new ECLActions.InvoiceLookup(selInvoice.paymentHash));
}
updateInvoicesData(newInvoice: Invoice) {
this.invoiceJSONArr = this.invoiceJSONArr.map((invoice) => ((invoice.paymentHash === newInvoice.paymentHash) ? newInvoice : invoice));
}
loadInvoicesTable(invs: Invoice[]) {
this.invoices = invs ? new MatTableDataSource<Invoice>([...invs]) : new MatTableDataSource<Invoice>([]);
this.invoices.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
@ -165,7 +183,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
if (this.selNode.fiatConversion && this.invoiceValue > 99) {
this.invoiceValueHint = '';
this.commonService.convertCurrency(this.invoiceValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, this.selNode.currencyUnits[2], this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[1])).
pipe(takeUntil(this.unSubs[2])).
subscribe({ next: (data) => {
this.invoiceValueHint = '= ' + data.symbol + this.decimalPipe.transform(data.OTHER, CURRENCY_UNIT_FORMATS.OTHER) + ' ' + data.unit;
}, error: (err) => {

@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';

@ -27,6 +27,7 @@ export class LNDEffects implements OnDestroy {
dialogRef: any;
CHILD_API_URL = API_URL + '/lnd';
private flgInitialized = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(
@ -44,12 +45,14 @@ export class LNDEffects implements OnDestroy {
pipe(takeUntil(this.unSubs[0])).
subscribe((rtlStore) => {
if (
(rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.ERROR) &&
((rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.ERROR) &&
(rtlStore.apisCallStatus.FetchBalanceBlockchain.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchBalanceBlockchain.status === APICallStatusEnum.ERROR) &&
(rtlStore.apisCallStatus.FetchAllChannels.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchAllChannels.status === APICallStatusEnum.ERROR) &&
(rtlStore.apisCallStatus.FetchPendingChannels.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchPendingChannels.status === APICallStatusEnum.ERROR)
(rtlStore.apisCallStatus.FetchPendingChannels.status === APICallStatusEnum.COMPLETED || rtlStore.apisCallStatus.FetchPendingChannels.status === APICallStatusEnum.ERROR)) &&
!this.flgInitialized
) {
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.INITALIZE_NODE_DATA));
this.flgInitialized = true;
}
});
}
@ -58,6 +61,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.FETCH_INFO_LND),
withLatestFrom(this.store.select('root')),
mergeMap(([action, store]: [LNDActions.FetchInfo, fromRTLReducer.RootState]) => {
this.flgInitialized = false;
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.GET_NODE_INFO));
this.store.dispatch(new LNDActions.UpdateAPICallStatus({ action: 'FetchInfo', status: APICallStatusEnum.INITIATED }));
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + environment.GETINFO_API).pipe(
@ -1034,7 +1038,8 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('Lookup', UI_MESSAGES.SEARCHING_INVOICE, 'Invoice Lookup Failed', this.CHILD_API_URL + environment.INVOICES_API + '/' + action.payload, err);
this.handleErrorWithoutAlert('Lookup', UI_MESSAGES.SEARCHING_INVOICE, 'Invoice Lookup Failed', err);
this.store.dispatch(new RTLActions.OpenSnackBar({ message: 'Invoice Refresh Failed.', type: 'ERROR' }));
return of({ type: RTLActions.VOID });
})
);

@ -37,7 +37,7 @@
</div>
<div fxFlex="50">
<h4 fxLayoutAlign="start" class="font-bold-500">Date Settled</h4>
<span class="foreground-secondary-text">{{((invoice.settle_date * 1000) | date:'dd/MMM/YYYY HH:mm') || '-'}}</span>
<span class="foreground-secondary-text">{{(+invoice.settle_date !== 0 ? ((+invoice.settle_date * 1000) | date:'dd/MMM/YYYY HH:mm') : '-')}}</span>
</div>
</div>
<mat-divider [inset]="true" class="my-1"></mat-divider>

@ -38,7 +38,7 @@
</ng-container>
<ng-container matColumnDef="settle_date">
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-4"> Date Settled </th>
<td mat-cell *matCellDef="let invoice" class="pl-4">{{((invoice.settle_date * 1000) | date:'dd/MMM/YYYY HH:mm') || '-'}}</td>
<td mat-cell *matCellDef="let invoice" class="pl-4">{{(+invoice.settle_date !== 0 ? ((+invoice.settle_date * 1000) | date:'dd/MMM/YYYY HH:mm') : '-')}}</td>
</ng-container>
<ng-container matColumnDef="memo">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Memo </th>
@ -66,7 +66,13 @@
</div>
</th>
<td mat-cell *matCellDef="let invoice" [ngClass]="{'pl-3': screenSize !== screenSizeEnum.XS}" fxLayoutAlign="end center">
<button mat-stroked-button color="primary" type="button" tabindex="4" (click)="onInvoiceClick(invoice, $event)">View Info</button>
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">
<mat-select placeholder="Actions" tabindex="4" class="mr-0">
<mat-select-trigger></mat-select-trigger>
<mat-option (click)="onInvoiceClick(invoice)">View Info</mat-option>
<mat-option (click)="onRefreshInvoice(invoice)">Refresh</mat-option>
</mat-select>
</div>
</td>
</ng-container>
<ng-container matColumnDef="no_invoice">

@ -1,8 +1,9 @@
import { Component, OnInit, OnDestroy, ViewChild, Input, AfterViewInit } from '@angular/core';
import { DatePipe, DecimalPipe } from '@angular/common';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { filter, takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { faHistory } from '@fortawesome/free-solid-svg-icons';
import { MatPaginator, MatPaginatorIntl, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
@ -66,7 +67,7 @@ export class LightningInvoicesComponent implements OnInit, AfterViewInit, OnDest
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private decimalPipe: DecimalPipe, private commonService: CommonService, private datePipe: DatePipe) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private decimalPipe: DecimalPipe, private commonService: CommonService, private datePipe: DatePipe, private actions: Actions) {
this.screenSize = this.commonService.getScreenSize();
if (this.screenSize === ScreenSizeEnum.XS) {
this.flgSticky = false;
@ -103,6 +104,15 @@ export class LightningInvoicesComponent implements OnInit, AfterViewInit, OnDest
}
this.logger.info(rtlStore);
});
this.actions.pipe(takeUntil(this.unSubs[1]), filter((action) => (action.type === LNDActions.SET_LOOKUP_LND || action.type === LNDActions.UPDATE_API_CALL_STATUS_LND))).
subscribe((resLookup: LNDActions.SetLookup | LNDActions.UpdateAPICallStatus) => {
if (resLookup.type === LNDActions.SET_LOOKUP_LND) {
if (this.invoicesData.length > 0 && this.sort && this.paginator && resLookup.payload) {
this.updateInvoicesData(JSON.parse(JSON.stringify(resLookup.payload)));
this.loadInvoicesTable(this.invoicesData);
}
}
});
}
ngAfterViewInit() {
@ -123,7 +133,7 @@ export class LightningInvoicesComponent implements OnInit, AfterViewInit, OnDest
this.resetData();
}
onInvoiceClick(selInvoice: Invoice, event: any) {
onInvoiceClick(selInvoice: Invoice) {
this.store.dispatch(new RTLActions.OpenAlert({
data: {
invoice: selInvoice,
@ -133,6 +143,14 @@ export class LightningInvoicesComponent implements OnInit, AfterViewInit, OnDest
}));
}
onRefreshInvoice(selInvoice: Invoice) {
this.store.dispatch(new LNDActions.InvoiceLookup(selInvoice.r_hash));
}
updateInvoicesData(newInvoice: Invoice) {
this.invoicesData = this.invoicesData.map((invoice) => ((invoice.r_hash === newInvoice.r_hash) ? newInvoice : invoice));
}
loadInvoicesTable(invoices) {
this.invoices = invoices ? new MatTableDataSource<Invoice>([...invoices]) : new MatTableDataSource<Invoice>([]);
this.invoices.sort = this.sort;
@ -182,7 +200,7 @@ export class LightningInvoicesComponent implements OnInit, AfterViewInit, OnDest
if (this.selNode.fiatConversion && this.invoiceValue > 99) {
this.invoiceValueHint = '';
this.commonService.convertCurrency(this.invoiceValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, this.selNode.currencyUnits[2], this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[1])).
pipe(takeUntil(this.unSubs[2])).
subscribe({
next: (data) => {
this.invoiceValueHint = '= ' + data.symbol + this.decimalPipe.transform(data.OTHER, CURRENCY_UNIT_FORMATS.OTHER) + ' ' + data.unit;

@ -49,6 +49,17 @@
}
.rtl-snack-bar {
max-width: 90vw !important;
font-weight: 700;
}
.rtl-warn-snack-bar {
max-width: 90vw !important;
font-weight: 700;
color: $warn-color;
}
.rtl-accent-snack-bar {
max-width: 90vw !important;
font-weight: 700;
color: $accent-color;
}
.mat-tab-group.mat-primary .mat-ink-bar, .mat-tab-nav-bar.mat-primary .mat-ink-bar {
background-color: $primary-darker;

@ -47,6 +47,24 @@
}
.rtl-snack-bar {
max-width: 90vw !important;
font-weight: 600;
background-color: $background-color;
opacity: 0.9 !important;
color: $primary-color;
}
.rtl-warn-snack-bar {
max-width: 90vw !important;
font-weight: 600;
background-color: $background-color;
opacity: 0.9 !important;
color: $warn-color;
}
.rtl-accent-snack-bar {
max-width: 90vw !important;
font-weight: 600;
background-color: $background-color;
opacity: 0.9 !important;
color: $accent-color;
}
.mat-tab-label {
&.mat-tab-label-active {

@ -62,7 +62,7 @@ export class CloseAllDialogs implements Action {
export class OpenSnackBar implements Action {
readonly type = OPEN_SNACK_BAR;
constructor(public payload: string | {message: string, duration: number}) {}
constructor(public payload: string | {message: string, duration?: number, type?: string}) {}
}

@ -67,7 +67,13 @@ export class RTLEffects implements OnDestroy {
if (typeof action.payload === 'string') {
this.snackBar.open(action.payload);
} else {
this.snackBar.open(action.payload.message, '', { duration: action.payload.duration });
if (action.payload.type === 'ERROR') {
this.snackBar.open(action.payload.message, '', { duration: action.payload.duration ? action.payload.duration : 2000, panelClass: 'rtl-warn-snack-bar' });
} else if (action.payload.type === 'WARN') {
this.snackBar.open(action.payload.message, '', { duration: action.payload.duration ? action.payload.duration : 2000, panelClass: 'rtl-accent-snack-bar' });
} else {
this.snackBar.open(action.payload.message, '', { duration: action.payload.duration ? action.payload.duration : 2000, panelClass: 'rtl-snack-bar' });
}
}
})),
{ dispatch: false }

Loading…
Cancel
Save