2
0
mirror of https://github.com/Ride-The-Lightning/RTL synced 2024-11-07 15:20:31 +00:00

Technical Debt to improve UI load time (#750)

Technical Debt to improve UI load time
This commit is contained in:
ShahanaFarooqui 2021-08-11 12:23:09 -04:00 committed by GitHub
parent 6ac652dbe7
commit 357de277fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
218 changed files with 2167 additions and 1912 deletions

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

File diff suppressed because one or more lines are too long

View File

@ -10,9 +10,9 @@
<link rel="mask-icon" href="assets/images/favicon-light/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta 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.97554e699a42acff6579.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.97554e699a42acff6579.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.83be63e86b93a0a59299.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.83be63e86b93a0a59299.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.f52f632bb5a718c5c118.js" defer></script><script src="polyfills.b74d595cc9766a139c5a.js" defer></script><script src="main.5a5144560b9519c9afbb.js" defer></script>
<script src="runtime.515ae0e5db4385847ae9.js" defer></script><script src="polyfills.b74d595cc9766a139c5a.js" defer></script><script src="main.ee077938ff4ca83988c5.js" defer></script>
</body></html>

File diff suppressed because one or more lines are too long

View File

@ -1 +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+"."+{432:"2d41157d5748ad590e31",646:"90252f5030b91e4f9473",891:"a7f59bdc4573de4372d0",958:"9c28bf52a09dc9644627"}[e]+".js",n.miniCssF=e=>"styles.97554e699a42acff6579.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))})()})();
(()=>{"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+"."+{432:"49acba864dead79d3813",646:"3fbe4d79910390a14cf6",891:"3def5a306a73761cdf3e",958:"39b052c196c8c4de3969"}[e]+".js",n.miniCssF=e=>"styles.83be63e86b93a0a59299.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

View File

@ -11,21 +11,12 @@ exports.getBalance = (req, res, next) => {
logger.log({level: 'DEBUG', fileName: 'Balance', msg: 'Balance Received', data: body});
if(!body.totalBalance) {
body.totalBalance = 0;
body.btc_totalBalance = 0;
} else {
body.btc_totalBalance = common.convertToBTC(body.totalBalance);
}
if(!body.confBalance) {
body.confBalance = 0;
body.btc_confBalance = 0;
} else {
body.btc_confBalance = common.convertToBTC(body.confBalance);
}
if(!body.unconfBalance) {
body.unconfBalance = 0;
body.btc_unconfBalance = 0;
} else {
body.btc_unconfBalance = common.convertToBTC(body.unconfBalance);
}
logger.log({level: 'INFO', fileName: 'Balance', msg: 'Balance Received'});
res.status(200).json(body);

View File

@ -149,15 +149,9 @@ exports.getLocalRemoteBalance = (req, res, next) => {
logger.log({level: 'DEBUG', fileName: 'Channels', msg: 'Local Remote Balance', data: body});
if(!body.localBalance) {
body.localBalance = 0;
body.btc_localBalance = 0;
} else {
body.btc_localBalance = common.convertToBTC(body.localBalance);
}
if(!body.remoteBalance) {
body.remoteBalance = 0;
body.btc_remoteBalance = 0;
} else {
body.btc_remoteBalance = common.convertToBTC(body.remoteBalance);
}
logger.log({level: 'INFO', fileName: 'Channels', msg: 'Local & Remote Balances Received'});
res.status(200).json(body);

View File

@ -18,9 +18,6 @@ exports.getFees = (req, res, next) => {
} else {
if(!body.feeCollected) {
body.feeCollected = 0;
body.btc_feeCollected = 0;
} else {
body.btc_feeCollected = common.convertToBTC(body.feeCollected);
}
logger.log({level: 'INFO', fileName: 'Fees', msg: 'Fees Received'});
res.status(200).json(body);

View File

@ -28,8 +28,6 @@ exports.getInfo = (req, res, next) => {
error: (!body || search_idx > -1) ? 'Error From Server!' : body.error
});
} else {
body.currency_unit = 'BTC';
body.smaller_currency_unit = 'Sats';
body.lnImplementation = 'C-Lightning';
let chainObj = { chain: '', network: '' };
if (body.network === 'testnet') {

View File

@ -37,10 +37,10 @@ exports.postPeer = (req, res, next) => {
options.body = req.body;
request.post(options, (error, response, body) => {
if(!body || body.error) {
logger.log({level: 'ERROR', fileName: 'Peers', msg: 'Connect Peer Error', error: body.error});
logger.log({level: 'ERROR', fileName: 'Peers', msg: 'Connect Peer Error', error: body && body.error ? body.error : body ? body : ''});
res.status(500).json({
message: "Adding peer failed!",
error: (!body) ? 'Error From Server!' : body.error
error: (!body) ? 'Error From Server!' : body.error ? body.error : 'Error From Server!'
});
} else {
logger.log({level: 'DEBUG', fileName: 'Peers', msg: 'Peer Added', data: body});

View File

@ -13,8 +13,6 @@ exports.getInfo = (req, res, next) => {
logger.log({level: 'DEBUG', fileName: 'GetInfo', msg: 'Calling Info from Eclair server url', data: options.url});
if (common.read_dummy_data) {
common.getDummyData('GetInfo').then(function(data) {
data.currency_unit = 'BTC';
data.smaller_currency_unit = 'Sats';
data.lnImplementation = 'Eclair';
res.status(200).json(data);
});
@ -30,8 +28,6 @@ exports.getInfo = (req, res, next) => {
logger.log({level: 'DEBUG', fileName: 'GetInfo', msg: 'Get Info Response', data: body});
const body_str = (!body) ? '' : JSON.stringify(body);
const search_idx = (!body) ? -1 : body_str.search('Not Found');
body.currency_unit = 'BTC';
body.smaller_currency_unit = 'Sats';
body.lnImplementation = 'Eclair';
logger.log({level: 'INFO', fileName: 'GetInfo', msg: 'Eclair Node Information Received'});
res.status(200).json(body);

View File

@ -6,15 +6,9 @@ var options = {};
arrangeBalances = (body) => {
if(!body.confirmed) {
body.confirmed = 0;
body.btc_confirmed = 0;
} else {
body.btc_confirmed = common.convertToBTC(body.confirmed);
}
if(!body.unconfirmed) {
body.unconfirmed = 0;
body.btc_unconfirmed = 0;
} else {
body.btc_unconfirmed = common.convertToBTC(body.unconfirmed);
}
body.total = +body.confirmed + +body.unconfirmed;
body.btc_total = +body.btc_confirmed + +body.btc_unconfirmed;

View File

@ -6,7 +6,7 @@ var options = {};
exports.getBalance = (req, res, next) => {
logger.log({level: 'INFO', fileName: 'Balance', msg: 'Getting Balance..'});
options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/v1/balance/' + req.params.source;
options.url = common.getSelLNServerUrl() + '/v1/balance/' + (req.params.source).toLowerCase();
options.qs = req.query;
request(options).then((body) => {
logger.log({level: 'DEBUG', fileName: 'Balance', msg: '[Request params, Request Query, Balance Received]', data: [req.params, req.query, body]});
@ -15,15 +15,10 @@ exports.getBalance = (req, res, next) => {
if (!body.total_balance) { body.total_balance = 0; }
if (!body.confirmed_balance) { body.confirmed_balance = 0; }
if (!body.unconfirmed_balance) { body.unconfirmed_balance = 0; }
body.btc_total_balance = common.convertToBTC(body.total_balance);
body.btc_confirmed_balance = common.convertToBTC(body.confirmed_balance);
body.btc_unconfirmed_balance = common.convertToBTC(body.unconfirmed_balance);
}
if (req.params.source === 'channels') {
if (!body.balance) { body.balance = 0; }
if (!body.pending_open_balance) { body.pending_open_balance = 0; }
body.btc_balance = common.convertToBTC(body.balance);
body.btc_pending_open_balance = common.convertToBTC(body.pending_open_balance);
}
logger.log({level: 'INFO', fileName: 'Balance', msg: 'Balance Received'});
res.status(200).json(body);

View File

@ -87,9 +87,6 @@ exports.getPendingChannels = (req, res, next) => {
request(options).then(function (body) {
if (!body.total_limbo_balance) {
body.total_limbo_balance = 0;
body.btc_total_limbo_balance = 0;
} else {
body.btc_total_limbo_balance = common.convertToBTC(body.total_limbo_balance);
}
const promises = [];
if(body.pending_open_channels && body.pending_open_channels.length > 0) {

View File

@ -37,9 +37,6 @@ exports.getFees = (req, res, next) => {
body.day_fee_sum = (daily_sum[1] / 1000).toFixed(2);
body.week_fee_sum = (weekly_sum[1] / 1000).toFixed(2);
body.month_fee_sum = (monthly_sum[1] / 1000).toFixed(2);
body.btc_day_fee_sum = common.convertToBTC(body.day_fee_sum);
body.btc_week_fee_sum = common.convertToBTC(body.week_fee_sum);
body.btc_month_fee_sum = common.convertToBTC(body.month_fee_sum);
body.forwarding_events_history = history;
if (history.error) {
logger.log({level: 'ERROR', fileName: 'Fees', msg: 'Fetch Forwarding Events Error', error: history.error});

View File

@ -62,10 +62,6 @@ exports.getGraphInfo = (req, res, next) => {
error: (!body || search_idx > -1) ? 'Error From Server!' : body.error
});
} else {
body.btc_total_network_capacity = (!body.total_network_capacity) ? 0 : common.convertToBTC(body.total_network_capacity);
body.btc_avg_channel_size = (!body.avg_channel_size) ? 0 : common.convertToBTC(body.avg_channel_size);
body.btc_min_channel_size = (!body.min_channel_size) ? 0 : common.convertToBTC(body.min_channel_size);
body.btc_max_channel_size = (!body.max_channel_size) ? 0 : common.convertToBTC(body.max_channel_size);
logger.log({level: 'DEBUG', fileName: 'Graph', msg: 'Network Information After Rounding and Conversion', data: body_str});
logger.log({level: 'INFO', fileName: 'Graph', msg: 'Graph Information Received'});
res.status(200).json(body);

View File

@ -56,8 +56,6 @@ exports.listInvoices = (req, res, next) => {
invoice.r_preimage = invoice.r_preimage ? Buffer.from(invoice.r_preimage, 'base64').toString('hex') : '';
invoice.r_hash = invoice.r_hash ? Buffer.from(invoice.r_hash, 'base64').toString('hex') : '';
invoice.description_hash = invoice.description_hash ? Buffer.from(invoice.description_hash, 'base64').toString('hex') : null;
invoice.btc_value = (!invoice.value) ? 0 : common.convertToBTC(invoice.value);
invoice.btc_amt_paid_sat = (!invoice.amt_paid_sat) ? 0 : common.convertToBTC(invoice.amt_paid_sat);
});
body.invoices = common.sortDescByKey(body.invoices, 'creation_date');
}

View File

@ -27,7 +27,6 @@ exports.decodePayment = (req, res, next) => {
error: (!body || search_idx > -1) ? 'Error From Server!' : body.error
});
} else {
body.btc_num_satoshis = (!body.num_satoshis) ? 0 : common.convertToBTC(body.num_satoshis);
logger.log({level: 'INFO', fileName: 'PayRequest', msg: 'Payment Decoded'});
res.status(200).json(body);
}

View File

@ -6,7 +6,7 @@ exports.log = (msgJSON, selNode = common.selectedNode) => {
switch (msgJSON.level) {
case 'ERROR':
if (selNode) {
msgStr = msgStr + ': ' + (typeof msgJSON.error === 'object' ? JSON.stringify(msgJSON.error) : (typeof msgJSON.error === 'string') ? msgJSON.error : '');
msgStr = msgStr + '. ' + (typeof msgJSON.error === 'object' ? JSON.stringify(msgJSON.error) : (typeof msgJSON.error === 'string') ? msgJSON.error : '');
console.error(msgStr);
fs.appendFile(selNode.log_file, msgStr, function (err) {
if (err) {
@ -20,7 +20,7 @@ exports.log = (msgJSON, selNode = common.selectedNode) => {
case 'WARN':
if (selNode && (selNode.log_level == "INFO" || selNode.log_level == "WARN" || selNode.log_level == "DEBUG")) {
msgStr = msgStr + ': ' + (typeof msgJSON.data === 'object' ? JSON.stringify(msgJSON.data) : (typeof msgJSON.data === 'string') ? msgJSON.data : '');
msgStr = msgStr + '. ' + (typeof msgJSON.data === 'object' ? JSON.stringify(msgJSON.data) : (typeof msgJSON.data === 'string') ? msgJSON.data : '');
console.warn(msgStr)
fs.appendFile(selNode.log_file, msgStr, function (err) {
if (err) {
@ -34,7 +34,7 @@ exports.log = (msgJSON, selNode = common.selectedNode) => {
case 'INFO':
if (selNode && (selNode.log_level == "INFO" || selNode.log_level == "DEBUG")) {
msgStr = msgStr + ': ' + (typeof msgJSON.data === 'object' ? JSON.stringify(msgJSON.data) : (typeof msgJSON.data === 'string') ? msgJSON.data : '');
msgStr = msgStr + '. ' + (typeof msgJSON.data === 'object' ? JSON.stringify(msgJSON.data) : (typeof msgJSON.data === 'string') ? msgJSON.data : '');
console.log(msgStr);
fs.appendFile(selNode.log_file, msgStr, function (err) {
if (err) {
@ -54,7 +54,7 @@ exports.log = (msgJSON, selNode = common.selectedNode) => {
}, msgStr + ': [');
msgStr = msgStr.slice(0, -2) + ']';
} else {
msgStr = msgStr + ': ' + (typeof msgJSON.data === 'object' ? JSON.stringify(msgJSON.data) : typeof msgJSON.data == 'string' ? msgJSON.data : '');
msgStr = msgStr + '. ' + (typeof msgJSON.data === 'object' ? JSON.stringify(msgJSON.data) : typeof msgJSON.data == 'string' ? msgJSON.data : '');
}
fs.appendFile(selNode.log_file, msgStr, function (err) {
if (err) {

View File

@ -157,10 +157,6 @@ common.replaceNode = (selNodeIndex, newNode) => {
common.selectedNode = common.findNode(selNodeIndex);
}
common.convertToBTC = (num) => {
return (num / 100000000).toFixed(6);
};
common.convertTimestampToTime = (num) => {
let myDate = new Date(+num * 1000);
let days = myDate.getDate().toString();

View File

@ -1,4 +1,4 @@
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch">
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch" *ngIf="errorMessage?.trim() === ''; else errorBlock">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Lightning</h4>
<div class="overflow-wrap dashboard-info-value">{{balances.lightning | number}} Sats</div>
@ -14,3 +14,8 @@
<div class="overflow-wrap dashboard-info-value">{{balances.total | number}} Sats</div>
</div>
</div>
<ng-template #errorBlock>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between" class="p-2">
<p>{{errorMessage}}</p>
</div>
</ng-template>

View File

@ -7,6 +7,7 @@ import { Component, Input } from '@angular/core';
})
export class CLBalancesInfoComponent {
@Input() balances = { onchain: 0, lightning: 0, total: 0 };
@Input() errorMessage: string;
constructor() {}

View File

@ -1,4 +1,4 @@
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxFlex="100">
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxFlex="100" *ngIf="errorMessage?.trim() === ''; else errorBlock">
<div fxLayout="column" fxFlex="9" fxLayoutAlign="end start">
<span class="dashboard-capacity-header this-channel-capacity">Total Capacity</span>
<div fxLayout="row" fxLayoutAlign="space-between start" class="w-100">
@ -35,3 +35,8 @@
<button mat-stroked-button color="primary" (click)="goToChannels()" tabindex="1">Open Channel</button>
</div>
</ng-template>
<ng-template #errorBlock>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between" class="p-2">
<p>{{errorMessage}}</p>
</div>
</ng-template>

View File

@ -15,6 +15,7 @@ export class CLChannelCapacityInfoComponent {
@Input() channelBalances: {localBalance: number, remoteBalance: number, balancedness: number};
@Input() allChannels: Channel[];
@Input() sortBy: string = 'Balance Score';
@Input() errorMessage: string;
constructor(private router: Router) {}

View File

@ -1,4 +1,4 @@
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxFlex="100" [ngClass]="{'mb-4': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM, 'mb-2': screenSize === screenSizeEnum.MD, 'mb-1': screenSize === screenSizeEnum.LG || screenSize === screenSizeEnum.XL}">
<div *ngIf="errorMessage?.trim() === ''; else errorBlock" fxLayout="column" fxLayoutAlign="space-between stretch" fxFlex="100" [ngClass]="{'mb-4': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM, 'mb-2': screenSize === screenSizeEnum.MD, 'mb-1': screenSize === screenSizeEnum.LG || screenSize === screenSizeEnum.XL}">
<div fxLayout="column" fxFlex="9" fxLayoutAlign="end start">
<span class="dashboard-capacity-header this-channel-capacity">Total Capacity</span>
<mat-hint class="font-size-90">{{totalLiquidity | number:'1.0-0'}} Sats</mat-hint>
@ -25,3 +25,8 @@
<button *ngIf="direction === 'Out'" mat-stroked-button color="primary" (click)="goToChannels()" tabindex="1">Open Channel</button>
</div>
</ng-template>
<ng-template #errorBlock>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between" class="p-2">
<p>{{errorMessage}}</p>
</div>
</ng-template>

View File

@ -14,6 +14,7 @@ export class CLChannelLiquidityInfoComponent implements OnInit {
@Input() direction: string;
@Input() totalLiquidity: number;
@Input() allChannels: Channel[];
@Input() errorMessage: string;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;

View File

@ -1,3 +1,4 @@
<div fxLayout="row" fxFlex="100" fxLayoutAlign="start stretch" *ngIf="errorMessage?.trim() === ''; else errorBlock">
<div fxLayout="column" fxFlex="50" fxLayoutAlign="space-between stretch">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Active</h4>
@ -26,3 +27,9 @@
<div class="overflow-wrap dashboard-info-value">{{(channelsStatus?.inactive?.capacity || 0) | number}} Sats</div>
</div>
</div>
</div>
<ng-template #errorBlock>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between" class="p-2">
<p>{{errorMessage}}</p>
</div>
</ng-template>

View File

@ -8,6 +8,7 @@ import { ChannelsStatus } from '../../../shared/models/clModels';
})
export class CLChannelStatusInfoComponent {
@Input() channelsStatus: ChannelsStatus = {};
@Input() errorMessage: string;
constructor() {}

View File

@ -1,3 +1,4 @@
<div fxLayout="row" fxFlex="100" fxLayoutAlign="start stretch" *ngIf="errorMessage?.trim() === ''; else errorBlock">
<div fxLayout="column" fxFlex="50" fxLayoutAlign="space-between stretch">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Total</h4>
@ -10,3 +11,9 @@
<div class="overflow-wrap dashboard-info-value">{{fees?.totalTxCount | number}}</div>
</div>
</div>
</div>
<ng-template #errorBlock>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between" class="p-2">
<p>{{errorMessage}}</p>
</div>
</ng-template>

View File

@ -8,6 +8,7 @@ import { Fees } from '../../../shared/models/clModels';
})
export class CLFeeInfoComponent {
@Input() fees: Fees;
@Input() errorMessage: string;
totalFees = [{'name': 'Total', 'value': 0}];
}

View File

@ -40,10 +40,10 @@
></mat-progress-bar>
<div [ngSwitch]="card.id" fxLayout="column" fxFlex="100">
<rtl-cl-node-info fxFlex="100" *ngSwitchCase="'node'" [information]="information" [showColorFieldSeparately]="false"></rtl-cl-node-info>
<rtl-cl-balances-info fxFlex="100" *ngSwitchCase="'balance'" [balances]="balances"></rtl-cl-balances-info>
<rtl-cl-channel-capacity-info fxFlex="100" *ngSwitchCase="'capacity'" [sortBy]="sortField" [channelBalances]="channelBalances" [allChannels]="allChannelsCapacity"></rtl-cl-channel-capacity-info>
<rtl-cl-fee-info fxFlex="100" *ngSwitchCase="'fee'" [fees]="fees"></rtl-cl-fee-info>
<rtl-cl-channel-status-info fxFlex="100" *ngSwitchCase="'status'" [channelsStatus]="channelsStatus"></rtl-cl-channel-status-info>
<rtl-cl-balances-info fxFlex="100" *ngSwitchCase="'balance'" [balances]="balances" [errorMessage]="errorMessages[2] + ' ' + errorMessages[3]"></rtl-cl-balances-info>
<rtl-cl-channel-capacity-info fxFlex="100" *ngSwitchCase="'capacity'" [sortBy]="sortField" [channelBalances]="channelBalances" [allChannels]="allChannelsCapacity" [errorMessage]="errorMessages[4] + ' ' + errorMessages[3]"></rtl-cl-channel-capacity-info>
<rtl-cl-fee-info fxFlex="100" *ngSwitchCase="'fee'" [fees]="fees" [errorMessage]="errorMessages[1] + ' ' + errorMessages[4] + ' ' + errorMessages[5]"></rtl-cl-fee-info>
<rtl-cl-channel-status-info fxFlex="100" *ngSwitchCase="'status'" [channelsStatus]="channelsStatus" [errorMessage]="errorMessages[0] + ' ' + errorMessages[3]"></rtl-cl-channel-status-info>
<h3 *ngSwitchDefault>Error! Unable to find information!</h3>
</div>
</mat-card-content>
@ -87,9 +87,9 @@
></mat-progress-bar>
<div [ngSwitch]="card.id" fxLayout="column" fxFlex="100">
<rtl-cl-node-info fxFlex="100" *ngSwitchCase="'node'" [information]="information"></rtl-cl-node-info>
<rtl-cl-balances-info fxFlex="100" *ngSwitchCase="'balance'" [balances]="balances"></rtl-cl-balances-info>
<rtl-cl-channel-liquidity-info fxFlex="100" *ngSwitchCase="'inboundLiq'" [direction]="'In'" [totalLiquidity]="totalInboundLiquidity" [allChannels]="allInboundChannels"></rtl-cl-channel-liquidity-info>
<rtl-cl-channel-liquidity-info fxFlex="100" *ngSwitchCase="'outboundLiq'" [direction]="'Out'" [totalLiquidity]="totalOutboundLiquidity" [allChannels]="allOutboundChannels"></rtl-cl-channel-liquidity-info>
<rtl-cl-balances-info fxFlex="100" *ngSwitchCase="'balance'" [balances]="balances" [errorMessage]="errorMessages[2] + ' ' + errorMessages[3]"></rtl-cl-balances-info>
<rtl-cl-channel-liquidity-info fxFlex="100" *ngSwitchCase="'inboundLiq'" [direction]="'In'" [totalLiquidity]="totalInboundLiquidity" [allChannels]="allInboundChannels" [errorMessage]="errorMessages[4]"></rtl-cl-channel-liquidity-info>
<rtl-cl-channel-liquidity-info fxFlex="100" *ngSwitchCase="'outboundLiq'" [direction]="'Out'" [totalLiquidity]="totalOutboundLiquidity" [allChannels]="allOutboundChannels" [errorMessage]="errorMessages[4]"></rtl-cl-channel-liquidity-info>
<span fxLayout="column" fxFlex="100" fxLayoutAlign="space-between start" *ngSwitchCase="'transactions'">
<mat-tab-group fxLayout="column" class="w-100 dashboard-tabs-group">
<mat-tab label="Receive"><rtl-cl-lightning-invoices class="h-100" [calledFrom]="'home'"></rtl-cl-lightning-invoices></mat-tab>

View File

@ -10,7 +10,7 @@ import { faAngleDoubleDown, faAngleDoubleUp, faChartPie, faBolt, faServer, faNet
import { SelNodeChild } from '../../shared/models/RTLconfig';
import { UserPersonaEnum, ScreenSizeEnum, APICallStatusEnum } from '../../shared/services/consts-enums-functions';
import { ChannelsStatus, GetInfo, Fees, Channel, Balance } from '../../shared/models/clModels';
import { ApiCallsList } from '../../shared/models/errorPayload';
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload';
import { LoggerService } from '../../shared/services/logger.service';
import { CommonService } from '../../shared/services/common.service';
@ -53,7 +53,7 @@ export class CLHomeComponent implements OnInit, OnDestroy {
public merchantCardHeight = '65px';
public sortField = 'Balance Score';
public errorMessages = ['', '', '', '', '', ''];
public apisCallStatus: ApiCallsList = null;
public apisCallStatus: ApiCallsListCL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
@ -127,7 +127,6 @@ export class CLHomeComponent implements OnInit, OnDestroy {
if (rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.ERROR) {
this.errorMessages[4] = (typeof(this.apisCallStatus.FetchChannels.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchChannels.message) : this.apisCallStatus.FetchChannels.message;
}
if (rtlStore.apisCallStatus.GetForwardingHistory.status === APICallStatusEnum.ERROR) {
this.errorMessages[5] = (typeof(this.apisCallStatus.GetForwardingHistory.message) === 'object') ? JSON.stringify(this.apisCallStatus.GetForwardingHistory.message) : this.apisCallStatus.GetForwardingHistory.message;
}

View File

@ -5,13 +5,12 @@ import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { faSearch } from '@fortawesome/free-solid-svg-icons';
import { APICallStatusEnum, ScreenSizeEnum, UI_MESSAGES } from '../../shared/services/consts-enums-functions';
import { CommonService } from '../../shared/services/common.service';
import { LoggerService } from '../../shared/services/logger.service';
import * as CLActions from '../store/cl.actions';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
import { ScreenSizeEnum } from '../../shared/services/consts-enums-functions';
import { CommonService } from '../../shared/services/common.service';
@Component({
selector: 'rtl-cl-lookups',
@ -63,7 +62,7 @@ export class CLLookupsComponent implements OnInit, OnDestroy {
this.logger.info(this.nodeLookupValue);
this.logger.info(this.channelLookupValue);
}
if (resLookup.type === CLActions.UPDATE_API_CALL_STATUS_CL && resLookup.payload.action === 'Lookup') {
if (resLookup.type === CLActions.UPDATE_API_CALL_STATUS_CL && resLookup.payload.status === APICallStatusEnum.ERROR && resLookup.payload.action === 'Lookup') {
this.flgLoading[0] = 'error';
}
});
@ -74,13 +73,12 @@ export class CLLookupsComponent implements OnInit, OnDestroy {
this.flgSetLookupValue = false;
this.nodeLookupValue = {nodeid: ''};
this.channelLookupValue = [];
this.store.dispatch(new RTLActions.OpenSpinner('Searching ' + this.lookupFields[this.selectedFieldId].name + '...'));
switch (this.selectedFieldId) {
case 0:
this.store.dispatch(new CLActions.PeerLookup(this.lookupKey.trim()));
break;
case 1:
this.store.dispatch(new CLActions.ChannelLookup({shortChannelID: this.lookupKey.trim(), showError: false}));
this.store.dispatch(new CLActions.ChannelLookup({uiMessage: UI_MESSAGES.SEARCHING_CHANNEL, shortChannelID: this.lookupKey.trim(), showError: false}));
break;
default:
break;

View File

@ -1,4 +1,4 @@
<div fxLayout="row" fxFlex="100" fxLayoutAlign="stretch" class="h-100">
<div fxLayout="row" fxFlex="100" fxLayoutAlign="stretch" class="h-100" *ngIf="errorMessage?.trim() === ''; else errorBlock">
<div fxLayout="column" fxFlex="50" fxLayoutAlign="space-between stretch">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Urgent</h4>
@ -36,3 +36,8 @@
</div>
</div>
</div>
<ng-template #errorBlock>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between" class="p-2">
<p>{{errorMessage}}</p>
</div>
</ng-template>

View File

@ -10,7 +10,7 @@ import { FeeRates, FeeRatePerObj, feeRateStyle } from '../../../shared/models/cl
export class CLFeeRatesComponent implements AfterContentChecked {
@Input() feeRateStyle: string;
@Input() feeRates: FeeRates;
@Input() flgLoading: Boolean | 'error';
@Input() errorMessage: string;
perkbw: FeeRatePerObj = {};
constructor() { }

View File

@ -10,19 +10,26 @@
</div>
<div fxLayout="column" fxLayoutAlign="stretch center" fxLayout.gt-sm="row" fxLayoutAlign.gt-sm="center stretch" class="w-100 h-93">
<mat-card fxLayout="row" fxFlex="95" fxLayoutAlign="start stretch" class="dashboard-card w-96 h-93">
<mat-card-content fxLayout="column" fxFlex="100" class="dashboard-card-content">
<mat-card-content fxLayout="column" fxFlex="100"
[ngClass]="{'dashboard-card-content': true,
'error-border': (card.id === 'node' && apisCallStatus?.FetchInfo.status === apiCallStatusEnum.ERROR) ||
(card.id === 'status' && (apisCallStatus?.FetchInfo.status === apiCallStatusEnum.ERROR || apisCallStatus?.FetchLocalRemoteBalance.status === apiCallStatusEnum.ERROR)) ||
(card.id === 'fee' && (apisCallStatus?.FetchFees.status === apiCallStatusEnum.ERROR || apisCallStatus?.FetchChannels.status === apiCallStatusEnum.ERROR || apisCallStatus?.GetForwardingHistory.status === apiCallStatusEnum.ERROR)) ||
(card.id === 'feeRatesKB' && apisCallStatus?.FetchFeeRatesperkb.status === apiCallStatusEnum.ERROR) ||
(card.id === 'feeRatesKW' && apisCallStatus?.FetchFeeRatesperkw.status === apiCallStatusEnum.ERROR)}">
<mat-progress-bar mode="indeterminate"
*ngIf="((card.id === 'node' || card.id === 'status') && apisCallStatus?.FetchInfo.status === apiCallStatusEnum.INITIATED) ||
(card.id === 'fee' && apisCallStatus?.FetchFees.status === apiCallStatusEnum.INITIATED) ||
*ngIf="(card.id === 'node' && apisCallStatus?.FetchInfo.status === apiCallStatusEnum.INITIATED) ||
(card.id === 'status' && (apisCallStatus?.FetchInfo.status === apiCallStatusEnum.INITIATED || apisCallStatus?.FetchLocalRemoteBalance.status === apiCallStatusEnum.INITIATED)) ||
(card.id === 'fee' && (apisCallStatus?.FetchFees.status === apiCallStatusEnum.INITIATED || apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED || apisCallStatus?.GetForwardingHistory.status === apiCallStatusEnum.INITIATED)) ||
(card.id === 'feeRatesKB' && apisCallStatus?.FetchFeeRatesperkb.status === apiCallStatusEnum.INITIATED) ||
(card.id === 'feeRatesKW' && apisCallStatus?.FetchFeeRatesperkw.status === apiCallStatusEnum.INITIATED)"
></mat-progress-bar>
<div [ngSwitch]="card.id" fxLayout="column" fxFlex="100">
<rtl-cl-node-info fxFlex="100" *ngSwitchCase="'node'" [information]="information" [showColorFieldSeparately]="false" [ngClass]="{'error-border': errorMessages[0] !== ''}"></rtl-cl-node-info>
<rtl-cl-channel-status-info fxFlex="100" *ngSwitchCase="'status'" [channelsStatus]="channelsStatus" [ngClass]="{'error-border': errorMessages[0] !== ''}"></rtl-cl-channel-status-info>
<rtl-cl-fee-info fxFlex="100" *ngSwitchCase="'fee'" [fees]="fees" [ngClass]="{'error-border': errorMessages[1] !== ''}"></rtl-cl-fee-info>
<rtl-cl-fee-rates *ngSwitchCase="'feeRatesKB'" [flgLoading]="apisCallStatus?.FetchFeeRatesperkb.status === apiCallStatusEnum.INITIATED" [feeRates]="feeRatesPerKB" [feeRateStyle]="'KB'" class="h-100" [ngClass]="{'error-border': errorMessages[2] !== ''}"></rtl-cl-fee-rates>
<rtl-cl-fee-rates *ngSwitchCase="'feeRatesKW'" [flgLoading]="apisCallStatus?.FetchFeeRatesperkw.status === apiCallStatusEnum.INITIATED" [feeRates]="feeRatesPerKW" [feeRateStyle]="'KW'" class="h-100" [ngClass]="{'error-border': errorMessages[3] !== ''}"></rtl-cl-fee-rates>
<rtl-cl-node-info fxFlex="100" *ngSwitchCase="'node'" [information]="information" [showColorFieldSeparately]="false"></rtl-cl-node-info>
<rtl-cl-channel-status-info fxFlex="100" *ngSwitchCase="'status'" [channelsStatus]="channelsStatus" [errorMessage]="errorMessages[0] + ' ' + errorMessages[2]"></rtl-cl-channel-status-info>
<rtl-cl-fee-info fxFlex="100" *ngSwitchCase="'fee'" [fees]="fees" [errorMessage]="errorMessages[1] + ' ' + errorMessages[3] + ' ' + errorMessages[4]"></rtl-cl-fee-info>
<rtl-cl-fee-rates *ngSwitchCase="'feeRatesKB'" [flgLoading]="apisCallStatus?.FetchFeeRatesperkb.status === apiCallStatusEnum.INITIATED" [feeRates]="feeRatesPerKB" [feeRateStyle]="'KB'" class="h-100" [errorMessage]="errorMessages[5]"></rtl-cl-fee-rates>
<rtl-cl-fee-rates *ngSwitchCase="'feeRatesKW'" [flgLoading]="apisCallStatus?.FetchFeeRatesperkw.status === apiCallStatusEnum.INITIATED" [feeRates]="feeRatesPerKW" [feeRateStyle]="'KW'" class="h-100" [errorMessage]="errorMessages[6]"></rtl-cl-fee-rates>
</div>
</mat-card-content>
</mat-card>
@ -41,19 +48,26 @@
</div>
<div fxLayout="column" fxLayoutAlign="stretch center" fxLayout.gt-sm="row" fxLayoutAlign.gt-sm="center stretch" class="w-100 h-93">
<mat-card fxLayout="row" fxFlex="95" fxLayoutAlign="start stretch" class="dashboard-card w-96 h-93">
<mat-card-content fxLayout="column" fxFlex="100" class="dashboard-card-content">
<mat-card-content fxLayout="column" fxFlex="100"
[ngClass]="{'dashboard-card-content': true,
'error-border': (card.id === 'node' && apisCallStatus?.FetchInfo.status === apiCallStatusEnum.ERROR) ||
(card.id === 'status' && (apisCallStatus?.FetchInfo.status === apiCallStatusEnum.ERROR || apisCallStatus?.FetchLocalRemoteBalance.status === apiCallStatusEnum.ERROR)) ||
(card.id === 'fee' && (apisCallStatus?.FetchFees.status === apiCallStatusEnum.ERROR || apisCallStatus?.FetchChannels.status === apiCallStatusEnum.ERROR || apisCallStatus?.GetForwardingHistory.status === apiCallStatusEnum.ERROR)) ||
(card.id === 'feeRatesKB' && apisCallStatus?.FetchFeeRatesperkb.status === apiCallStatusEnum.ERROR) ||
(card.id === 'feeRatesKW' && apisCallStatus?.FetchFeeRatesperkw.status === apiCallStatusEnum.ERROR)}">
<mat-progress-bar mode="indeterminate"
*ngIf="((card.id === 'node' || card.id === 'status') && apisCallStatus?.FetchInfo.status === apiCallStatusEnum.INITIATED) ||
(card.id === 'fee' && apisCallStatus?.FetchFees.status === apiCallStatusEnum.INITIATED) ||
*ngIf="(card.id === 'node' && apisCallStatus?.FetchInfo.status === apiCallStatusEnum.INITIATED) ||
(card.id === 'status' && (apisCallStatus?.FetchInfo.status === apiCallStatusEnum.INITIATED || apisCallStatus?.FetchLocalRemoteBalance.status === apiCallStatusEnum.INITIATED)) ||
(card.id === 'fee' && (apisCallStatus?.FetchFees.status === apiCallStatusEnum.INITIATED || apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED || apisCallStatus?.GetForwardingHistory.status === apiCallStatusEnum.INITIATED)) ||
(card.id === 'feeRatesKB' && apisCallStatus?.FetchFeeRatesperkb.status === apiCallStatusEnum.INITIATED) ||
(card.id === 'feeRatesKW' && apisCallStatus?.FetchFeeRatesperkw.status === apiCallStatusEnum.INITIATED)"
></mat-progress-bar>
<div [ngSwitch]="card.id" fxLayout="column" fxFlex="100">
<rtl-cl-node-info fxFlex="100" *ngSwitchCase="'node'" [information]="information" [showColorFieldSeparately]="false" [ngClass]="{'error-border': errorMessages[0] !== ''}"></rtl-cl-node-info>
<rtl-cl-channel-status-info fxFlex="100" *ngSwitchCase="'status'" [channelsStatus]="channelsStatus" [ngClass]="{'error-border': errorMessages[0] !== ''}"></rtl-cl-channel-status-info>
<rtl-cl-fee-info fxFlex="100" *ngSwitchCase="'fee'" [fees]="fees" [ngClass]="{'error-border': errorMessages[1] !== ''}"></rtl-cl-fee-info>
<rtl-cl-fee-rates *ngSwitchCase="'feeRatesKB'" [flgLoading]="apisCallStatus?.FetchFeeRatesperkb.status === apiCallStatusEnum.INITIATED" [feeRates]="feeRatesPerKB" [feeRateStyle]="'KB'" class="h-100" [ngClass]="{'error-border': errorMessages[2] !== ''}"></rtl-cl-fee-rates>
<rtl-cl-fee-rates *ngSwitchCase="'feeRatesKW'" [flgLoading]="apisCallStatus?.FetchFeeRatesperkw.status === apiCallStatusEnum.INITIATED" [feeRates]="feeRatesPerKW" [feeRateStyle]="'KW'" class="h-100" [ngClass]="{'error-border': errorMessages[3] !== ''}"></rtl-cl-fee-rates>
<rtl-cl-node-info fxFlex="100" *ngSwitchCase="'node'" [information]="information" [showColorFieldSeparately]="false"></rtl-cl-node-info>
<rtl-cl-channel-status-info fxFlex="100" *ngSwitchCase="'status'" [channelsStatus]="channelsStatus" [errorMessage]="errorMessages[0] + ' ' + errorMessages[2]"></rtl-cl-channel-status-info>
<rtl-cl-fee-info fxFlex="100" *ngSwitchCase="'fee'" [fees]="fees" [errorMessage]="errorMessages[1] + ' ' + errorMessages[3] + ' ' + errorMessages[4]"></rtl-cl-fee-info>
<rtl-cl-fee-rates *ngSwitchCase="'feeRatesKB'" [flgLoading]="apisCallStatus?.FetchFeeRatesperkb.status === apiCallStatusEnum.INITIATED" [feeRates]="feeRatesPerKB" [feeRateStyle]="'KB'" class="h-100" [errorMessage]="errorMessages[5]"></rtl-cl-fee-rates>
<rtl-cl-fee-rates *ngSwitchCase="'feeRatesKW'" [flgLoading]="apisCallStatus?.FetchFeeRatesperkw.status === apiCallStatusEnum.INITIATED" [feeRates]="feeRatesPerKW" [feeRateStyle]="'KW'" class="h-100" [errorMessage]="errorMessages[5]"></rtl-cl-fee-rates>
</div>
</mat-card-content>
</mat-card>

View File

@ -7,7 +7,7 @@ import { faBolt, faServer, faNetworkWired } from '@fortawesome/free-solid-svg-ic
import { SelNodeChild } from '../../shared/models/RTLconfig';
import { GetInfo, Fees, ChannelsStatus, FeeRates } from '../../shared/models/clModels';
import { APICallStatusEnum, ScreenSizeEnum, UserPersonaEnum } from '../../shared/services/consts-enums-functions';
import { ApiCallsList } from '../../shared/models/errorPayload';
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload';
import { LoggerService } from '../../shared/services/logger.service';
import { CommonService } from '../../shared/services/common.service';
@ -33,8 +33,8 @@ export class CLNetworkInfoComponent implements OnInit, OnDestroy {
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public userPersonaEnum = UserPersonaEnum;
public errorMessages = ['', '', '', ''];
public apisCallStatus: ApiCallsList = null;
public errorMessages = ['', '', '', '', '', '', ''];
public apisCallStatus: ApiCallsListCL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject()];
@ -71,7 +71,7 @@ export class CLNetworkInfoComponent implements OnInit, OnDestroy {
this.store.select('cl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore) => {
this.errorMessages = ['', '', '', ''];
this.errorMessages = ['', '', '', '', '', '', ''];
this.apisCallStatus = rtlStore.apisCallStatus;
if (rtlStore.apisCallStatus.FetchInfo.status === APICallStatusEnum.ERROR) {
this.errorMessages[0] = (typeof(this.apisCallStatus.FetchInfo.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchInfo.message) : this.apisCallStatus.FetchInfo.message;
@ -79,11 +79,20 @@ export class CLNetworkInfoComponent implements OnInit, OnDestroy {
if (rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.ERROR) {
this.errorMessages[1] = (typeof(this.apisCallStatus.FetchFees.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchFees.message) : this.apisCallStatus.FetchFees.message;
}
if (rtlStore.apisCallStatus.FetchLocalRemoteBalance.status === APICallStatusEnum.ERROR) {
this.errorMessages[2] = (typeof(this.apisCallStatus.FetchLocalRemoteBalance.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchLocalRemoteBalance.message) : this.apisCallStatus.FetchLocalRemoteBalance.message;
}
if (rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.ERROR) {
this.errorMessages[3] = (typeof(this.apisCallStatus.FetchChannels.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchChannels.message) : this.apisCallStatus.FetchChannels.message;
}
if (rtlStore.apisCallStatus.GetForwardingHistory.status === APICallStatusEnum.ERROR) {
this.errorMessages[4] = (typeof(this.apisCallStatus.GetForwardingHistory.message) === 'object') ? JSON.stringify(this.apisCallStatus.GetForwardingHistory.message) : this.apisCallStatus.GetForwardingHistory.message;
}
if (rtlStore.apisCallStatus.FetchFeeRatesperkb.status === APICallStatusEnum.ERROR) {
this.errorMessages[2] = (typeof(this.apisCallStatus.FetchFeeRatesperkb.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchFeeRatesperkb.message) : this.apisCallStatus.FetchFeeRatesperkb.message;
this.errorMessages[5] = (typeof(this.apisCallStatus.FetchFeeRatesperkb.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchFeeRatesperkb.message) : this.apisCallStatus.FetchFeeRatesperkb.message;
}
if (rtlStore.apisCallStatus.FetchFeeRatesperkw.status === APICallStatusEnum.ERROR) {
this.errorMessages[3] = (typeof(this.apisCallStatus.FetchFeeRatesperkw.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchFeeRatesperkw.message) : this.apisCallStatus.FetchFeeRatesperkw.message;
this.errorMessages[6] = (typeof(this.apisCallStatus.FetchFeeRatesperkw.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchFeeRatesperkw.message) : this.apisCallStatus.FetchFeeRatesperkw.message;
}
this.selNode = rtlStore.nodeSettings;

View File

@ -23,7 +23,6 @@ export class CLOnChainReceiveComponent {
constructor(private store: Store<fromRTLReducer.RTLState>, private clEffects: CLEffects) {}
onGenerateAddress() {
this.store.dispatch(new RTLActions.OpenSpinner('Getting New Address...'));
this.store.dispatch(new CLActions.GetNewAddress(this.selectedAddressType));
this.clEffects.setNewAddressCL
.pipe(take(1))

View File

@ -13,7 +13,7 @@ import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { SelNodeChild, GetInfoRoot } from '../../../shared/models/RTLconfig';
import { CLOnChainSendFunds } from '../../../shared/models/alertData';
import { GetInfo, Balance, OnChain, UTXO } from '../../../shared/models/clModels';
import { CURRENCY_UNITS, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, ADDRESS_TYPES, FEE_RATE_TYPES } from '../../../shared/services/consts-enums-functions';
import { CURRENCY_UNITS, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, ADDRESS_TYPES, FEE_RATE_TYPES, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
import { RTLConfiguration } from '../../../shared/models/RTLconfig';
import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
@ -44,7 +44,6 @@ export class CLOnChainSendModalComponent implements OnInit, OnDestroy {
public selUTXOs = [];
public flgUseAllBalance = false;
public totalSelectedUTXOAmount = null;
public flgLoadingWallet: Boolean | 'error' = true;
public selectedAddress = ADDRESS_TYPES[1];
public blockchainBalance: Balance = {};
public information: GetInfo = {};
@ -127,7 +126,7 @@ export class CLOnChainSendModalComponent implements OnInit, OnDestroy {
this.store.dispatch(new RTLActions.OpenSnackBar('Fund Sent Successfully!'));
this.dialogRef.close();
}
if (action.type === CLActions.UPDATE_API_CALL_STATUS_CL && action.payload.action === 'SetChannelTransaction') {
if (action.type === CLActions.UPDATE_API_CALL_STATUS_CL && action.payload.status === APICallStatusEnum.ERROR && action.payload.action === 'SetChannelTransaction') {
this.sendFundError = action.payload.message;
}
});
@ -162,7 +161,6 @@ export class CLOnChainSendModalComponent implements OnInit, OnDestroy {
this.selUTXOs.forEach(utxo => this.transaction.utxos.push(utxo.txid + ':' + utxo.output));
}
if (this.sweepAll) {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Funds...'));
this.transaction.satoshis = 'all';
this.transaction.address = this.sendFundFormGroup.controls.transactionAddress.value;
if (this.sendFundFormGroup.controls.flgMinConf.value) {
@ -183,7 +181,6 @@ export class CLOnChainSendModalComponent implements OnInit, OnDestroy {
this.commonService.convertCurrency(+this.transaction.satoshis, this.selAmountUnit === this.amountUnits[2] ? CurrencyUnitEnum.OTHER : this.selAmountUnit, CurrencyUnitEnum.SATS, this.amountUnits[2], this.fiatConversion)
.pipe(takeUntil(this.unSubs[2]))
.subscribe(data => {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Funds...'));
this.transaction.satoshis = data[CurrencyUnitEnum.SATS];
this.selAmountUnit = CurrencyUnitEnum.SATS;
this.store.dispatch(new CLActions.SetChannelTransaction(this.transaction));
@ -193,7 +190,6 @@ export class CLOnChainSendModalComponent implements OnInit, OnDestroy {
this.amountError = 'Conversion Error: ' + (err.error && err.error.error && err.error.error.error ? err.error.error.error : err.error && err.error.error ? err.error.error : err.error ? err.error : 'Currency Conversion Error');
});
} else {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Funds...'));
this.store.dispatch(new CLActions.SetChannelTransaction(this.transaction));
}
}

View File

@ -8,7 +8,7 @@ import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { UTXO } from '../../../../shared/models/clModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum } from '../../../../shared/services/consts-enums-functions';
import { ApiCallsList } from '../../../../shared/models/errorPayload';
import { ApiCallsListCL } from '../../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../../shared/services/logger.service';
import { CommonService } from '../../../../shared/services/common.service';
@ -37,7 +37,7 @@ export class CLOnChainUtxosComponent implements OnInit, OnChanges, AfterViewInit
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsList = null;
public apisCallStatus: ApiCallsListCL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];

View File

@ -8,8 +8,8 @@ import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Channel, GetInfo, ChannelEdge } from '../../../../../shared/models/clModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, FEE_RATE_TYPES, APICallStatusEnum } from '../../../../../shared/services/consts-enums-functions';
import { ApiCallsList } from '../../../../../shared/models/errorPayload';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, FEE_RATE_TYPES, APICallStatusEnum, UI_MESSAGES } from '../../../../../shared/services/consts-enums-functions';
import { ApiCallsListCL } from '../../../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../../../shared/services/logger.service';
import { CommonService } from '../../../../../shared/services/common.service';
@ -49,7 +49,7 @@ export class CLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDes
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsList = null;
public apisCallStatus: ApiCallsListCL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
@ -97,7 +97,7 @@ export class CLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDes
}
onViewRemotePolicy(selChannel: Channel) {
this.store.dispatch(new CLActions.ChannelLookup({shortChannelID: selChannel.short_channel_id, showError: true}));
this.store.dispatch(new CLActions.ChannelLookup({uiMessage: UI_MESSAGES.GET_REMOTE_POLICY, shortChannelID: selChannel.short_channel_id, showError: true}));
this.clEffects.setLookupCL
.pipe(take(1))
.subscribe((resLookup: ChannelEdge[]):boolean|void => {
@ -147,14 +147,12 @@ export class CLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDes
if (confirmRes) {
const base_fee = confirmRes[0].inputValue;
const fee_rate = confirmRes[1].inputValue;
this.store.dispatch(new RTLActions.OpenSpinner('Updating Channel Policy...'));
this.store.dispatch(new CLActions.UpdateChannels({baseFeeMsat: base_fee, feeRate: fee_rate, channelId: 'all'}));
}
});
} else {
this.myChanPolicy = {fee_base_msat: 0, fee_rate_milli_msat: 0};
this.store.dispatch(new RTLActions.OpenSpinner('Fetching Channel Policy...'));
this.store.dispatch(new CLActions.ChannelLookup({shortChannelID: channelToUpdate.short_channel_id, showError: false}));
this.store.dispatch(new CLActions.ChannelLookup({uiMessage: UI_MESSAGES.GET_CHAN_POLICY, shortChannelID: channelToUpdate.short_channel_id, showError: false}));
this.clEffects.setLookupCL
.pipe(take(1))
.subscribe((resLookup: ChannelEdge[]) => {
@ -166,7 +164,6 @@ export class CLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDes
this.myChanPolicy = {fee_base_msat: 0, fee_rate_milli_msat: 0};
}
this.logger.info(this.myChanPolicy);
this.store.dispatch(new RTLActions.CloseSpinner());
const titleMsg = 'Update fee policy for Channel: ' + channelToUpdate.channel_id;
const confirmationMsg = [];
this.store.dispatch(new RTLActions.OpenConfirmation({ data: {
@ -189,7 +186,6 @@ export class CLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDes
if (confirmRes) {
const base_fee = confirmRes[0].inputValue;
const fee_rate = confirmRes[1].inputValue;
this.store.dispatch(new RTLActions.OpenSpinner('Updating Channel Policy...'));
this.store.dispatch(new CLActions.UpdateChannels({baseFeeMsat: base_fee, feeRate: fee_rate, channelId: channelToUpdate.channel_id}));
}
});
@ -213,7 +209,6 @@ export class CLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDes
.pipe(takeUntil(this.unSubs[3]))
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Closing Channel...'));
this.store.dispatch(new CLActions.CloseChannel({channelId: channelToClose.channel_id, force: false}));
}
});

View File

@ -8,7 +8,7 @@ import { MatTableDataSource } from '@angular/material/table';
import { GetInfo, Channel } from '../../../../../shared/models/clModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, AlertTypeEnum, APICallStatusEnum } from '../../../../../shared/services/consts-enums-functions';
import { ApiCallsList } from '../../../../../shared/models/errorPayload';
import { ApiCallsListCL } from '../../../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../../../shared/services/logger.service';
import { CommonService } from '../../../../../shared/services/common.service';
import { CLChannelInformationComponent } from '../../channel-information-modal/channel-information.component';
@ -45,7 +45,7 @@ export class CLChannelPendingTableComponent implements OnInit, AfterViewInit, On
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsList = null;
public apisCallStatus: ApiCallsListCL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
@ -119,7 +119,6 @@ export class CLChannelPendingTableComponent implements OnInit, AfterViewInit, On
.pipe(takeUntil(this.unSubs[3]))
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Force Closing Channel...'));
this.store.dispatch(new CLActions.CloseChannel({channelId: channelToClose.channel_id, force: true}));
}
});

View File

@ -24,7 +24,7 @@
<mat-form-field fxFlex="70" fxLayoutAlign="start end">
<input matInput [(ngModel)]="fundingAmount" placeholder="Amount" type="number" [step]="1000" [min]="1" [max]="totalBalance" tabindex="1" required name="amount" #amount="ngModel" [disabled]="flgUseAllBalance">
<mat-hint>Remaining Bal: {{totalBalance - ((fundingAmount) ? fundingAmount : 0) | number}}{{flgUseAllBalance ? '. Amount replaced by UTXO balance' : ''}}</mat-hint>
<span matSuffix> {{information?.smaller_currency_unit}} </span>
<span matSuffix> Sats </span>
<mat-error *ngIf="amount.errors?.required || !fundingAmount">Amount is required.</mat-error>
<mat-error *ngIf="amount.errors?.max">Amount must be less than or equal to {{totalBalance}}.</mat-error>
</mat-form-field>

View File

@ -10,10 +10,9 @@ import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { Peer, GetInfo, UTXO } from '../../../../shared/models/clModels';
import { CLOpenChannelAlert } from '../../../../shared/models/alertData';
import { FEE_RATE_TYPES } from '../../../../shared/services/consts-enums-functions';
import { APICallStatusEnum, FEE_RATE_TYPES } from '../../../../shared/services/consts-enums-functions';
import * as CLActions from '../../../store/cl.actions';
import * as RTLActions from '../../../../store/rtl.actions';
import * as fromRTLReducer from '../../../../store/rtl.reducers';
@Component({
@ -61,7 +60,7 @@ export class CLOpenChannelComponent implements OnInit, OnDestroy {
this.actions.pipe(takeUntil(this.unSubs[0]),
filter(action => action.type === CLActions.UPDATE_API_CALL_STATUS_CL || action.type === CLActions.FETCH_CHANNELS_CL))
.subscribe((action: CLActions.UpdateAPICallStatus | CLActions.FetchChannels) => {
if (action.type === CLActions.UPDATE_API_CALL_STATUS_CL && action.payload.action === 'SaveNewChannel') {
if (action.type === CLActions.UPDATE_API_CALL_STATUS_CL && action.payload.status === APICallStatusEnum.ERROR && action.payload.action === 'SaveNewChannel') {
this.channelConnectionError = action.payload.message;
}
if (action.type === CLActions.FETCH_CHANNELS_CL) {
@ -166,7 +165,6 @@ export class CLOpenChannelComponent implements OnInit, OnDestroy {
newChannel['utxos'] = [];
this.selUTXOs.forEach(utxo => newChannel['utxos'].push(utxo.txid + ':' + utxo.output));
}
this.store.dispatch(new RTLActions.OpenSpinner('Opening Channel...'));
this.store.dispatch(new CLActions.SaveNewChannel(newChannel));
}

View File

@ -11,11 +11,9 @@ import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { LoggerService } from '../../../shared/services/logger.service';
import { Peer } from '../../../shared/models/clModels';
import { CLOpenChannelAlert } from '../../../shared/models/alertData';
import { FEE_RATE_TYPES } from '../../../shared/services/consts-enums-functions';
import { APICallStatusEnum, FEE_RATE_TYPES } from '../../../shared/services/consts-enums-functions';
import { CLEffects } from '../../store/cl.effects';
import * as CLActions from '../../store/cl.actions';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
@ -87,7 +85,7 @@ export class CLConnectPeerComponent implements OnInit, OnDestroy {
if (action.type === CLActions.FETCH_CHANNELS_CL) {
this.dialogRef.close();
}
if (action.type === CLActions.UPDATE_API_CALL_STATUS_CL) {
if (action.type === CLActions.UPDATE_API_CALL_STATUS_CL && action.payload.status === APICallStatusEnum.ERROR) {
if (action.payload.action === 'SaveNewPeer') {
this.peerConnectionError = action.payload.message;
} else if (action.payload.action === 'SaveNewChannel') {
@ -100,14 +98,12 @@ export class CLConnectPeerComponent implements OnInit, OnDestroy {
onConnectPeer():boolean|void {
if(!this.peerFormGroup.controls.peerAddress.value) { return true; }
this.peerConnectionError = '';
this.store.dispatch(new RTLActions.OpenSpinner('Adding Peer...'));
this.store.dispatch(new CLActions.SaveNewPeer({id: this.peerFormGroup.controls.peerAddress.value}));
}
onOpenChannel():boolean|void {
if (!this.channelFormGroup.controls.fundingAmount.value || ((this.totalBalance - this.channelFormGroup.controls.fundingAmount.value) < 0) || (this.channelFormGroup.controls.flgMinConf.value && !this.channelFormGroup.controls.minConfValue.value)) { return true; }
this.channelConnectionError = '';
this.store.dispatch(new RTLActions.OpenSpinner('Opening Channel...'));
this.store.dispatch(new CLActions.SaveNewChannel({
peerId: this.newlyAddedPeer.id, satoshis: this.channelFormGroup.controls.fundingAmount.value, announce: !this.channelFormGroup.controls.isPrivate.value, feeRate: this.channelFormGroup.controls.selFeeRate.value, minconf: this.channelFormGroup.controls.flgMinConf.value ? this.channelFormGroup.controls.minConfValue.value : null
}));

View File

@ -11,7 +11,7 @@ import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Peer, GetInfo } from '../../../shared/models/clModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, ScreenSizeEnum, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
import { ApiCallsList } from '../../../shared/models/errorPayload';
import { ApiCallsListCL } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
import { CLConnectPeerComponent } from '../connect-peer/connect-peer.component';
@ -50,7 +50,7 @@ export class CLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsList = null;
public apisCallStatus: ApiCallsListCL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
@ -154,7 +154,6 @@ export class CLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
.pipe(takeUntil(this.unSubs[3]))
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Disconnecting Peer...'));
this.store.dispatch(new CLActions.DetachPeer({id: peerToDetach.id, force: false}));
}
});

View File

@ -5,7 +5,7 @@ import { Store } from '@ngrx/store';
import { ForwardingHistoryRes, ForwardingEvent } from '../../../shared/models/clModels';
import { APICallStatusEnum, MONTHS, ScreenSizeEnum, SCROLL_RANGES } from '../../../shared/services/consts-enums-functions';
import { ApiCallsList } from '../../../shared/models/errorPayload';
import { ApiCallsListCL } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
import { fadeIn } from '../../../shared/animation/opacity-animation';
@ -38,7 +38,7 @@ export class CLFeeReportComponent implements OnInit, AfterContentInit, OnDestroy
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsList = null;
public apisCallStatus: ApiCallsListCL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];

View File

@ -1,5 +1,5 @@
<div fxLayout="column" fxLayoutAlign="start stretch" [ngClass]="{'error-border my-1': errorMessage !== '', 'padding-gap-x': true}">
<div class="p-2" *ngIf="errorMessage !== ''">{{errorMessage}}</div>
<div fxLayout="column" fxLayoutAlign="start stretch" class="padding-gap-x">
<div class="p-2 error-border my-2" *ngIf="errorMessage !== ''">{{errorMessage}}</div>
<div *ngIf="errorMessage === ''" fxLayout="column" fxLayout.gt-xs="row" fxLayoutAlign.gt-xs="start center" fxLayoutAlign="start stretch" class="page-sub-title-container">
<div fxFlex="70"></div>
<mat-form-field fxFlex="30">
@ -42,6 +42,7 @@
<td mat-footer-cell *matFooterCellDef colspan="4">
<p *ngIf="(!forwardingHistoryEvents?.data || forwardingHistoryEvents?.data?.length<1) && apisCallStatus?.GetForwardingHistory.status === apiCallStatusEnum.COMPLETED">No failed transaction available.</p>
<p *ngIf="(!forwardingHistoryEvents?.data || forwardingHistoryEvents?.data?.length<1) && apisCallStatus?.GetForwardingHistory.status === apiCallStatusEnum.INITIATED">Getting failed transactions...</p>
<p *ngIf="(!forwardingHistoryEvents?.data || forwardingHistoryEvents?.data?.length<1) && apisCallStatus?.GetForwardingHistory.status === apiCallStatusEnum.ERROR">{{errorMessage}}</p>
</td>
</ng-container>
<tr mat-footer-row *matFooterRowDef="['no_event']" [ngClass]="{'display-none': forwardingHistoryEvents?.data && forwardingHistoryEvents?.data?.length>0}"></tr>

View File

@ -9,7 +9,7 @@ import { MatTableDataSource } from '@angular/material/table';
import { ForwardingEvent } from '../../../shared/models/clModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
import { ApiCallsList } from '../../../shared/models/errorPayload';
import { ApiCallsListCL } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
@ -36,7 +36,7 @@ export class CLFailedTransactionsComponent implements OnInit, AfterViewInit, OnD
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public apisCallStatus: ApiCallsList = null;
public apisCallStatus: ApiCallsListCL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];

View File

@ -1,5 +1,5 @@
<div fxLayout="column" fxLayoutAlign="start stretch" [ngClass]="{'error-border my-1': errorMessage !== '', 'padding-gap-x': true}">
<div class="p-2" *ngIf="errorMessage !== ''">{{errorMessage}}</div>
<div fxLayout="column" fxLayoutAlign="start stretch" class="padding-gap-x">
<div class="p-2 error-border my-2" *ngIf="errorMessage !== ''">{{errorMessage}}</div>
<div *ngIf="errorMessage === ''" fxLayout="column" fxLayout.gt-xs="row" fxLayoutAlign.gt-xs="start center" fxLayoutAlign="start stretch" class="page-sub-title-container">
<div fxFlex="70"></div>
<mat-form-field fxFlex="30">
@ -58,6 +58,7 @@
<td mat-footer-cell *matFooterCellDef colspan="4">
<p *ngIf="(!forwardingHistoryEvents?.data || forwardingHistoryEvents?.data?.length<1) && apisCallStatus?.GetForwardingHistory.status === apiCallStatusEnum.COMPLETED">No forwarding history available.</p>
<p *ngIf="(!forwardingHistoryEvents?.data || forwardingHistoryEvents?.data?.length<1) && apisCallStatus?.GetForwardingHistory.status === apiCallStatusEnum.INITIATED">Getting forwarding history...</p>
<p *ngIf="(!forwardingHistoryEvents?.data || forwardingHistoryEvents?.data?.length<1) && apisCallStatus?.GetForwardingHistory.status === apiCallStatusEnum.ERROR">{{errorMessage}}</p>
</td>
</ng-container>
<tr mat-footer-row *matFooterRowDef="['no_event']" [ngClass]="{'display-none': forwardingHistoryEvents?.data && forwardingHistoryEvents?.data?.length>0}"></tr>

View File

@ -9,7 +9,7 @@ import { MatTableDataSource } from '@angular/material/table';
import { ForwardingEvent } from '../../../shared/models/clModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
import { ApiCallsList } from '../../../shared/models/errorPayload';
import { ApiCallsListCL } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
@ -30,7 +30,6 @@ export class CLForwardingHistoryComponent implements OnInit, OnChanges, AfterVie
@Input() eventsData = [];
@Input() filterValue = '';
public successfulEvents = [];
public errorMessage = '';
public displayedColumns: any[] = [];
public forwardingHistoryEvents: any;
public flgSticky = false;
@ -38,7 +37,8 @@ export class CLForwardingHistoryComponent implements OnInit, OnChanges, AfterVie
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public apisCallStatus: ApiCallsList = null;
public errorMessage = '';
public apisCallStatus: ApiCallsListCL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];

View File

@ -1,6 +1,6 @@
import { Action } from '@ngrx/store';
import { ApiCallStatusPayload, ErrorPayload } from '../../shared/models/errorPayload';
import { ApiCallStatusPayload } from '../../shared/models/apiCallsPayload';
import { SelNodeChild } from '../../shared/models/RTLconfig';
import { GetInfo, Fees, Peer, Payment, PayRequest, QueryRoutes, Channel, FeeRates,
ForwardingHistoryRes, Invoice, ListInvoices, OnChain, UTXO
@ -185,7 +185,7 @@ export class SetDecodedPayment implements Action {
export class SendPayment implements Action {
readonly type = SEND_PAYMENT_CL;
constructor(public payload: {fromDialog: boolean, invoice?: string, amount?: number, pubkey?: string}) {}
constructor(public payload: {uiMessage: string, fromDialog: boolean, invoice?: string, amount?: number, pubkey?: string}) {}
}
export class SendPaymentStatus implements Action {
@ -239,7 +239,7 @@ export class PeerLookup implements Action {
export class ChannelLookup implements Action {
readonly type = CHANNEL_LOOKUP_CL;
constructor(public payload: {shortChannelID: string, showError: boolean}) {}
constructor(public payload: {uiMessage: string, shortChannelID: string, showError: boolean}) {}
}
export class InvoiceLookup implements Action {

View File

@ -13,7 +13,7 @@ import { SessionService } from '../../shared/services/session.service';
import { ErrorMessageComponent } from '../../shared/components/data-modal/error-message/error-message.component';
import { CLInvoiceInformationComponent } from '../transactions/invoice-information-modal/invoice-information.component';
import { GetInfo, Fees, Balance, LocalRemoteBalance, Payment, FeeRates, ListInvoices, Invoice, Peer } from '../../shared/models/clModels';
import { AlertTypeEnum, APICallStatusEnum, CurrencyUnitEnum } from '../../shared/services/consts-enums-functions';
import { AlertTypeEnum, APICallStatusEnum, UI_MESSAGES } from '../../shared/services/consts-enums-functions';
import * as fromRTLReducer from '../../store/rtl.reducers';
import * as RTLActions from '../../store/rtl.actions';
@ -37,12 +37,12 @@ export class CLEffects implements OnDestroy {
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore) => {
if (
rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.COMPLETED &&
rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.COMPLETED &&
rtlStore.apisCallStatus.FetchBalance.status === APICallStatusEnum.COMPLETED &&
rtlStore.apisCallStatus.FetchLocalRemoteBalance.status === APICallStatusEnum.COMPLETED
(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)
) {
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.INITALIZE_NODE_DATA));
}
});
}
@ -53,14 +53,14 @@ export class CLEffects implements OnDestroy {
withLatestFrom(this.store.select('root')),
mergeMap(([action, store]: [CLActions.FetchInfo, fromRTLReducer.RootState]) => {
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'FetchInfo', status: APICallStatusEnum.INITIATED}));
this.store.dispatch(new RTLActions.OpenSpinner('Getting Node Information...'));
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.GET_NODE_INFO));
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + environment.GETINFO_API)
.pipe(
takeUntil(this.actions.pipe(ofType(RTLActions.SET_SELECTED_NODE))),
map((info) => {
this.logger.info(info);
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'FetchInfo', status: APICallStatusEnum.COMPLETED}));
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.GET_NODE_INFO));
if (info.chains && info.chains.length && info.chains[0]
&& (typeof info.chains[0] === 'object' && info.chains[0].hasOwnProperty('chain') && info.chains[0].chain.toLowerCase().indexOf('bitcoin') < 0)
) {
@ -82,11 +82,10 @@ export class CLEffects implements OnDestroy {
}
}),
catchError((err) => {
this.store.dispatch(new RTLActions.CloseSpinner());
const code = (err.error && err.error.error && err.error.error.message && err.error.error.message.code) ? err.error.error.message.code : (err.error && err.error.error && err.error.error.code) ? err.error.error.code : err.status ? err.status : '';
const message = ((err.error && err.error.message) ? err.error.message + ' ' : '') + ((err.error && err.error.error && err.error.error.error && typeof err.error.error.error === 'string') ? err.error.error.error : (err.error && err.error.error && err.error.error.errno && typeof err.error.error.errno === 'string') ? err.error.error.errno : (err.error && err.error.error && typeof err.error.error === 'string') ? err.error.error : (err.error && typeof err.error === 'string') ? err.error : 'Unknown Error');
this.router.navigate(['/error'], { state: { errorCode: code, errorMessage: message }});
this.handleErrorWithoutAlert('FetchInfo', 'Fetching Node Info Failed.', err);
this.handleErrorWithoutAlert('FetchInfo', UI_MESSAGES.GET_NODE_INFO, 'Fetching Node Info Failed.', err);
return of({type: RTLActions.VOID});
}));
}))
@ -108,7 +107,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('FetchFees', 'Fetching Fees Failed.', err);
this.handleErrorWithoutAlert('FetchFees', UI_MESSAGES.NO_SPINNER, 'Fetching Fees Failed.', err);
return of({type: RTLActions.VOID});
}))
);
@ -128,7 +127,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('FetchFeeRates' + action.payload, 'Fetching Fee Rates Failed.', err);
this.handleErrorWithoutAlert('FetchFeeRates' + action.payload, UI_MESSAGES.NO_SPINNER, 'Fetching Fee Rates Failed.', err);
return of({type: RTLActions.VOID});
}));
}))
@ -150,7 +149,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('FetchBalance', 'Fetching Balances Failed.', err);
this.handleErrorWithoutAlert('FetchBalance', UI_MESSAGES.NO_SPINNER, 'Fetching Balances Failed.', err);
return of({type: RTLActions.VOID});
}))
);
@ -171,7 +170,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('FetchLocalRemoteBalance', 'Fetching Balances Failed.', err);
this.handleErrorWithoutAlert('FetchLocalRemoteBalance', UI_MESSAGES.NO_SPINNER, 'Fetching Balances Failed.', err);
return of({type: RTLActions.VOID});
}))
);
@ -180,17 +179,18 @@ export class CLEffects implements OnDestroy {
this.actions.pipe(
ofType(CLActions.GET_NEW_ADDRESS_CL),
mergeMap((action: CLActions.GetNewAddress) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.GENERATE_NEW_ADDRESS));
return this.httpClient.get(this.CHILD_API_URL + environment.ON_CHAIN_API + '?type=' + action.payload.addressCode)
.pipe(map((newAddress: any) => {
this.logger.info(newAddress);
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.GENERATE_NEW_ADDRESS));
return {
type: CLActions.SET_NEW_ADDRESS_CL,
payload: (newAddress && newAddress.address) ? newAddress.address : {}
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('GenerateNewAddress', 'Generate New Address Failed', this.CHILD_API_URL + environment.ON_CHAIN_API + '?type=' + action.payload.addressId, err);
this.handleErrorWithAlert('GenerateNewAddress', UI_MESSAGES.GENERATE_NEW_ADDRESS, 'Generate New Address Failed', this.CHILD_API_URL + environment.ON_CHAIN_API + '?type=' + action.payload.addressId, err);
return of({type: RTLActions.VOID});
}));
}))
@ -222,7 +222,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('FetchPeers', 'Fetching Peers Failed.', err);
this.handleErrorWithoutAlert('FetchPeers', UI_MESSAGES.NO_SPINNER, 'Fetching Peers Failed.', err);
return of({type: RTLActions.VOID});
}));
}))
@ -233,13 +233,14 @@ export class CLEffects implements OnDestroy {
ofType(CLActions.SAVE_NEW_PEER_CL),
withLatestFrom(this.store.select('cl')),
mergeMap(([action, clData]: [CLActions.SaveNewPeer, fromCLReducers.CLState]) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.CONNECT_PEER));
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'SaveNewPeer', status: APICallStatusEnum.INITIATED}));
return this.httpClient.post(this.CHILD_API_URL + environment.PEERS_API, { id: action.payload.id })
.pipe(
map((postRes: Peer[]) => {
this.logger.info(postRes);
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'SaveNewPeer', status: APICallStatusEnum.COMPLETED}));
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.CONNECT_PEER));
this.store.dispatch(new CLActions.SetPeers((postRes && postRes.length > 0) ? postRes : []));
return {
type: CLActions.NEWLY_ADDED_PEER_CL,
@ -247,7 +248,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('SaveNewPeer', 'Peer Connection Failed.', err);
this.handleErrorWithoutAlert('SaveNewPeer', UI_MESSAGES.CONNECT_PEER, 'Peer Connection Failed.', err);
return of({type: RTLActions.VOID});
}));
}))
@ -257,11 +258,12 @@ export class CLEffects implements OnDestroy {
this.actions.pipe(
ofType(CLActions.DETACH_PEER_CL),
mergeMap((action: CLActions.DetachPeer) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.DISCONNECT_PEER));
return this.httpClient.delete(this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.id + '?force=' + action.payload.force)
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.DISCONNECT_PEER));
this.store.dispatch(new RTLActions.OpenSnackBar('Peer Disconnected Successfully!'));
return {
type: CLActions.REMOVE_PEER_CL,
@ -269,7 +271,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('PeerDisconnect', 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.id, err);
this.handleErrorWithAlert('PeerDisconnect', UI_MESSAGES.DISCONNECT_PEER, 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.id, err);
return of({type: RTLActions.VOID});
}));
}))
@ -292,7 +294,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('FetchChannels', 'Fetching Channels Failed.', err);
this.handleErrorWithoutAlert('FetchChannels', UI_MESSAGES.NO_SPINNER, 'Fetching Channels Failed.', err);
return of({type: RTLActions.VOID});
}))
);
@ -301,6 +303,7 @@ export class CLEffects implements OnDestroy {
this.actions.pipe(
ofType(CLActions.SAVE_NEW_CHANNEL_CL),
mergeMap((action: CLActions.SaveNewChannel) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.OPEN_CHANNEL));
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'SaveNewChannel', status: APICallStatusEnum.INITIATED}));
let newPayload = {id: action.payload.peerId, satoshis: action.payload.satoshis, feeRate: action.payload.feeRate, announce: action.payload.announce, minconf: (action.payload.minconf) ? action.payload.minconf : null};
if (action.payload.utxos) { newPayload['utxos'] = action.payload.utxos; }
@ -308,7 +311,7 @@ export class CLEffects implements OnDestroy {
.pipe(map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'SaveNewChannel', status: APICallStatusEnum.COMPLETED}));
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.OPEN_CHANNEL));
this.store.dispatch(new RTLActions.OpenSnackBar('Channel Added Successfully!'));
this.store.dispatch(new CLActions.FetchBalance());
this.store.dispatch(new CLActions.FetchUTXOs());
@ -317,7 +320,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('SaveNewChannel', 'Opening Channel Failed.', err);
this.handleErrorWithoutAlert('SaveNewChannel', UI_MESSAGES.OPEN_CHANNEL, 'Opening Channel Failed.', err);
return of({type: RTLActions.VOID});
}));
}))
@ -327,12 +330,13 @@ export class CLEffects implements OnDestroy {
this.actions.pipe(
ofType(CLActions.UPDATE_CHANNELS_CL),
mergeMap((action: CLActions.UpdateChannels) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.UPDATE_CHAN_POLICY));
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_API + '/setChannelFee',
{ id: action.payload.channelId, base: action.payload.baseFeeMsat, ppm: action.payload.feeRate })
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.UPDATE_CHAN_POLICY));
if(action.payload.channelId === 'all') {
this.store.dispatch(new RTLActions.OpenSnackBar({message:'All Channels Updated Successfully. Fee policy updates may take some time to reflect on the channel.', duration: 5000}));
} else {
@ -343,7 +347,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('UpdateChannel', 'Update Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
this.handleErrorWithAlert('UpdateChannel', UI_MESSAGES.UPDATE_CHAN_POLICY, 'Update Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
return of({type: RTLActions.VOID});
}));
}))
@ -353,12 +357,13 @@ export class CLEffects implements OnDestroy {
this.actions.pipe(
ofType(CLActions.CLOSE_CHANNEL_CL),
mergeMap((action: CLActions.CloseChannel) => {
this.store.dispatch(new RTLActions.OpenSpinner(action.payload.force ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL));
const queryParam = action.payload.force ? '?force=' + action.payload.force : '';
return this.httpClient.delete(this.CHILD_API_URL + environment.CHANNELS_API + '/' + action.payload.channelId + queryParam)
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(action.payload.force ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL));
this.store.dispatch(new CLActions.FetchChannels());
this.store.dispatch(new RTLActions.OpenSnackBar('Channel Closed Successfully!'));
return {
@ -367,7 +372,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('CloseChannel', 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_API, err);
this.handleErrorWithAlert('CloseChannel', (action.payload.force ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL), 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_API, err);
return of({type: RTLActions.VOID});
}));
}))
@ -389,7 +394,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('FetchPayments', 'Fetching Payments Failed.', err);
this.handleErrorWithoutAlert('FetchPayments', UI_MESSAGES.NO_SPINNER, 'Fetching Payments Failed.', err);
return of({type: RTLActions.VOID});
}))
);
@ -398,13 +403,14 @@ export class CLEffects implements OnDestroy {
this.actions.pipe(
ofType(CLActions.DECODE_PAYMENT_CL),
mergeMap((action: CLActions.DecodePayment) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.DECODE_PAYMENT));
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'DecodePayment', status: APICallStatusEnum.INITIATED}));
return this.httpClient.get(this.CHILD_API_URL + environment.PAYMENTS_API + '/' + action.payload.routeParam)
.pipe(
map((decodedPayment) => {
this.logger.info(decodedPayment);
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'DecodePayment', status: APICallStatusEnum.COMPLETED}));
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.DECODE_PAYMENT));
return {
type: CLActions.SET_DECODED_PAYMENT_CL,
payload: decodedPayment ? decodedPayment : {}
@ -412,9 +418,9 @@ export class CLEffects implements OnDestroy {
}),
catchError((err: any) => {
if (action.payload.fromDialog) {
this.handleErrorWithoutAlert('DecodePayment', 'Decode Payment Failed.', err);
this.handleErrorWithoutAlert('DecodePayment', UI_MESSAGES.DECODE_PAYMENT, 'Decode Payment Failed.', err);
} else {
this.handleErrorWithAlert('DecodePayment', 'Decode Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API + '/' + action.payload, err);
this.handleErrorWithAlert('DecodePayment', UI_MESSAGES.DECODE_PAYMENT, 'Decode Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API + '/' + action.payload, err);
}
return of({type: RTLActions.VOID});
}));
@ -436,22 +442,23 @@ export class CLEffects implements OnDestroy {
ofType(CLActions.SEND_PAYMENT_CL),
withLatestFrom(this.store.select('root')),
mergeMap(([action, store]: [CLActions.SendPayment, any]) => {
this.store.dispatch(new RTLActions.OpenSpinner(action.payload.uiMessage));
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'SendPayment', status: APICallStatusEnum.INITIATED}));
let paymentUrl = (action.payload.pubkey && action.payload.pubkey !== '') ? this.CHILD_API_URL + environment.PAYMENTS_API + '/keysend' : this.CHILD_API_URL + environment.PAYMENTS_API + '/invoice';
return this.httpClient.post(paymentUrl, action.payload).pipe(
map((sendRes: any) => {
this.logger.info(sendRes);
this.store.dispatch(new RTLActions.CloseSpinner());
if (sendRes.error) {
this.logger.error('Error: ' + sendRes.payment_error);
const myErr = {status: sendRes.payment_error.status, error: sendRes.payment_error.error && sendRes.payment_error.error.error && typeof(sendRes.payment_error.error.error) === 'object' ? sendRes.payment_error.error.error : {error: sendRes.payment_error.error && sendRes.payment_error.error.error ? sendRes.payment_error.error.error : 'Unknown Error'}};
if (action.payload.fromDialog) {
this.handleErrorWithoutAlert('SendPayment', 'Send Payment Failed.', myErr);
this.handleErrorWithoutAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed.', myErr);
} else {
this.handleErrorWithAlert('SendPayment', 'Send Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API, myErr);
this.handleErrorWithAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API, myErr);
}
return {type: RTLActions.VOID};
} else {
this.store.dispatch(new RTLActions.CloseSpinner(action.payload.uiMessage));
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'SendPayment', status: APICallStatusEnum.COMPLETED}));
this.store.dispatch(new RTLActions.OpenSnackBar('Payment Sent Successfully!'));
this.store.dispatch(new CLActions.FetchChannels());
@ -468,9 +475,9 @@ export class CLEffects implements OnDestroy {
this.logger.error('Error: ' + JSON.stringify(err));
const myErr = {status: err.status, error: err.error && err.error.error && typeof(err.error.error) === 'object' ? err.error.error : {error: err.error && err.error.error ? err.error.error : 'Unknown Error'}};
if (action.payload.fromDialog) {
this.handleErrorWithoutAlert('SendPayment', 'Send Payment Failed.', myErr);
this.handleErrorWithoutAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed.', myErr);
} else {
this.handleErrorWithAlert('SendPayment', 'Send Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API, myErr);
this.handleErrorWithAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API, myErr);
}
return of({type: RTLActions.VOID});
}));
@ -494,7 +501,7 @@ export class CLEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(new CLActions.SetQueryRoutes({ routes: [] }));
this.handleErrorWithAlert('GetQueryRoutes', 'Get Query Routes Failed', this.CHILD_API_URL + environment.NETWORK_API + '/getRoute/' + action.payload.destPubkey + '/' + action.payload.amount, err);
this.handleErrorWithAlert('GetQueryRoutes', UI_MESSAGES.NO_SPINNER, 'Get Query Routes Failed', this.CHILD_API_URL + environment.NETWORK_API + '/getRoute/' + action.payload.destPubkey + '/' + action.payload.amount, err);
return of({type: RTLActions.VOID});
}));
}))
@ -513,20 +520,21 @@ export class CLEffects implements OnDestroy {
this.actions.pipe(
ofType(CLActions.PEER_LOOKUP_CL),
mergeMap((action: CLActions.PeerLookup) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.SEARCHING_NODE));
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'Lookup', status: APICallStatusEnum.INITIATED}));
return this.httpClient.get(this.CHILD_API_URL + environment.NETWORK_API + '/listNode/' + action.payload)
.pipe(
map((resPeer) => {
this.logger.info(resPeer);
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'Lookup', status: APICallStatusEnum.COMPLETED}));
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.SEARCHING_NODE));
return {
type: CLActions.SET_LOOKUP_CL,
payload: resPeer
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('Lookup', 'Peer Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listNode/' + action.payload, err);
this.handleErrorWithAlert('Lookup', UI_MESSAGES.SEARCHING_NODE, 'Peer Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listNode/' + action.payload, err);
return of({type: RTLActions.VOID});
}));
}))
@ -536,13 +544,14 @@ export class CLEffects implements OnDestroy {
this.actions.pipe(
ofType(CLActions.CHANNEL_LOOKUP_CL),
mergeMap((action: CLActions.ChannelLookup) => {
this.store.dispatch(new RTLActions.OpenSpinner(action.payload.uiMessage));
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'Lookup', status: APICallStatusEnum.INITIATED}));
return this.httpClient.get(this.CHILD_API_URL + environment.NETWORK_API + '/listChannel/' + action.payload.shortChannelID)
.pipe(
map((resChannel) => {
this.logger.info(resChannel);
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'Lookup', status: APICallStatusEnum.COMPLETED}));
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(action.payload.uiMessage));
return {
type: CLActions.SET_LOOKUP_CL,
payload: resChannel
@ -550,9 +559,9 @@ export class CLEffects implements OnDestroy {
}),
catchError((err: any) => {
if(action.payload.showError) {
this.handleErrorWithAlert('Lookup', 'Channel Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listChannel/' + action.payload.shortChannelID, err);
this.handleErrorWithAlert('Lookup', action.payload.uiMessage, 'Channel Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listChannel/' + action.payload.shortChannelID, err);
} else {
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(action.payload.uiMessage));
}
this.store.dispatch(new CLActions.SetLookup([]));
return of({type: RTLActions.VOID});
@ -586,7 +595,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('GetForwardingHistory', 'Get Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards', err);
this.handleErrorWithAlert('GetForwardingHistory', UI_MESSAGES.NO_SPINNER, 'Get Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards', err);
return of({type: RTLActions.VOID});
}));
}))
@ -596,12 +605,13 @@ export class CLEffects implements OnDestroy {
this.actions.pipe(
ofType(CLActions.DELETE_EXPIRED_INVOICE_CL),
mergeMap((action: CLActions.DeleteExpiredInvoice) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.DELETE_INVOICE));
const queryStr = (action.payload) ? '?maxexpiry=' + action.payload : '';
return this.httpClient.delete(this.CHILD_API_URL + environment.INVOICES_API + queryStr)
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.DELETE_INVOICE));
this.store.dispatch(new RTLActions.OpenSnackBar('Invoices Deleted Successfully!'));
return {
type: CLActions.FETCH_INVOICES_CL,
@ -609,7 +619,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('DeleteInvoices', 'Delete Invoice Failed', this.CHILD_API_URL + environment.INVOICES_API, err);
this.handleErrorWithAlert('DeleteInvoices', UI_MESSAGES.DELETE_INVOICE, 'Delete Invoice Failed', this.CHILD_API_URL + environment.INVOICES_API, err);
return of({type: RTLActions.VOID});
}));
}))
@ -619,6 +629,7 @@ export class CLEffects implements OnDestroy {
this.actions.pipe(
ofType(CLActions.SAVE_NEW_INVOICE_CL),
mergeMap((action: CLActions.SaveNewInvoice) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.ADD_INVOICE));
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'SaveNewInvoice', status: APICallStatusEnum.INITIATED}));
return this.httpClient.post(this.CHILD_API_URL + environment.INVOICES_API, {
label: action.payload.label, amount: action.payload.amount, description: action.payload.description, expiry: action.payload.expiry, private: action.payload.private
@ -627,7 +638,7 @@ export class CLEffects implements OnDestroy {
map((postRes: Invoice) => {
this.logger.info(postRes);
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'SaveNewInvoice', status: APICallStatusEnum.COMPLETED}));
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.ADD_INVOICE));
postRes.msatoshi = action.payload.amount;
postRes.label = action.payload.label;
postRes.expires_at = Math.round((new Date().getTime() / 1000) + action.payload.expiry);
@ -644,7 +655,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('SaveNewInvoice', 'Add Invoice Failed.', err);
this.handleErrorWithoutAlert('SaveNewInvoice', UI_MESSAGES.ADD_INVOICE, 'Add Invoice Failed.', err);
return of({type: RTLActions.VOID});
}));
}))
@ -668,7 +679,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('FetchInvoices', 'Fetching Invoices Failed.', err);
this.handleErrorWithoutAlert('FetchInvoices', UI_MESSAGES.NO_SPINNER, 'Fetching Invoices Failed.', err);
return of({type: RTLActions.VOID});
}));
}))
@ -678,13 +689,14 @@ export class CLEffects implements OnDestroy {
this.actions.pipe(
ofType(CLActions.SET_CHANNEL_TRANSACTION_CL),
mergeMap((action: CLActions.SetChannelTransaction) => {
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.SEND_FUNDS));
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'SetChannelTransaction', status: APICallStatusEnum.INITIATED}));
return this.httpClient.post(this.CHILD_API_URL + environment.ON_CHAIN_API, action.payload)
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: 'SetChannelTransaction', status: APICallStatusEnum.COMPLETED}));
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(UI_MESSAGES.SEND_FUNDS));
this.store.dispatch(new CLActions.FetchBalance());
this.store.dispatch(new CLActions.FetchUTXOs());
return {
@ -693,7 +705,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('SetChannelTransaction', 'Sending Fund Failed.', err);
this.handleErrorWithoutAlert('SetChannelTransaction', UI_MESSAGES.SEND_FUNDS, 'Sending Fund Failed.', err);
return of({type: RTLActions.VOID});
}));
}))
@ -715,7 +727,7 @@ export class CLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('FetchUTXOs', 'Fetching UTXOs Failed.', err);
this.handleErrorWithoutAlert('FetchUTXOs', UI_MESSAGES.NO_SPINNER, 'Fetching UTXOs Failed.', err);
return of({type: RTLActions.VOID});
}))
);
@ -730,11 +742,9 @@ export class CLEffects implements OnDestroy {
uris: info.uris,
version: info.version,
api_version: info.api_version,
currency_unit: CurrencyUnitEnum.BTC,
smaller_currency_unit: CurrencyUnitEnum.SATS,
numberOfPendingChannels: info.num_pending_channels
};
this.store.dispatch(new RTLActions.OpenSpinner('Initializing Node Data...'));
this.store.dispatch(new RTLActions.OpenSpinner(UI_MESSAGES.INITALIZE_NODE_DATA));
this.store.dispatch(new RTLActions.SetNodeData(node_data));
this.store.dispatch(new CLActions.FetchInvoices({num_max_invoices: 1000000, index_offset: 0, reversed: true}));
this.store.dispatch(new CLActions.FetchFees());
@ -758,7 +768,7 @@ export class CLEffects implements OnDestroy {
this.router.navigate([newRoute]);
}
handleErrorWithoutAlert(actionName: string, genericErrorMessage: string, err: { status: number, error: any }) {
handleErrorWithoutAlert(actionName: string, uiMessage: string, genericErrorMessage: string, err: { status: number, error: any }) {
this.logger.error('ERROR IN: ' + actionName + '\n' + JSON.stringify(err));
if (err.status === 401) {
this.logger.info('Redirecting to Login');
@ -766,12 +776,22 @@ export class CLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.Logout());
this.store.dispatch(new RTLActions.OpenSnackBar('Authentication Failed. Redirecting to Login.'));
} else {
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: actionName, status: APICallStatusEnum.ERROR, statusCode: err.status.toString(), message: (err.error.error && err.error.error.error && err.error.error.error.error && err.error.error.error.error.message && typeof err.error.error.error.error.message === 'string') ? err.error.error.error.error.message : (err.error.error && err.error.error.error && err.error.error.error.message && typeof err.error.error.error.message === 'string') ? err.error.error.error.message : (err.error.error && err.error.error.message && typeof err.error.error.message === 'string') ? err.error.error.message : (err.error.message && typeof err.error.message === 'string') ? err.error.message : typeof err.error === 'string' ? err.error : genericErrorMessage}));
this.store.dispatch(new RTLActions.CloseSpinner(uiMessage));
const errMsg = (err.error.error && err.error.error.error && err.error.error.error.error && err.error.error.error.error.error && typeof err.error.error.error.error.error === 'string') ? err.error.error.error.error.error :
(err.error.error && err.error.error.error && err.error.error.error.error && typeof err.error.error.error.error === 'string') ? err.error.error.error.error :
(err.error.error && err.error.error.error && typeof err.error.error.error === 'string') ? err.error.error.error :
(err.error.error && typeof err.error.error === 'string') ? err.error.error :
(err.error.error && err.error.error.error && err.error.error.error.error && err.error.error.error.error.message && typeof err.error.error.error.error.message === 'string') ? err.error.error.error.error.message :
(err.error.error && err.error.error.error && err.error.error.error.message && typeof err.error.error.error.message === 'string') ? err.error.error.error.message :
(err.error.error && err.error.error.message && typeof err.error.error.message === 'string') ? err.error.error.message :
(err.error.error && typeof err.error.error === 'string') ? err.error.error :
(err.error.message && typeof err.error.message === 'string') ? err.error.message :
typeof err.error === 'string' ? err.error : genericErrorMessage;
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: actionName, status: APICallStatusEnum.ERROR, statusCode: err.status.toString(), message: errMsg}));
}
}
handleErrorWithAlert(actionName: string, alertTitle: string, errURL: string, err: { status: number, error: any }) {
handleErrorWithAlert(actionName: string, uiMessage: string, alertTitle: string, errURL: string, err: { status: number, error: any }) {
this.logger.error(err);
if (err.status === 401) {
this.logger.info('Redirecting to Login');
@ -779,16 +799,26 @@ export class CLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.Logout());
this.store.dispatch(new RTLActions.OpenSnackBar('Authentication Failed. Redirecting to Login.'));
} else {
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.CloseSpinner(uiMessage));
const errMsg = (err.error.error && err.error.error.error && err.error.error.error.error && err.error.error.error.error.error && typeof err.error.error.error.error.error === 'string') ? err.error.error.error.error.error :
(err.error.error && err.error.error.error && err.error.error.error.error && typeof err.error.error.error.error === 'string') ? err.error.error.error.error :
(err.error.error && err.error.error.error && typeof err.error.error.error === 'string') ? err.error.error.error :
(err.error.error && typeof err.error.error === 'string') ? err.error.error :
(err.error.error && err.error.error.error && err.error.error.error.error && err.error.error.error.error.message && typeof err.error.error.error.error.message === 'string') ? err.error.error.error.error.message :
(err.error.error && err.error.error.error && err.error.error.error.message && typeof err.error.error.error.message === 'string') ? err.error.error.error.message :
(err.error.error && err.error.error.message && typeof err.error.error.message === 'string') ? err.error.error.message :
(err.error.error && typeof err.error.error === 'string') ? err.error.error :
(err.error.message && typeof err.error.message === 'string') ? err.error.message :
typeof err.error === 'string' ? err.error : 'Unknown Error.';
this.store.dispatch(new RTLActions.OpenAlert({
data: {
type: 'ERROR',
alertTitle: alertTitle,
message: { code: err.status, message: (err.error.error && err.error.error.error && err.error.error.error.error && err.error.error.error.error.message && typeof err.error.error.error.error.message === 'string') ? err.error.error.error.error.message : (err.error.error && err.error.error.error && err.error.error.error.message && typeof err.error.error.error.message === 'string') ? err.error.error.error.message : (err.error.error && err.error.error.message && typeof err.error.error.message === 'string') ? err.error.error.message : (err.error.message && typeof err.error.message === 'string') ? err.error.message : typeof err.error === 'string' ? err.error : 'Unknown Error', URL: errURL },
message: { code: err.status, message: errMsg, URL: errURL },
component: ErrorMessageComponent
}
}));
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: actionName, status: APICallStatusEnum.ERROR, statusCode: err.status.toString(), message: (err.error.error && err.error.error.error && err.error.error.error.error && err.error.error.error.error.message && typeof err.error.error.error.error.message === 'string') ? err.error.error.error.error.message : (err.error.error && err.error.error.error && err.error.error.error.message && typeof err.error.error.error.message === 'string') ? err.error.error.error.message : (err.error.error && err.error.error.message && typeof err.error.error.message === 'string') ? err.error.error.message : (err.error.message && typeof err.error.message === 'string') ? err.error.message : typeof err.error === 'string' ? err.error : 'Unknown Error', URL: errURL}));
this.store.dispatch(new CLActions.UpdateAPICallStatus({action: actionName, status: APICallStatusEnum.ERROR, statusCode: err.status.toString(), message: errMsg, URL: errURL}));
}
}

