Incomplete lazy load 3

Incomplete lazy load 3
pull/209/head
Shahana Farooqui 5 years ago
parent 82ffa315b7
commit 0948ea139c

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 it is too large Load Diff

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

@ -1,13 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>RTL</title>
<base href="/rtl/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="assets/images/favicon.ico">
<link rel="stylesheet" href="styles.95c3afc83be2d91ee834.css"></head>
<body>
<rtl-app></rtl-app>
<script src="runtime-es2015.3823fce60e023395905e.js" type="module"></script><script src="polyfills-es2015.af35579f5b57e97fcdea.js" type="module"></script><script src="runtime-es5.2953e9422ec209420d0e.js" nomodule></script><script src="polyfills-es5.64372fcf007b6e0e7247.js" nomodule></script><script src="main-es2015.cb85c9adb81ec81ff7f4.js" type="module"></script><script src="main-es5.381f902d2d21a950120d.js" nomodule></script></body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],f=r[2],p=0,s=[];p<a.length;p++)o[i=a[p]]&&s.push(o[i][0]),o[i]=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,a=1;a<t.length;a++)0!==o[t[a]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={0:0},u=[];function i(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,i),t.l=!0,t.exports}i.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,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({}[e]||e)+"-es2015."+{1:"3e412c623e89cdf24dfb",5:"dfda4684cef2bd775937",6:"651bccdf8f4ccb7e6e16"}[e]+".js"}(e);var c=new Error;u=function(r){a.onerror=a.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:a})},12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var l=c;t()}([]);

@ -1 +0,0 @@
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],f=r[2],p=0,s=[];p<a.length;p++)o[i=a[p]]&&s.push(o[i][0]),o[i]=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,a=1;a<t.length;a++)0!==o[t[a]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={0:0},u=[];function i(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,i),t.l=!0,t.exports}i.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,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({}[e]||e)+"-es5."+{1:"572105fd62f1a1fb6122",4:"224c734b259c83972052",5:"9e7241a89bb15935113e"}[e]+".js"}(e);var c=new Error;u=function(r){a.onerror=a.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:a})},12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var l=c;t()}([]);

File diff suppressed because one or more lines are too long

