parent
e93231c590
commit
d318ad7c82
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
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
@ -0,0 +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)+"-es2015."+{1:"6aacfc3b356893189a11",5:"728790da8d674f1a9a03",6:"12f89c6eac1f84929add"}[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()}([]);
|
@ -1 +0,0 @@
|
||||
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=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(f&&f(r);s.length;)s.shift()();return u.push.apply(u,l||[]),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."+{4:"d4064c76d94d78581525"}[e]+".js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);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 l=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 l=0;l<a.length;l++)r(a[l]);var f=c;t()}([]);
|
@ -0,0 +1 @@
|
||||
!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:"988ddf44a4866c3ff558",4:"2ce4f749146b640b4203",5:"dc29e5cf514a69f8162d"}[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."+{3:"be011c3d61feb311e96f"}[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,8 +1,22 @@
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { ModuleWithProviders } from '@angular/core';
|
||||
|
||||
import { ServerConfigComponent } from './shared/components/server-config/server-config.component';
|
||||
import { HelpComponent } from './shared/components/help/help.component';
|
||||
import { SigninComponent } from './shared/components/signin/signin.component';
|
||||
import { NotFoundComponent } from './shared/components/not-found/not-found.component';
|
||||
import { SsoFailedComponent } from './shared/components/sso-failed/sso-failed.component';
|
||||
import { AuthGuard } from './shared/services/auth.guard';
|
||||
|
||||
export const routes: Routes = [
|
||||
{ path: '', loadChildren: () => import('./lnd/lnd.module').then(childModule => childModule.LndModule)},
|
||||
{ path: '', redirectTo: '/lnd', pathMatch: 'full' },
|
||||
{ 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] },
|
||||
{ path: 'login', component: SigninComponent },
|
||||
{ path: 'help', component: HelpComponent },
|
||||
{ path: 'ssoerror', component: SsoFailedComponent },
|
||||
{ path: '**', component: NotFoundComponent }
|
||||
];
|
||||
|
||||
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);
|
||||
|
@ -0,0 +1 @@
|
||||
<router-outlet></router-outlet>
|
@ -0,0 +1,4 @@
|
||||
.inline-spinner {
|
||||
display: inline-flex !important;
|
||||
top: 0px !important;
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
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 * as CLActions from './store/cl.actions';
|
||||
import * as RTLActions from '../store/rtl.actions';
|
||||
import * as fromRTLReducer from '../store/rtl.reducers';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cl-root-app',
|
||||
templateUrl: './cl-root.component.html',
|
||||
styleUrls: ['./cl-root.component.scss']
|
||||
})
|
||||
export class ClRootComponent implements OnInit, OnDestroy {
|
||||
unsubs: Array<Subject<void>> = [new Subject(), new Subject()];
|
||||
|
||||
constructor(private store: Store<fromRTLReducer.State>, private actions$: Actions, private router: Router, private activatedRoute: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
console.warn('CL ROOT');
|
||||
this.router.navigate(['./home'], {relativeTo: this.activatedRoute});
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
initializeRemainingData() {
|
||||
// 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(unsub => {
|
||||
unsub.next();
|
||||
unsub.complete();
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgxChartsModule } from '@swimlane/ngx-charts';
|
||||
import { StoreModule } from '@ngrx/store';
|
||||
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
|
||||
import { environment } from '../../environments/environment';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
import { CLReducer } from './store/cl.reducers';
|
||||
import { CLEffects } from './store/cl.effects';
|
||||
|
||||
import { clRouting } from './cl.routing';
|
||||
import { ClRootComponent } from './cl-root.component';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
SharedModule,
|
||||
clRouting,
|
||||
NgxChartsModule,
|
||||
EffectsModule.forFeature([CLEffects]),
|
||||
StoreModule.forFeature('cl', CLReducer),
|
||||
!environment.production ? StoreDevtoolsModule.instrument() : []
|
||||
],
|
||||
declarations: [
|
||||
ClRootComponent,
|
||||
HomeComponent
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [ClRootComponent]
|
||||
})
|
||||
export class ClModule {}
|
@ -0,0 +1,15 @@
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { ModuleWithProviders } from '@angular/core';
|
||||
|
||||
import { AuthGuard } from '../shared/services/auth.guard';
|
||||
|
||||
import { ClRootComponent } from './cl-root.component';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
|
||||
export const clRoutes: Routes = [
|
||||
{ path: '', redirectTo: '.', pathMatch: 'full', canActivate: [AuthGuard]},
|
||||
{ path: '.', component: ClRootComponent, canActivate: [AuthGuard] },
|
||||
{ path: './home', component: HomeComponent, canActivate: [AuthGuard] }
|
||||
];
|
||||
|
||||
export const clRouting: ModuleWithProviders = RouterModule.forChild(clRoutes);
|
@ -0,0 +1,2 @@
|
||||
<h4>CL Home</h4>
|
||||
<p>{{information | json}}</p>
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HomeComponent } from './home.component';
|
||||
|
||||
describe('HomeComponent', () => {
|
||||
let component: HomeComponent;
|
||||
let fixture: ComponentFixture<HomeComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HomeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HomeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,39 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { LoggerService } from '../../shared/services/logger.service';
|
||||
import { GetInfo } from '../../shared/models/clModels';
|
||||
|
||||
import * as fromCLReducer from '../store/cl.reducers';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-home',
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.scss']
|
||||
})
|
||||
export class HomeComponent implements OnInit, OnDestroy {
|
||||
public information: GetInfo = {};
|
||||
private unsubs: Array<Subject<void>> = [new Subject(), new Subject()];
|
||||
|
||||
constructor(private logger: LoggerService, private clStore: Store<fromCLReducer.CLState>) {}
|
||||
|
||||
ngOnInit() {
|
||||
console.warn('CL HOME');
|
||||
this.clStore.select('cl')
|
||||
.pipe(takeUntil(this.unsubs[1]))
|
||||
.subscribe(clStore => {
|
||||
this.information = clStore.information;
|
||||
this.logger.info(clStore);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.unsubs.forEach(completeSub => {
|
||||
completeSub.next();
|
||||
completeSub.complete();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
import { Action } from '@ngrx/store';
|
||||
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 class ResetCLStore implements Action {
|
||||
readonly type = RESET_CL_STORE;
|
||||
}
|
||||
|
||||
export class FetchCLInfo implements Action {
|
||||
readonly type = FETCH_CL_INFO;
|
||||
}
|
||||
|
||||
export class SetCLInfo implements Action {
|
||||
readonly type = SET_CL_INFO;
|
||||
constructor(public payload: GetInfo) {}
|
||||
}
|
||||
|
||||
export type CLActions =
|
||||
ResetCLStore | FetchCLInfo | SetCLInfo;
|
@ -0,0 +1,83 @@
|
||||
import { Injectable, OnDestroy } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Actions, Effect, ofType } from '@ngrx/effects';
|
||||
import { of, Subject } from 'rxjs';
|
||||
import { map, mergeMap, catchError, withLatestFrom } from 'rxjs/operators';
|
||||
|
||||
import { MatDialog } from '@angular/material';
|
||||
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { LoggerService } from '../../shared/services/logger.service';
|
||||
import { GetInfo } from '../../shared/models/clModels';
|
||||
|
||||
import * as RTLActions from '../../store/rtl.actions';
|
||||
import * as fromRTLReducer from '../../store/rtl.reducers';
|
||||
import * as CLActions from './cl.actions';
|
||||
import * as fromCLReducer from './cl.reducers';
|
||||
|
||||
@Injectable()
|
||||
export class CLEffects implements OnDestroy {
|
||||
dialogRef: any;
|
||||
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
|
||||
|
||||
constructor(
|
||||
private actions$: Actions,
|
||||
private httpClient: HttpClient,
|
||||
private store: Store<fromCLReducer.CLState>,
|
||||
private logger: LoggerService,
|
||||
public dialog: MatDialog,
|
||||
private router: Router) { }
|
||||
|
||||
@Effect()
|
||||
infoFetch = this.actions$.pipe(
|
||||
ofType(CLActions.FETCH_CL_INFO),
|
||||
withLatestFrom(this.store.select('rtlRoot')),
|
||||
mergeMap(([action, store]: [CLActions.FetchCLInfo, fromRTLReducer.State]) => {
|
||||
this.store.dispatch(new RTLActions.ClearEffectError('FetchInfo'));
|
||||
return this.httpClient.get<GetInfo>(environment.GETINFO_API)
|
||||
.pipe(
|
||||
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,
|
||||
payload: (undefined !== info) ? info : {}
|
||||
};
|
||||
}
|
||||
}),
|
||||
catchError((err) => {
|
||||
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']);
|
||||
} else {
|
||||
if (err.status === 401) {
|
||||
this.logger.info('Redirecting to Signin');
|
||||
this.router.navigate([store.appConfig.sso.logoutRedirectLink]);
|
||||
return of();
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
));
|
||||
|
||||
ngOnDestroy() {
|
||||
this.unSubs.forEach(completeSub => {
|
||||
completeSub.next();
|
||||
completeSub.complete();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
import * as CLActions from './cl.actions';
|
||||
import { GetInfo, GetInfoChain } from '../../shared/models/clModels';
|
||||
import * as fromApp from '../../store/rtl.reducers';
|
||||
|
||||
export interface FeatureState extends fromApp.State {
|
||||
cl: CLState;
|
||||
}
|
||||
|
||||
export interface CLState {
|
||||
information: GetInfo;
|
||||
}
|
||||
|
||||
export const CLInitialState: CLState = {
|
||||
information: {}
|
||||
};
|
||||
|
||||
export function CLReducer(state = CLInitialState, action: CLActions.CLActions) {
|
||||
switch (action.type) {
|
||||
case CLActions.RESET_CL_STORE:
|
||||
return {
|
||||
...CLInitialState
|
||||
};
|
||||
case CLActions.SET_CL_INFO:
|
||||
if (undefined !== action.payload.chains) {
|
||||
if (typeof action.payload.chains[0] === 'string') {
|
||||
action.payload.smaller_currency_unit = (action.payload.chains[0].toString().toLowerCase().indexOf('bitcoin') < 0) ? 'Litoshis' : 'Sats';
|
||||
action.payload.currency_unit = (action.payload.chains[0].toString().toLowerCase().indexOf('bitcoin') < 0) ? 'LTC' : 'BTC';
|
||||
} else if (typeof action.payload.chains[0] === 'object' && action.payload.chains[0].hasOwnProperty('chain')) {
|
||||
const getInfoChain = <GetInfoChain>action.payload.chains[0];
|
||||
action.payload.smaller_currency_unit = (getInfoChain.chain.toLowerCase().indexOf('bitcoin') < 0) ? 'Litoshis' : 'Sats';
|
||||
action.payload.currency_unit = (getInfoChain.chain.toLowerCase().indexOf('bitcoin') < 0) ? 'LTC' : 'BTC';
|
||||
}
|
||||
action.payload.version = (undefined === action.payload.version) ? '' : action.payload.version.split(' ')[0];
|
||||
} else {
|
||||
action.payload.smaller_currency_unit = 'Sats';
|
||||
action.payload.currency_unit = 'BTC';
|
||||
action.payload.version = (undefined === action.payload.version) ? '' : action.payload.version.split(' ')[0];
|
||||
}
|
||||
return {
|
||||
...state,
|
||||
information: action.payload
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
@ -1,48 +1 @@
|
||||
<div fxLayout="column" id="rtl-container" class="rtl-container" [ngClass]="settings.theme" [class.horizontal]="settings.menu === 'Horizontal'" [class.compact]="settings.menuType === 'Compact'" [class.mini]="settings.menuType === 'Mini'">
|
||||
<mat-sidenav-container>
|
||||
<mat-sidenav perfectScrollbar *ngIf="settings.menu === 'Vertical'" [opened]="settings.flgSidenavOpened" [mode]="(settings.flgSidenavPinned) ? 'side' : 'over'"
|
||||
#sideNavigation class="sidenav mat-elevation-z6 overflow-auto">
|
||||
<rtl-side-navigation (ChildNavClicked)="onNavigationClicked($event)"></rtl-side-navigation>
|
||||
</mat-sidenav>
|
||||
<mat-sidenav-content perfectScrollbar class="overflow-auto">
|
||||
<mat-toolbar fxLayout="row" fxLayoutAlign="space-between center" color="primary" class="padding-gap-x">
|
||||
<div fxLayoutAlign="center center">
|
||||
<button *ngIf="settings.menu === 'Vertical'" mat-icon-button (click)="sideNavToggle()">
|
||||
<mat-icon>menu</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Ride The Lightning <span class="font-60-percent">(Beta)</span></h2>
|
||||
</div>
|
||||
<div fxLayoutAlign="space-between center">
|
||||
<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]="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}"> {{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>
|
||||
<mat-toolbar color="primary" *ngIf="settings.menu === 'Horizontal'" class="padding-gap-x horizontal-nav">
|
||||
<div fxLayout="row" fxFlex="100" fxLayoutAlign="center center" class="h-100">
|
||||
<rtl-horizontal-navigation></rtl-horizontal-navigation>
|
||||
</div>
|
||||
</mat-toolbar>
|
||||
<div [ngClass]="{'mt-minus-1': smallScreen, 'inner-sidenav-content': true}">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="center center" class="bg-primary settings-icon" (click)="settingSidenav.toggle()">
|
||||
<mat-icon class="animate-settings">settings</mat-icon>
|
||||
</div>
|
||||
</mat-sidenav-content>
|
||||
<mat-sidenav #settingSidenav position="end" class="settings mat-elevation-z6" mode="side">
|
||||
<rtl-settings-nav (done)="settingSidenav.toggle()"></rtl-settings-nav>
|
||||
</mat-sidenav>
|
||||
</mat-sidenav-container>
|
||||
<div class="rtl-spinner" *ngIf="undefined === settings.theme">
|
||||
<mat-spinner color="accent"></mat-spinner>
|
||||
<h4>Loading RTL...</h4>
|
||||
</div>
|
||||
</div>
|
||||
<router-outlet></router-outlet>
|
||||
|
@ -1,16 +1,7 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-not-found',
|
||||
templateUrl: './not-found.component.html'
|
||||
})
|
||||
export class NotFoundComponent {
|
||||
|
||||
constructor(public router: Router) {}
|
||||
|
||||
goHome(): void {
|
||||
this.router.navigate(['/']);
|
||||
}
|
||||
|
||||
}
|
||||
export class NotFoundComponent {}
|
||||
|
@ -0,0 +1,43 @@
|
||||
// export interface GetInfoAddress {
|
||||
// type?: string;
|
||||
// address?: string;
|
||||
// port?: number;
|
||||
// }
|
||||
|
||||
// export interface GetInfo {
|
||||
// id?: string;
|
||||
// alias?: string;
|
||||
// color?: string;
|
||||
// num_peers?: number;
|
||||
// num_pending_channels?: number;
|
||||
// num_active_channels?: number;
|
||||
// num_inactive_channels?: number;
|
||||
// address?: GetInfoAddress[];
|
||||
// binding?: GetInfoAddress[];
|
||||
// version?: string;
|
||||
// blockheight?: number;
|
||||
// network?: string;
|
||||
// msatoshi_fees_collected?: number;
|
||||
// fees_collected_msat?: string;
|
||||
// }
|
||||
|
||||
export interface GetInfoChain {
|
||||
chain?: string;
|
||||
network?: string;
|
||||
}
|
||||
|
||||
export interface GetInfo {
|
||||
identity_pubkey?: string;
|
||||
alias?: string;
|
||||
num_pending_channels?: number;
|
||||
num_active_channels?: number;
|
||||
num_inactive_channels?: number;
|
||||
num_peers?: number;
|
||||
block_height?: number;
|
||||
synced_to_chain?: boolean;
|
||||
testnet?: boolean;
|
||||
chains?: GetInfoChain[];
|
||||
version?: string;
|
||||
currency_unit?: string;
|
||||
smaller_currency_unit?: string;
|
||||
}
|
Loading…
Reference in New Issue