Legend for balances and balancedness

Legend for balances and balancedness
pull/260/head
Shahana Farooqui 5 years ago
parent 9f676f7468
commit 5b5a0428bd

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -9,8 +9,8 @@
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon/favicon-16x16.png">
<link rel="manifest" href="assets/images/favicon/site.webmanifest">
<link rel="stylesheet" href="styles.2854cf815b8f6666c61c.css"></head>
<link rel="stylesheet" href="styles.b99cd8a685fbb10e0d1c.css"></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.32f66eb87b7f21a182be.js"></script><script src="polyfills-es5.92f4069201c83f4833ef.js" nomodule></script><script src="polyfills.5ddcccdb990eb395f306.js"></script><script src="main.ec8cc621bd3cf505ae93.js"></script></body>
<script src="runtime.97d50eae24ff822dc543.js"></script><script src="polyfills-es5.92f4069201c83f4833ef.js" nomodule></script><script src="polyfills.5ddcccdb990eb395f306.js"></script><script src="main.33f3f158c10ca59b7ee4.js"></script></body>
</html>

File diff suppressed because one or more lines are too long

@ -1 +1 @@
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],f=r[2],p=0,s=[];p<i.length;p++)o[a=i[p]]&&s.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({}[e]||e)+"."+{1:"9e71a210a8bdc5ba9df9",6:"e98fe0b31473cd63eb21",7:"bb13bd7e7c6fc23f4ea7"}[e]+".js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var f=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var f=0;f<i.length;f++)r(i[f]);var l=c;t()}([]);
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],f=r[2],p=0,s=[];p<i.length;p++)o[a=i[p]]&&s.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({}[e]||e)+"."+{1:"9e71a210a8bdc5ba9df9",6:"f8549065015b340da576",7:"bb13bd7e7c6fc23f4ea7"}[e]+".js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var f=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var f=0;f<i.length;f++)r(i[f]);var l=c;t()}([]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -95,14 +95,14 @@ common.convertTimestampToDate = (num) => {
common.sortAscByKey = (array, key) => {
return array.sort(function (a, b) {
var x = a[key]; var y = b[key];
var x = +a[key]; var y = +b[key];
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
});
}
common.sortDescByKey = (array, key) => {
const temp = array.sort(function (a, b) {
var x = a[key]; var y = b[key];
var x = +a[key]; var y = +b[key];
return ((x > y) ? -1 : ((x < y) ? 1 : 0));
});
return temp;

@ -21,15 +21,32 @@ exports.getAllChannels = (req, res, next) => {
options.qs = req.query;
request(options).then(function (body) {
if(body.channels) {
let channels = body.channels;
Promise.all(
channels.map(channel => {
body.channels.map(channel => {
if (!channel.local_balance && !channel.remote_balance) {
channel.balancedness = 50;
} else if(channel.local_balance && !channel.remote_balance) {
channel.balancedness = 0;
} else if(!channel.local_balance && channel.remote_balance) {
channel.balancedness = 100;
} else {
channel.balancedness = (+channel.local_balance/(+channel.remote_balance + +channel.local_balance)) * 100;
}
// if (!channel.local_balance && !channel.remote_balance) {
// channel.balancedness = 0;
// } else if(channel.local_balance && !channel.remote_balance) {
// channel.balancedness = -1;
// } else if(!channel.local_balance && channel.remote_balance) {
// channel.balancedness = 1;
// } else {
// channel.balancedness = ((+channel.remote_balance - +channel.local_balance)/(+channel.remote_balance + +channel.local_balance)).toFixed(10);
// }
return getAliasForChannel(channel);
})
)
.then(function(values) {
body.channels = common.sortDescByKey(body.channels, 'balancedness');
logger.info({fileName: 'Channels', msg: 'All Channels with Alias: ' + JSON.stringify(body)});
body.channels = common.sortAscByKey(body.channels, 'capacity');
res.status(200).json(body);
}).catch(err => {
logger.error({fileName: 'Channels', lineNum: 49, msg: 'Get All Channel Alias: ' + JSON.stringify(err)});

@ -55,6 +55,9 @@
<div fxLayout="column" fxFlex="60" fxLayoutAlign="start start" *ngIf="flgInfoUpdate">
<ngx-charts-pie-chart class="balances-info-pie-chart" style="margin-top: -2.5rem;"
[explodeSlices]="true"
[legend]="true"
[legendTitle]="''"
[legendPosition]="'below'"
[view]="[190, 190]"
[results]="totalBalances">
</ngx-charts-pie-chart>

@ -9,14 +9,14 @@ export class BalancesInfoComponent implements OnChanges {
@Input() balances = { onchain: 0, lightning: 0 };
@Input() flgInfoUpdate = false;
flgBalanceUpdated = false;
totalBalances = [{'name': 'Lightning ', 'value': 0}, {'name': 'On-chain', 'value': 0}];
totalBalances = [{'name': 'Lightning', 'value': 0}, {'name': 'On-chain', 'value': 0}];
maxBalanceValue = 0;
xAxisLabel = 'Balance';
constructor() {}
ngOnChanges() {
this.totalBalances = [{'name': 'Lightning ', 'value': this.balances.lightning}, {'name': 'On-chain', 'value': this.balances.onchain}];
this.totalBalances = [{'name': 'Lightning', 'value': this.balances.lightning}, {'name': 'On-chain', 'value': this.balances.onchain}];
this.maxBalanceValue = (this.balances.lightning > this.balances.onchain) ? this.balances.lightning : this.balances.onchain;
Object.assign(this, this.totalBalances);
}

@ -15,11 +15,11 @@
<mat-hint fxFlex="50" fxLayoutAlign="start center" class="font-size-80"><strong class="font-weight-900">Local:</strong>{{channel.local_balance || 0 | number}} Sats</mat-hint>
<mat-hint fxFlex="50" fxLayoutAlign="end center" class="font-size-80"><strong class="font-weight-900">Remote:</strong>{{channel.remote_balance || 0 | number}} Sats</mat-hint>
</div>
<mat-progress-bar class="dashboard-progress-bar" mode="determinate" value="{{channel.local_balance && channel.local_balance > 0 ? ((+channel.local_balance/((+channel.local_balance)+(+channel.remote_balance)))*100) : 0}}"></mat-progress-bar>
<mat-progress-bar class="dashboard-progress-bar" mode="determinate" value="{{(channel.balancedness)}}"></mat-progress-bar>
</div>
</div>
</div>
</div>
<ng-template #noChannelBlock>
<div fxLayout="column" fxFlex="100" class="w-100 mt-2">No channels available.</div>
</ng-template>
</ng-template>

@ -28,7 +28,7 @@ export class HomeComponent implements OnInit, OnDestroy {
public selNode: SelNodeChild = {};
public fees: Fees;
public information: GetInfo = {};
public balances = { onchain: 0, lightning: 0 };
public balances = { onchain: -1, lightning: -1 };
public allChannels = [];
public flgLoading: Array<Boolean | 'error'> = [true, true, true, true, true, true, true, true]; // 0: Info, 1: Fee, 2: Wallet, 3: Channel, 4: Network
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
@ -120,6 +120,11 @@ export class HomeComponent implements OnInit, OnDestroy {
this.flgLoading[5] = false;
}
this.allChannels = rtlStore.allChannels.filter(channel => channel.active === true);
if (this.balances.lightning >= 0 && this.balances.onchain >= 0 && this.fees.month_fee_sum >= 0) {
this.flgChildInfoUpdated = true;
} else {
this.flgChildInfoUpdated = false;
}
this.logger.info(rtlStore);
});
this.actions$.pipe(takeUntil(this.unSubs[2]),

@ -48,8 +48,8 @@ export const initLNDState: LNDState = {
numberOfPendingChannels: -1,
totalCapacityActive: 0,
totalCapacityInactive: 0,
totalLocalBalance: 0,
totalRemoteBalance: 0,
totalLocalBalance: -1,
totalRemoteBalance: -1,
totalInvoices: -1,
transactions: [],
payments: [],

@ -55,6 +55,7 @@ export interface Channel {
private?: boolean;
pending_htlcs?: HTLC[];
csv_delay?: number;
balancedness?: number; // Between -1 to +1
}
export interface PendingChannels {

@ -174,14 +174,6 @@
border-bottom: 2px solid white;
}
.ngx-charts {
fill: $foreground-text;
.bar {
fill: $primary-color !important;
cursor: default;
}
}
.mat-primary .mat-select-panel .mat-option.mat-selected:not(.mat-option-multiple),
.mat-primary .mat-option.mat-selected:not(.mat-option-multiple):not(.mat-option-disabled) {
background: none;
@ -342,58 +334,79 @@
overflow: hidden;
}
.balances-info-pie-chart .ngx-charts .ng-star-inserted:nth-child(1) {
& .arc {
fill: mat-color($primary, 400);
.ngx-charts {
fill: $foreground-text;
.bar {
fill: $primary-color;
cursor: default;
}
& .arc.active, .arc:hover {
fill: mat-color($primary, 300);
& .arc.active, .ngx-charts .arc:hover {
opacity: 1;
transform: scale(1.03);
-webkit-transition: transform 200ms linear;
transition: transform 200ms linear;
}
}
.balances-info-pie-chart .ngx-charts .ng-star-inserted:nth-child(2) {
& .arc {
fill: mat-color($primary, 600);
.balances-info-pie-chart {
& .legend-label:nth-child(1) .legend-label-color {
background-color: mat-color($primary, 400) !important;
}
& .arc.active, .arc:hover {
fill: mat-color($primary, 700);
}
}
.ngx-charts .arc.active, .ngx-charts .arc:hover {
opacity: 1;
transform: scale(1.03);
-webkit-transition: transform 200ms linear;
transition: transform 200ms linear;
}
& .legend-label:nth-child(2) .legend-label-color {
background-color: mat-color($primary, 600) !important;
}
.fee-info-gauge-chart .ngx-charts .gauge .ng-star-inserted:nth-child(1) g g:nth-child(2) {
& .arc {
fill: mat-color($primary, 700);
& .ngx-charts .ng-star-inserted:nth-child(1) {
& .arc {
fill: mat-color($primary, 400);
}
& .arc.active, .arc:hover {
fill: mat-color($primary, 300);
}
}
& .arc.active, .arc:hover {
fill: mat-color($primary, 900);
& .ngx-charts .ng-star-inserted:nth-child(2) {
& .arc {
fill: mat-color($primary, 600);
}
& .arc.active, .arc:hover {
fill: mat-color($primary, 700);
}
}
}
.fee-info-gauge-chart .ngx-charts .gauge .ng-star-inserted:nth-child(2) g g:nth-child(2) {
& .arc {
fill: mat-color($primary, 500);
}
& .arc.active, .arc:hover {
fill: mat-color($primary, 900);
.fee-info-gauge-chart .ngx-charts .gauge {
& .ng-star-inserted:nth-child(1) g g:nth-child(2) {
& .arc {
fill: mat-color($primary, 700);
}
& .arc.active, .arc:hover {
fill: mat-color($primary, 900);
}
}
}
.fee-info-gauge-chart .ngx-charts .gauge .ng-star-inserted:nth-child(3) g g:nth-child(2) {
& .arc {
fill: mat-color($primary, 300);
& .ng-star-inserted:nth-child(2) g g:nth-child(2) {
& .arc {
fill: mat-color($primary, 500);
}
& .arc.active, .arc:hover {
fill: mat-color($primary, 900);
}
}
& .arc.active, .arc:hover {
fill: mat-color($primary, 900);
& .ng-star-inserted:nth-child(3) g g:nth-child(2) {
& .arc {
fill: mat-color($primary, 300);
}
& .arc.active, .arc:hover {
fill: mat-color($primary, 900);
}
}
}
}

Loading…
Cancel
Save