View File

@ -1,11 +1,11 @@
import { SelNodeChild } from '../../shared/models/RTLconfig';
import { APICallStatusEnum, UserPersonaEnum } from '../../shared/services/consts-enums-functions';
import { GetInfo, Fees, Balance, LocalRemoteBalance, Peer, Payment, Channel, FeeRates, ForwardingHistoryRes, ListInvoices, UTXO } from '../../shared/models/clModels';
import { ApiCallsList, ErrorPayload } from '../../shared/models/errorPayload';
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload';
import * as CLActions from '../store/cl.actions';
export interface CLState {
apisCallStatus: ApiCallsList;
apisCallStatus: ApiCallsListCL;
nodeSettings: SelNodeChild;
information: GetInfo;
fees: Fees;

View File

@ -14,7 +14,7 @@
<div fxLayout="row" fxLayoutAlign="space-between start" fxFlex="100">
<mat-form-field fxFlex="40">
<input matInput [(ngModel)]="invoiceValue" (keyup)="onInvoiceValueChange()" placeholder="Amount" type="number" [step]="100" [min]="1" tabindex="3" name="invoiceValue">
<span matSuffix> {{information?.smaller_currency_unit}} </span>
<span matSuffix> Sats </span>
<mat-hint>{{invoiceValueHint}}</mat-hint>
</mat-form-field>
<mat-form-field fxFlex="30">

View File

@ -8,7 +8,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { InvoiceInformation } from '../../../shared/models/alertData';
import { TimeUnitEnum, CurrencyUnitEnum, TIME_UNITS, CURRENCY_UNIT_FORMATS, PAGE_SIZE } from '../../../shared/services/consts-enums-functions';
import { TimeUnitEnum, CurrencyUnitEnum, TIME_UNITS, CURRENCY_UNIT_FORMATS, PAGE_SIZE, APICallStatusEnum, UI_MESSAGES } from '../../../shared/services/consts-enums-functions';
import { SelNodeChild } from '../../../shared/models/RTLconfig';
import { GetInfo } from '../../../shared/models/clModels';
import { CommonService } from '../../../shared/services/common.service';
@ -57,7 +57,7 @@ export class CLCreateInvoiceComponent implements OnInit, OnDestroy {
if (action.type === CLActions.ADD_INVOICE_CL) {
this.dialogRef.close();
}
if (action.type === CLActions.UPDATE_API_CALL_STATUS_CL && action.payload.action === 'SaveNewInvoice') {
if (action.type === CLActions.UPDATE_API_CALL_STATUS_CL && action.payload.status === APICallStatusEnum.ERROR && action.payload.action === 'SaveNewInvoice') {
this.invoiceError = action.payload.message;
}
});
@ -70,7 +70,6 @@ export class CLCreateInvoiceComponent implements OnInit, OnDestroy {
if (this.selTimeUnit !== TimeUnitEnum.SECS) {
expiryInSecs = this.commonService.convertTime(this.expiry, this.selTimeUnit, TimeUnitEnum.SECS);
}
this.store.dispatch(new RTLActions.OpenSpinner('Adding Invoice...'));
this.store.dispatch(new CLActions.SaveNewInvoice({
label: ('ulbl' + Math.random().toString(36).slice(2) + Date.now()), amount: this.invoiceValue*1000, description: this.description, expiry: expiryInSecs, private: this.private
}));

View File

@ -6,9 +6,10 @@ import { MatSnackBar } from '@angular/material/snack-bar';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
import { CLInvoiceInformation } from '../../../shared/models/alertData';
import { Invoice } from '../../../shared/models/clModels';
import { ScreenSizeEnum } from '../../../shared/services/consts-enums-functions';
import { Invoice } from '../../../shared/models/clModels';
@Component({
selector: 'rtl-cl-invoice-information',
templateUrl: './invoice-information.component.html',

View File

@ -5,7 +5,7 @@
</mat-form-field>
<mat-form-field fxFlex="100" fxLayoutAlign="start end">
<input matInput [(ngModel)]="invoiceValue" (keyup)="onInvoiceValueChange()" placeholder="Amount" name="invoiceValue" type="number" [step]="100" [min]="1" tabindex="3">
<span matSuffix> {{information?.smaller_currency_unit}} </span>
<span matSuffix> Sats </span>
<mat-hint>{{invoiceValueHint}}</mat-hint>
</mat-form-field>
<div fxLayout="row" class="mt-1">

View File

@ -8,8 +8,8 @@ import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
import { ApiCallsList } from '../../../shared/models/errorPayload';
import { CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum, UI_MESSAGES } from '../../../shared/services/consts-enums-functions';
import { ApiCallsListCL } from '../../../shared/models/apiCallsPayload';
import { SelNodeChild } from '../../../shared/models/RTLconfig';
import { GetInfo, Invoice } from '../../../shared/models/clModels';
import { LoggerService } from '../../../shared/services/logger.service';
@ -59,7 +59,7 @@ export class CLLightningInvoicesComponent implements OnInit, AfterViewInit, OnDe
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsList = null;
public apisCallStatus: ApiCallsListCL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
@ -119,7 +119,6 @@ export class CLLightningInvoicesComponent implements OnInit, AfterViewInit, OnDe
this.flgAnimate = true;
this.newlyAddedInvoiceMemo = 'ulbl' + Math.random().toString(36).slice(2) + Date.now();
this.newlyAddedInvoiceValue = this.invoiceValue;
this.store.dispatch(new RTLActions.OpenSpinner('Adding Invoice...'));
this.store.dispatch(new CLActions.SaveNewInvoice({
label: this.newlyAddedInvoiceMemo, amount: this.invoiceValue*1000, description: this.description, expiry: expiryInSecs, private: this.private
}));
@ -134,7 +133,6 @@ export class CLLightningInvoicesComponent implements OnInit, AfterViewInit, OnDe
.pipe(takeUntil(this.unSubs[1]))
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Deleting Invoices...'));
this.store.dispatch(new CLActions.DeleteExpiredInvoice());
}
});

View File

@ -9,8 +9,8 @@ import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { GetInfo, Payment, PayRequest } from '../../../shared/models/clModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
import { ApiCallsList } from '../../../shared/models/errorPayload';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, APICallStatusEnum, UI_MESSAGES } from '../../../shared/services/consts-enums-functions';
import { ApiCallsListCL } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
@ -56,7 +56,7 @@ export class CLLightningPaymentsComponent implements OnInit, AfterViewInit, OnDe
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsList = null;
public apisCallStatus: ApiCallsListCL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
@ -116,7 +116,6 @@ export class CLLightningPaymentsComponent implements OnInit, AfterViewInit, OnDe
if (this.paymentDecoded.created_at) {
this.sendPayment();
} else {
this.store.dispatch(new RTLActions.OpenSpinner('Decoding Payment...'));
this.store.dispatch(new CLActions.DecodePayment({routeParam: this.paymentRequest, fromDialog: false}));
this.clEffects.setDecodedPaymentCL
.pipe(take(1))
@ -165,8 +164,7 @@ export class CLLightningPaymentsComponent implements OnInit, AfterViewInit, OnDe
.subscribe(confirmRes => {
if (confirmRes) {
this.paymentDecoded.msatoshi = confirmRes[0].inputValue;
this.store.dispatch(new RTLActions.OpenSpinner('Sending Payment...'));
this.store.dispatch(new CLActions.SendPayment({invoice: this.paymentRequest, amount: confirmRes[0].inputValue*1000, fromDialog: false}));
this.store.dispatch(new CLActions.SendPayment({uiMessage:UI_MESSAGES.SEND_PAYMENT, invoice: this.paymentRequest, amount: confirmRes[0].inputValue*1000, fromDialog: false}));
this.resetData();
}
});
@ -191,8 +189,7 @@ export class CLLightningPaymentsComponent implements OnInit, AfterViewInit, OnDe
.pipe(take(1))
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Payment...'));
this.store.dispatch(new CLActions.SendPayment({invoice: this.paymentRequest, fromDialog: false}));
this.store.dispatch(new CLActions.SendPayment({uiMessage:UI_MESSAGES.SEND_PAYMENT, invoice: this.paymentRequest, fromDialog: false}));
this.resetData();
}
});
@ -203,7 +200,6 @@ export class CLLightningPaymentsComponent implements OnInit, AfterViewInit, OnDe
this.paymentRequest = event;
this.paymentDecodedHint = '';
if(this.paymentRequest && this.paymentRequest.length > 100) {
this.store.dispatch(new RTLActions.OpenSpinner('Decoding Payment...'));
this.store.dispatch(new CLActions.DecodePayment({routeParam: this.paymentRequest, fromDialog: false}));
this.clEffects.setDecodedPaymentCL.subscribe(decodedPayment => {
this.paymentDecoded = decodedPayment;

View File

@ -2,18 +2,18 @@ import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { faRoute, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { CommonService } from '../../../shared/services/common.service';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { faRoute, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { Routes } from '../../../shared/models/clModels';
import { AlertTypeEnum, DataTypeEnum, ScreenSizeEnum } from '../../../shared/services/consts-enums-functions';
import { CommonService } from '../../../shared/services/common.service';
import { CLEffects } from '../../store/cl.effects';
import * as CLActions from '../../store/cl.actions';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
import { AlertTypeEnum, DataTypeEnum, ScreenSizeEnum } from '../../../shared/services/consts-enums-functions';
@Component({
selector: 'rtl-cl-query-routes',

View File

@ -10,7 +10,7 @@ import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { SelNodeChild } from '../../../shared/models/RTLconfig';
import { PayRequest, Channel } from '../../../shared/models/clModels';
import { CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, FEE_LIMIT_TYPES } from '../../../shared/services/consts-enums-functions';
import { APICallStatusEnum, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, FEE_LIMIT_TYPES, UI_MESSAGES } from '../../../shared/services/consts-enums-functions';
import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
@ -65,7 +65,7 @@ export class CLLightningSendPaymentsComponent implements OnInit, OnDestroy {
if (action.type === CLActions.SEND_PAYMENT_STATUS_CL) {
this.dialogRef.close();
}
if (action.type === CLActions.UPDATE_API_CALL_STATUS_CL) {
if (action.type === CLActions.UPDATE_API_CALL_STATUS_CL && action.payload.status === APICallStatusEnum.ERROR) {
if (action.payload.action === 'SendPayment') {
delete this.paymentDecoded.msatoshi;
this.paymentError = action.payload.message;
@ -90,7 +90,6 @@ export class CLLightningSendPaymentsComponent implements OnInit, OnDestroy {
this.paymentError = '';
this.paymentDecodedHint = '';
this.paymentReq.control.setErrors(null);
this.store.dispatch(new RTLActions.OpenSpinner('Decoding Payment...'));
this.store.dispatch(new CLActions.DecodePayment({routeParam: this.paymentRequest, fromDialog: true}));
this.clEffects.setDecodedPaymentCL.pipe(take(1)).subscribe(decodedPayment => {
this.paymentDecoded = decodedPayment;
@ -118,16 +117,14 @@ export class CLLightningSendPaymentsComponent implements OnInit, OnDestroy {
}
keysendPayment() {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Keysend Payment...'));
this.store.dispatch(new CLActions.SendPayment({pubkey: this.pubkey, amount: this.keysendAmount*1000, fromDialog: true}));
this.store.dispatch(new CLActions.SendPayment({uiMessage: UI_MESSAGES.SEND_KEYSEND, pubkey: this.pubkey, amount: this.keysendAmount*1000, fromDialog: true}));
}
sendPayment() {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Payment...'));
if (this.zeroAmtInvoice) {
this.store.dispatch(new CLActions.SendPayment({invoice: this.paymentRequest, amount: this.paymentAmount*1000, fromDialog: true}));
this.store.dispatch(new CLActions.SendPayment({uiMessage: UI_MESSAGES.SEND_PAYMENT, invoice: this.paymentRequest, amount: this.paymentAmount*1000, fromDialog: true}));
} else {
this.store.dispatch(new CLActions.SendPayment({invoice: this.paymentRequest, fromDialog: true}));
this.store.dispatch(new CLActions.SendPayment({uiMessage: UI_MESSAGES.SEND_PAYMENT, invoice: this.paymentRequest, fromDialog: true}));
}
}
@ -139,7 +136,6 @@ export class CLLightningSendPaymentsComponent implements OnInit, OnDestroy {
if(this.paymentRequest && this.paymentRequest.length > 100) {
this.paymentReq.control.setErrors(null);
this.zeroAmtInvoice = false;
this.store.dispatch(new RTLActions.OpenSpinner('Decoding Payment...'));
this.store.dispatch(new CLActions.DecodePayment({routeParam: this.paymentRequest, fromDialog: true}));
this.clEffects.setDecodedPaymentCL.subscribe(decodedPayment => {
this.paymentDecoded = decodedPayment;

View File

@ -5,9 +5,10 @@ import { takeUntil, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { faExchangeAlt, faChartPie } from '@fortawesome/free-solid-svg-icons';
import { LoggerService } from '../../shared/services/logger.service';
import * as fromRTLReducer from '../../store/rtl.reducers';
import { UserPersonaEnum } from '../../shared/services/consts-enums-functions';
import { LoggerService } from '../../shared/services/logger.service';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-cl-transactions',

View File

@ -1,4 +1,4 @@
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch">
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch" *ngIf="errorMessage?.trim() === ''; else errorBlock">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Lightning</h4>
<div class="overflow-wrap dashboard-info-value">{{balances.lightning | number}} Sats</div>
@ -14,3 +14,8 @@
<div class="overflow-wrap dashboard-info-value">{{balances.total | number}} Sats</div>
</div>
</div>
<ng-template #errorBlock>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between" class="p-2">
<p>{{errorMessage}}</p>
</div>
</ng-template>

View File

@ -7,6 +7,7 @@ import { Component, Input } from '@angular/core';
})
export class ECLBalancesInfoComponent {
@Input() balances = { onchain: 0, lightning: 0, total: 0 };
@Input() errorMessage: string;
constructor() {}

View File

@ -1,4 +1,4 @@
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxFlex="100">
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxFlex="100" *ngIf="errorMessage?.trim() === ''; else errorBlock">
<div fxLayout="column" fxFlex="9" fxLayoutAlign="end start">
<span class="dashboard-capacity-header this-channel-capacity">Total Capacity</span>
<div fxLayout="row" fxLayoutAlign="space-between start" class="w-100">
@ -35,3 +35,8 @@
<button mat-stroked-button color="primary" (click)="goToChannels()" tabindex="1">Open Channel</button>
</div>
</ng-template>
<ng-template #errorBlock>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between" class="p-2">
<p>{{errorMessage}}</p>
</div>
</ng-template>

View File

@ -15,6 +15,7 @@ export class ECLChannelCapacityInfoComponent {
@Input() channelBalances: {localBalance: number, remoteBalance: number, balancedness: number};
@Input() allChannels: Channel[];
@Input() sortBy: string = 'Balance Score';
@Input() errorMessage: string;
constructor(private router: Router) {}

View File

@ -1,4 +1,4 @@
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxFlex="100" [ngClass]="{'mb-4': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM, 'mb-2': screenSize === screenSizeEnum.MD, 'mb-1': screenSize === screenSizeEnum.LG || screenSize === screenSizeEnum.XL}">
<div *ngIf="errorMessage?.trim() === ''; else errorBlock" fxLayout="column" fxLayoutAlign="space-between stretch" fxFlex="100" [ngClass]="{'mb-4': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM, 'mb-2': screenSize === screenSizeEnum.MD, 'mb-1': screenSize === screenSizeEnum.LG || screenSize === screenSizeEnum.XL}">
<div fxLayout="column" fxFlex="9" fxLayoutAlign="end start">
<span class="dashboard-capacity-header this-channel-capacity">Total Capacity</span>
<mat-hint class="font-size-90">{{totalLiquidity | number:'1.0-0'}} Sats</mat-hint>
@ -25,3 +25,8 @@
<button *ngIf="direction === 'Out'" mat-stroked-button color="primary" (click)="goToChannels()" tabindex="1">Open Channel</button>
</div>
</ng-template>
<ng-template #errorBlock>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between" class="p-2">
<p>{{errorMessage}}</p>
</div>
</ng-template>

View File

@ -14,6 +14,7 @@ export class ECLChannelLiquidityInfoComponent implements OnInit {
@Input() direction: string;
@Input() totalLiquidity: number;
@Input() allChannels: Channel[];
@Input() errorMessage: string;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;

View File

@ -1,3 +1,4 @@
<div fxLayout="row" fxFlex="100" fxLayoutAlign="start stretch" *ngIf="errorMessage?.trim() === ''; else errorBlock">
<div fxLayout="column" fxFlex="50" fxLayoutAlign="space-between stretch">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Active</h4>
@ -26,3 +27,9 @@
<div class="overflow-wrap dashboard-info-value">{{(channelsStatus.inactive?.capacity || 0) | number}} Sats</div>
</div>
</div>
</div>
<ng-template #errorBlock>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between" class="p-2">
<p>{{errorMessage}}</p>
</div>
</ng-template>

View File

@ -8,6 +8,7 @@ import { ChannelsStatus } from '../../../shared/models/eclModels';
})
export class ECLChannelStatusInfoComponent {
@Input() channelsStatus: ChannelsStatus = {};
@Input() errorMessage: string;
constructor() {}

View File

@ -1,3 +1,4 @@
<div fxLayout="row" fxFlex="100" fxLayoutAlign="start stretch" *ngIf="errorMessage?.trim() === ''; else errorBlock">
<div fxLayout="column" fxFlex="50" fxLayoutAlign="space-between stretch">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Daily</h4>
@ -26,3 +27,9 @@
<div class="overflow-wrap dashboard-info-value">{{fees?.monthly_txs | number}}</div>
</div>
</div>
</div>
<ng-template #errorBlock>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between" class="p-2">
<p>{{errorMessage}}</p>
</div>
</ng-template>

View File

@ -8,13 +8,14 @@ import { Fees } from '../../../shared/models/eclModels';
})
export class ECLFeeInfoComponent implements OnChanges {
@Input() fees: Fees;
@Input() errorMessage: string;
totalFees = [{'name': 'Monthly', 'value': 0}, {'name': 'Weekly', 'value': 0}, {'name': 'Daily', 'value': 0}];
maxFeeValue = 100;
constructor() {}
ngOnChanges() {
if(this.fees.monthly_fee) {
if(this.fees?.monthly_fee) {
this.totalFees = [{'name': 'Monthly', 'value': this.fees.monthly_fee}, {'name': 'Weekly', 'value': this.fees.weekly_fee}, {'name': 'Daily ', 'value': this.fees.daily_fee}];
let e = Math.ceil(Math.log(this.fees.monthly_fee + 1) / Math.LN10);
let m = Math.pow(10, e - 1);

View File

@ -1,8 +1,7 @@
<div fxLayout="column" *ngIf="selNode.userPersona === userPersonaEnum.OPERATOR; else merchantDashboard">
<div fxLayout="row" fxLayoutAlign="start start" class="page-title-container mb-0">
<fa-icon [icon]="!flgLoading[0] ? faSmile : faFrown" class="page-title-img mr-1"></fa-icon>
<span
class="page-title">{{!flgLoading[0] ? 'Welcome ' + information.alias + '! Your node is up and running.' : 'Error! Please check the server connection.'}}</span>
<fa-icon [icon]="apisCallStatus?.FetchInfo.status === apiCallStatusEnum.COMPLETED ? faSmile : faFrown" class="page-title-img mr-1"></fa-icon>
<span class="page-title">{{apisCallStatus?.FetchInfo.status === apiCallStatusEnum.COMPLETED ? 'Welcome ' + information.alias + '! Your node is up and running.' : apisCallStatus?.FetchInfo.status === apiCallStatusEnum.INITIATED ? 'Wait! Getting your node information...' : 'Error! Please check the server connection.'}}</span>
</div>
<mat-grid-list cols="10" [rowHeight]="operatorCardHeight">
<mat-grid-tile *ngFor="let card of operatorCards" [colspan]="card.cols" [rowspan]="card.rows">
@ -27,20 +26,24 @@
</div>
</mat-card-title>
</mat-card-header>
<mat-card-content class="dashboard-card-content" fxLayout="column" fxFlex="{{card.id === 'capacity' ? 90 : 70}}">
<mat-card-content fxLayout="column" fxFlex="{{card.id === 'capacity' ? 90 : 70}}"
[ngClass]="{'dashboard-card-content': true,
'error-border': (card.id === 'node' && apisCallStatus?.FetchInfo.status === apiCallStatusEnum.ERROR) ||
(card.id === 'balance' && (apisCallStatus?.FetchChannels.status === apiCallStatusEnum.ERROR || apisCallStatus?.FetchOnchainBalance.status === apiCallStatusEnum.ERROR)) ||
((card.id === 'capacity' || card.id === 'status') && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.ERROR) ||
(card.id === 'fee' && apisCallStatus?.FetchFees.status === apiCallStatusEnum.ERROR)}">
<mat-progress-bar mode="indeterminate"
*ngIf="(card.id === 'node' && apisCallStatus?.FetchInfo.status === apiCallStatusEnum.INITIATED) ||
(card.id === 'balance' && (apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED || apisCallStatus?.FetchOnchainBalance.status === apiCallStatusEnum.INITIATED)) ||
((card.id === 'capacity' || card.id === 'status') && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED) ||
(card.id === 'fee' && apisCallStatus?.FetchFees.status === apiCallStatusEnum.INITIATED)"
></mat-progress-bar>
<div [ngSwitch]="card.id" fxLayout="column" fxFlex="100">
<rtl-ecl-node-info fxFlex="100" *ngSwitchCase="'node'" [information]="information"
[showColorFieldSeparately]="false" [ngClass]="{'error-border': flgLoading[0]==='error'}">
</rtl-ecl-node-info>
<rtl-ecl-balances-info fxFlex="100" *ngSwitchCase="'balance'" [balances]="balances"
[ngClass]="{'error-border': flgLoading[2]==='error'}"></rtl-ecl-balances-info>
<rtl-ecl-channel-capacity-info fxFlex="100" *ngSwitchCase="'capacity'" [sortBy]="sortField"
[channelBalances]="channelBalances" [allChannels]="allChannelsCapacity"
[ngClass]="{'error-border': flgLoading[5]==='error'}"></rtl-ecl-channel-capacity-info>
<rtl-ecl-fee-info fxFlex="100" *ngSwitchCase="'fee'" [fees]="fees"
[ngClass]="{'error-border': flgLoading[1]==='error'}"></rtl-ecl-fee-info>
<rtl-ecl-channel-status-info fxFlex="100" *ngSwitchCase="'status'" [channelsStatus]="channelsStatus"
[ngClass]="{'error-border': flgLoading[0]==='error'}"></rtl-ecl-channel-status-info>
<rtl-ecl-node-info fxFlex="100" *ngSwitchCase="'node'" [information]="information" [showColorFieldSeparately]="false"></rtl-ecl-node-info>
<rtl-ecl-balances-info fxFlex="100" *ngSwitchCase="'balance'" [balances]="balances" [errorMessage]="errorMessages[2] + ' ' + errorMessages[3]"></rtl-ecl-balances-info>
<rtl-ecl-channel-capacity-info fxFlex="100" *ngSwitchCase="'capacity'" [sortBy]="sortField" [channelBalances]="channelBalances" [allChannels]="allChannelsCapacity" [errorMessage]="errorMessages[2]"></rtl-ecl-channel-capacity-info>
<rtl-ecl-fee-info fxFlex="100" *ngSwitchCase="'fee'" [fees]="fees" [errorMessage]="errorMessages[1]"></rtl-ecl-fee-info>
<rtl-ecl-channel-status-info fxFlex="100" *ngSwitchCase="'status'" [channelsStatus]="channelsStatus" [errorMessage]="errorMessages[2]"></rtl-ecl-channel-status-info>
<h3 *ngSwitchDefault>Error! Unable to find information!</h3>
</div>
</mat-card-content>
@ -73,18 +76,21 @@
</div>
</mat-card-title>
</mat-card-header>
<mat-card-content class="dashboard-card-content" fxLayout="column" fxLayoutAlign="start stretch" fxFlex="{{card.id === 'transactions' ? 100 : card.id === 'balance' ? 70: 90}}">
<mat-card-content fxLayout="column" fxLayoutAlign="start stretch" fxFlex="{{card.id === 'transactions' ? 100 : card.id === 'balance' ? 70: 90}}"
[ngClass]="{'dashboard-card-content': true,
'error-border': (card.id === 'node' && apisCallStatus?.FetchInfo.status === apiCallStatusEnum.ERROR) ||
(card.id === 'balance' && (apisCallStatus?.FetchChannels.status === apiCallStatusEnum.ERROR || apisCallStatus?.FetchOnchainBalance.status === apiCallStatusEnum.ERROR)) ||
((card.id === 'inboundLiq' || card.id === 'outboundLiq') && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.ERROR)}">
<mat-progress-bar mode="indeterminate"
*ngIf="(card.id === 'node' && apisCallStatus?.FetchInfo.status === apiCallStatusEnum.INITIATED) ||
(card.id === 'balance' && (apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED || apisCallStatus?.FetchOnchainBalance.status === apiCallStatusEnum.INITIATED)) ||
((card.id === 'inboundLiq' || card.id === 'outboundLiq') && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED)"
></mat-progress-bar>
<div [ngSwitch]="card.id" fxLayout="column" fxFlex="100">
<rtl-ecl-node-info fxFlex="100" *ngSwitchCase="'node'" [information]="information"
[ngClass]="{'error-border': flgLoading[0]==='error'}"></rtl-ecl-node-info>
<rtl-ecl-balances-info fxFlex="100" *ngSwitchCase="'balance'" [balances]="balances"
[ngClass]="{'error-border': flgLoading[2]==='error'}"></rtl-ecl-balances-info>
<rtl-ecl-channel-liquidity-info fxFlex="100" *ngSwitchCase="'inboundLiq'" [direction]="'In'"
[totalLiquidity]="totalInboundLiquidity" [allChannels]="allInboundChannels"
[ngClass]="{'error-border': flgLoading[5]==='error'}"></rtl-ecl-channel-liquidity-info>
<rtl-ecl-channel-liquidity-info fxFlex="100" *ngSwitchCase="'outboundLiq'" [direction]="'Out'"
[totalLiquidity]="totalOutboundLiquidity" [allChannels]="allOutboundChannels"
[ngClass]="{'error-border': flgLoading[5]==='error'}"></rtl-ecl-channel-liquidity-info>
<rtl-ecl-node-info fxFlex="100" *ngSwitchCase="'node'" [information]="information"></rtl-ecl-node-info>
<rtl-ecl-balances-info fxFlex="100" *ngSwitchCase="'balance'" [balances]="balances" [errorMessage]="errorMessages[2] + ' ' + errorMessages[3]"></rtl-ecl-balances-info>
<rtl-ecl-channel-liquidity-info fxFlex="100" *ngSwitchCase="'inboundLiq'" [direction]="'In'" [totalLiquidity]="totalInboundLiquidity" [allChannels]="allInboundChannels" [errorMessage]="errorMessages[2]"></rtl-ecl-channel-liquidity-info>
<rtl-ecl-channel-liquidity-info fxFlex="100" *ngSwitchCase="'outboundLiq'" [direction]="'Out'" [totalLiquidity]="totalOutboundLiquidity" [allChannels]="allOutboundChannels" [errorMessage]="errorMessages[2]"></rtl-ecl-channel-liquidity-info>
<span fxLayout="column" fxFlex="100" fxLayoutAlign="space-between start" *ngSwitchCase="'transactions'">
<mat-tab-group fxLayout="column" class="w-100 dashboard-tabs-group">
<mat-tab label="Receive">

View File

@ -9,8 +9,9 @@ import { faAngleDoubleDown, faAngleDoubleUp, faChartPie, faBolt, faServer, faNet
import { LoggerService } from '../../shared/services/logger.service';
import { CommonService } from '../../shared/services/common.service';
import { UserPersonaEnum, ScreenSizeEnum } from '../../shared/services/consts-enums-functions';
import { UserPersonaEnum, ScreenSizeEnum, APICallStatusEnum } from '../../shared/services/consts-enums-functions';
import { GetInfo, Channel, Fees, OnChainBalance, ChannelsStatus } from '../../shared/models/eclModels';
import { ApiCallsListECL } from '../../shared/models/apiCallsPayload';
import { SelNodeChild } from '../../shared/models/RTLconfig';
import * as fromRTLReducer from '../../store/rtl.reducers';
@ -30,7 +31,6 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
public faBolt = faBolt;
public faServer = faServer;
public faNetworkWired = faNetworkWired;
public flgChildInfoUpdated = false;
public userPersonaEnum = UserPersonaEnum;
public channelBalances = {localBalance: 0, remoteBalance: 0, balancedness: 0};
public selNode: SelNodeChild = {};
@ -51,7 +51,9 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
public operatorCardHeight = '330px';
public merchantCardHeight = '65px';
public sortField = 'Balance Score';
public flgLoading: Array<Boolean | 'error'> = [true, true, true, true, true, true, true, true]; // 0: Info, 1: Fee, 2: Wallet, 3: Channel, 4: Network
public errorMessages = ['', '', '', ''];
public apisCallStatus: ApiCallsListECL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private actions: Actions, private commonService: CommonService, private router: Router) {
@ -107,29 +109,23 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
this.store.select('ecl')
.pipe(takeUntil(this.unSubs[1]))
.subscribe((rtlStore) => {
this.flgLoading = [true, true, true, true, true, true, true, true];
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchInfo') {
this.flgLoading[0] = 'error';
this.errorMessages = ['', '', '', ''];
this.apisCallStatus = rtlStore.apisCallStatus;
if (rtlStore.apisCallStatus.FetchInfo.status === APICallStatusEnum.ERROR) {
this.errorMessages[0] = (typeof(this.apisCallStatus.FetchInfo.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchInfo.message) : this.apisCallStatus.FetchInfo.message;
}
if (effectsErr.action === 'FetchFees') {
this.flgLoading[1] = 'error';
if (rtlStore.apisCallStatus.FetchFees.status === APICallStatusEnum.ERROR) {
this.errorMessages[1] = (typeof(this.apisCallStatus.FetchFees.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchFees.message) : this.apisCallStatus.FetchFees.message;
}
if (effectsErr.action === 'FetchChannels') {
this.flgLoading[2] = 'error';
if (rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.ERROR) {
this.errorMessages[2] = (typeof(this.apisCallStatus.FetchChannels.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchChannels.message) : this.apisCallStatus.FetchChannels.message;
}
if (rtlStore.apisCallStatus.FetchOnchainBalance.status === APICallStatusEnum.ERROR) {
this.errorMessages[3] = (typeof(this.apisCallStatus.FetchOnchainBalance.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchOnchainBalance.message) : this.apisCallStatus.FetchOnchainBalance.message;
}
});
this.selNode = rtlStore.nodeSettings;
this.information = rtlStore.information;
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (this.information.nodeId) ? false : true;
}
this.fees = rtlStore.fees;
if (this.flgLoading[1] !== 'error') {
this.flgLoading[1] = (this.fees.daily_fee) ? false : true;
}
this.channels = rtlStore.activeChannels;
this.onchainBalance = rtlStore.onchainBalance;
this.balances.onchain = this.onchainBalance.total;
@ -150,26 +146,8 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
this.totalInboundLiquidity = this.totalInboundLiquidity + Math.ceil(channel.toRemote);
this.totalOutboundLiquidity = this.totalOutboundLiquidity + Math.floor(channel.toLocal);
});
if (this.flgLoading[2] !== 'error') {
this.flgLoading[2] = (this.channels) ? false : true;
}
if (this.balances.lightning >= 0 && this.balances.onchain >= 0 && this.fees.monthly_fee >= 0) {
this.flgChildInfoUpdated = true;
} else {
this.flgChildInfoUpdated = false;
}
this.logger.info(rtlStore);
});
this.actions.pipe(takeUntil(this.unSubs[2]),
filter((action) => action.type === ECLActions.FETCH_FEES_ECL || action.type === ECLActions.SET_FEES_ECL))
.subscribe(action => {
if(action.type === ECLActions.FETCH_FEES_ECL) {
this.flgChildInfoUpdated = false;
}
if(action.type === ECLActions.SET_FEES_ECL) {
this.flgChildInfoUpdated = true;
}
});
}
onNavigateTo(link: string) {

View File

@ -1,19 +1,18 @@
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { FormControl } from '@angular/forms';
import { Subject } from 'rxjs';
import { takeUntil, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { faSearch } from '@fortawesome/free-solid-svg-icons';
import { APICallStatusEnum, ScreenSizeEnum } from '../../shared/services/consts-enums-functions';
import { CommonService } from '../../shared/services/common.service';
import { LookupNode } from '../../shared/models/eclModels';
import { LoggerService } from '../../shared/services/logger.service';
import * as ECLActions from '../store/ecl.actions';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
import { ScreenSizeEnum } from '../../shared/services/consts-enums-functions';
import { CommonService } from '../../shared/services/common.service';
import { FormControl } from '@angular/forms';
import { LookupNode } from '../../shared/models/eclModels';
@Component({
selector: 'rtl-ecl-lookups',
@ -46,7 +45,7 @@ export class ECLLookupsComponent implements OnInit, OnDestroy {
ngOnInit() {
this.actions.pipe(takeUntil(this.unSubs[0]),
filter((action) => (action.type === ECLActions.SET_LOOKUP_ECL || action.type === ECLActions.EFFECT_ERROR_ECL))).subscribe((resLookup: ECLActions.SetLookup | ECLActions.EffectError) => {
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) {
this.flgLoading[0] = true;
switch (this.selectedFieldId) {
@ -63,7 +62,7 @@ export class ECLLookupsComponent implements OnInit, OnDestroy {
this.logger.info(this.nodeLookupValue);
this.logger.info(this.channelLookupValue);
}
if (resLookup.type === ECLActions.EFFECT_ERROR_ECL && resLookup.payload.action === 'Lookup') {
if (resLookup.type === ECLActions.UPDATE_API_CALL_STATUS_ECL && resLookup.payload.status === APICallStatusEnum.ERROR && resLookup.payload.action === 'Lookup') {
this.flgLoading[0] = 'error';
}
});
@ -88,7 +87,6 @@ export class ECLLookupsComponent implements OnInit, OnDestroy {
this.flgSetLookupValue = false;
this.nodeLookupValue = {};
this.channelLookupValue = [];
this.store.dispatch(new RTLActions.OpenSpinner('Searching ' + this.lookupFields[this.selectedFieldId].name + '...'));
switch (this.selectedFieldId) {
case 0:
this.store.dispatch(new ECLActions.PeerLookup(this.lookupKeyCtrl.value.trim()));

View File

@ -20,7 +20,6 @@ export class ECLOnChainReceiveComponent {
constructor(private store: Store<fromRTLReducer.RTLState>, private eclEffects: ECLEffects) {}
onGenerateAddress() {
this.store.dispatch(new RTLActions.OpenSpinner('Getting New Address...'));
this.store.dispatch(new ECLActions.GetNewAddress());
this.eclEffects.setNewAddress.pipe(take(1))
.subscribe(newAddress => {

View File

@ -9,7 +9,7 @@ import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { SelNodeChild, GetInfoRoot } from '../../../shared/models/RTLconfig';
import { GetInfo, OnChainBalance, SendPaymentOnChain } from '../../../shared/models/eclModels';
import { CURRENCY_UNITS, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, ADDRESS_TYPES } from '../../../shared/services/consts-enums-functions';
import { CURRENCY_UNITS, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, ADDRESS_TYPES, APICallStatusEnum, UI_MESSAGES } from '../../../shared/services/consts-enums-functions';
import { RTLConfiguration } from '../../../shared/models/RTLconfig';
import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
@ -30,7 +30,6 @@ export class ECLOnChainSendModalComponent implements OnInit, OnDestroy {
public appConfig: RTLConfiguration;
public nodeData: GetInfoRoot;
public addressTypes = [];
public flgLoadingWallet: Boolean | 'error' = true;
public selectedAddress = ADDRESS_TYPES[1];
public blockchainBalance: OnChainBalance = {};
public information: GetInfo = {};
@ -59,13 +58,13 @@ export class ECLOnChainSendModalComponent implements OnInit, OnDestroy {
this.logger.info(rootStore);
});
this.actions.pipe(takeUntil(this.unSubs[1]),
filter(action => action.type === ECLActions.EFFECT_ERROR_ECL || action.type === ECLActions.SEND_ONCHAIN_FUNDS_RES_ECL))
.subscribe((action: ECLActions.EffectError | ECLActions.SendOnchainFundsRes) => {
filter(action => action.type === ECLActions.UPDATE_API_CALL_STATUS_ECL || action.type === ECLActions.SEND_ONCHAIN_FUNDS_RES_ECL))
.subscribe((action: ECLActions.UpdateAPICallStatus | ECLActions.SendOnchainFundsRes) => {
if (action.type === ECLActions.SEND_ONCHAIN_FUNDS_RES_ECL) {
this.store.dispatch(new RTLActions.OpenSnackBar('Fund Sent Successfully!'));
this.dialogRef.close();
}
if (action.type === ECLActions.EFFECT_ERROR_ECL && action.payload.action === 'SendOnchainFunds') {
if (action.type === ECLActions.UPDATE_API_CALL_STATUS_ECL && action.payload.status === APICallStatusEnum.ERROR && action.payload.action === 'SendOnchainFunds') {
this.sendFundError = action.payload.message;
}
});
@ -78,7 +77,6 @@ export class ECLOnChainSendModalComponent implements OnInit, OnDestroy {
this.commonService.convertCurrency(this.transaction.amount, this.selAmountUnit === this.amountUnits[2] ? CurrencyUnitEnum.OTHER : this.selAmountUnit, CurrencyUnitEnum.SATS, this.amountUnits[2], this.fiatConversion)
.pipe(takeUntil(this.unSubs[2]))
.subscribe(data => {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Funds...'));
this.transaction.amount = parseInt(data[CurrencyUnitEnum.SATS]);
this.selAmountUnit = CurrencyUnitEnum.SATS;
this.store.dispatch(new ECLActions.SendOnchainFunds(this.transaction));
@ -88,7 +86,6 @@ export class ECLOnChainSendModalComponent implements OnInit, OnDestroy {
this.amountError = 'Conversion Error: ' + (err.error && err.error.error && err.error.error.error ? err.error.error.error : err.error && err.error.error ? err.error.error : err.error ? err.error : 'Currency Conversion Error');
});
} else {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Funds...'));
this.store.dispatch(new ECLActions.SendOnchainFunds(this.transaction));
}
}

View File

@ -9,10 +9,10 @@
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="start start">
<div [perfectScrollbar] class="table-container" fxFlex="100">
<mat-progress-bar *ngIf="flgLoading[0]===true" mode="indeterminate"></mat-progress-bar>
<table mat-table #table [dataSource]="listTransactions" matSort
[ngClass]="{'overflow-auto error-border': flgLoading[0]==='error','overflow-auto': true}">
<div [perfectScrollbar] fxLayout="column" fxLayoutAlign="start end" fxFlex="100" class="table-container">
<mat-progress-bar *ngIf="apisCallStatus?.FetchTransactions.status === apiCallStatusEnum.INITIATED" mode="indeterminate"></mat-progress-bar>
<table mat-table #table fxFlex="100" [dataSource]="listTransactions" matSort
[ngClass]="{'overflow-auto error-border': errorMessage !== '','overflow-auto': true}">
<ng-container matColumnDef="timestamp">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Date/Time </th>
<td mat-cell *matCellDef="let transaction">{{(transaction.timestamp * 1000) | date:'dd/MMM/YYYY HH:mm'}}</td>
@ -52,7 +52,9 @@
</ng-container>
<ng-container matColumnDef="no_transaction">
<td mat-footer-cell *matFooterCellDef colspan="4">
<p *ngIf="!listTransactions?.data || listTransactions?.data?.length<1">No transactions available.</p>
<p *ngIf="(!listTransactions?.data || listTransactions?.data?.length<1) && apisCallStatus?.FetchTransactions.status === apiCallStatusEnum.COMPLETED">No transaction available.</p>
<p *ngIf="(!listTransactions?.data || listTransactions?.data?.length<1) && apisCallStatus?.FetchTransactions.status === apiCallStatusEnum.INITIATED">Getting transactions...</p>
<p *ngIf="(!listTransactions?.data || listTransactions?.data?.length<1) && apisCallStatus?.FetchTransactions.status === apiCallStatusEnum.ERROR">{{errorMessage}}</p>
</td>
</ng-container>
<tr mat-footer-row *matFooterRowDef="['no_transaction']" [ngClass]="{'display-none': listTransactions?.data && listTransactions?.data?.length>0}"></tr>

View File

@ -4,12 +4,13 @@ import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { faHistory } from '@fortawesome/free-solid-svg-icons';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Transaction } from '../../../shared/models/eclModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum } from '../../../shared/services/consts-enums-functions';
import { ApiCallsListECL } from '../../../shared/models/apiCallsPayload';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
@ -31,12 +32,14 @@ export class ECLOnChainTransactionHistoryComponent implements OnInit, OnDestroy
faHistory = faHistory;
public displayedColumns: any[] = [];
public listTransactions: any;
public flgLoading: Array<Boolean | 'error'> = [true];
public flgSticky = false;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsListECL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>, private datePipe: DatePipe) {
@ -61,17 +64,14 @@ export class ECLOnChainTransactionHistoryComponent implements OnInit, OnDestroy
this.store.select('ecl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchTransactions') {
this.flgLoading[0] = 'error';
this.errorMessage = '';
this.apisCallStatus = rtlStore.apisCallStatus;
if (rtlStore.apisCallStatus.FetchTransactions.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof(this.apisCallStatus.FetchPayments.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchPayments.message) : this.apisCallStatus.FetchPayments.message;
}
});
if (rtlStore.transactions) {
this.loadTransactionsTable(rtlStore.transactions);
}
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (rtlStore.transactions) ? false : true;
}
this.logger.info(rtlStore);
});

View File

@ -5,9 +5,9 @@
<input matInput (keyup)="applyFilter()" [(ngModel)]="selFilter" name="filter" placeholder="Filter">
</mat-form-field>
</div>
<div [perfectScrollbar] fxLayout="row" fxLayoutAlign="start center" fxFlex="100" class="table-container w-100">
<mat-progress-bar *ngIf="flgLoading[0]===true" mode="indeterminate"></mat-progress-bar>
<table mat-table #table [dataSource]="channels" matSort [ngClass]="{'overflow-auto error-border': flgLoading[0]==='error','overflow-auto': true}">
<div [perfectScrollbar] fxLayout="column" fxLayoutAlign="start center" fxFlex="100" class="table-container">
<mat-progress-bar *ngIf="apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED" mode="indeterminate"></mat-progress-bar>
<table mat-table #table fxFlex="100" [dataSource]="channels" matSort [ngClass]="{'overflow-auto error-border': errorMessage !== '','overflow-auto': true}">
<ng-container matColumnDef="state">
<th mat-header-cell *matHeaderCellDef mat-sort-header> State </th>
<td mat-cell *matCellDef="let channel">
@ -70,7 +70,9 @@
</ng-container>
<ng-container matColumnDef="no_channel">
<td mat-footer-cell *matFooterCellDef colspan="4">
<p *ngIf="(!channels?.data || channels?.data?.length<1)">No inactive channels available.</p>
<p *ngIf="(!channels?.data || channels?.data?.length<1) && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.COMPLETED">No inactive channel available.</p>
<p *ngIf="(!channels?.data || channels?.data?.length<1) && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED">Getting inactive channels...</p>
<p *ngIf="(!channels?.data || channels?.data?.length<1) && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.ERROR">{{errorMessage}}</p>
</td>
</ng-container>
<tr mat-footer-row *matFooterRowDef="['no_channel']" [ngClass]="{'display-none': channels?.data && channels?.data?.length>0}"></tr>

View File

@ -8,7 +8,7 @@ import { MatTableDataSource } from '@angular/material/table';
import {faEye, faEyeSlash} from "@fortawesome/free-solid-svg-icons";
import { Channel, GetInfo } from '../../../../../shared/models/eclModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, AlertTypeEnum } from '../../../../../shared/services/consts-enums-functions';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, AlertTypeEnum, APICallStatusEnum } from '../../../../../shared/services/consts-enums-functions';
import { LoggerService } from '../../../../../shared/services/logger.service';
import { CommonService } from '../../../../../shared/services/common.service';
@ -17,6 +17,7 @@ import { RTLEffects } from '../../../../../store/rtl.effects';
import * as ECLActions from '../../../../store/ecl.actions';
import * as RTLActions from '../../../../../store/rtl.actions';
import * as fromRTLReducer from '../../../../../store/rtl.reducers';
import { ApiCallsListECL } from '../../../../../shared/models/apiCallsPayload';
@Component({
selector: 'rtl-ecl-channel-inactive-table',
@ -39,13 +40,15 @@ export class ECLChannelInactiveTableComponent implements OnInit, AfterViewInit,
public information: GetInfo = {};
public numPeers = -1;
public feeRateTypes = FEE_RATE_TYPES;
public flgLoading: Array<Boolean | 'error'> = [true];
public selFilter = '';
public flgSticky = false;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsListECL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private commonService: CommonService) {
@ -69,19 +72,16 @@ export class ECLChannelInactiveTableComponent implements OnInit, AfterViewInit,
this.store.select('ecl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchChannels') {
this.flgLoading[0] = 'error';
this.errorMessage = '';
this.apisCallStatus = rtlStore.apisCallStatus;
if (rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof(this.apisCallStatus.FetchChannels.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchChannels.message) : this.apisCallStatus.FetchChannels.message;
}
});
this.information = rtlStore.information;
this.numPeers = (rtlStore.peers && rtlStore.peers.length) ? rtlStore.peers.length : 0;
this.totalBalance = rtlStore.onchainBalance.total;
this.inactiveChannels = rtlStore.inactiveChannels;
this.loadChannelsTable();
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (rtlStore.inactiveChannels) ? false : true;
}
this.logger.info(rtlStore);
});
}
@ -107,7 +107,6 @@ export class ECLChannelInactiveTableComponent implements OnInit, AfterViewInit,
.pipe(takeUntil(this.unSubs[1]))
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner((forceClose) ? 'Force Closing Channel...' : 'Closing Channel...'));
this.store.dispatch(new ECLActions.CloseChannel({channelId: channelToClose.channelId, force: forceClose}));
}
});

View File

@ -5,9 +5,9 @@
<input matInput (keyup)="applyFilter()" [(ngModel)]="selFilter" name="filter" placeholder="Filter">
</mat-form-field>
</div>
<div [perfectScrollbar] fxLayout="row" fxLayoutAlign="start center" fxFlex="100" class="table-container w-100">
<mat-progress-bar *ngIf="flgLoading[0]===true" mode="indeterminate"></mat-progress-bar>
<table mat-table #table [dataSource]="channels" matSort [ngClass]="{'overflow-auto error-border': flgLoading[0]==='error','overflow-auto': true}">
<div [perfectScrollbar] fxLayout="column" fxLayoutAlign="start center" fxFlex="100" class="table-container">
<mat-progress-bar *ngIf="apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED" mode="indeterminate"></mat-progress-bar>
<table mat-table #table fxFlex="100" [dataSource]="channels" matSort [ngClass]="{'overflow-auto error-border': errorMessage !== '','overflow-auto': true}">
<ng-container matColumnDef="shortChannelId">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Short Channel ID </th>
<td mat-cell *matCellDef="let channel">
@ -79,8 +79,10 @@
</ng-container>
<ng-container matColumnDef="no_peer">
<td mat-footer-cell *matFooterCellDef colspan="4">
<p *ngIf="numPeers<1 && (!channels?.data || channels?.data?.length<1)">No peers connected. Add a peer in order to open a channel.</p>
<p *ngIf="numPeers>0 && (!channels?.data || channels?.data?.length<1)">No open channels available.</p>
<p *ngIf="numPeers<1 && (!channels?.data || channels?.data?.length<1) && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.COMPLETED">No peers connected. Add a peer in order to open a channel.</p>
<p *ngIf="numPeers>0 && (!channels?.data || channels?.data?.length<1) && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.COMPLETED">No channel available.</p>
<p *ngIf="(!channels?.data || channels?.data?.length<1) && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED">Getting channels...</p>
<p *ngIf="(!channels?.data || channels?.data?.length<1) && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.ERROR">{{errorMessage}}</p>
</td>
</ng-container>
<tr mat-footer-row *matFooterRowDef="['no_peer']" [ngClass]="{'display-none': numPeers>0 && channels?.data && channels?.data?.length>0}"></tr>

View File

@ -8,7 +8,7 @@ import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Channel, GetInfo } from '../../../../../shared/models/eclModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, AlertTypeEnum } from '../../../../../shared/services/consts-enums-functions';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, AlertTypeEnum, APICallStatusEnum } from '../../../../../shared/services/consts-enums-functions';
import { LoggerService } from '../../../../../shared/services/logger.service';
import { CommonService } from '../../../../../shared/services/common.service';
@ -17,6 +17,7 @@ import { RTLEffects } from '../../../../../store/rtl.effects';
import * as ECLActions from '../../../../store/ecl.actions';
import * as RTLActions from '../../../../../store/rtl.actions';
import * as fromRTLReducer from '../../../../../store/rtl.reducers';
import { ApiCallsListECL } from '../../../../../shared/models/apiCallsPayload';
@Component({
selector: 'rtl-ecl-channel-open-table',
@ -39,13 +40,15 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
public information: GetInfo = {};
public numPeers = -1;
public feeRateTypes = FEE_RATE_TYPES;
public flgLoading: Array<Boolean | 'error'> = [true];
public selFilter = '';
public flgSticky = false;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsListECL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private commonService: CommonService) {
@ -69,11 +72,11 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
this.store.select('ecl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchChannels') {
this.flgLoading[0] = 'error';
this.errorMessage = '';
this.apisCallStatus = rtlStore.apisCallStatus;
if (rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof(this.apisCallStatus.FetchChannels.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchChannels.message) : this.apisCallStatus.FetchChannels.message;
}
});
this.information = rtlStore.information;
this.numPeers = (rtlStore.peers && rtlStore.peers.length) ? rtlStore.peers.length : 0;
this.totalBalance = rtlStore.onchainBalance.total;
@ -81,9 +84,6 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
if (this.activeChannels.length > 0 && this.sort && this.paginator) {
this.loadChannelsTable();
}
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (rtlStore.activeChannels) ? false : true;
}
this.logger.info(rtlStore);
});
}
@ -128,7 +128,6 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
} else {
updateRequestPayload = { baseFeeMsat: base_fee, feeRate: fee_rate, channelId: channelToUpdate.channelId };
}
this.store.dispatch(new RTLActions.OpenSpinner('Updating Channel Policy...'));
this.store.dispatch(new ECLActions.UpdateChannels(updateRequestPayload));
}
});
@ -154,7 +153,6 @@ export class ECLChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
.pipe(takeUntil(this.unSubs[3]))
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner((forceClose) ? 'Force Closing Channel...' : 'Closing Channel...'));
this.store.dispatch(new ECLActions.CloseChannel({channelId: channelToClose.channelId, force: forceClose}));
}
});

View File

@ -5,9 +5,9 @@
<input matInput (keyup)="applyFilter()" [(ngModel)]="selFilter" name="filter" placeholder="Filter">
</mat-form-field>
</div>
<div [perfectScrollbar] fxLayout="row" fxLayoutAlign="start center" fxFlex="100" class="table-container w-100">
<mat-progress-bar *ngIf="flgLoading[0]===true" mode="indeterminate"></mat-progress-bar>
<table mat-table #table [dataSource]="channels" matSort [ngClass]="{'overflow-auto error-border': flgLoading[0]==='error','overflow-auto': true}">
<div [perfectScrollbar] fxLayout="column" fxLayoutAlign="start center" fxFlex="100" class="table-container">
<mat-progress-bar *ngIf="apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED" mode="indeterminate"></mat-progress-bar>
<table mat-table #table fxFlex="100" [dataSource]="channels" matSort [ngClass]="{'overflow-auto error-border': errorMessage !== '','overflow-auto': true}">
<ng-container matColumnDef="state">
<th mat-header-cell *matHeaderCellDef mat-sort-header> State </th>
<td mat-cell *matCellDef="let channel"> {{channel?.state | titlecase}}</td>
@ -41,7 +41,9 @@
</ng-container>
<ng-container matColumnDef="no_channel">
<td mat-footer-cell *matFooterCellDef colspan="4">
<p *ngIf="(!channels?.data || channels?.data?.length<1)">No pending channels available.</p>
<p *ngIf="(!channels?.data || channels?.data?.length<1) && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.COMPLETED">No pending channel available.</p>
<p *ngIf="(!channels?.data || channels?.data?.length<1) && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.INITIATED">Getting pending channels...</p>
<p *ngIf="(!channels?.data || channels?.data?.length<1) && apisCallStatus?.FetchChannels.status === apiCallStatusEnum.ERROR">{{errorMessage}}</p>
</td>
</ng-container>
<tr mat-footer-row *matFooterRowDef="['no_channel']" [ngClass]="{'display-none': channels?.data && channels?.data?.length>0}"></tr>

View File

@ -8,15 +8,16 @@ import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Channel, GetInfo } from '../../../../../shared/models/eclModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES } from '../../../../../shared/services/consts-enums-functions';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, FEE_RATE_TYPES, APICallStatusEnum } from '../../../../../shared/services/consts-enums-functions';
import { ApiCallsListECL } from '../../../../../shared/models/apiCallsPayload';
import { ECLChannelInformationComponent } from '../../channel-information-modal/channel-information.component';
import { LoggerService } from '../../../../../shared/services/logger.service';
import { CommonService } from '../../../../../shared/services/common.service';
import { ECLChannelInformationComponent } from '../../channel-information-modal/channel-information.component';
import * as RTLActions from '../../../../../store/rtl.actions';
import * as fromRTLReducer from '../../../../../store/rtl.reducers';
@Component({
selector: 'rtl-ecl-channel-pending-table',
templateUrl: './channel-pending-table.component.html',
@ -36,13 +37,15 @@ export class ECLChannelPendingTableComponent implements OnInit, AfterViewInit, O
public information: GetInfo = {};
public numPeers = -1;
public feeRateTypes = FEE_RATE_TYPES;
public flgLoading: Array<Boolean | 'error'> = [true];
public selFilter = '';
public flgSticky = false;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsListECL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private commonService: CommonService) {
@ -66,19 +69,16 @@ export class ECLChannelPendingTableComponent implements OnInit, AfterViewInit, O
this.store.select('ecl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchChannels') {
this.flgLoading[0] = 'error';
this.errorMessage = '';
this.apisCallStatus = rtlStore.apisCallStatus;
if (rtlStore.apisCallStatus.FetchChannels.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof(this.apisCallStatus.FetchChannels.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchChannels.message) : this.apisCallStatus.FetchChannels.message;
}
});
this.information = rtlStore.information;
this.numPeers = (rtlStore.peers && rtlStore.peers.length) ? rtlStore.peers.length : 0;
this.totalBalance = rtlStore.onchainBalance.total;
this.pendingChannels = rtlStore.pendingChannels;
this.loadChannelsTable();
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (rtlStore.pendingChannels) ? false : true;
}
this.logger.info(rtlStore);
});
}

View File

@ -24,7 +24,7 @@
<mat-form-field fxFlex="70" fxLayoutAlign="start end">
<input matInput [(ngModel)]="fundingAmount" placeholder="Amount" type="number" [step]="1000" [min]="1" [max]="totalBalance" tabindex="1" required name="amount" #amount="ngModel">
<mat-hint>Remaining Bal: {{totalBalance - ((fundingAmount) ? fundingAmount : 0) | number}}</mat-hint>
<span matSuffix> {{information?.smaller_currency_unit}} </span>
<span matSuffix> Sats </span>
<mat-error *ngIf="amount.errors?.required">Amount is required.</mat-error>
<mat-error *ngIf="amount.errors?.max">Amount must be less than or equal to {{totalBalance}}.</mat-error>
</mat-form-field>

View File

@ -8,10 +8,10 @@ import { Actions } from '@ngrx/effects';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { Peer, GetInfo } from '../../../../shared/models/eclModels';
import { APICallStatusEnum } from '../../../../shared/services/consts-enums-functions';
import { ECLOpenChannelAlert } from '../../../../shared/models/alertData';
import * as ECLActions from '../../../store/ecl.actions';
import * as RTLActions from '../../../../store/rtl.actions';
import * as fromRTLReducer from '../../../../store/rtl.reducers';
@Component({
@ -47,9 +47,9 @@ export class ECLOpenChannelComponent implements OnInit, OnDestroy {
this.peer = this.data.message.peer ? this.data.message.peer : null;
this.peers = this.data.message.peers && this.data.message.peers.length ? this.data.message.peers : [];
this.actions.pipe(takeUntil(this.unSubs[0]),
filter(action => action.type === ECLActions.EFFECT_ERROR_ECL || action.type === ECLActions.FETCH_CHANNELS_ECL))
.subscribe((action: ECLActions.EffectError | ECLActions.FetchChannels) => {
if (action.type === ECLActions.EFFECT_ERROR_ECL && action.payload.action === 'SaveNewChannel') {
filter(action => action.type === ECLActions.UPDATE_API_CALL_STATUS_ECL || action.type === ECLActions.FETCH_CHANNELS_ECL))
.subscribe((action: ECLActions.UpdateAPICallStatus | ECLActions.FetchChannels) => {
if (action.type === ECLActions.UPDATE_API_CALL_STATUS_ECL && action.payload.status === APICallStatusEnum.ERROR && action.payload.action === 'SaveNewChannel') {
this.channelConnectionError = action.payload.message;
}
if (action.type === ECLActions.FETCH_CHANNELS_ECL) {
@ -114,7 +114,6 @@ export class ECLOpenChannelComponent implements OnInit, OnDestroy {
onOpenChannel():boolean|void {
if ((!this.peer && !this.selectedPubkey) || (!this.fundingAmount || ((this.totalBalance - this.fundingAmount) < 0))) { return true; }
this.store.dispatch(new RTLActions.OpenSpinner('Opening Channel...'));
this.store.dispatch(new ECLActions.SaveNewChannel({
nodeId: ((!this.peer || !this.peer.nodeId) ? this.selectedPubkey : this.peer.nodeId), amount: this.fundingAmount, private: this.isPrivate, feeRate: this.feeRate
}));

View File

@ -9,11 +9,11 @@ import { MatVerticalStepper } from '@angular/material/stepper';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { Peer } from '../../../shared/models/eclModels';
import { APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
import { ECLOpenChannelAlert } from '../../../shared/models/alertData';
import { LoggerService } from '../../../shared/services/logger.service';
import * as ECLActions from '../../store/ecl.actions';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
@ -58,8 +58,8 @@ export class ECLConnectPeerComponent implements OnInit, OnDestroy {
});
this.statusFormGroup = this.formBuilder.group({});
this.actions.pipe(takeUntil(this.unSubs[1]),
filter((action) => action.type === ECLActions.NEWLY_ADDED_PEER_ECL || action.type === ECLActions.FETCH_CHANNELS_ECL || action.type === ECLActions.EFFECT_ERROR_ECL))
.subscribe((action: (ECLActions.NewlyAddedPeer | ECLActions.FetchChannels | ECLActions.EffectError)) => {
filter((action) => action.type === ECLActions.NEWLY_ADDED_PEER_ECL || action.type === ECLActions.FETCH_CHANNELS_ECL || action.type === ECLActions.UPDATE_API_CALL_STATUS_ECL))
.subscribe((action: (ECLActions.NewlyAddedPeer | ECLActions.FetchChannels | ECLActions.UpdateAPICallStatus)) => {
if (action.type === ECLActions.NEWLY_ADDED_PEER_ECL) {
this.logger.info(action.payload);
this.flgEditable = false;
@ -70,7 +70,7 @@ export class ECLConnectPeerComponent implements OnInit, OnDestroy {
if (action.type === ECLActions.FETCH_CHANNELS_ECL) {
this.dialogRef.close();
}
if (action.type === ECLActions.EFFECT_ERROR_ECL) {
if (action.type === ECLActions.UPDATE_API_CALL_STATUS_ECL && action.payload.status === APICallStatusEnum.ERROR) {
if (action.payload.action === 'SaveNewPeer') {
this.peerConnectionError = action.payload.message;
} else if (action.payload.action === 'SaveNewChannel') {
@ -83,14 +83,12 @@ export class ECLConnectPeerComponent implements OnInit, OnDestroy {
onConnectPeer():boolean|void {
if(!this.peerFormGroup.controls.peerAddress.value) { return true; }
this.peerConnectionError = '';
this.store.dispatch(new RTLActions.OpenSpinner('Adding Peer...'));
this.store.dispatch(new ECLActions.SaveNewPeer({id: this.peerFormGroup.controls.peerAddress.value}));
}
onOpenChannel():boolean|void {
if (!this.channelFormGroup.controls.fundingAmount.value || ((this.totalBalance - this.channelFormGroup.controls.fundingAmount.value) < 0)) { return true; }
this.channelConnectionError = '';
this.store.dispatch(new RTLActions.OpenSpinner('Opening Channel...'));
this.store.dispatch(new ECLActions.SaveNewChannel({
nodeId: this.newlyAddedPeer.nodeId, amount: this.channelFormGroup.controls.fundingAmount.value, private: this.channelFormGroup.controls.isPrivate.value, feeRate: this.channelFormGroup.controls.feeRate.value
}));

View File

@ -14,9 +14,9 @@
</div>
</mat-form-field>
</div>
<div [perfectScrollbar] fxLayout="row" fxLayoutAlign="start center" fxFlex="100" class="table-container">
<mat-progress-bar *ngIf="flgLoading[0]===true" mode="indeterminate"></mat-progress-bar>
<table mat-table #table [dataSource]="peers" matSort [ngClass]="{'overflow-auto error-border': flgLoading[0]==='error','overflow-auto': true}">
<div [perfectScrollbar] fxLayout="column" fxLayoutAlign="start center" fxFlex="100" class="table-container">
<mat-progress-bar *ngIf="apisCallStatus?.FetchPeers.status === apiCallStatusEnum.INITIATED" mode="indeterminate"></mat-progress-bar>
<table mat-table #table fxFlex="100" [dataSource]="peers" matSort [ngClass]="{'overflow-auto error-border': errorMessage !== '','overflow-auto': true}">
<ng-container matColumnDef="nodeId">
<th mat-header-cell *matHeaderCellDef mat-sort-header> ID </th>
<td mat-cell *matCellDef="let peer" [ngStyle]="{'max-width': (screenSize === screenSizeEnum.XS) ? '10rem' : '30rem'}">
@ -66,7 +66,9 @@
</ng-container>
<ng-container matColumnDef="no_peer">
<td mat-footer-cell *matFooterCellDef colspan="4">
<p *ngIf="!peers?.data || peers?.data?.length<1">No connected peers.</p>
<p *ngIf="(!peers?.data || peers?.data?.length<1) && apisCallStatus?.FetchPeers.status === apiCallStatusEnum.COMPLETED">No connected peer.</p>
<p *ngIf="(!peers?.data || peers?.data?.length<1) && apisCallStatus?.FetchPeers.status === apiCallStatusEnum.INITIATED">Getting peers...</p>
<p *ngIf="(!peers?.data || peers?.data?.length<1) && apisCallStatus?.FetchPeers.status === apiCallStatusEnum.ERROR">{{errorMessage}}</p>
</td>
</ng-container>
<tr mat-footer-row *matFooterRowDef="['no_peer']" [ngClass]="{'display-none': peers?.data && peers?.data?.length>0}"></tr>

View File

@ -10,9 +10,10 @@ import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Peer, GetInfo } from '../../../shared/models/eclModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, ScreenSizeEnum } from '../../../shared/services/consts-enums-functions';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, ScreenSizeEnum, APICallStatusEnum } from '../../../shared/services/consts-enums-functions';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
import { ApiCallsListECL } from '../../../shared/models/apiCallsPayload';
import { ECLOpenChannelComponent } from '../channels/open-channel-modal/open-channel.component';
import { ECLConnectPeerComponent } from '../connect-peer/connect-peer.component';
import { newlyAddedRowAnimation } from '../../../shared/animation/row-animation';
@ -43,12 +44,14 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
public peers: any;
public information: GetInfo = {};
public availableBalance = 0;
public flgLoading: Array<Boolean | 'error'> = [true]; // 0: peers
public flgSticky = false;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public errorMessage = '';
public apisCallStatus: ApiCallsListECL = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private actions: Actions, private commonService: CommonService) {
@ -72,18 +75,15 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
this.store.select('ecl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchPeers') {
this.flgLoading[0] = 'error';
this.errorMessage = '';
this.apisCallStatus = rtlStore.apisCallStatus;
if (rtlStore.apisCallStatus.FetchPeers.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof(this.apisCallStatus.FetchPeers.message) === 'object') ? JSON.stringify(this.apisCallStatus.FetchPeers.message) : this.apisCallStatus.FetchPeers.message;
}
});
this.information = rtlStore.information;
this.availableBalance = rtlStore.onchainBalance.total || 0;
this.peersData = rtlStore.peers;
this.loadPeersTable(this.peersData);
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = false;
}
setTimeout(() => { this.flgAnimate = false; }, 3000);
this.logger.info(rtlStore);
});
@ -165,7 +165,6 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
.pipe(takeUntil(this.unSubs[3]))
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Disconnecting Peer...'));
this.store.dispatch(new ECLActions.DisconnectPeer({nodeId: peerToDetach.nodeId}));
}
});

View File

@ -5,11 +5,11 @@ import { Store } from '@ngrx/store';
import { PaymentRelayed } from '../../../shared/models/eclModels';
import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
import { MONTHS, ScreenSizeEnum, SCROLL_RANGES } from '../../../shared/services/consts-enums-functions';
import { fadeIn } from '../../../shared/animation/opacity-animation';
import * as fromRTLReducer from '../../../store/rtl.reducers';
import { LoggerService } from '../../../shared/services/logger.service';
@Component({
selector: 'rtl-ecl-fee-report',

View File

@ -1,5 +1,5 @@
<div fxLayout="column" fxLayoutAlign="start stretch" [ngClass]="{'error-border': errorMessage !== '', 'padding-gap-x': true}">
<div class="p-2" *ngIf="errorMessage !== ''">{{errorMessage}}</div>
<div fxLayout="column" fxLayoutAlign="start stretch" class="padding-gap-x">
<div class="p-2 error-border my-2" *ngIf="errorMessage !== ''">{{errorMessage}}</div>
<div *ngIf="errorMessage === ''" fxLayout="column" fxLayout.gt-xs="row" fxLayoutAlign.gt-xs="start center" fxLayoutAlign="start stretch" class="page-sub-title-container">
<div fxFlex="70"></div>
<mat-form-field fxFlex="30">
@ -7,6 +7,7 @@
</mat-form-field>
</div>
<div *ngIf="errorMessage === ''" [perfectScrollbar] fxLayout="column" fxLayoutAlign="start center" fxFlex="100" class="table-container">
<mat-progress-bar *ngIf="apisCallStatus?.FetchPayments.status === apiCallStatusEnum.INITIATED" mode="indeterminate"></mat-progress-bar>
<table mat-table #table [dataSource]="forwardingHistoryEvents" fxFlex="100" matSort class="overflow-auto">
<ng-container matColumnDef="timestamp">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Date/Time</th>
@ -47,7 +48,9 @@
</ng-container>
<ng-container matColumnDef="no_event">
<td mat-footer-cell *matFooterCellDef colspan="4">
<p *ngIf="!forwardingHistoryEvents?.data || forwardingHistoryEvents?.data?.length<1">No forwarding event available.</p>
<p *ngIf="(!forwardingHistoryEvents?.data || forwardingHistoryEvents?.data?.length<1) && apisCallStatus?.FetchPayments.status === apiCallStatusEnum.COMPLETED">No forwarding history available.</p>
<p *ngIf="(!forwardingHistoryEvents?.data || forwardingHistoryEvents?.data?.length<1) && apisCallStatus?.FetchPayments.status === apiCallStatusEnum.INITIATED">Getting forwarding history...</p>
<p *ngIf="(!forwardingHistoryEvents?.data || forwardingHistoryEvents?.data?.length<1) && apisCallStatus?.FetchPayments.status === apiCallStatusEnum.ERROR">{{errorMessage}}</p>
</td>
</ng-container>
<tr mat-footer-row *matFooterRowDef="['no_event']" [ngClass]="{'display-none': forwardingHistoryEvents?.data && forwardingHistoryEvents?.data?.length>0}"></tr>
@ -55,5 +58,5 @@
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
<mat-paginator [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator>
<mat-paginator *ngIf="errorMessage === ''" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator>
</div>

Some files were not shown because too many files have changed in this diff Show More