mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2024-11-19 09:50:36 +01:00
MultiNode Ready for Testing
MultiNode Ready for Testing
This commit is contained in:
parent
08a609ef85
commit
794c2ad5d9
@ -8,5 +8,5 @@
|
||||
<link rel="stylesheet" href="styles.bab7f62b489f0c86770d.css"></head>
|
||||
<body>
|
||||
<rtl-app></rtl-app>
|
||||
<script type="text/javascript" src="runtime.26209474bfa8dc87a77c.js"></script><script type="text/javascript" src="polyfills.181b5a67c421a167a96a.js"></script><script type="text/javascript" src="main.303f236883907eaa2a3b.js"></script></body>
|
||||
<script type="text/javascript" src="runtime.26209474bfa8dc87a77c.js"></script><script type="text/javascript" src="polyfills.181b5a67c421a167a96a.js"></script><script type="text/javascript" src="main.9e142f99e4861933b2c8.js"></script></body>
|
||||
</html>
|
||||
|
File diff suppressed because one or more lines are too long
1
angular/main.9e142f99e4861933b2c8.js
Normal file
1
angular/main.9e142f99e4861933b2c8.js
Normal file
File diff suppressed because one or more lines are too long
15
common.js
15
common.js
@ -15,10 +15,6 @@ common.secret_key = crypto.randomBytes(64).toString('hex');
|
||||
common.nodes = [];
|
||||
common.selectedNode = {};
|
||||
|
||||
common.getSelectedNode = () => {
|
||||
return common.selectedNode;
|
||||
};
|
||||
|
||||
common.getSelLNDServerUrl = () => {
|
||||
return common.selectedNode.lnd_server_url;
|
||||
};
|
||||
@ -28,6 +24,7 @@ common.getOptions = () => {
|
||||
};
|
||||
|
||||
common.setOptions = () => {
|
||||
if(common.nodes[0].options) { return; }
|
||||
common.nodes.forEach(node => {
|
||||
node.options = {
|
||||
url: '',
|
||||
@ -39,6 +36,16 @@ common.setOptions = () => {
|
||||
form: ''
|
||||
};
|
||||
});
|
||||
// Options cannot be set before selected node initializes. Updating selected node's options separatly
|
||||
common.selectedNode.options = {
|
||||
url: '',
|
||||
rejectUnauthorized: false,
|
||||
json: true,
|
||||
headers: {
|
||||
'Grpc-Metadata-macaroon': fs.readFileSync(common.selectedNode.macaroon_path + '/admin.macaroon').toString('hex'),
|
||||
},
|
||||
form: ''
|
||||
};
|
||||
}
|
||||
|
||||
common.findNode = (selNodeIndex) => {
|
||||
|
@ -379,9 +379,11 @@ connect.setServerConfiguration = () => {
|
||||
if ((!multiNodeExists && singleNodeExists) || (!multiNodeExists && !singleNodeExists)) {
|
||||
common.multi_node_setup = false;
|
||||
connect.setSingleNodeConfiguration(singleNodeConfFile);
|
||||
common.selectedNode = common.findNode(common.nodes[0].index);
|
||||
} else if ((multiNodeExists && singleNodeExists) || (multiNodeExists && !singleNodeExists)) {
|
||||
common.multi_node_setup = true;
|
||||
connect.setMultiNodeConfiguration(multiNodeConfFile);
|
||||
common.selectedNode = common.findNode(common.nodes[0].index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,9 @@ var logger = require('./logger');
|
||||
var common = require('../common');
|
||||
|
||||
exports.updateSelectedNode = (req, res, next) => {
|
||||
const selNodeIndex = req.body.selNodeIndex
|
||||
const selNodeIndex = req.body.selNodeIndex;
|
||||
common.selectedNode = common.findNode(selNodeIndex);
|
||||
logger.info('\r\nConf: 9: ' + JSON.stringify(Date.now()) + ': INFO: Selected Node Updated!' + JSON.stringify(common.selectedNode));
|
||||
res.status(200).json({status: 'Selected Node Updated!'});
|
||||
};
|
||||
|
||||
|
@ -4,12 +4,10 @@ var logger = require('./logger');
|
||||
var options = {};
|
||||
|
||||
exports.getInfo = (req, res, next) => {
|
||||
// Do Not Change the set options & selected Node code sequence
|
||||
common.setOptions();
|
||||
common.selectedNode = common.findNode(common.nodes[0].index);
|
||||
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNDServerUrl() + '/getinfo';
|
||||
logger.info('\r\nSelected Node: ' + JSON.stringify(common.selectedNode));
|
||||
logger.info('\r\nCalling getinfo from lnd server url: INFO: ' + options.url);
|
||||
request(options).then((body) => {
|
||||
logger.info('\r\nGetInfo: 9: ' + JSON.stringify(Date.now()) + ': INFO: ' + JSON.stringify(body));
|
||||
|
@ -1,7 +1,7 @@
|
||||
var fs = require('fs');
|
||||
var common = require('../common');
|
||||
|
||||
exports.info = (msgStr, selNode = common.nodes[0]) => {
|
||||
exports.info = (msgStr, selNode = common.selectedNode) => {
|
||||
if (msgStr.indexOf('Config Setup Variable') === -1) {
|
||||
console.log('Console: ' + msgStr);
|
||||
}
|
||||
@ -16,7 +16,7 @@ exports.info = (msgStr, selNode = common.nodes[0]) => {
|
||||
}
|
||||
}
|
||||
|
||||
exports.error = (msgStr, selNode = common.nodes[0]) => {
|
||||
exports.error = (msgStr, selNode = common.selectedNode) => {
|
||||
console.error('Console: ' + msgStr);
|
||||
if(selNode.enable_logging) {
|
||||
fs.appendFile(selNode.log_file, msgStr, function(err) {
|
||||
|
@ -6,6 +6,6 @@ const authCheck = require("./authCheck");
|
||||
router.get("/rtlconf", RTLConfController.getRTLConfig);
|
||||
router.post("/", authCheck, RTLConfController.updateUISettings);
|
||||
router.get("/config/:nodeType", authCheck, RTLConfController.getConfig);
|
||||
router.post("/updateSelNode", authCheck, RTLConfController.updateSelectedNode);
|
||||
router.post("/updateSelNode", RTLConfController.updateSelectedNode);
|
||||
|
||||
module.exports = router;
|
||||
|
@ -15,10 +15,10 @@
|
||||
<h2>Ride The Lightning <span class="font-60-percent">(Beta)</span></h2>
|
||||
</div>
|
||||
<div fxLayoutAlign="space-between center">
|
||||
<div *ngIf="appConfig.nodes.length > 0" tabindex="1" fxLayoutAlign="start start" class="nodes-list">
|
||||
<div *ngIf="appConfig.nodes.length > 1" tabindex="1" fxLayoutAlign="start start" class="nodes-list">
|
||||
<mat-form-field fxFlex="99">
|
||||
<mat-select (selectionChange)="onSelectionChange($event.value)">
|
||||
<mat-option *ngFor="let node of appConfig.nodes; index as idx" [value]="idx">
|
||||
<mat-select (selectionChange)="onSelectionChange($event.value)" [value]="selNode">
|
||||
<mat-option *ngFor="let node of appConfig.nodes; index as idx" [value]="node">
|
||||
{{node.index}}: {{node.lnNode}} ({{node.lnImplementation}})
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
@ -7,7 +7,7 @@ import { Actions } from '@ngrx/effects';
|
||||
import { UserIdleService } from 'angular-user-idle';
|
||||
|
||||
import { LoggerService } from './shared/services/logger.service';
|
||||
import { RTLConfiguration, Settings } from './shared/models/RTLconfig';
|
||||
import { RTLConfiguration, Settings, Node } from './shared/models/RTLconfig';
|
||||
import { GetInfo } from './shared/models/lndModels';
|
||||
|
||||
import * as RTLActions from './shared/store/rtl.actions';
|
||||
@ -21,7 +21,7 @@ import * as fromRTLReducer from './shared/store/rtl.reducers';
|
||||
export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
@ViewChild('sideNavigation') sideNavigation: any;
|
||||
@ViewChild('settingSidenav') settingSidenav: any;
|
||||
public selNodeIndex = 0;
|
||||
public selNode: Node;
|
||||
public settings: Settings;
|
||||
public information: GetInfo = {};
|
||||
public flgLoading: Array<Boolean | 'error'> = [true]; // 0: Info
|
||||
@ -40,20 +40,20 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.store.select('rtlRoot')
|
||||
.pipe(takeUntil(this.unsubs[0]))
|
||||
.subscribe(rtlStore => {
|
||||
this.selNodeIndex = rtlStore.selNodeIndex;
|
||||
this.settings = rtlStore.appConfig.nodes[this.selNodeIndex].settings;
|
||||
this.selNode = rtlStore.selNode;
|
||||
this.settings = this.selNode.settings;
|
||||
this.appConfig = rtlStore.appConfig;
|
||||
this.information = rtlStore.information;
|
||||
this.flgLoading[0] = (undefined !== this.information.identity_pubkey) ? false : true;
|
||||
if (window.innerWidth <= 768) {
|
||||
this.appConfig.nodes[this.selNodeIndex].settings.menu = 'Vertical';
|
||||
this.appConfig.nodes[this.selNodeIndex].settings.flgSidenavOpened = false;
|
||||
this.appConfig.nodes[this.selNodeIndex].settings.flgSidenavPinned = false;
|
||||
this.settings.menu = 'Vertical';
|
||||
this.settings.flgSidenavOpened = false;
|
||||
this.settings.flgSidenavPinned = false;
|
||||
}
|
||||
if (window.innerWidth <= 414) {
|
||||
this.smallScreen = true;
|
||||
}
|
||||
this.logger.info(this.appConfig.nodes[this.selNodeIndex].settings);
|
||||
this.logger.info(this.settings);
|
||||
if (!sessionStorage.getItem('token')) {
|
||||
this.flgLoading[0] = false;
|
||||
}
|
||||
@ -75,9 +75,9 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
if (
|
||||
this.appConfig.nodes[this.selNodeIndex].settings.menu === 'Horizontal' ||
|
||||
this.appConfig.nodes[this.selNodeIndex].settings.menuType === 'Compact' ||
|
||||
this.appConfig.nodes[this.selNodeIndex].settings.menuType === 'Mini') {
|
||||
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
|
||||
setTimeout(() => { this.settingSidenav.toggle(); }, 100);
|
||||
}
|
||||
@ -126,7 +126,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
if (!this.appConfig.nodes[this.selNodeIndex].settings.flgSidenavPinned) {
|
||||
if (!this.settings.flgSidenavPinned) {
|
||||
this.sideNavigation.close();
|
||||
this.settingSidenav.toggle();
|
||||
}
|
||||
@ -139,9 +139,9 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
@HostListener('window:resize')
|
||||
public onWindowResize(): void {
|
||||
if (window.innerWidth <= 768) {
|
||||
this.appConfig.nodes[this.selNodeIndex].settings.menu = 'Vertical';
|
||||
this.appConfig.nodes[this.selNodeIndex].settings.flgSidenavOpened = false;
|
||||
this.appConfig.nodes[this.selNodeIndex].settings.flgSidenavPinned = false;
|
||||
this.settings.menu = 'Vertical';
|
||||
this.settings.flgSidenavOpened = false;
|
||||
this.settings.flgSidenavPinned = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,10 +161,10 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.logger.info('Copied Text: ' + payload);
|
||||
}
|
||||
|
||||
onSelectionChange(val: number) {
|
||||
console.warn(val);
|
||||
this.selNodeIndex = val;
|
||||
this.store.dispatch(new RTLActions.SetSelNodeIndex(this.selNodeIndex));
|
||||
onSelectionChange(selNodeValue: Node) {
|
||||
this.selNode = selNodeValue;
|
||||
this.store.dispatch(new RTLActions.OpenSpinner('Updating Selected Node...'));
|
||||
this.store.dispatch(new RTLActions.SetSelelectedNode(selNodeValue));
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
@ -9,7 +9,7 @@
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<div class="padding-gap">
|
||||
<h3 *ngIf="settings?.satsToBTC; else smallerUnit">Total Limbo Balance:
|
||||
<h3 *ngIf="selNode?.settings?.satsToBTC; else smallerUnit">Total Limbo Balance:
|
||||
{{pendingChannels.btc_total_limbo_balance | number}} {{information?.currency_unit}}</h3>
|
||||
<ng-template #smallerUnit>
|
||||
<h3>Total Limbo Balance: {{pendingChannels.total_limbo_balance | number}}
|
||||
|
@ -5,7 +5,7 @@ import { Store } from '@ngrx/store';
|
||||
|
||||
import { MatTableDataSource, MatSort } from '@angular/material';
|
||||
import { Channel, GetInfo, PendingChannels } from '../../../shared/models/lndModels';
|
||||
import { Settings } from '../../../shared/models/RTLconfig';
|
||||
import { Node } from '../../../shared/models/RTLconfig';
|
||||
import { LoggerService } from '../../../shared/services/logger.service';
|
||||
|
||||
import { RTLEffects } from '../../../shared/store/rtl.effects';
|
||||
@ -19,9 +19,8 @@ import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
|
||||
})
|
||||
export class ChannelPendingComponent implements OnInit, OnDestroy {
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
public selNodeIndex = 0;
|
||||
public selNode: Node;
|
||||
public selectedFilter = 0;
|
||||
public settings: Settings;
|
||||
public information: GetInfo = {};
|
||||
public pendingChannels: PendingChannels = {};
|
||||
public displayedClosingColumns = [
|
||||
@ -106,8 +105,7 @@ export class ChannelPendingComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
|
||||
this.selNodeIndex = rtlStore.selNodeIndex;
|
||||
this.settings = rtlStore.appConfig.nodes[this.selNodeIndex].settings;
|
||||
this.selNode = rtlStore.selNode;
|
||||
this.information = rtlStore.information;
|
||||
this.pendingChannels = rtlStore.pendingChannels;
|
||||
if (undefined !== this.pendingChannels.total_limbo_balance) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
<mat-icon class="icon-large">account_balance_wallet</mat-icon>
|
||||
</mat-card-content>
|
||||
<span *ngIf="information?.currency_unit; else withoutData">
|
||||
<h3 *ngIf="settings?.satsToBTC; else smallerUnit1">{{BTCtotalBalance | number}} {{information?.currency_unit}}</h3>
|
||||
<h3 *ngIf="selNode?.settings?.satsToBTC; else smallerUnit1">{{BTCtotalBalance | number}} {{information?.currency_unit}}</h3>
|
||||
<ng-template #smallerUnit1><h3>{{totalBalance | number}} {{information?.smaller_currency_unit}}</h3></ng-template>
|
||||
</span>
|
||||
</mat-card-content>
|
||||
@ -51,7 +51,7 @@
|
||||
<mat-icon class="icon-large">linear_scale</mat-icon>
|
||||
</mat-card-content>
|
||||
<span *ngIf="information?.currency_unit; else withoutData">
|
||||
<h3 *ngIf="settings?.satsToBTC; else smallerUnit2">{{BTCchannelBalance | number}} {{information?.currency_unit}}</h3>
|
||||
<h3 *ngIf="selNode?.settings?.satsToBTC; else smallerUnit2">{{BTCchannelBalance | number}} {{information?.currency_unit}}</h3>
|
||||
<ng-template #smallerUnit2><h3>{{channelBalance | number}} {{information?.smaller_currency_unit}}</h3></ng-template>
|
||||
</span>
|
||||
</mat-card-content>
|
||||
@ -180,8 +180,8 @@
|
||||
<mat-card-content>
|
||||
<div fxLayout="column" class="pl-4 network-info-list">
|
||||
<mat-list fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="65" fxLayoutAlign="start start" *ngIf="settings?.satsToBTC; else smallerUnit6">Network Capacity ({{information?.currency_unit}})</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="end start" *ngIf="settings?.satsToBTC; else smallerData6">{{networkInfo?.btc_total_network_capacity | number}}</mat-list-item>
|
||||
<mat-list-item fxFlex="65" fxLayoutAlign="start start" *ngIf="selNode?.settings?.satsToBTC; else smallerUnit6">Network Capacity ({{information?.currency_unit}})</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="end start" *ngIf="selNode?.settings?.satsToBTC; else smallerData6">{{networkInfo?.btc_total_network_capacity | number}}</mat-list-item>
|
||||
<ng-template #smallerUnit6><mat-list-item fxFlex="65" fxLayoutAlign="start start">Network Capacity ({{information?.smaller_currency_unit}})</mat-list-item></ng-template>
|
||||
<ng-template #smallerData6><mat-list-item fxFlex="25" fxLayoutAlign="end start">{{networkInfo?.total_network_capacity | number}}</mat-list-item></ng-template>
|
||||
<mat-divider></mat-divider>
|
||||
@ -207,23 +207,23 @@
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
<mat-list fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="65" fxLayoutAlign="start start" *ngIf="settings?.satsToBTC; else smallerUnit7">Max Channel Size ({{information?.currency_unit}})</mat-list-item>
|
||||
<mat-list-item fxFlex="65" fxLayoutAlign="start start" *ngIf="selNode?.settings?.satsToBTC; else smallerUnit7">Max Channel Size ({{information?.currency_unit}})</mat-list-item>
|
||||
<ng-template #smallerUnit7><mat-list-item fxFlex="65" fxLayoutAlign="start start">Max Channel Size ({{information?.smaller_currency_unit}})</mat-list-item></ng-template>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="end start" *ngIf="settings?.satsToBTC; else smallerData7">{{networkInfo?.btc_max_channel_size | number}}</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="end start" *ngIf="selNode?.settings?.satsToBTC; else smallerData7">{{networkInfo?.btc_max_channel_size | number}}</mat-list-item>
|
||||
<ng-template #smallerData7><mat-list-item fxFlex="25" fxLayoutAlign="end start">{{networkInfo?.max_channel_size | number}}</mat-list-item></ng-template>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
<mat-list fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="65" fxLayoutAlign="start start" *ngIf="settings?.satsToBTC; else smallerUnit8">Avg Channel Size ({{information?.currency_unit}})</mat-list-item>
|
||||
<mat-list-item fxFlex="65" fxLayoutAlign="start start" *ngIf="selNode?.settings?.satsToBTC; else smallerUnit8">Avg Channel Size ({{information?.currency_unit}})</mat-list-item>
|
||||
<ng-template #smallerUnit8><mat-list-item fxFlex="65" fxLayoutAlign="start start">Avg Channel Size ({{information?.smaller_currency_unit}})</mat-list-item></ng-template>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="end start" *ngIf="settings?.satsToBTC; else smallerData8">{{networkInfo?.btc_avg_channel_size | number}}</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="end start" *ngIf="selNode?.settings?.satsToBTC; else smallerData8">{{networkInfo?.btc_avg_channel_size | number}}</mat-list-item>
|
||||
<ng-template #smallerData8><mat-list-item fxFlex="25" fxLayoutAlign="end start">{{networkInfo?.avg_channel_size | number:'1.0-2'}}</mat-list-item></ng-template>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
<mat-list fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="65" fxLayoutAlign="start start" *ngIf="settings?.satsToBTC; else smallerUnit9">Min Channel Size ({{information?.currency_unit}})</mat-list-item>
|
||||
<mat-list-item fxFlex="65" fxLayoutAlign="start start" *ngIf="selNode?.settings?.satsToBTC; else smallerUnit9">Min Channel Size ({{information?.currency_unit}})</mat-list-item>
|
||||
<ng-template #smallerUnit9><mat-list-item fxFlex="65" fxLayoutAlign="start start">Min Channel Size ({{information?.smaller_currency_unit}})</mat-list-item></ng-template>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="end start" *ngIf="settings?.satsToBTC; else smallerData9">{{networkInfo?.btc_min_channel_size | number}}</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="end start" *ngIf="selNode?.settings?.satsToBTC; else smallerData9">{{networkInfo?.btc_min_channel_size | number}}</mat-list-item>
|
||||
<ng-template #smallerData9><mat-list-item fxFlex="25" fxLayoutAlign="end start">{{networkInfo?.min_channel_size | number}}</mat-list-item></ng-template>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
|
@ -5,7 +5,7 @@ import { Store } from '@ngrx/store';
|
||||
|
||||
import { LoggerService } from '../../shared/services/logger.service';
|
||||
import { GetInfo, NetworkInfo, Fees, Peer } from '../../shared/models/lndModels';
|
||||
import { Settings } from '../../shared/models/RTLconfig';
|
||||
import { Node } from '../../shared/models/RTLconfig';
|
||||
|
||||
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
|
||||
|
||||
@ -15,8 +15,7 @@ import * as fromRTLReducer from '../../shared/store/rtl.reducers';
|
||||
styleUrls: ['./home.component.scss']
|
||||
})
|
||||
export class HomeComponent implements OnInit, OnDestroy {
|
||||
public selNodeIndex = 0;
|
||||
public settings: Settings;
|
||||
public selNode: Node;
|
||||
public fees: Fees;
|
||||
public information: GetInfo = {};
|
||||
public remainder = 0;
|
||||
@ -89,8 +88,7 @@ export class HomeComponent implements OnInit, OnDestroy {
|
||||
this.flgLoading[6] = 'error';
|
||||
}
|
||||
});
|
||||
this.selNodeIndex = rtlStore.selNodeIndex;
|
||||
this.settings = rtlStore.appConfig.nodes[this.selNodeIndex].settings;
|
||||
this.selNode = rtlStore.selNode;
|
||||
this.information = rtlStore.information;
|
||||
if (this.flgLoading[0] !== 'error') {
|
||||
this.flgLoading[0] = (undefined !== this.information.identity_pubkey) ? false : true;
|
||||
|
@ -48,8 +48,8 @@
|
||||
<td mat-cell *matCellDef="let invoice">{{invoice.memo}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="value">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Value ({{(settings?.satsToBTC) ? information?.currency_unit : information?.smaller_currency_unit}}) </th>
|
||||
<td mat-cell *matCellDef="let invoice"><span fxLayoutAlign="end center"> {{(settings?.satsToBTC) ? (invoice?.btc_value | number:'1.0-3') : (invoice?.value | number)}} </span></td>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Value ({{(selNode?.settings?.satsToBTC) ? information?.currency_unit : information?.smaller_currency_unit}}) </th>
|
||||
<td mat-cell *matCellDef="let invoice"><span fxLayoutAlign="end center"> {{(selNode?.settings?.satsToBTC) ? (invoice?.btc_value | number:'1.0-3') : (invoice?.value | number)}} </span></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="settled">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Settled </th>
|
||||
@ -64,8 +64,8 @@
|
||||
<td mat-cell *matCellDef="let invoice"><span fxLayoutAlign="end center"> {{invoice.cltv_expiry | number}} </span></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="amt_paid_sat">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Amount Paid ({{(settings?.satsToBTC) ? information?.currency_unit : information?.smaller_currency_unit}})</th>
|
||||
<td mat-cell *matCellDef="let invoice"><span fxLayoutAlign="end center"> {{(settings?.satsToBTC) ? (invoice?.btc_amt_paid_sat | number:'1.0-3') : (invoice?.amt_paid_sat | number)}} </span></td>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Amount Paid ({{(selNode?.settings?.satsToBTC) ? information?.currency_unit : information?.smaller_currency_unit}})</th>
|
||||
<td mat-cell *matCellDef="let invoice"><span fxLayoutAlign="end center"> {{(selNode?.settings?.satsToBTC) ? (invoice?.btc_amt_paid_sat | number:'1.0-3') : (invoice?.amt_paid_sat | number)}} </span></td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: flgSticky;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [@newlyAddedRowAnimation]="(row.memo === newlyAddedInvoiceMemo && row.value === newlyAddedInvoiceValue && flgAnimate) ? 'added' : 'notAdded'" (click)="onInvoiceClick(row, $event)"></tr>
|
||||
|
@ -6,7 +6,7 @@ import { Store } from '@ngrx/store';
|
||||
import { Actions } from '@ngrx/effects';
|
||||
|
||||
import { MatTableDataSource, MatSort } from '@angular/material';
|
||||
import { Settings } from '../../shared/models/RTLconfig';
|
||||
import { Node } from '../../shared/models/RTLconfig';
|
||||
import { GetInfo, Invoice } from '../../shared/models/lndModels';
|
||||
import { LoggerService } from '../../shared/services/logger.service';
|
||||
|
||||
@ -22,11 +22,10 @@ import * as fromRTLReducer from '../../shared/store/rtl.reducers';
|
||||
})
|
||||
export class InvoicesComponent implements OnInit, OnDestroy {
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
public selNodeIndex = 0;
|
||||
public selNode: Node;
|
||||
public newlyAddedInvoiceMemo = '';
|
||||
public newlyAddedInvoiceValue = 0;
|
||||
public flgAnimate = true;
|
||||
public settings: Settings;
|
||||
public memo = '';
|
||||
public invoiceValue: number;
|
||||
public displayedColumns = [];
|
||||
@ -68,8 +67,7 @@ export class InvoicesComponent implements OnInit, OnDestroy {
|
||||
this.flgLoading[0] = 'error';
|
||||
}
|
||||
});
|
||||
this.selNodeIndex = rtlStore.selNodeIndex;
|
||||
this.settings = rtlStore.appConfig.nodes[this.selNodeIndex].settings;
|
||||
this.selNode = rtlStore.selNode;
|
||||
this.information = rtlStore.information;
|
||||
this.logger.info(rtlStore);
|
||||
this.loadInvoicesTable(rtlStore.invoices);
|
||||
|
@ -9,7 +9,7 @@ import { environment } from '../../../../environments/environment';
|
||||
import { FlatTreeControl } from '@angular/cdk/tree';
|
||||
import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
|
||||
|
||||
import { Settings } from '../../../shared/models/RTLconfig';
|
||||
import { Node, Settings } from '../../../shared/models/RTLconfig';
|
||||
import { LoggerService } from '../../../shared/services/logger.service';
|
||||
import { GetInfo, GetInfoChain } from '../../../shared/models/lndModels';
|
||||
import { MenuNode, FlatMenuNode, MENU_DATA } from '../../../shared/models/navMenu';
|
||||
@ -25,9 +25,9 @@ import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
|
||||
})
|
||||
export class SideNavigationComponent implements OnInit, OnDestroy {
|
||||
@Output() ChildNavClicked = new EventEmitter<any>();
|
||||
public selNodeIndex = 0;
|
||||
public version = '';
|
||||
public selNode: Node;
|
||||
public settings: Settings;
|
||||
public version = '';
|
||||
public information: GetInfo = {};
|
||||
public informationChain: GetInfoChain = {};
|
||||
public flgLoading = true;
|
||||
@ -63,8 +63,8 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
|
||||
this.store.select('rtlRoot')
|
||||
.pipe(takeUntil(this.unSubs[0]))
|
||||
.subscribe((rtlStore: fromRTLReducer.State) => {
|
||||
this.selNodeIndex = rtlStore.selNodeIndex;
|
||||
this.settings = rtlStore.appConfig.nodes[this.selNodeIndex].settings;
|
||||
this.selNode = rtlStore.selNode;
|
||||
this.settings = this.selNode.settings;
|
||||
this.information = rtlStore.information;
|
||||
this.numPendingChannels = rtlStore.numberOfPendingChannels;
|
||||
|
||||
|
@ -4,7 +4,7 @@ import { takeUntil, filter } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Actions } from '@ngrx/effects';
|
||||
|
||||
import { Settings } from '../../../shared/models/RTLconfig';
|
||||
import { Node } from '../../../shared/models/RTLconfig';
|
||||
import { LoggerService } from '../../../shared/services/logger.service';
|
||||
import { GetInfo, GetInfoChain } from '../../../shared/models/lndModels';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
@ -19,8 +19,7 @@ import * as RTLActions from '../../../shared/store/rtl.actions';
|
||||
styleUrls: ['./top-menu.component.scss']
|
||||
})
|
||||
export class TopMenuComponent implements OnInit, OnDestroy {
|
||||
public selNodeIndex = 0;
|
||||
public settings: Settings;
|
||||
public selNode: Node;
|
||||
public version = '';
|
||||
public information: GetInfo = {};
|
||||
public informationChain: GetInfoChain = {};
|
||||
@ -36,8 +35,7 @@ export class TopMenuComponent implements OnInit, OnDestroy {
|
||||
this.store.select('rtlRoot')
|
||||
.pipe(takeUntil(this.unSubs[0]))
|
||||
.subscribe((rtlStore: fromRTLReducer.State) => {
|
||||
this.selNodeIndex = rtlStore.selNodeIndex;
|
||||
this.settings = rtlStore.appConfig.nodes[this.selNodeIndex].settings;
|
||||
this.selNode = rtlStore.selNode;
|
||||
|
||||
this.information = rtlStore.information;
|
||||
this.flgLoading = (undefined !== this.information.identity_pubkey) ? false : true;
|
||||
|
@ -5,7 +5,7 @@ import { takeUntil } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { MatTableDataSource, MatSort } from '@angular/material';
|
||||
import { Settings } from '../../shared/models/RTLconfig';
|
||||
import { Node } from '../../shared/models/RTLconfig';
|
||||
import { GetInfo, Payment, PayRequest } from '../../shared/models/lndModels';
|
||||
import { LoggerService } from '../../shared/services/logger.service';
|
||||
|
||||
@ -23,10 +23,9 @@ import * as fromRTLReducer from '../../shared/store/rtl.reducers';
|
||||
export class PaymentsComponent implements OnInit, OnDestroy {
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
@ViewChild('sendPaymentForm') form;
|
||||
public selNodeIndex = 0;
|
||||
public selNode: Node;
|
||||
public newlyAddedPayment = '';
|
||||
public flgAnimate = true;
|
||||
public settings: Settings;
|
||||
public flgLoading: Array<Boolean | 'error'> = [true];
|
||||
public information: GetInfo = {};
|
||||
public payments: any;
|
||||
@ -68,8 +67,7 @@ export class PaymentsComponent implements OnInit, OnDestroy {
|
||||
this.flgLoading[0] = 'error';
|
||||
}
|
||||
});
|
||||
this.selNodeIndex = rtlStore.selNodeIndex;
|
||||
this.settings = rtlStore.appConfig.nodes[this.selNodeIndex].settings;
|
||||
this.selNode = rtlStore.selNode;
|
||||
this.information = rtlStore.information;
|
||||
this.paymentJSONArr = (rtlStore.payments.length > 0) ? rtlStore.payments : [];
|
||||
this.payments = (undefined === rtlStore.payments) ? new MatTableDataSource([]) : new MatTableDataSource<Payment>([...this.paymentJSONArr]);
|
||||
|
@ -3,10 +3,10 @@ import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { Node } from '../../shared/models/RTLconfig';
|
||||
import { RTLEffects } from '../../shared/store/rtl.effects';
|
||||
import * as RTLActions from '../../shared/store/rtl.actions';
|
||||
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
|
||||
import { Authentication } from '../../shared/models/RTLconfig';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-server-config',
|
||||
@ -14,9 +14,8 @@ import { Authentication } from '../../shared/models/RTLconfig';
|
||||
styleUrls: ['./server-config.component.scss']
|
||||
})
|
||||
export class ServerConfigComponent implements OnInit, OnDestroy {
|
||||
public selNodeIndex = 0;
|
||||
public selNode: Node;
|
||||
public selectedNodeType = 'lnd';
|
||||
public authSettings: Authentication = {};
|
||||
public showLND = false;
|
||||
public showBitcoind = false;
|
||||
public configData = '';
|
||||
@ -34,12 +33,11 @@ export class ServerConfigComponent implements OnInit, OnDestroy {
|
||||
this.resetData();
|
||||
}
|
||||
});
|
||||
this.selNodeIndex = rtlStore.selNodeIndex;
|
||||
this.authSettings = rtlStore.appConfig.nodes[this.selNodeIndex].authentication;
|
||||
if (undefined !== this.authSettings && this.authSettings.lndConfigPath !== '') {
|
||||
this.selNode = rtlStore.selNode;
|
||||
if (undefined !== this.selNode.authentication && this.selNode.authentication.lndConfigPath !== '') {
|
||||
this.showLND = true;
|
||||
}
|
||||
if (undefined !== this.authSettings && undefined !== this.authSettings.bitcoindConfigPath && this.authSettings.bitcoindConfigPath !== '') {
|
||||
if (undefined !== this.selNode.authentication && undefined !== this.selNode.authentication.bitcoindConfigPath && this.selNode.authentication.bitcoindConfigPath !== '') {
|
||||
this.showBitcoind = true;
|
||||
}
|
||||
});
|
||||
|
@ -3,6 +3,7 @@ import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { Node } from '../../shared/models/RTLconfig';
|
||||
import { LoggerService } from '../../shared/services/logger.service';
|
||||
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
|
||||
import * as RTLActions from '../../shared/store/rtl.actions';
|
||||
@ -13,7 +14,7 @@ import * as RTLActions from '../../shared/store/rtl.actions';
|
||||
styleUrls: ['./signin.component.scss']
|
||||
})
|
||||
export class SigninComponent implements OnInit, OnDestroy {
|
||||
public selNodeIndex = 0;
|
||||
public selNode: Node;
|
||||
public password = '';
|
||||
public nodeAuthType = '';
|
||||
public rtlSSO = 0;
|
||||
@ -32,8 +33,8 @@ export class SigninComponent implements OnInit, OnDestroy {
|
||||
rtlStore.effectErrors.forEach(effectsErr => {
|
||||
this.logger.error(effectsErr);
|
||||
});
|
||||
this.selNodeIndex = rtlStore.selNodeIndex;
|
||||
this.nodeAuthType = rtlStore.appConfig.nodes[this.selNodeIndex].authentication.nodeAuthType;
|
||||
this.selNode = rtlStore.selNode;
|
||||
this.nodeAuthType = this.selNode.authentication.nodeAuthType;
|
||||
this.logger.info(rtlStore);
|
||||
if (this.nodeAuthType.toUpperCase() === 'DEFAULT') {
|
||||
this.hintStr = 'Enter RPC password';
|
||||
|
@ -33,7 +33,7 @@
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="block_hash">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Block Hash </th>
|
||||
<td mat-cell *matCellDef="let trans"> {{trans.block_hash | slice:0:10}}...</td>
|
||||
<td mat-cell *matCellDef="let trans" class="ellipsis-parent"><span class="ellipsis-child">{{trans.block_hash | removeleadingzeros}}</span></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="block_height">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Block Height </th>
|
||||
@ -41,7 +41,7 @@
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="tx_hash">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Txn Hash </th>
|
||||
<td mat-cell *matCellDef="let trans"><div>{{trans.tx_hash | slice:0:10}}...</div></td>
|
||||
<td mat-cell *matCellDef="let trans" class="ellipsis-parent"><span class="ellipsis-child">{{trans.tx_hash}}</span></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="amount">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Amount </th>
|
||||
|
@ -17,3 +17,16 @@
|
||||
table {
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.ellipsis-parent {
|
||||
min-width: 20px;
|
||||
display: flex;
|
||||
padding: 13px 0 13px 12px;
|
||||
}
|
||||
|
||||
.ellipsis-child {
|
||||
max-width:97%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
</svg>
|
||||
</mat-card-content>
|
||||
<span *ngIf="information?.currency_unit; else withoutData">
|
||||
<h3 *ngIf="settings?.satsToBTC; else smallerUnit1">{{blockchainBalance?.btc_total_balance | number}} {{information?.currency_unit}}</h3>
|
||||
<h3 *ngIf="selNode?.settings?.satsToBTC; else smallerUnit1">{{blockchainBalance?.btc_total_balance | number}} {{information?.currency_unit}}</h3>
|
||||
<ng-template #smallerUnit1><h3>{{blockchainBalance?.total_balance | number}} {{information?.smaller_currency_unit}}</h3></ng-template>
|
||||
</span>
|
||||
</mat-card-content>
|
||||
@ -40,7 +40,7 @@
|
||||
</svg>
|
||||
</mat-card-content>
|
||||
<span *ngIf="information?.currency_unit; else withoutData">
|
||||
<h3 *ngIf="settings?.satsToBTC; else smallerUnit2">{{blockchainBalance?.btc_confirmed_balance | number}} {{information?.currency_unit}}</h3>
|
||||
<h3 *ngIf="selNode?.settings?.satsToBTC; else smallerUnit2">{{blockchainBalance?.btc_confirmed_balance | number}} {{information?.currency_unit}}</h3>
|
||||
<ng-template #smallerUnit2><h3>{{blockchainBalance?.confirmed_balance | number}} {{information?.smaller_currency_unit}}</h3></ng-template>
|
||||
</span>
|
||||
</mat-card-content>
|
||||
@ -63,7 +63,7 @@
|
||||
</svg>
|
||||
</mat-card-content>
|
||||
<span *ngIf="information?.currency_unit; else withoutData">
|
||||
<h3 *ngIf="settings?.satsToBTC; else smallerUnit3">{{blockchainBalance?.btc_unconfirmed_balance | number}} {{information?.currency_unit}}</h3>
|
||||
<h3 *ngIf="selNode?.settings?.satsToBTC; else smallerUnit3">{{blockchainBalance?.btc_unconfirmed_balance | number}} {{information?.currency_unit}}</h3>
|
||||
<ng-template #smallerUnit3><h3>{{blockchainBalance?.unconfirmed_balance | number}} {{information?.smaller_currency_unit}}</h3></ng-template>
|
||||
</span>
|
||||
</mat-card-content>
|
||||
|
@ -3,7 +3,7 @@ import { Subject } from 'rxjs';
|
||||
import { takeUntil, take } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { Settings } from '../../../shared/models/RTLconfig';
|
||||
import { Node } from '../../../shared/models/RTLconfig';
|
||||
import { GetInfo, Balance, ChannelsTransaction, AddressType } from '../../../shared/models/lndModels';
|
||||
import { RTLConfiguration } from '../../../shared/models/RTLconfig';
|
||||
import { LoggerService } from '../../../shared/services/logger.service';
|
||||
@ -18,8 +18,7 @@ import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
|
||||
styleUrls: ['./send-receive-trans.component.scss']
|
||||
})
|
||||
export class SendReceiveTransComponent implements OnInit, OnDestroy {
|
||||
public selNodeIndex = 0;
|
||||
public settings: Settings;
|
||||
public selNode: Node;
|
||||
public appConfig: RTLConfiguration;
|
||||
public addressTypes = [];
|
||||
public flgLoadingWallet: Boolean | 'error' = true;
|
||||
@ -44,8 +43,7 @@ export class SendReceiveTransComponent implements OnInit, OnDestroy {
|
||||
this.flgLoadingWallet = 'error';
|
||||
}
|
||||
});
|
||||
this.selNodeIndex = rtlStore.selNodeIndex;
|
||||
this.settings = rtlStore.appConfig.nodes[this.selNodeIndex].settings;
|
||||
this.selNode = rtlStore.selNode;
|
||||
this.appConfig = rtlStore.appConfig;
|
||||
this.information = rtlStore.information;
|
||||
this.addressTypes = rtlStore.addressTypes;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<h4>Currency Unit</h4>
|
||||
<div fxLayout="row" fxLayoutAlign="space-between center">
|
||||
<span>{{currencyUnit}}</span>
|
||||
<mat-slide-toggle [checked]="settings?.satsToBTC" (change)="toggleSettings('satsToBTC')" labelPosition="before"></mat-slide-toggle>
|
||||
<mat-slide-toggle [checked]="selNode?.settings?.satsToBTC" (change)="toggleSettings('satsToBTC')" labelPosition="before"></mat-slide-toggle>
|
||||
</div>
|
||||
<mat-divider class="mt-2"></mat-divider>
|
||||
<div *ngIf="showSettingOption">
|
||||
@ -27,12 +27,12 @@
|
||||
<h4>Sidenav Options</h4>
|
||||
<div fxLayout="row" fxLayoutAlign="space-between center">
|
||||
<span>Opened</span>
|
||||
<mat-slide-toggle [checked]="settings.flgSidenavOpened" (change)="toggleSettings('flgSidenavOpened')"
|
||||
<mat-slide-toggle [checked]="selNode?.settings?.flgSidenavOpened" (change)="toggleSettings('flgSidenavOpened')"
|
||||
labelPosition="before"></mat-slide-toggle>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="space-between center">
|
||||
<span>Pinned</span>
|
||||
<mat-slide-toggle [checked]="settings.flgSidenavPinned" (change)="toggleSettings('flgSidenavPinned')"
|
||||
<mat-slide-toggle [checked]="selNode?.settings?.flgSidenavPinned" (change)="toggleSettings('flgSidenavPinned')"
|
||||
labelPosition="before"></mat-slide-toggle>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3,7 +3,7 @@ import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { Settings } from '../../models/RTLconfig';
|
||||
import { Node } from '../../models/RTLconfig';
|
||||
import { GetInfo } from '../../models/lndModels';
|
||||
import { LoggerService } from '../../services/logger.service';
|
||||
|
||||
@ -16,9 +16,8 @@ import * as fromRTLReducer from '../../store/rtl.reducers';
|
||||
styleUrls: ['./settings-nav.component.scss']
|
||||
})
|
||||
export class SettingsNavComponent implements OnInit, OnDestroy {
|
||||
public selNodeIndex = 0;
|
||||
public selNode: Node;
|
||||
public information: GetInfo = {};
|
||||
public settings: Settings;
|
||||
public menus = ['Vertical', 'Horizontal'];
|
||||
public menuTypes = ['Regular', 'Compact', 'Mini'];
|
||||
public selectedMenu: string;
|
||||
@ -35,14 +34,13 @@ export class SettingsNavComponent implements OnInit, OnDestroy {
|
||||
this.store.select('rtlRoot')
|
||||
.pipe(takeUntil(this.unsubs[0]))
|
||||
.subscribe((rtlStore: fromRTLReducer.State) => {
|
||||
this.selNodeIndex = rtlStore.selNodeIndex;
|
||||
this.settings = rtlStore.appConfig.nodes[this.selNodeIndex].settings;
|
||||
this.selectedMenu = this.settings.menu;
|
||||
this.selectedMenuType = this.settings.menuType;
|
||||
this.selNode = rtlStore.selNode;
|
||||
this.selectedMenu = this.selNode.settings.menu;
|
||||
this.selectedMenuType = this.selNode.settings.menuType;
|
||||
if (window.innerWidth <= 768) {
|
||||
this.settings.menu = 'Vertical';
|
||||
this.settings.flgSidenavOpened = false;
|
||||
this.settings.flgSidenavPinned = false;
|
||||
this.selNode.settings.menu = 'Vertical';
|
||||
this.selNode.settings.flgSidenavOpened = false;
|
||||
this.selNode.settings.flgSidenavPinned = false;
|
||||
this.showSettingOption = false;
|
||||
}
|
||||
this.information = rtlStore.information;
|
||||
@ -52,24 +50,24 @@ export class SettingsNavComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public chooseMenu() {
|
||||
this.settings.menu = this.selectedMenu;
|
||||
this.selNode.settings.menu = this.selectedMenu;
|
||||
}
|
||||
|
||||
public chooseMenuType() {
|
||||
this.settings.menuType = this.selectedMenuType;
|
||||
this.selNode.settings.menuType = this.selectedMenuType;
|
||||
}
|
||||
|
||||
toggleSettings(toggleField: string) {
|
||||
this.settings[toggleField] = !this.settings[toggleField];
|
||||
this.selNode.settings[toggleField] = !this.selNode.settings[toggleField];
|
||||
}
|
||||
|
||||
changeTheme(newTheme: string) {
|
||||
this.settings.theme = newTheme;
|
||||
this.selNode.settings.theme = newTheme;
|
||||
}
|
||||
|
||||
onClose() {
|
||||
this.logger.info(this.settings);
|
||||
this.store.dispatch(new RTLActions.SaveSettings(this.settings));
|
||||
this.logger.info(this.selNode.settings);
|
||||
this.store.dispatch(new RTLActions.SaveSettings(this.selNode.settings));
|
||||
this.done.emit();
|
||||
}
|
||||
|
||||
|
12
src/app/shared/pipes/remove-leading-zero.pipe.ts
Normal file
12
src/app/shared/pipes/remove-leading-zero.pipe.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'removeleadingzeros'
|
||||
})
|
||||
export class RemoveLeadingZerosPipe implements PipeTransform {
|
||||
|
||||
transform(value: string, args?: any): string {
|
||||
return value.replace(/^[0]+/g, '');
|
||||
}
|
||||
|
||||
}
|
@ -15,6 +15,7 @@ import { NotFoundComponent } from './components/not-found/not-found.component';
|
||||
import { SettingsNavComponent } from './components/settings-nav/settings-nav.component';
|
||||
import { ClipboardDirective } from './directive/clipboard.directive';
|
||||
import { SsoFailedComponent } from './components/sso-failed/sso-failed.component';
|
||||
import { RemoveLeadingZerosPipe } from './pipes/remove-leading-zero.pipe';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@ -82,7 +83,8 @@ import { SsoFailedComponent } from './components/sso-failed/sso-failed.component
|
||||
NotFoundComponent,
|
||||
SettingsNavComponent,
|
||||
ClipboardDirective,
|
||||
QRCodeModule
|
||||
QRCodeModule,
|
||||
RemoveLeadingZerosPipe
|
||||
],
|
||||
declarations: [
|
||||
AlertMessageComponent,
|
||||
@ -91,7 +93,8 @@ import { SsoFailedComponent } from './components/sso-failed/sso-failed.component
|
||||
NotFoundComponent,
|
||||
SettingsNavComponent,
|
||||
ClipboardDirective,
|
||||
SsoFailedComponent
|
||||
SsoFailedComponent,
|
||||
RemoveLeadingZerosPipe
|
||||
],
|
||||
entryComponents: [
|
||||
AlertMessageComponent,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Action } from '@ngrx/store';
|
||||
import { RTLConfiguration, Settings } from '../models/RTLconfig';
|
||||
import { RTLConfiguration, Settings, Node } from '../models/RTLconfig';
|
||||
import { ErrorPayload } from '../models/errorPayload';
|
||||
import {
|
||||
GetInfo, Peer, Balance, NetworkInfo, Fees, Channel, Invoice, Payment, GraphNode, AddressType,
|
||||
@ -20,7 +20,7 @@ export const SET_STORE = 'SET_STORE';
|
||||
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_SEL_NODE_INDEX = 'SET_SEL_NODE_INDEX';
|
||||
export const SET_SELECTED_NODE = 'SET_SELECTED_NODE';
|
||||
export const FETCH_INFO = 'FETCH_INFO';
|
||||
export const SET_INFO = 'SET_INFO';
|
||||
export const FETCH_PEERS = 'FETCH_PEERS';
|
||||
@ -126,9 +126,9 @@ export class SaveSettings implements Action {
|
||||
constructor(public payload: Settings) {}
|
||||
}
|
||||
|
||||
export class SetSelNodeIndex implements Action {
|
||||
readonly type = SET_SEL_NODE_INDEX;
|
||||
constructor(public payload: number) {}
|
||||
export class SetSelelectedNode implements Action {
|
||||
readonly type = SET_SELECTED_NODE;
|
||||
constructor(public payload: Node) {}
|
||||
}
|
||||
|
||||
export class FetchInfo implements Action {
|
||||
@ -387,7 +387,7 @@ export type RTLActions =
|
||||
ClearEffectError | EffectError | OpenSpinner | CloseSpinner |
|
||||
FetchRTLConfig | SetRTLConfig | SaveSettings |
|
||||
OpenAlert | CloseAlert | OpenConfirmation | CloseConfirmation |
|
||||
SetSelNodeIndex | FetchInfo | SetInfo |
|
||||
SetSelelectedNode | FetchInfo | SetInfo |
|
||||
FetchPeers | SetPeers | AddPeer | DetachPeer | SaveNewPeer | RemovePeer |
|
||||
AddInvoice | SaveNewInvoice | GetForwardingHistory | SetForwardingHistory |
|
||||
FetchFees | SetFees |
|
||||
|
@ -1041,6 +1041,44 @@ export class RTLEffects implements OnDestroy {
|
||||
})
|
||||
);
|
||||
|
||||
@Effect()
|
||||
setSelectedNode = this.actions$.pipe(
|
||||
ofType(RTLActions.SET_SELECTED_NODE),
|
||||
mergeMap((action: RTLActions.SetSelelectedNode) => {
|
||||
this.store.dispatch(new RTLActions.ClearEffectError('UpdateSelNode'));
|
||||
return this.httpClient.post(environment.CONF_API + '/updateSelNode', { selNodeIndex: action.payload.index })
|
||||
.pipe(
|
||||
map((postRes: any) => {
|
||||
this.logger.info(postRes);
|
||||
setTimeout(() => {
|
||||
this.store.dispatch(new RTLActions.CloseSpinner());
|
||||
}, 4000);
|
||||
if (sessionStorage.getItem('token')) {
|
||||
return { type: RTLActions.FETCH_INFO };
|
||||
} else {
|
||||
return {
|
||||
type: RTLActions.OPEN_ALERT,
|
||||
payload: { width: '70%', data: {type: 'WARN', titleMessage: 'Authorization required to get the data from the node!' }}
|
||||
};
|
||||
}
|
||||
}),
|
||||
catchError((err: any) => {
|
||||
this.store.dispatch(new RTLActions.CloseSpinner());
|
||||
this.store.dispatch(new RTLActions.EffectError({ action: 'UpdateSelNode', code: err.status, message: err.error.message }));
|
||||
this.logger.error(err);
|
||||
return of(
|
||||
{
|
||||
type: RTLActions.OPEN_ALERT,
|
||||
payload: { width: '70%', data: {type: 'ERROR', titleMessage: 'Update Selected Node Failed!',
|
||||
message: JSON.stringify({code: err.status, Message: err.error.error})
|
||||
}}
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
));
|
||||
|
||||
SetToken(token: string) {
|
||||
if (token) {
|
||||
sessionStorage.setItem('lndUnlocked', 'true');
|
||||
|
@ -1,14 +1,14 @@
|
||||
import * as RTLActions from './rtl.actions';
|
||||
|
||||
import { ErrorPayload } from '../models/errorPayload';
|
||||
import { RTLConfiguration } from '../models/RTLconfig';
|
||||
import { RTLConfiguration, Node } from '../models/RTLconfig';
|
||||
import {
|
||||
GetInfo, GetInfoChain, Peer, AddressType, Fees, NetworkInfo, Balance, Channel, Payment, Invoice, PendingChannels, ClosedChannel, Transaction, SwitchRes
|
||||
} from '../models/lndModels';
|
||||
|
||||
export interface State {
|
||||
effectErrors: ErrorPayload[];
|
||||
selNodeIndex: number;
|
||||
selNode: Node;
|
||||
appConfig: RTLConfiguration;
|
||||
information: GetInfo;
|
||||
peers: Peer[];
|
||||
@ -31,15 +31,15 @@ export interface State {
|
||||
addressTypes: AddressType[];
|
||||
}
|
||||
|
||||
const initNodeSettings = { flgSidenavOpened: true, flgSidenavPinned: true, menu: 'Vertical', menuType: 'Regular', theme: 'dark-blue', satsToBTC: false };
|
||||
const initNodeAuthentication = { nodeAuthType: 'CUSTOM', lndConfigPath: '', bitcoindConfigPath: '' };
|
||||
|
||||
const initialState: State = {
|
||||
effectErrors: [],
|
||||
selNodeIndex: 0,
|
||||
selNode: {settings: initNodeSettings, authentication: initNodeAuthentication},
|
||||
appConfig: {
|
||||
sso: { rtlSSO: 0, logoutRedirectLink: '/login' },
|
||||
nodes: [{
|
||||
settings: { flgSidenavOpened: true, flgSidenavPinned: true, menu: 'Vertical', menuType: 'Regular', theme: 'dark-blue', satsToBTC: false },
|
||||
authentication: { nodeAuthType: 'CUSTOM', lndConfigPath: '', bitcoindConfigPath: '' }
|
||||
}]
|
||||
nodes: [{ settings: initNodeSettings, authentication: initNodeAuthentication}]
|
||||
},
|
||||
information: {},
|
||||
peers: [],
|
||||
@ -84,14 +84,15 @@ export function RTLRootReducer(state = initialState, action: RTLActions.RTLActio
|
||||
...state,
|
||||
effectErrors: [...state.effectErrors, action.payload]
|
||||
};
|
||||
case RTLActions.SET_SEL_NODE_INDEX:
|
||||
case RTLActions.SET_SELECTED_NODE:
|
||||
return {
|
||||
...state,
|
||||
selNodeIndex: action.payload
|
||||
selNode: action.payload
|
||||
};
|
||||
case RTLActions.SET_RTL_CONFIG:
|
||||
return {
|
||||
...state,
|
||||
selNode: action.payload.nodes[0],
|
||||
appConfig: action.payload
|
||||
};
|
||||
case RTLActions.SET_INFO:
|
||||
|
Loading…
Reference in New Issue
Block a user