@ -262,7 +262,7 @@ connect.validateMultiNodeConfig = (config) => {
config.nodes.forEach((node, idx) => {
common.nodes[idx] = {};
if(node.lnImplementation === 'CLightning') {
if(node.lnImplementation.toString().toLowerCase() === 'clightning') {
common.nodes[idx].macaroon_path = '';
} else {
if(node.Authentication.macaroonPath === '' || undefined === node.Authentication.macaroonPath) {

@ -18,10 +18,10 @@
<rtl-top-menu></rtl-top-menu>
</div>
</mat-toolbar>
<div fxLayout="row" fxLayoutAlign="center center" class="bg-primary flex-wrap pubkey-info-top" rtlClipboard [payload]="selNodeInfo?.identity_pubkey" (copied)="copiedText($event)">
<div fxLayout="row" fxLayoutAlign="center center" class="bg-primary flex-wrap pubkey-info-top" rtlClipboard [payload]="information?.identity_pubkey" (copied)="copiedText($event)">
<mat-icon [ngClass]="{'icon-smaller': smallScreen}">vpn_key</mat-icon>
<div [ngClass]="{'word-break font-9px': smallScreen, 'word-break': !smallScreen}">&nbsp;{{selNodeInfo?.identity_pubkey}}
<mat-spinner [diameter]="20" *ngIf="!selNodeInfo?.identity_pubkey" class="inline-spinner foreground"></mat-spinner>
<div [ngClass]="{'word-break font-9px': smallScreen, 'word-break': !smallScreen}">&nbsp;{{information?.identity_pubkey}}
<mat-spinner [diameter]="20" *ngIf="flgLoading[0]" class="inline-spinner foreground"></mat-spinner>
<mat-icon [ngClass]="{'icon-smaller cursor-pointer copy-icon-smaller': smallScreen, 'icon-small cursor-pointer copy-icon': !smallScreen}">file_copy</mat-icon><span [hidden]="!flgCopied">Copied</span>
</div>
</div>
@ -31,7 +31,7 @@
</div>
</mat-toolbar>
<div [ngClass]="{'mt-minus-1': smallScreen, 'inner-sidenav-content': true}">
<router-outlet></router-outlet>
<rtl-super-user-dashboard></rtl-super-user-dashboard>
</div>
<div fxLayout="row" fxLayoutAlign="center center" class="bg-primary settings-icon" (click)="settingSidenav.toggle()">
<mat-icon class="animate-settings">settings</mat-icon>

@ -1,5 +1,5 @@
import { Component, OnInit, AfterViewInit, OnDestroy, ViewChild, HostListener } from '@angular/core';
import { Router } from '@angular/router';
import { Router, ActivatedRoute } from '@angular/router';
import { Subject } from 'rxjs';
import { takeUntil, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';
@ -8,7 +8,8 @@ import { UserIdleService } from 'angular-user-idle';
import * as sha256 from 'sha256';
import { LoggerService } from './shared/services/logger.service';
import { RTLConfiguration, Settings, Node, SelNodeInfo } from './shared/models/RTLconfig';
import { RTLConfiguration, Settings, Node } from './shared/models/RTLconfig';
import { GetInfo } from './shared/models/lndModels';
import * as RTLActions from './store/rtl.actions';
import * as fromApp from './store/rtl.reducers';
@ -21,27 +22,24 @@ import * as fromApp from './store/rtl.reducers';
export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild('sideNavigation', { static: false }) sideNavigation: any;
@ViewChild('settingSidenav', { static: true }) settingSidenav: any;
public selNode: Node;
public settings: Settings;
public selNodeInfo: SelNodeInfo;
public flgLoading: Array<Boolean | 'error'> = [true]; // 0: Info
public information: GetInfo = {};
public flgLoading: Array<Boolean | 'error'> = [true];
public flgCopied = false;
public appConfig: RTLConfiguration;
public accessKey = '';
public smallScreen = false;
unsubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromApp.AppState>, private actions$: Actions, private userIdle: UserIdleService, private router: Router) {}
constructor(private logger: LoggerService, private store: Store<fromApp.AppState>, private actions$: Actions, private userIdle: UserIdleService, private router: Router, private activatedRoute: ActivatedRoute) {}
ngOnInit() {
this.store.dispatch(new RTLActions.FetchRTLConfig());
this.accessKey = this.readAccessKey();
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsubs[0]))
.pipe(takeUntil(this.unSubs[0]))
.subscribe(rtlStore => {
// this.selNodeInfo = rtlStore.selNodeInfo;
this.selNode = rtlStore.selNode;
this.settings = this.selNode.settings;
this.settings = rtlStore.selNode.settings;
this.appConfig = rtlStore.appConfig;
if (window.innerWidth <= 768) {
this.settings.menu = 'Vertical';
@ -55,7 +53,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
});
this.actions$
.pipe(
takeUntil(this.unsubs[1]),
takeUntil(this.unSubs[3]),
filter(action => action.type === RTLActions.SET_RTL_CONFIG)
).subscribe((actionPayload: RTLActions.SetRTLConfig) => {
if (actionPayload.type === RTLActions.SET_RTL_CONFIG) {
@ -63,14 +61,14 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
if (+actionPayload.payload.sso.rtlSSO) {
this.store.dispatch(new RTLActions.Signin(sha256(this.accessKey)));
} else {
this.router.navigate([this.appConfig.sso.logoutRedirectLink]);
this.router.navigate([this.appConfig.sso.logoutRedirectLink], { relativeTo: this.activatedRoute });
}
}
if (
this.settings.menu === 'Horizontal' ||
this.settings.menuType === 'Compact' ||
this.settings.menuType === 'Mini') {
this.settingSidenav.toggle(); // To dynamically update the width to 100% after side nav is closed
this.settingSidenav.toggle();
setTimeout(() => { this.settingSidenav.toggle(); }, 100);
}
}
@ -132,7 +130,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
}
ngOnDestroy() {
this.unsubs.forEach(unsub => {
this.unSubs.forEach(unsub => {
unsub.next();
unsub.complete();
});

@ -23,6 +23,7 @@ import { SharedModule } from './shared/shared.module';
import { ThemeOverlay } from './shared/theme/overlay-container/theme-overlay';
import { AppComponent } from './app.component';
import { SuperUserDashboardComponent } from './super-user-dashboard/super-user-dashboard.component';
import { CommonService } from './shared/services/common.service';
import { LoggerService, ConsoleLoggerService } from './shared/services/logger.service';
import { AuthGuard, LNDUnlockedGuard } from './shared/services/auth.guard';
@ -47,7 +48,8 @@ import { CLEffects } from './c-lightning/store/cl.effects';
!environment.production ? StoreDevtoolsModule.instrument() : []
],
declarations: [
AppComponent
AppComponent,
SuperUserDashboardComponent
],
providers: [
{ provide: LoggerService, useClass: ConsoleLoggerService },

@ -7,9 +7,12 @@ import { SigninComponent } from './shared/components/signin/signin.component';
import { SsoFailedComponent } from './shared/components/sso-failed/sso-failed.component';
import { NotFoundComponent } from './shared/components/not-found/not-found.component';
import { AuthGuard } from './shared/services/auth.guard';
import { SuperUserDashboardComponent } from './super-user-dashboard/super-user-dashboard.component';
export const routes: Routes = [
{ path: '', redirectTo: '/cl', pathMatch: 'full' },
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: SuperUserDashboardComponent },
{ path: 'lnd', loadChildren: () => import('./lnd/lnd.module').then(childModule => childModule.LndModule)},
{ path: 'cl', loadChildren: () => import('./c-lightning/cl.module').then(childModule => childModule.ClModule)},
{ path: 'sconfig', component: ServerConfigComponent, canActivate: [AuthGuard] },
@ -19,4 +22,4 @@ export const routes: Routes = [
{ path: '**', component: NotFoundComponent }
];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);
export const routing: ModuleWithProviders = RouterModule.forRoot(routes, { enableTracing: true });

@ -21,22 +21,33 @@ export class ClRootComponent implements OnInit, OnDestroy {
ngOnInit() {
console.warn('CL ROOT');
console.warn(this.activatedRoute.url);
// this.router.navigate(['./home'], {relativeTo: this.activatedRoute});
this.store.dispatch(new CLActions.FetchCLInfo());
this.actions$.pipe(takeUntil(this.unsubs[0]), filter((action) => action.type === RTLActions.INIT_APP_DATA))
.subscribe((actionPayload: RTLActions.InitAppData) => {
this.store.dispatch(new CLActions.FetchCLInfo());
});
this.actions$.pipe(takeUntil(this.unsubs[1]), filter((action) => action.type === CLActions.SET_CL_INFO))
.subscribe((infoData: CLActions.SetCLInfo) => {
if (undefined !== infoData.payload.identity_pubkey) {
this.initializeRemainingData();
}
});
// this.store.dispatch(new CLActions.FetchCLInfo());
this.router.navigate(['./home'], {relativeTo: this.activatedRoute});
// this.store.select('cl')
// .pipe(takeUntil(this.unsubs[0]))
// .subscribe(clStore => {
// console.warn(clStore);
// if (undefined !== clStore.information.identity_pubkey) {
// this.initializeRemainingData();
// }
// });
// this.actions$
// .pipe(
// takeUntil(this.unSubs[3]),
// filter(action => action.type === RTLActions.INIT_APP_DATA || action.type === LNDActions.SET_INFO || action.type === CLActions.SET_CL_INFO)
// ).subscribe((actionPayload: RTLActions.InitAppData | LNDActions.SetInfo | CLActions.SetCLInfo) => {
// // if (actionPayload.type === RTLActions.INIT_APP_DATA) {
// if(this.information.identity_pubkey) {
// this.initializeRemainingData();
// }
// });
}
initializeRemainingData() {
console.warn('SOMETHING IS WRONG HERE');
// this.store.dispatch(new CLActions.FetchCLFees());
// this.store.dispatch(new CLActions.FetchPeers());
// this.store.dispatch(new CLActions.FetchBalance('channels'));
// this.store.dispatch(new CLActions.FetchFees());

@ -25,10 +25,27 @@ export class HomeComponent implements OnInit, OnDestroy {
.pipe(takeUntil(this.unsubs[1]))
.subscribe(clStore => {
this.information = clStore.information;
if (undefined !== this.information.identity_pubkey) {
this.initializeRemainingData();
}
this.logger.info(clStore);
});
}
initializeRemainingData() {
console.warn('SOMETHING IS WRONG HERE');
// this.store.dispatch(new CLActions.FetchCLFees());
// this.store.dispatch(new CLActions.FetchPeers());
// this.store.dispatch(new CLActions.FetchBalance('channels'));
// this.store.dispatch(new CLActions.FetchFees());
// this.store.dispatch(new CLActions.FetchNetwork());
// this.store.dispatch(new CLActions.FetchChannels({routeParam: 'all'}));
// this.store.dispatch(new CLActions.FetchChannels({routeParam: 'pending'}));
// this.store.dispatch(new CLActions.FetchInvoices({num_max_invoices: 25, reversed: true}));
// this.store.dispatch(new CLActions.FetchPayments());
}
ngOnDestroy() {
this.unsubs.forEach(completeSub => {
completeSub.next();

@ -4,6 +4,8 @@ import { GetInfo } from '../../shared/models/clModels';
export const RESET_CL_STORE = 'RESET_CL_STORE';
export const FETCH_CL_INFO = 'FETCH_CL_INFO';
export const SET_CL_INFO = 'SET_CL_INFO';
export const FETCH_CL_FEES = 'FETCH_CL_FEES';
export const SET_CL_FEES = 'SET_CL_FEES';
export class ResetCLStore implements Action {
readonly type = RESET_CL_STORE;
@ -18,5 +20,14 @@ export class SetCLInfo implements Action {
constructor(public payload: GetInfo) {}
}
export class FetchCLFees implements Action {
readonly type = FETCH_CL_FEES;
}
export class SetCLFees implements Action {
readonly type = SET_CL_FEES;
constructor(public payload: {}) {}
}
export type CLActions =
ResetCLStore | FetchCLInfo | SetCLInfo;
ResetCLStore | FetchCLInfo | SetCLInfo | FetchCLFees | SetCLFees;

@ -1,6 +1,6 @@
import { Injectable, OnDestroy } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router';
import { Router, ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { of, Subject } from 'rxjs';
@ -27,7 +27,8 @@ export class CLEffects implements OnDestroy {
private store: Store<fromApp.AppState>,
private logger: LoggerService,
public dialog: MatDialog,
private router: Router) { }
private router: Router,
private activatedRoute: ActivatedRoute) { }
@Effect()
infoFetch = this.actions$.pipe(
@ -40,14 +41,12 @@ export class CLEffects implements OnDestroy {
map((info) => {
this.logger.info(info);
if (undefined === info.identity_pubkey) {
// this.store.dispatch(new RTLActions.SetSelNodeInfo({}));
sessionStorage.removeItem('clUnlocked');
return {
type: CLActions.SET_CL_INFO,
payload: {}
};
} else {
// this.store.dispatch(new RTLActions.SetSelNodeInfo(info));
sessionStorage.setItem('clUnlocked', 'true');
return {
type: CLActions.SET_CL_INFO,
@ -59,11 +58,11 @@ export class CLEffects implements OnDestroy {
this.logger.error(err);
this.store.dispatch(new RTLActions.EffectError({ action: 'FetchInfo', code: err.status, message: err.error.error }));
if (+store.appConfig.sso.rtlSSO) {
this.router.navigate(['/ssoerror']);
this.router.navigate(['../ssoerror'], {relativeTo: this.activatedRoute});
} else {
if (err.status === 401) {
this.logger.info('Redirecting to Signin');
this.router.navigate([store.appConfig.sso.logoutRedirectLink]);
this.router.navigate([store.appConfig.sso.logoutRedirectLink], {relativeTo: this.activatedRoute});
return of();
}
}
@ -72,6 +71,27 @@ export class CLEffects implements OnDestroy {
}
));
@Effect()
fetchFees = this.actions$.pipe(
ofType(CLActions.FETCH_CL_FEES),
mergeMap((action: CLActions.FetchCLFees) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchCLFees'));
return this.httpClient.get(environment.FEES_API);
}),
map((fees) => {
this.logger.info(fees);
return {
type: CLActions.SET_CL_FEES,
payload: (undefined !== fees) ? fees : {}
};
}),
catchError((err: any) => {
this.logger.error(err);
this.store.dispatch(new RTLActions.EffectError({ action: 'FetchCLFees', code: err.status, message: err.error.error }));
return of();
}
));
ngOnDestroy() {
this.unSubs.forEach(completeSub => {
completeSub.next();

@ -3,10 +3,12 @@ import { GetInfo, GetInfoChain } from '../../shared/models/clModels';
export interface CLState {
information: GetInfo;
fees: {};
}
export const CLInitialState: CLState = {
information: {}
information: {},
fees: {}
};
export function CLReducer(state = CLInitialState, action: CLActions.CLActions) {
@ -35,6 +37,11 @@ export function CLReducer(state = CLInitialState, action: CLActions.CLActions) {
...state,
information: action.payload
};
case CLActions.SET_CL_FEES:
return {
...state,
fees: action.payload
};
default:
return state;
}

@ -25,7 +25,7 @@ export class ChannelBackupComponent implements OnInit, OnDestroy {
public displayedColumns = ['chan_id', 'backup', 'verify'];
public selChannel: Channel;
public channels: any;
public flgLoading: Array<Boolean | 'error'> = [true]; // 0: channels
public flgLoading: Array<Boolean | 'error'> = [true];
public flgSticky = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];

@ -25,7 +25,7 @@ export class HomeComponent implements OnInit, OnDestroy {
public BTCtotalBalance = '';
public BTCchannelBalance = '';
public networkInfo: NetworkInfo = {};
public flgLoading: Array<Boolean | 'error'> = [true, true, true, true, true, true, true, true]; // 0: Info, 1: Fee, 2: Wallet, 3: Channel, 4: Network
public flgLoading: Array<Boolean | 'error'> = [true, true, true, true, true, true, true, true];
private unsubs: Array<Subject<void>> = [new Subject(), new Subject()];
public channels: any;
public position = 'below';

@ -20,8 +20,8 @@ export class LndRootComponent implements OnInit, OnDestroy {
ngOnInit() {
console.warn('LND ROOT');
// this.router.navigate(['./home'], {relativeTo: this.activatedRoute});
this.store.dispatch(new LNDActions.FetchInfo());
// this.store.dispatch(new LNDActions.FetchInfo());
this.router.navigate(['./home'], {relativeTo: this.activatedRoute});
this.store.select('lnd')
.pipe(takeUntil(this.unsubs[0]))
.subscribe(lndStore => {
@ -30,7 +30,6 @@ export class LndRootComponent implements OnInit, OnDestroy {
this.initializeRemainingData();
}
});
this.store.dispatch(new LNDActions.FetchInfo());
this.actions$.pipe(takeUntil(this.unsubs[2]), filter((action) => action.type === LNDActions.SET_INFO))
.subscribe((infoData: LNDActions.SetInfo) => {
console.warn(infoData);
@ -38,17 +37,29 @@ export class LndRootComponent implements OnInit, OnDestroy {
this.initializeRemainingData();
}
});
// this.actions$
// .pipe(
// takeUntil(this.unSubs[3]),
// filter(action => action.type === RTLActions.INIT_APP_DATA || action.type === LNDActions.SET_INFO || action.type === CLActions.SET_CL_INFO)
// ).subscribe((actionPayload: RTLActions.InitAppData | LNDActions.SetInfo | CLActions.SetCLInfo) => {
// // if (actionPayload.type === RTLActions.INIT_APP_DATA) {
// if(this.information.identity_pubkey) {
// this.initializeRemainingData();
// }
// });
}
initializeRemainingData() {
this.store.dispatch(new LNDActions.FetchPeers());
this.store.dispatch(new LNDActions.FetchBalance('channels'));
this.store.dispatch(new LNDActions.FetchFees());
this.store.dispatch(new LNDActions.FetchNetwork());
this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'all'}));
this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'pending'}));
this.store.dispatch(new LNDActions.FetchInvoices({num_max_invoices: 25, reversed: true}));
this.store.dispatch(new LNDActions.FetchPayments());
console.warn('SOMETHING IS WRONG HERE');
// this.store.dispatch(new LNDActions.FetchPeers());
// this.store.dispatch(new LNDActions.FetchBalance('channels'));
// this.store.dispatch(new LNDActions.FetchFees());
// this.store.dispatch(new LNDActions.FetchNetwork());
// this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'all'}));
// this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'pending'}));
// this.store.dispatch(new LNDActions.FetchInvoices({num_max_invoices: 25, reversed: true}));
// this.store.dispatch(new LNDActions.FetchPayments());
}
ngOnDestroy() {

@ -26,7 +26,7 @@ export class QueryRoutesComponent implements OnInit, OnDestroy {
public qrHops: any;
public flgSticky = false;
public displayedColumns = [];
public flgLoading: Array<Boolean | 'error'> = [false]; // 0: peers
public flgLoading: Array<Boolean | 'error'> = [false];
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromApp.AppState>, private lndEffects: LNDEffects, private actions$: Actions) {

@ -1,5 +1,5 @@
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { Router, ActivatedRoute } from '@angular/router';
import { Subject } from 'rxjs';
import { takeUntil, filter, take } from 'rxjs/operators';
@ -32,12 +32,12 @@ export class PeersComponent implements OnInit, OnDestroy {
public peerAddress = '';
public peers: any;
public information: GetInfo = {};
public flgLoading: Array<Boolean | 'error'> = [true]; // 0: peers
public flgLoading: Array<Boolean | 'error'> = [true];
public flgSticky = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromApp.AppState>, private rtlEffects: RTLEffects,
private lndEffects: LNDEffects, private actions$: Actions, private router: Router) {
private lndEffects: LNDEffects, private actions$: Actions, private router: Router, private activatedRoute: ActivatedRoute) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['detach', 'pub_key', 'alias'];
@ -146,7 +146,7 @@ export class PeersComponent implements OnInit, OnDestroy {
}
onOpenChannel(peerToAddChannel: Peer) {
this.router.navigate(['chnlmanage'], { state: { peer: peerToAddChannel.pub_key }});
this.router.navigate(['chnlmanage'], { relativeTo: this.activatedRoute, state: { peer: peerToAddChannel.pub_key }});
}
onPeerDetach(peerToDetach: Peer) {

@ -69,7 +69,6 @@ export class RoutingPeersComponent implements OnInit, OnDestroy {
if (undefined !== lndStore.forwardingHistory && undefined !== lndStore.forwardingHistory.forwarding_events) {
this.loadRoutingPeersTable(lndStore.forwardingHistory.forwarding_events);
} else {
// To reset table after other Forwarding history calls
this.loadRoutingPeersTable([]);
}
if (this.flgLoading[0] !== 'error') {
@ -118,7 +117,6 @@ export class RoutingPeersComponent implements OnInit, OnDestroy {
this.RoutingPeersOutgoing.sort = this.sortOut;
this.logger.info(this.RoutingPeersOutgoing);
} else {
// To reset table after other Forwarding history calls
this.RoutingPeersIncoming = new MatTableDataSource<RoutingPeers>([]);
this.RoutingPeersOutgoing = new MatTableDataSource<RoutingPeers>([]);
}

@ -1,6 +1,6 @@
import { Injectable, OnDestroy } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router';
import { Router, ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { of, Subject } from 'rxjs';
@ -28,7 +28,8 @@ export class LNDEffects implements OnDestroy {
private store: Store<fromApp.AppState>,
private logger: LoggerService,
public dialog: MatDialog,
private router: Router) { }
private router: Router,
private activatedRoute: ActivatedRoute) { }
@Effect()
infoFetch = this.actions$.pipe(
@ -43,14 +44,12 @@ export class LNDEffects implements OnDestroy {
if (undefined === info.identity_pubkey) {
sessionStorage.removeItem('lndUnlocked');
this.logger.info('Redirecting to Unlock');
// this.store.dispatch(new RTLActions.SetSelNodeInfo({}));
this.router.navigate(['/unlocklnd']);
this.router.navigate(['../unlocklnd'], { relativeTo: this.activatedRoute });
return {
type: LNDActions.SET_INFO,
payload: {}
};
} else {
// this.store.dispatch(new RTLActions.SetSelNodeInfo(info));
sessionStorage.setItem('lndUnlocked', 'true');
return {
type: LNDActions.SET_INFO,
@ -62,15 +61,15 @@ export class LNDEffects implements OnDestroy {
this.logger.error(err);
this.store.dispatch(new RTLActions.EffectError({ action: 'FetchInfo', code: err.status, message: err.error.error }));
if (+store.appConfig.sso.rtlSSO) {
this.router.navigate(['/ssoerror']);
this.router.navigate(['../ssoerror'], { relativeTo: this.activatedRoute });
} else {
if (err.status === 401) {
this.logger.info('Redirecting to Signin');
this.router.navigate([store.appConfig.sso.logoutRedirectLink]);
this.router.navigate([store.appConfig.sso.logoutRedirectLink], { relativeTo: this.activatedRoute });
return of();
} else {
this.logger.info('Redirecting to Unlock');
this.router.navigate(['/unlocklnd']);
this.router.navigate(['../unlocklnd'], { relativeTo: this.activatedRoute });
return of();
}
}
@ -940,7 +939,7 @@ export class LNDEffects implements OnDestroy {
this.store.dispatch(new RTLActions.CloseSpinner());
this.logger.info('Successfully Initialized!');
this.store.dispatch(new RTLActions.InitAppData());
this.router.navigate(['/']);
this.router.navigate(['/'], { relativeTo: this.activatedRoute });
}, 1000 * 90);
return of({});
}),

@ -65,7 +65,6 @@ export class ForwardingHistoryComponent implements OnInit, OnDestroy {
this.lastOffsetIndex = lndStore.forwardingHistory.last_offset_index;
this.loadForwardingEventsTable(lndStore.forwardingHistory.forwarding_events);
} else {
// To reset table after other Forwarding history calls
this.lastOffsetIndex = 0;
this.loadForwardingEventsTable([]);
}

@ -1,7 +1,7 @@
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { Router, ActivatedRoute } from '@angular/router';
import { Subject } from 'rxjs';
import { takeUntil, take } from 'rxjs/operators';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { FormBuilder, FormGroup, Validators, ValidatorFn, ValidationErrors } from '@angular/forms';
import { STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper';
@ -49,7 +49,7 @@ export class UnlockLNDComponent implements OnInit, OnDestroy {
private unsubs = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private store: Store<fromApp.AppState>, private formBuilder: FormBuilder, private rtlEffects: RTLEffects,
private lndEffects: LNDEffects, private router: Router) {}
private lndEffects: LNDEffects, private router: Router, private activatedRoute: ActivatedRoute) {}
ngOnInit() {
this.walletPassword = '';
@ -147,7 +147,7 @@ export class UnlockLNDComponent implements OnInit, OnDestroy {
onGoToHome() {
setTimeout(() => {
this.store.dispatch(new RTLActions.InitAppData());
this.router.navigate(['/']);
this.router.navigate(['../'], { relativeTo: this.activatedRoute });
}, 1000 * 1);
}

@ -21,8 +21,6 @@ export class HelpComponent implements OnInit {
constructor() {}
ngOnInit() {
// this.helpTopics.push(new HelpTopic('Set LND home directory?',
// 'Pass the directroy information while getting the server up with --lndir "local-lnd-path".<br>Example: node rtl --lndir C:\lnd\dir\path'));
this.helpTopics.push(new HelpTopic('Change theme?', 'Click on rotating setting icon on the right side of the screen and choose from the given options.'));
}

@ -9,9 +9,9 @@
</mat-toolbar>
<div fxLayout="row" fxLayoutAlign="start center" class="lnd-info pl-2" *ngIf="settings.menuType !== 'Mini'">
<div fxLayout="column">
<p class="name">Alias: <mat-spinner [diameter]="20" *ngIf="flgLoading" class="inline-spinner"></mat-spinner>{{selNodeInfo?.alias}}</p>
<p>Chain: <mat-spinner [diameter]="20" *ngIf="flgLoading" class="inline-spinner"></mat-spinner>{{selNodeInfoChain.chain | titlecase}}<span> [{{selNodeInfoChain.network | titlecase}}]</span></p>
<p class="name">LND Version: <mat-spinner [diameter]="20" *ngIf="flgLoading" class="inline-spinner"></mat-spinner>{{selNodeInfo?.version}}</p>
<p class="name">Alias: <mat-spinner [diameter]="20" *ngIf="flgLoading" class="inline-spinner"></mat-spinner>{{information?.alias}}</p>
<p>Chain: <mat-spinner [diameter]="20" *ngIf="flgLoading" class="inline-spinner"></mat-spinner>{{informationChain.chain | titlecase}}<span> [{{informationChain.network | titlecase}}]</span></p>
<p class="name">LND Version: <mat-spinner [diameter]="20" *ngIf="flgLoading" class="inline-spinner"></mat-spinner>{{information?.version}}</p>
</div>
</div>

@ -9,7 +9,8 @@ import { environment } from '../../../../../environments/environment';
import { FlatTreeControl } from '@angular/cdk/tree';
import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
import { Node, Settings, SelNodeInfo, SelNodeInfoChain } from '../../../models/RTLconfig';
import { GetInfo, GetInfoChain } from '../../../models/lndModels';
import { Node, Settings } from '../../../models/RTLconfig';
import { LoggerService } from '../../../services/logger.service';
import { MenuNode, FlatMenuNode, MENU_DATA } from '../../../models/navMenu';
@ -27,14 +28,14 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
public selNode: Node;
public settings: Settings;
public version = '';
public selNodeInfo: SelNodeInfo = {};
public selNodeInfoChain: SelNodeInfoChain = {};
public information: GetInfo = {};
public informationChain: GetInfoChain = {};
public flgLoading = true;
public logoutNode = [{id: 100, parentId: 0, name: 'Logout', icon: 'eject'}];
public showLogout = false;
public numPendingChannels = 0;
public smallScreen = false;
private unSubs = [new Subject(), new Subject(), new Subject(), new Subject()];
private unSubs = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
treeControl: FlatTreeControl<FlatMenuNode>;
treeControlLogout: FlatTreeControl<FlatMenuNode>;
treeFlattener: MatTreeFlattener<MenuNode, FlatMenuNode>;
@ -68,26 +69,24 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
this.store.select('rtlRoot')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromApp.RootState) => {
// this.selNodeInfo = rtlStore.selNodeInfo;
this.selNode = rtlStore.selNode;
this.settings = this.selNode.settings;
this.showLogout = (sessionStorage.getItem('token')) ? true : false;
if (undefined !== this.selNodeInfo.identity_pubkey) {
if (undefined !== this.selNodeInfo.chains && typeof this.selNodeInfo.chains[0] === 'string') {
this.selNodeInfoChain.chain = this.selNodeInfo.chains[0].toString();
this.selNodeInfoChain.network = (this.selNodeInfo.testnet) ? 'Testnet' : 'Mainnet';
} else if (typeof this.selNodeInfo.chains[0] === 'object' && this.selNodeInfo.chains[0].hasOwnProperty('chain')) {
const getInfoChain = <SelNodeInfoChain>this.selNodeInfo.chains[0];
this.selNodeInfoChain.chain = getInfoChain.chain;
this.selNodeInfoChain.network = getInfoChain.network;
}
if (this.selNode.lnImplementation.toLowerCase() === 'clightning') {
this.store.select('cl')
.pipe(takeUntil(this.unSubs[4]))
.subscribe((clStore) => {
this.information = clStore.information;
this.readInformation();
});
} else {
this.selNodeInfoChain.chain = '';
this.selNodeInfoChain.network = '';
this.store.select('lnd')
.pipe(takeUntil(this.unSubs[5]))
.subscribe((lndStore) => {
this.information = lndStore.information;
this.readInformation();
});
}
this.flgLoading = (undefined !== this.selNodeInfo.identity_pubkey) ? false : true;
if (!sessionStorage.getItem('token')) {
this.flgLoading = false;
}
@ -105,6 +104,23 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
});
}
private readInformation() {
if (undefined !== this.information.identity_pubkey) {
if (undefined !== this.information.chains && typeof this.information.chains[0] === 'string') {
this.informationChain.chain = this.information.chains[0].toString();
this.informationChain.network = (this.information.testnet) ? 'Testnet' : 'Mainnet';
} else if (typeof this.information.chains[0] === 'object' && this.information.chains[0].hasOwnProperty('chain')) {
const getInfoChain = <GetInfoChain>this.information.chains[0];
this.informationChain.chain = getInfoChain.chain;
this.informationChain.network = getInfoChain.network;
}
} else {
this.informationChain.chain = '';
this.informationChain.network = '';
}
this.flgLoading = (undefined !== this.information.identity_pubkey) ? false : true;
}
private transformer(node: MenuNode, level: number) { return new FlatMenuNode(!!node.children, level, node.id, node.parentId, node.name, node.icon, node.link); }
private getLevel(node: FlatMenuNode) { return node.level; }
@ -119,10 +135,7 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
this.treeControl.collapseAll();
if (node.parentId === 0) {
this.treeControl.expandDescendants(node);
console.warn(this.activatedRoute.firstChild);
if (this.activatedRoute.firstChild.children.length > 0) {
this.router.navigate([node.link], {relativeTo: this.activatedRoute.firstChild});
}
this.router.navigate([node.link], {relativeTo: this.activatedRoute.firstChild});
} else {
const parentNode = this.treeControl.dataNodes.filter(dataNode => {
return dataNode.id === node.parentId;

@ -40,7 +40,7 @@ export class SigninComponent implements OnInit, OnDestroy {
if (this.nodeAuthType.toUpperCase() === 'DEFAULT') {
this.hintStr = 'Enter RPC password';
} else {
this.hintStr = ''; // Do not remove, initial passowrd 'DEFAULT' is initilizing its value
this.hintStr = '';
}
});
}

@ -45,16 +45,3 @@ export class RTLConfiguration {
public nodes: Node[]
) { }
}
export interface SelNodeInfo {
identity_pubkey?: string;
alias?: string;
testnet?: boolean;
chains?: SelNodeInfoChain[] | string[];
version?: string;
}
export interface SelNodeInfoChain {
chain?: string;
network?: string;
}

@ -5,16 +5,16 @@ export interface AddressType {
}
export interface Balance {
btc_balance?: string; // For Channels Balance
balance?: string; // For Channels Balance
btc_pending_open_balance?: string; // For Channels Balance
pending_open_balance?: string; // For Channels Balance
btc_total_balance?: string; // For Blockchain Balance
total_balance?: string; // For Blockchain Balance
btc_confirmed_balance?: string; // For Blockchain Balance
confirmed_balance?: string; // For Blockchain Balance
btc_unconfirmed_balance?: string; // For Blockchain Balance
unconfirmed_balance?: string; // For Blockchain Balance
btc_balance?: string;
balance?: string;
btc_pending_open_balance?: string;
pending_open_balance?: string;
btc_total_balance?: string;
total_balance?: string;
btc_confirmed_balance?: string;
confirmed_balance?: string;
btc_unconfirmed_balance?: string;
unconfirmed_balance?: string;
}
export interface ChannelFeeReport {
@ -271,7 +271,7 @@ export interface PayRequest {
export interface Peer {
pub_key?: string;
alias?: string;
address?: string; // host
address?: string;
bytes_sent?: number;
bytes_recv?: number;
sat_sent?: string;

@ -43,7 +43,7 @@
.active-link {
background: mat-color($primary);
color: white; // mat-color($foreground, text); for dark theme but for light theme the foreground text color is black
color: white;
}
.h-active-link {
@ -58,10 +58,6 @@
}
}
.mat-primary .mat-select, .mat-primary .mat-select-trigger, .mat-primary .mat-select-value, .mat-primary .mat-select-arrow {
// color: white !important;
}
.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;

@ -1,5 +1,5 @@
import { Action } from '@ngrx/store';
import { RTLConfiguration, Settings, Node, SelNodeInfo } from '../shared/models/RTLconfig';
import { RTLConfiguration, Settings, Node } from '../shared/models/RTLconfig';
import { ErrorPayload } from '../shared/models/errorPayload';
import { MatDialogConfig } from '@angular/material';
@ -18,7 +18,6 @@ export const FETCH_RTL_CONFIG = 'FETCH_RTL_CONFIG';
export const SET_RTL_CONFIG = 'SET_RTL_CONFIG';
export const SAVE_SETTINGS = 'SAVE_SETTINGS';
export const SET_SELECTED_NODE = 'SET_SELECTED_NODE';
// export const SET_SELECTED_NODE_INFO = 'SET_SELECTED_NODE_INFO';
export const IS_AUTHORIZED = 'IS_AUTHORIZED';
export const IS_AUTHORIZED_RES = 'IS_AUTHORIZED_RES';
export const SIGNIN = 'SIGNIN';
@ -87,11 +86,6 @@ export class SetSelelectedNode implements Action {
constructor(public payload: Node) {}
}
// export class SetSelNodeInfo implements Action {
// readonly type = SET_SELECTED_NODE_INFO;
// constructor(public payload: SelNodeInfo) {}
// }
export class IsAuthorized implements Action {
readonly type = IS_AUTHORIZED;
constructor(public payload: string) {} // payload = password
@ -121,5 +115,4 @@ export type RTLActions =
FetchRTLConfig | SetRTLConfig | SaveSettings |
OpenAlert | CloseAlert | OpenConfirmation | CloseConfirmation |
ResetStore | SetSelelectedNode |
// SetSelNodeInfo |
IsAuthorized | IsAuthorizedRes | Signin | Signout | InitAppData;

@ -1,6 +1,6 @@
import { Injectable, OnDestroy } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router';
import { Router, ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { of, Subject } from 'rxjs';
@ -31,7 +31,8 @@ export class RTLEffects implements OnDestroy {
private store: Store<fromApp.AppState>,
private logger: LoggerService,
public dialog: MatDialog,
private router: Router) { }
private router: Router,
private activatedRoute: ActivatedRoute) { }
@Effect({ dispatch: false })
openSpinner = this.actions$.pipe(
@ -163,7 +164,7 @@ export class RTLEffects implements OnDestroy {
this.logger.info(postRes);
this.logger.info('Successfully Authorized!');
this.SetToken(postRes.token);
this.router.navigate(['/']);
this.router.navigate(['/'], { relativeTo: this.activatedRoute });
}),
catchError((err) => {
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%', data: {type: 'ERROR', message: JSON.stringify(err.error)}}));
@ -171,9 +172,9 @@ export class RTLEffects implements OnDestroy {
this.logger.error(err.error);
this.logger.info('Redirecting to Signin Error Page');
if (+store.appConfig.sso.rtlSSO) {
this.router.navigate(['/ssoerror']);
this.router.navigate(['/ssoerror'], { relativeTo: this.activatedRoute });
} else {
this.router.navigate([store.appConfig.sso.logoutRedirectLink]);
this.router.navigate([store.appConfig.sso.logoutRedirectLink], { relativeTo: this.activatedRoute });
}
return of();
})
@ -188,7 +189,7 @@ export class RTLEffects implements OnDestroy {
if (+store.appConfig.sso.rtlSSO) {
window.location.href = store.appConfig.sso.logoutRedirectLink;
} else {
this.router.navigate([store.appConfig.sso.logoutRedirectLink]);
this.router.navigate([store.appConfig.sso.logoutRedirectLink], { relativeTo: this.activatedRoute });
}
sessionStorage.removeItem('lndUnlocked');
sessionStorage.removeItem('token');
@ -208,11 +209,11 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.CloseSpinner());
if (sessionStorage.getItem('token')) {
this.store.dispatch(new RTLActions.ResetStore(action.payload));
if (action.payload.lnImplementation === 'CLightning') {
this.router.navigate(['./cl']);
if (action.payload.lnImplementation.toLowerCase() === 'clightning') {
this.router.navigate(['./cl'], { relativeTo: this.activatedRoute });
return { type: CLActions.FETCH_CL_INFO };
} else {
this.router.navigate(['./lnd']);
this.router.navigate(['./lnd'], { relativeTo: this.activatedRoute });
return { type: LNDActions.FETCH_INFO };
}
} else {

@ -1,6 +1,6 @@
import * as RTLActions from './rtl.actions';
import { ErrorPayload } from '../shared/models/errorPayload';
import { RTLConfiguration, Node, SelNodeInfo } from '../shared/models/RTLconfig';
import { RTLConfiguration, Node } from '../shared/models/RTLconfig';
import { ActionReducerMap } from '@ngrx/store';
@ -17,7 +17,6 @@ export interface RootState {
effectErrors: ErrorPayload[];
selNode: Node;
appConfig: RTLConfiguration;
// selNodeInfo: SelNodeInfo;
}
const initNodeSettings = { flgSidenavOpened: true, flgSidenavPinned: true, menu: 'Vertical', menuType: 'Regular', theme: 'dark-blue', satsToBTC: false };
@ -30,8 +29,7 @@ const initialState: RootState = {
selectedNodeIndex: -1,
sso: { rtlSSO: 0, logoutRedirectLink: '/login' },
nodes: [{ settings: initNodeSettings, authentication: initNodeAuthentication}]
},
// selNodeInfo: {}
}
};
export function RTLRootReducer(state = initialState, action: RTLActions.RTLActions) {
@ -70,11 +68,6 @@ export function RTLRootReducer(state = initialState, action: RTLActions.RTLActio
selNode: action.payload.nodes.find(node => +node.index === action.payload.selectedNodeIndex),
appConfig: action.payload
};
// case RTLActions.SET_SELECTED_NODE_INFO:
// return {
// ...state,
// selNodeInfo: action.payload
// };
default:
return state;
}

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SuperUserDashboardComponent } from './super-user-dashboard.component';
describe('SuperUserDashboardComponent', () => {
let component: SuperUserDashboardComponent;
let fixture: ComponentFixture<SuperUserDashboardComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SuperUserDashboardComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SuperUserDashboardComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,70 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Subject } from 'rxjs';
import { takeUntil, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { UserIdleService } from 'angular-user-idle';
import { LoggerService } from '../shared/services/logger.service';
import { RTLConfiguration, Settings, Node } from '../shared/models/RTLconfig';
import { GetInfo } from '../shared/models/lndModels';
import * as LNDActions from '../lnd/store/lnd.actions';
import * as CLActions from '../c-lightning/store/cl.actions';
import * as RTLActions from '../store/rtl.actions';
import * as fromApp from '../store/rtl.reducers';
@Component({
selector: 'rtl-super-user-dashboard',
templateUrl: './super-user-dashboard.component.html',
styleUrls: ['./super-user-dashboard.component.scss']
})
export class SuperUserDashboardComponent implements OnInit, OnDestroy {
public selNode: Node;
public settings: Settings;
public information: GetInfo = {};
public flgLoading: Array<Boolean | 'error'> = [true];
public flgCopied = false;
public appConfig: RTLConfiguration;
public accessKey = '';
public smallScreen = false;
unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromApp.AppState>, private actions$: Actions, private userIdle: UserIdleService, private router: Router, private activatedRoute: ActivatedRoute) {}
ngOnInit() {
this.actions$.pipe(takeUntil(this.unSubs[3]), filter(action => action.type === RTLActions.SET_RTL_CONFIG))
.subscribe((setConfigAction: RTLActions.SetRTLConfig) => {
console.warn(setConfigAction);
this.selNode = setConfigAction.payload.nodes.find(node => +node.index === setConfigAction.payload.selectedNodeIndex)
if (this.selNode.lnImplementation.toLowerCase() === 'clightning') {
this.store.dispatch(new CLActions.FetchCLInfo());
this.router.navigate(['../cl'], { relativeTo: this.activatedRoute });
} else {
this.store.dispatch(new LNDActions.FetchInfo());
this.router.navigate(['../lnd'], { relativeTo: this.activatedRoute });
}
});
// this.store.select('rtlRoot')
// .pipe(takeUntil(this.unSubs[0]))
// .subscribe(rtlStore => {
// this.selNode = rtlStore.selNode;
// if (this.selNode.lnImplementation.toLowerCase() === 'clightning') {
// this.store.dispatch(new CLActions.FetchCLInfo());
// this.router.navigate(['./cl'], { relativeTo: this.activatedRoute });
// } else {
// this.store.dispatch(new LNDActions.FetchInfo());
// this.router.navigate(['./lnd'], { relativeTo: this.activatedRoute });
// }
// });
}
ngOnDestroy() {
this.unSubs.forEach(unsub => {
unsub.next();
unsub.complete();
});
}
}
Loading…
Cancel
Save