mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2024-11-19 01:40:29 +01:00
Config Upgrade RC
This commit is contained in:
parent
9c9d4f08a0
commit
8fdba67a5d
5
.gitignore
vendored
5
.gitignore
vendored
@ -39,7 +39,10 @@ Thumbs.db
|
||||
|
||||
/logs/*
|
||||
/cookies/*
|
||||
RTL-Config.json
|
||||
/backup/*
|
||||
cookies
|
||||
.env
|
||||
RTL-Config.json
|
||||
RTL-Config-1.json
|
||||
RTL-Multi-Node-Conf.json
|
||||
RTL.conf
|
||||
|
@ -12,5 +12,5 @@
|
||||
<link rel="stylesheet" href="styles.90ee7bcb73e8367b2a29.css"></head>
|
||||
<body>
|
||||
<rtl-app></rtl-app>
|
||||
<script src="runtime.381542d227df565e3542.js" defer></script><script src="polyfills-es5.37b2eeccc22c1df73ce7.js" nomodule defer></script><script src="polyfills.f1c3d2a0bcdfc4e93ca8.js" defer></script><script src="main.5b4359fe9f0cfb1a3504.js" defer></script></body>
|
||||
<script src="runtime.381542d227df565e3542.js" defer></script><script src="polyfills-es5.37b2eeccc22c1df73ce7.js" nomodule defer></script><script src="polyfills.f1c3d2a0bcdfc4e93ca8.js" defer></script><script src="main.44eca5bf638d8b08e871.js" defer></script></body>
|
||||
</html>
|
||||
|
1
angular/main.44eca5bf638d8b08e871.js
Normal file
1
angular/main.44eca5bf638d8b08e871.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
183
connect.js
183
connect.js
@ -9,12 +9,14 @@ var logger = require('./controllers/logger');
|
||||
var connect = {};
|
||||
var errMsg = '';
|
||||
var request = require('request');
|
||||
var ini = require('ini');
|
||||
common.path_separator = (platform === 'win32') ? '\\' : '/';
|
||||
|
||||
connect.setDefaultConfig = () => {
|
||||
var homeDir = os.userInfo().homedir;
|
||||
var macaroonPath = '';
|
||||
var configPath = '';
|
||||
var channelBackupPath = '';
|
||||
switch (platform) {
|
||||
case 'win32':
|
||||
macaroonPath = homeDir + '\\AppData\\Local\\Lnd\\data\\chain\\bitcoin\\mainnet';
|
||||
@ -49,7 +51,7 @@ connect.setDefaultConfig = () => {
|
||||
nodes: [
|
||||
{
|
||||
index: 1,
|
||||
lnNode: "LND Node 1",
|
||||
lnNode: "Node 1",
|
||||
lnImplementation: "LND",
|
||||
Authentication: {
|
||||
macaroonPath: macaroonPath,
|
||||
@ -127,15 +129,15 @@ connect.validateNodeConfig = (config) => {
|
||||
if (config.nodes && config.nodes.length > 0) {
|
||||
config.nodes.forEach((node, idx) => {
|
||||
common.nodes[idx] = {};
|
||||
if(node.Authentication.macaroonPath === '' || undefined === node.Authentication.macaroonPath) {
|
||||
if(node.Authentication.macaroonPath === '' || !node.Authentication.macaroonPath) {
|
||||
errMsg = 'Please set macaroon path for node index ' + node.index + ' in RTL-Config.json!';
|
||||
} else {
|
||||
common.nodes[idx].macaroon_path = node.Authentication.macaroonPath;
|
||||
}
|
||||
|
||||
if(
|
||||
(node.Settings.lndServerUrl === '' || undefined === node.Settings.lndServerUrl)
|
||||
&& (node.Settings.lnServerUrl === '' || undefined === node.Settings.lnServerUrl)
|
||||
(node.Settings.lndServerUrl === '' || !node.Settings.lndServerUrl)
|
||||
&& (node.Settings.lnServerUrl === '' || !node.Settings.lnServerUrl)
|
||||
) {
|
||||
errMsg = errMsg + '\nPlease set server URL for node index ' + node.index + ' in RTL-Config.json!';
|
||||
} else {
|
||||
@ -158,7 +160,7 @@ connect.validateNodeConfig = (config) => {
|
||||
common.nodes[idx].config_path = '';
|
||||
}
|
||||
common.nodes[idx].bitcoind_config_path = (node.Settings.bitcoindConfigPath) ? node.Settings.bitcoindConfigPath : '';
|
||||
common.nodes[idx].enable_logging = (node.Settings.enableLogging) ? node.Settings.enableLogging : false;
|
||||
common.nodes[idx].enable_logging = (node.Settings.enableLogging) ? !!node.Settings.enableLogging : false;
|
||||
common.nodes[idx].channel_backup_path = (node.Settings.channelBackupPath) ? node.Settings.channelBackupPath : common.rtl_conf_file_path + common.path_separator + 'backup' + common.path_separator + 'node-' + node.index;
|
||||
try {
|
||||
connect.createDirectory(common.nodes[idx].channel_backup_path);
|
||||
@ -172,7 +174,7 @@ connect.validateNodeConfig = (config) => {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Something went wrong while creating backup file: \n' + err);
|
||||
console.error('Something went wrong while creating the backup directory: \n' + err);
|
||||
}
|
||||
|
||||
if (common.nodes[idx].enable_logging) {
|
||||
@ -230,9 +232,8 @@ connect.setSSOParams = (config) => {
|
||||
|
||||
connect.createDirectory = (dirname) => {
|
||||
try {
|
||||
const sep = path.sep;
|
||||
const initDir = path.isAbsolute(dirname) ? sep : '';
|
||||
dirname.split(sep).reduce((parentDir, childDir) => {
|
||||
const initDir = path.isAbsolute(dirname) ? path.sep : '';
|
||||
dirname.split(path.sep).reduce((parentDir, childDir) => {
|
||||
const curDir = path.resolve(parentDir, childDir);
|
||||
if (!fs.existsSync(curDir)) {
|
||||
fs.mkdirSync(curDir);
|
||||
@ -244,7 +245,7 @@ connect.createDirectory = (dirname) => {
|
||||
return dirname;
|
||||
}
|
||||
if (err.code === 'ENOENT') {
|
||||
throw new Error(`EACCES: permission denied, mkdir '${dirname}'`);
|
||||
throw new Error(`ENOENT: No such file or directory, mkdir '${dirname}'. Ensure that channel backup path separator is '${(platform === 'win32') ? '\\\\' : '/'}'`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -340,12 +341,170 @@ connect.setSelectedNode = (config) => {
|
||||
}
|
||||
}
|
||||
|
||||
connect.modifyJsonForNewUX = (confFileFullPath) => {
|
||||
RTLConfFile = common.rtl_conf_file_path + '/RTL-Multi-Node-Conf.json';
|
||||
var config = JSON.parse(fs.readFileSync(RTLConfFile, 'utf-8'));
|
||||
if (!config.SSO) { config.SSO = {}; }
|
||||
var newConfig = {
|
||||
port: config.port ? config.port : 3000,
|
||||
defaultNodeIndex: config.defaultNodeIndex ? config.defaultNodeIndex : 1,
|
||||
SSO: {
|
||||
rtlSSO: config.SSO.rtlSSO ? config.SSO.rtlSSO : 0,
|
||||
rtlCookiePath: config.SSO.rtlCookiePath ? config.SSO.rtlCookiePath : "",
|
||||
logoutRedirectLink: config.SSO.logoutRedirectLink ? config.SSO.logoutRedirectLink : ""
|
||||
},
|
||||
nodes: []
|
||||
};
|
||||
|
||||
if(config.nodes && config.nodes.length > 0) {
|
||||
let newNode = {};
|
||||
config.nodes.forEach((node, idx) => {
|
||||
newNode = {
|
||||
index: node.index ? node.index : (idx + 1),
|
||||
lnNode: node.lnNode ? node.lnNode : "Node " + (idx + 1),
|
||||
lnImplementation: node.lnImplementation ? node.lnImplementation : "LND",
|
||||
Authentication: {
|
||||
macaroonPath: node.Authentication.macaroonPath ? node.Authentication.macaroonPath : ''
|
||||
},
|
||||
Settings: {
|
||||
userPersona: node.Settings.userPersona ? node.Settings.userPersona : "MERCHANT",
|
||||
enableLogging: node.Settings.enableLogging ? !!node.Settings.enableLogging : false,
|
||||
fiatConversion: node.Settings.fiatConversion ? node.Settings.fiatConversion : false
|
||||
}
|
||||
};
|
||||
|
||||
if (node.Authentication.configPath) {
|
||||
newNode.Authentication.configPath = node.Authentication.configPath;
|
||||
} else if (node.Authentication.lndConfigPath) {
|
||||
newNode.Authentication.configPath = node.Authentication.lndConfigPath;
|
||||
}
|
||||
|
||||
if (node.Settings.theme) {
|
||||
var themeArr = node.Settings.theme.split("-");
|
||||
if (themeArr[2]) { themeArr[1] = themeArr[1] + themeArr[2]; } // For light-blue-gray
|
||||
newNode.Settings.themeMode = (themeArr[0] === "dark") ? "NIGHT" : "DAY";
|
||||
newNode.Settings.themeColor = (themeArr[1] === "blue") ? "INDIGO" : (themeArr[1] === "pink") ? "PINK" : (themeArr[1] === "green" || themeArr[1] === "teal") ? "TEAL" : "PURPLE";
|
||||
} else {
|
||||
newNode.Settings.themeMode = node.Settings.themeMode ? node.Settings.themeMode : "DAY";
|
||||
newNode.Settings.themeColor = node.Settings.themeColor ? node.Settings.themeColor : "PURPLE";
|
||||
}
|
||||
if (node.Settings.currencyUnit) {
|
||||
newNode.Settings.currencyUnit = node.Settings.currencyUnit;
|
||||
}
|
||||
if (node.Settings.bitcoindConfigPath) {
|
||||
newNode.Settings.bitcoindConfigPath = node.Settings.bitcoindConfigPath;
|
||||
}
|
||||
if (node.Settings.channelBackupPath) {
|
||||
newNode.Settings.channelBackupPath = node.Settings.channelBackupPath;
|
||||
}
|
||||
if (node.Settings.lnServerUrl) {
|
||||
newNode.Settings.lnServerUrl = node.Settings.lnServerUrl;
|
||||
} else if (node.Settings.lndServerUrl) {
|
||||
newNode.Settings.lnServerUrl = node.Settings.lndServerUrl;
|
||||
}
|
||||
newConfig.nodes.push(newNode);
|
||||
});
|
||||
}
|
||||
if(config.multiPass) {
|
||||
newConfig.multiPass = config.multiPass;
|
||||
} else if(config.multiPassHashed) {
|
||||
newConfig.multiPassHashed = config.multiPassHashed;
|
||||
}
|
||||
fs.writeFileSync(confFileFullPath, JSON.stringify(newConfig));
|
||||
}
|
||||
|
||||
connect.upgradeIniToJson = (confFileFullPath) => {
|
||||
RTLConfFile = common.rtl_conf_file_path + '/RTL.conf';
|
||||
var config = ini.parse(fs.readFileSync(RTLConfFile, 'utf-8'));
|
||||
if (!config.SSO) { config.SSO = {}; }
|
||||
if (!config.Authentication) { config.Authentication = {}; }
|
||||
if (!config.Settings) { config.Settings = {}; }
|
||||
var newConfig = {
|
||||
port: config.Settings.port ? config.Settings.port : 3000,
|
||||
defaultNodeIndex: 1,
|
||||
SSO: {
|
||||
rtlSSO: config.SSO.rtlSSO ? config.SSO.rtlSSO : 0,
|
||||
rtlCookiePath: config.SSO.rtlCookiePath ? config.SSO.rtlCookiePath : "",
|
||||
logoutRedirectLink: config.SSO.logoutRedirectLink ? config.SSO.logoutRedirectLink : ""
|
||||
},
|
||||
nodes: [
|
||||
{
|
||||
index: 1,
|
||||
lnNode: "Node 1",
|
||||
lnImplementation: config.Settings.lnImplementation ? config.Settings.lnImplementation : "LND",
|
||||
Authentication: {
|
||||
macaroonPath: config.Authentication.macaroonPath ? config.Authentication.macaroonPath : (config.Authentication.macroonPath ? config.Authentication.macroonPath : ''),
|
||||
configPath: config.Authentication.configPath ? config.Authentication.configPath : (config.Authentication.lndConfigPath ? config.Authentication.lndConfigPath : ''),
|
||||
},
|
||||
Settings: {
|
||||
userPersona: config.Settings.userPersona ? config.Settings.userPersona : "MERCHANT",
|
||||
enableLogging: config.Settings.enableLogging ? !!config.Settings.enableLogging : (config.Authentication.enableLogging ? !!config.Authentication.enableLogging : false),
|
||||
fiatConversion: config.Settings.fiatConversion ? config.Settings.fiatConversion : false
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
if (config.Settings.theme) {
|
||||
var themeArr = config.Settings.theme.split("-");
|
||||
if (themeArr[2]) { themeArr[1] = themeArr[1] + themeArr[2]; } // For light-blue-gray
|
||||
newConfig.nodes[0].Settings.themeMode = (themeArr[0] === "dark") ? "NIGHT" : "DAY";
|
||||
newConfig.nodes[0].Settings.themeColor = (themeArr[1] === "blue") ? "INDIGO" : (themeArr[1] === "pink") ? "PINK" : (themeArr[1] === "green" || themeArr[1] === "teal") ? "TEAL" : "PURPLE";
|
||||
} else {
|
||||
newConfig.nodes[0].Settings.themeMode = config.Settings.themeMode ? config.Settings.themeMode : "DAY";
|
||||
newConfig.nodes[0].Settings.themeColor = config.Settings.themeColor ? config.Settings.themeColor : "PURPLE";
|
||||
}
|
||||
if (config.Settings.currencyUnit) {
|
||||
newConfig.nodes[0].Settings.currencyUnit = config.Settings.currencyUnit;
|
||||
}
|
||||
if (config.Settings.bitcoindConfigPath) {
|
||||
newConfig.nodes[0].Settings.bitcoindConfigPath = config.Settings.bitcoindConfigPath;
|
||||
}
|
||||
if (config.Settings.channelBackupPath) {
|
||||
newConfig.nodes[0].Settings.channelBackupPath = config.Settings.channelBackupPath;
|
||||
}
|
||||
if (config.Settings.lnServerUrl) {
|
||||
newConfig.nodes[0].Settings.lnServerUrl = config.Settings.lnServerUrl;
|
||||
} else if (config.Settings.lndServerUrl) {
|
||||
newConfig.nodes[0].Settings.lnServerUrl = config.Settings.lndServerUrl;
|
||||
} else if (config.Authentication.lndServerUrl) {
|
||||
newConfig.nodes[0].Settings.lnServerUrl = config.Authentication.lndServerUrl;
|
||||
}
|
||||
|
||||
if(config.Authentication.rtlPass) {
|
||||
newConfig.multiPass = config.Authentication.rtlPass;
|
||||
} else if(config.Authentication.rtlPassHashed) {
|
||||
newConfig.multiPassHashed = config.Authentication.rtlPassHashed;
|
||||
}
|
||||
fs.writeFileSync(confFileFullPath, JSON.stringify(newConfig));
|
||||
}
|
||||
|
||||
connect.upgradeConfig = (confFileFullPath) => {
|
||||
try {
|
||||
singleNodeConfFile = common.rtl_conf_file_path + '/RTL.conf';
|
||||
multiNodeConfFile = common.rtl_conf_file_path + '/RTL-Multi-Node-Conf.json';
|
||||
const singleNodeExists = fs.existsSync(singleNodeConfFile);
|
||||
const multiNodeExists = fs.existsSync(multiNodeConfFile);
|
||||
if ((singleNodeExists && multiNodeExists) || (!singleNodeExists && multiNodeExists)) {
|
||||
connect.modifyJsonForNewUX(confFileFullPath);
|
||||
} else if (singleNodeExists && !multiNodeExists) {
|
||||
connect.upgradeIniToJson(confFileFullPath);
|
||||
} else if (!singleNodeExists && !multiNodeExists) {
|
||||
if (!fs.existsSync(confFileFullPath)) {
|
||||
fs.writeFileSync(confFileFullPath, JSON.stringify(connect.setDefaultConfig()));
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
console.error('Something went wrong while upgrading the RTL config file: \n' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
|
||||
connect.setServerConfiguration = () => {
|
||||
try {
|
||||
common.rtl_conf_file_path = (process.env.RTL_CONFIG_PATH) ? process.env.RTL_CONFIG_PATH : path.normalize(__dirname);
|
||||
confFileFullPath = common.rtl_conf_file_path + common.path_separator + 'RTL-Config.json';
|
||||
if (!fs.existsSync(confFileFullPath)) {
|
||||
fs.writeFileSync(confFileFullPath, JSON.stringify(connect.setDefaultConfig()));
|
||||
if(!fs.existsSync(confFileFullPath)) {
|
||||
connect.upgradeConfig(confFileFullPath);
|
||||
}
|
||||
var config = JSON.parse(fs.readFileSync(confFileFullPath, 'utf-8'));
|
||||
connect.validateNodeConfig(config);
|
||||
|
@ -46,14 +46,8 @@ exports.getRTLConfig = (req, res, next) => {
|
||||
authentication.bitcoindConfigPath = node.Settings.bitcoindConfigPath;
|
||||
}
|
||||
node.Settings.channelBackupPath = (node.Settings.channelBackupPath) ? node.Settings.channelBackupPath : common.nodes[i].channel_backup_path;
|
||||
node.Settings.flgSidenavOpened = (node.Settings.flgSidenavOpened) ? node.Settings.flgSidenavOpened : true;
|
||||
node.Settings.flgSidenavPinned = (node.Settings.flgSidenavPinned) ? node.Settings.flgSidenavPinned : true;
|
||||
node.Settings.menu = (node.Settings.menu) ? node.Settings.menu : 'VERTICAL';
|
||||
node.Settings.menuType = (node.Settings.menuType) ? node.Settings.menuType : 'REGULAR';
|
||||
node.Settings.fontSize = (node.Settings.fontSize) ? node.Settings.fontSize : 'MEDIUM';
|
||||
node.Settings.themeMode = (node.Settings.themeMode) ? node.Settings.themeMode : 'DAY';
|
||||
node.Settings.themeColor = (node.Settings.themeColor) ? node.Settings.themeColor : 'PURPLE';
|
||||
node.Settings.satsToBTC = (node.Settings.satsToBTC) ? node.Settings.satsToBTC : false;
|
||||
nodesArr.push({
|
||||
index: node.index,
|
||||
lnNode: node.lnNode,
|
||||
@ -81,12 +75,6 @@ exports.updateUISettings = (req, res, next) => {
|
||||
} else {
|
||||
delete node.Settings.currencyUnit;
|
||||
}
|
||||
node.Settings.flgSidenavOpened = true; // req.body.updatedSettings.flgSidenavOpened;
|
||||
node.Settings.flgSidenavPinned = true; // req.body.updatedSettings.flgSidenavPinned;
|
||||
node.Settings.menu = 'VERTICAL'; // req.body.updatedSettings.menu;
|
||||
node.Settings.menuType = 'REGULAR'; // req.body.updatedSettings.menuType;
|
||||
node.Settings.fontSize = 'MEDIUM'; // req.body.updatedSettings.fontSize;
|
||||
node.Settings.satsToBTC = false; // req.body.updatedSettings.satsToBTC;
|
||||
}
|
||||
});
|
||||
try {
|
||||
|
@ -14,7 +14,7 @@ The parameters can be configured via RTL-Config.json file or through environment
|
||||
"nodes": [
|
||||
{
|
||||
"index": <Incrimental Node indices starting from 1>,
|
||||
"lnNode": "<Node name to uniquely identify the node in the UI, Default 'LND Node 1'>",
|
||||
"lnNode": "<Node name to uniquely identify the node in the UI, Default 'Node 1'>",
|
||||
"lnImplementation": "<LNP implementation, Allowed values LND/CLT. Default 'LND'>",
|
||||
"Authentication": {
|
||||
"macaroonPath": "<Path for the folder containing 'admin.macaroon' file>",
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rtl",
|
||||
"version": "0.6.2-beta",
|
||||
"version": "0.6.4-beta",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rtl",
|
||||
"version": "0.6.2-beta",
|
||||
"version": "0.6.4-beta",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
|
@ -10,7 +10,7 @@
|
||||
"nodes": [
|
||||
{
|
||||
"index": 1,
|
||||
"lnNode": "LND Node 1",
|
||||
"lnNode": "Node 1",
|
||||
"lnImplementation": "LND",
|
||||
"Authentication": {
|
||||
"macaroonPath": "C:\\Users\\shaha\\AppData\\Local\\Lnd\\data\\chain\\bitcoin\\mainnet",
|
||||
|
@ -1,26 +1,13 @@
|
||||
<!-- <div fxLayout="column" id="rtl-container" class="rtl-container" [ngClass]="[settings.themeColor, settings.themeMode]" [class.horizontal]="settings.menu === 'HORIZONTAL'" [class.compact]="settings.menuType === 'COMPACT'" [class.mini]="settings.menuType === 'MINI'" [style.fontSize.px]="getFontSize()"> -->
|
||||
<div fxLayout="column" id="rtl-container" class="rtl-container" [ngClass]="[settings.themeColor | lowercase, settings.themeMode | lowercase, settings.fontSize | lowercase]" [class.horizontal]="settings.menu === 'HORIZONTAL'" [class.compact]="settings.menuType === 'COMPACT'" [class.mini]="settings.menuType === 'MINI'">
|
||||
<mat-toolbar fxLayout="row" fxLayoutAlign="space-between center" class="padding-gap-x bg-primary rtl-top-toolbar" *ngIf="settings.menu === 'VERTICAL'">
|
||||
<div fxLayout="column" id="rtl-container" class="rtl-container medium" [ngClass]="[settings.themeColor | lowercase, settings.themeMode | lowercase]">
|
||||
<mat-toolbar fxLayout="row" fxLayoutAlign="space-between center" class="padding-gap-x bg-primary rtl-top-toolbar">
|
||||
<div>
|
||||
<button *ngIf="settings.menu === 'VERTICAL'" class="top-toolbar-icon" mat-icon-button (click)="sideNavToggle()">
|
||||
<button class="top-toolbar-icon" mat-icon-button (click)="sideNavToggle()">
|
||||
<mat-icon class="mr-5px">menu</mat-icon>
|
||||
</button>
|
||||
<button *ngIf="settings.fontSize === 'SMALL' && settings.menu === 'VERTICAL' && !smallScreen" mat-icon-button (click)="settings.flgSidenavPinned = !settings.flgSidenavPinned">
|
||||
<svg class="top-toolbar-icon icon-pinned" viewBox="0 0 42 42">
|
||||
<path fill="currentColor" *ngIf="!settings.flgSidenavPinned" d="M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12Z" />
|
||||
<path fill="currentColor" *ngIf="settings.flgSidenavPinned" d="M2,5.27L3.28,4L20,20.72L18.73,22L12.8,16.07V22H11.2V16H6V14L8,12V11.27L2,5.27M16,12L18,14V16H17.82L8,6.18V4H7V2H17V4H16V12Z" />
|
||||
</svg>
|
||||
</button>
|
||||
<button *ngIf="settings.fontSize === 'MEDIUM' && settings.menu === 'VERTICAL' && !smallScreen" mat-icon-button (click)="settings.flgSidenavPinned = !settings.flgSidenavPinned">
|
||||
<button *ngIf="!smallScreen" mat-icon-button (click)="flgSidenavPinned = !flgSidenavPinned">
|
||||
<svg class="top-toolbar-icon icon-pinned" viewBox="0 0 32 32">
|
||||
<path fill="currentColor" *ngIf="!settings.flgSidenavPinned" d="M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12Z" />
|
||||
<path fill="currentColor" *ngIf="settings.flgSidenavPinned" d="M2,5.27L3.28,4L20,20.72L18.73,22L12.8,16.07V22H11.2V16H6V14L8,12V11.27L2,5.27M16,12L18,14V16H17.82L8,6.18V4H7V2H17V4H16V12Z" />
|
||||
</svg>
|
||||
</button>
|
||||
<button *ngIf="settings.fontSize === 'LARGE' && settings.menu === 'VERTICAL' && !smallScreen" mat-icon-button (click)="settings.flgSidenavPinned = !settings.flgSidenavPinned">
|
||||
<svg class="top-toolbar-icon icon-pinned" viewBox="0 0 24 24">
|
||||
<path fill="currentColor" *ngIf="!settings.flgSidenavPinned" d="M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12Z" />
|
||||
<path fill="currentColor" *ngIf="settings.flgSidenavPinned" d="M2,5.27L3.28,4L20,20.72L18.73,22L12.8,16.07V22H11.2V16H6V14L8,12V11.27L2,5.27M16,12L18,14V16H17.82L8,6.18V4H7V2H17V4H16V12Z" />
|
||||
<path fill="currentColor" *ngIf="!flgSidenavPinned" d="M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12Z" />
|
||||
<path fill="currentColor" *ngIf="flgSidenavPinned" d="M2,5.27L3.28,4L20,20.72L18.73,22L12.8,16.07V22H11.2V16H6V14L8,12V11.27L2,5.27M16,12L18,14V16H17.82L8,6.18V4H7V2H17V4H16V12Z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
@ -32,11 +19,8 @@
|
||||
<rtl-top-menu></rtl-top-menu>
|
||||
</div>
|
||||
</mat-toolbar>
|
||||
<mat-toolbar color="primary" *ngIf="settings.menu === 'HORIZONTAL'" class="padding-gap-x horizontal-nav">
|
||||
<rtl-horizontal-navigation fxLayout="row" fxFlex="100" fxLayoutAlign="start center" class="h-100"></rtl-horizontal-navigation>
|
||||
</mat-toolbar>
|
||||
<mat-sidenav-container>
|
||||
<mat-sidenav perfectScrollbar *ngIf="settings.menu === 'VERTICAL'" [opened]="settings.flgSidenavOpened" [mode]="(settings.flgSidenavPinned && !smallScreen) ? 'side' : 'over'" #sideNavigation class="sidenav mat-elevation-z6">
|
||||
<mat-sidenav perfectScrollbar [opened]="true" [mode]="(flgSidenavPinned && !smallScreen) ? 'side' : 'over'" #sideNavigation class="sidenav mat-elevation-z6">
|
||||
<rtl-side-navigation (ChildNavClicked)="onNavigationClicked($event)" fxFlex="100"></rtl-side-navigation>
|
||||
</mat-sidenav>
|
||||
<mat-sidenav-content perfectScrollbar>
|
||||
|
@ -34,6 +34,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
public accessKey = '';
|
||||
public xSmallScreen = false;
|
||||
public smallScreen = false;
|
||||
public flgSidenavPinned = true;
|
||||
unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
|
||||
|
||||
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions,
|
||||
@ -91,10 +92,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
// START: Workaround to add adjust container width initially
|
||||
this.sideNavigation.toggle();
|
||||
setTimeout(() => { this.sideNavigation.toggle(); }, 500);
|
||||
if (this.settings.menuType === 'COMPACT' || this.settings.menuType === 'MINI') {
|
||||
this.sideNavigation.toggle(); // To dynamically update the width to 100% after side nav is closed
|
||||
setTimeout(() => { this.sideNavigation.toggle(); }, 100);
|
||||
}
|
||||
// END: Workaround to add left margin to container initially
|
||||
}
|
||||
});
|
||||
@ -129,13 +126,12 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
if ((this.settings.menuType !== 'REGULAR' || !this.settings.flgSidenavPinned) || (this.smallScreen)) {
|
||||
if (this.smallScreen) {
|
||||
this.sideNavigation.close();
|
||||
}
|
||||
}
|
||||
|
||||
sideNavToggle() {
|
||||
this.settings.flgSidenavOpened = !this.settings.flgSidenavOpened;
|
||||
this.sideNavigation.toggle();
|
||||
}
|
||||
|
||||
@ -151,11 +147,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.logger.info('Copied Text: ' + payload);
|
||||
}
|
||||
|
||||
getFontSize() {
|
||||
return (this.settings.fontSize === NODE_SETTINGS.fontSize[0].class) ? 14 :
|
||||
(this.settings.fontSize === NODE_SETTINGS.fontSize[2].class) ? 18 : 16;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.unSubs.forEach(unsub => {
|
||||
unsub.next();
|
||||
|
@ -23,7 +23,7 @@ export interface CLState {
|
||||
|
||||
export const initCLState: CLState = {
|
||||
effectErrorsCl: [],
|
||||
nodeSettings: { userPersona: UserPersonaEnum.OPERATOR, selCurrencyUnit: 'USD', fiatConversion: false, channelBackupPath: '', satsToBTC: false, currencyUnits: [] },
|
||||
nodeSettings: { userPersona: UserPersonaEnum.OPERATOR, selCurrencyUnit: 'USD', fiatConversion: false, channelBackupPath: '', currencyUnits: [] },
|
||||
information: {},
|
||||
fees: {},
|
||||
feeRatesPerKB: {},
|
||||
|
@ -34,7 +34,7 @@ export interface LNDState {
|
||||
|
||||
export const initLNDState: LNDState = {
|
||||
effectErrorsLnd: [],
|
||||
nodeSettings: { userPersona: UserPersonaEnum.OPERATOR, fiatConversion: false, channelBackupPath: '', satsToBTC: false, currencyUnits: [] },
|
||||
nodeSettings: { userPersona: UserPersonaEnum.OPERATOR, fiatConversion: false, channelBackupPath: '', currencyUnits: [] },
|
||||
information: {},
|
||||
peers: [],
|
||||
fees: {},
|
||||
|
@ -1,30 +0,0 @@
|
||||
<div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between center">
|
||||
<div fxFlex="70" fxLayoutAlign="start start">
|
||||
<div *ngFor="let menuNode of menuNodes">
|
||||
<button mat-button *ngIf="undefined === menuNode.children" fxLayoutAlign="center center" class="horizontal-button" routerLinkActive="h-active-link" [routerLinkActiveOptions]="{exact: true}" routerLink="{{menuNode.link}}" (click)="onClick(menuNode)">
|
||||
<fa-icon *ngIf="menuNode.iconType === 'FA'" matTooltip="{{menuNode.name}}" [icon]="menuNode.icon" class="fa-icon-small"></fa-icon>
|
||||
</button>
|
||||
<div *ngIf="undefined !== menuNode.children" fxLayoutAlign="start start" [matMenuTriggerFor]="childMenu">
|
||||
<button mat-button class="horizontal-button" fxLayoutAlign="center center">
|
||||
<fa-icon *ngIf="menuNode.iconType === 'FA'" matTooltip="{{menuNode.name}}" [icon]="menuNode.icon" class="fa-icon-small"></fa-icon>
|
||||
</button>
|
||||
<mat-menu #childMenu="matMenu" xPosition="after" overlapTrigger="false" class="child-menu">
|
||||
<div *ngFor="let childNode of menuNode.children">
|
||||
<button mat-button class="horizontal-button bg-primary px-2" fxFlex="100" fxLayoutAlign="center center" [routerLinkActive]="'h-active-link'" routerLink="{{childNode.link}}" [routerLinkActiveOptions]="{exact: true}">
|
||||
<fa-icon *ngIf="childNode.iconType === 'FA'" matTooltip="{{childNode.name}}" [icon]="childNode.icon" class="fa-icon-small"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
</mat-menu>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="30" fxLayoutAlign="end center">
|
||||
<mat-select fxFlex="40" *ngIf="appConfig.nodes.length > 1" [value]="selNode" (selectionChange)="onNodeSelectionChange($event.value)" class="m-2 multi-node-select">
|
||||
<mat-option *ngFor="let node of appConfig.nodes" [value]="node" tabindex="19">
|
||||
{{node.lnNode}} ({{node.lnImplementation}})
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<button fxLayoutAlign="center center" mat-stroked-button color="primary" class="horizontal-button-show" tabindex="20" (click)="onShowPubkey()">Show Public Key</button>
|
||||
<rtl-top-menu></rtl-top-menu>
|
||||
</div>
|
||||
</div>
|
@ -1,19 +0,0 @@
|
||||
.mat-menu-panel.child-menu {
|
||||
min-width: 88px;
|
||||
width:88px;
|
||||
border-radius: 0;
|
||||
margin-left: 30%;
|
||||
margin-top: 6%;
|
||||
.mat-menu-content {
|
||||
.mat-menu-item {
|
||||
padding: 0;
|
||||
margin-top: -3px;
|
||||
.mat-icon {
|
||||
margin-right: 0;
|
||||
}
|
||||
button {
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HorizontalNavigationComponent } from './horizontal-navigation.component';
|
||||
|
||||
describe('HorizontalNavigationComponent', () => {
|
||||
let component: HorizontalNavigationComponent;
|
||||
let fixture: ComponentFixture<HorizontalNavigationComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HorizontalNavigationComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HorizontalNavigationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -1,102 +0,0 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { faEject } from '@fortawesome/free-solid-svg-icons';
|
||||
import { SessionService } from '../../../services/session.service';
|
||||
import { MENU_DATA } from '../../../models/navMenu';
|
||||
|
||||
import { RTLEffects } from '../../../../store/rtl.effects';
|
||||
import * as RTLActions from '../../../../store/rtl.actions';
|
||||
import * as fromRTLReducer from '../../../../store/rtl.reducers';
|
||||
import { GetInfoRoot, ConfigSettingsNode, RTLConfiguration } from '../../../models/RTLconfig';
|
||||
import { AlertTypeEnum } from '../../../services/consts-enums-functions';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-horizontal-navigation',
|
||||
templateUrl: './horizontal-navigation.component.html',
|
||||
styleUrls: ['./horizontal-navigation.component.scss']
|
||||
})
|
||||
export class HorizontalNavigationComponent implements OnInit, OnDestroy {
|
||||
public menuNodes = [];
|
||||
public logoutNode = [];
|
||||
public showLogout = false;
|
||||
public numPendingChannels = 0;
|
||||
public appConfig: RTLConfiguration;
|
||||
public selNode: ConfigSettingsNode;
|
||||
public information: GetInfoRoot = {};
|
||||
private unSubs = [new Subject(), new Subject(), new Subject()];
|
||||
|
||||
constructor(private sessionService: SessionService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.store.select('root')
|
||||
.pipe(takeUntil(this.unSubs[0]))
|
||||
.subscribe((rtlStore) => {
|
||||
this.information = rtlStore.nodeData;
|
||||
this.appConfig = rtlStore.appConfig;
|
||||
this.selNode = rtlStore.selNode;
|
||||
if(this.selNode.lnImplementation.toUpperCase() === 'CLT') {
|
||||
this.menuNodes = MENU_DATA.CLChildren;
|
||||
} else {
|
||||
this.menuNodes = MENU_DATA.LNDChildren;
|
||||
}
|
||||
if(this.sessionService.getItem('token')) {
|
||||
if (this.menuNodes[this.menuNodes.length - 1].id !== 200) {
|
||||
this.menuNodes.push({id: 200, parentId: 0, name: 'Logout', iconType: 'FA', icon: faEject});
|
||||
}
|
||||
} else {
|
||||
if(this.menuNodes[this.menuNodes.length - 1].id === 200) {
|
||||
this.menuNodes.pop();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.sessionService.watchSession()
|
||||
.pipe(takeUntil(this.unSubs[1]))
|
||||
.subscribe(session => {
|
||||
if(session.token) {
|
||||
if (this.menuNodes[this.menuNodes.length - 1].id !== 200) {
|
||||
this.menuNodes.push({id: 200, parentId: 0, name: 'Logout', iconType: 'FA', icon: faEject});
|
||||
}
|
||||
} else {
|
||||
if(this.menuNodes[this.menuNodes.length - 1].id === 200) {
|
||||
this.menuNodes.pop();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onClick(node) {
|
||||
if (node.name === 'Logout') {
|
||||
this.store.dispatch(new RTLActions.OpenConfirmation({
|
||||
data: { type: AlertTypeEnum.CONFIRM, alertTitle: 'Logout', titleMessage: 'Logout from this device?', noBtnText: 'Cancel', yesBtnText: 'Logout'
|
||||
}}));
|
||||
this.rtlEffects.closeConfirm
|
||||
.pipe(takeUntil(this.unSubs[2]))
|
||||
.subscribe(confirmRes => {
|
||||
if (confirmRes) {
|
||||
this.showLogout = false;
|
||||
this.store.dispatch(new RTLActions.Signout());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onShowPubkey() {
|
||||
this.store.dispatch(new RTLActions.ShowPubkey());
|
||||
}
|
||||
|
||||
onNodeSelectionChange(selNodeValue: ConfigSettingsNode) {
|
||||
this.selNode = selNodeValue;
|
||||
this.store.dispatch(new RTLActions.OpenSpinner('Updating Selected Node...'));
|
||||
this.store.dispatch(new RTLActions.SetSelelectedNode({ lnNode: selNodeValue, isInitialSetup: false }));
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.unSubs.forEach(completeSub => {
|
||||
completeSub.next();
|
||||
completeSub.complete();
|
||||
});
|
||||
}
|
||||
}
|
@ -6,13 +6,13 @@
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-divider class="w-100"></mat-divider>
|
||||
<mat-tree #tree [dataSource]="navMenus" [treeControl]="treeControlNested" *ngIf="settings.menuType === 'REGULAR'">
|
||||
<mat-tree #tree [dataSource]="navMenus" [treeControl]="treeControlNested">
|
||||
<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle routerLinkActive="active-link" routerLink="{{node.link}}">
|
||||
<div (click)="onChildNavClicked(node)">
|
||||
<div fxLayout="row" fxFlex="100" fxLayoutAlign="start center">
|
||||
<fa-icon *ngIf="node.iconType === 'FA'" [icon]="node.icon" class="fa-icon-small mr-2"></fa-icon>
|
||||
<mat-icon *ngIf="!node.iconType" class="mat-icon-36">{{node.icon}}</mat-icon>
|
||||
<span *ngIf="settings.menuType === 'REGULAR'">{{node.name}}</span>
|
||||
<span>{{node.name}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tree-node>
|
||||
@ -34,100 +34,21 @@
|
||||
</div>
|
||||
</mat-nested-tree-node>
|
||||
</mat-tree>
|
||||
|
||||
<mat-tree [dataSource]="navMenus" [treeControl]="treeControlNested" *ngIf="settings.menuType === 'COMPACT'">
|
||||
<mat-tree-node fxLayout="row" matTreeNodeToggle fxLayoutAlign="start center" *matTreeNodeDef="let node"
|
||||
(click)="onChildNavClicked(node)" routerLinkActive="active-link" routerLink="{{node.link}}">
|
||||
<fa-icon *ngIf="node.iconType === 'FA'" [icon]="node.icon" class="fa-icon-small mr-1"></fa-icon>
|
||||
<mat-icon *ngIf="!node.iconType" class="mat-icon-36">{{node.icon}}</mat-icon>
|
||||
<span>{{node.name}}</span>
|
||||
</mat-tree-node>
|
||||
|
||||
<mat-nested-tree-node fxLayout="column" *matTreeNodeDef="let node; when: hasChild" matTreeNodeToggle>
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mat-nested-tree-node-parent">
|
||||
<div fxFlex="89" fxLayoutAlign="start center">
|
||||
<fa-icon *ngIf="node.iconType === 'FA'" [icon]="node.icon" class="fa-icon-small mr-1"></fa-icon>
|
||||
<mat-icon *ngIf="!node.iconType" class="mat-icon-36">{{node.icon}}</mat-icon>
|
||||
<span>{{node.name}}</span>
|
||||
</div>
|
||||
<button fxFlex="11" mat-icon-button [attr.aria-label]="'toggle ' + node.name" fxLayoutAlign="end center">
|
||||
<mat-icon class="mat-icon-rtl-mirror">
|
||||
{{treeControlNested.isExpanded(node) ? 'arrow_drop_up' : 'arrow_drop_down'}}</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div [class.tree-children-invisible]="!treeControlNested.isExpanded(node)" class="mat-nested-tree-node-child">
|
||||
<ng-container matTreeNodeOutlet></ng-container>
|
||||
</div>
|
||||
</mat-nested-tree-node>
|
||||
</mat-tree>
|
||||
|
||||
<mat-tree [dataSource]="navMenus" [treeControl]="treeControlNested" *ngIf="settings.menuType === 'MINI'">
|
||||
<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle routerLinkActive="active-link" routerLink="{{node.link}}">
|
||||
<div (click)="onChildNavClicked(node)">
|
||||
<div fxLayout="row" fxFlex="100" fxLayoutAlign="start center">
|
||||
<fa-icon *ngIf="node.iconType === 'FA'" [icon]="node.icon" class="fa-icon-regular" matTooltip="{{node.name}}" matTooltipPosition="right"></fa-icon>
|
||||
<mat-icon *ngIf="!node.iconType" class="mat-icon-36" matTooltip="{{node.name}}" matTooltipPosition="right">{{node.icon}}</mat-icon>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tree-node>
|
||||
<mat-nested-tree-node fxLayout="column" *matTreeNodeDef="let node; when: hasChild" matTreeNodeToggle>
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mat-nested-tree-node-parent">
|
||||
<div fxFlex="89" fxLayoutAlign="start center">
|
||||
<fa-icon *ngIf="node.iconType === 'FA'" [icon]="node.icon" class="fa-icon-regular" matTooltip="{{node.name}}" matTooltipPosition="right"></fa-icon>
|
||||
<mat-icon *ngIf="!node.iconType" class="mat-icon-36" matTooltip="{{node.name}}" matTooltipPosition="right">{{node.icon}}</mat-icon>
|
||||
</div>
|
||||
<button fxFlex="11" fxLayoutAlign="end center" mat-icon-button [attr.aria-label]="'toggle ' + node.name"
|
||||
fxLayoutAlign="end center">
|
||||
<mat-icon class="mat-icon-rtl-mirror">
|
||||
{{treeControlNested.isExpanded(node) ? 'arrow_drop_up' : 'arrow_drop_down'}}</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div [class.tree-children-invisible]="!treeControlNested.isExpanded(node)" class="mat-nested-tree-node-child">
|
||||
<ng-container matTreeNodeOutlet></ng-container>
|
||||
</div>
|
||||
</mat-nested-tree-node>
|
||||
</mat-tree>
|
||||
<mat-divider class="w-100"></mat-divider>
|
||||
<mat-tree [dataSource]="navMenusShowData" [treeControl]="treeControlShowData" *ngIf="settings.menuType === 'REGULAR'">
|
||||
<mat-tree [dataSource]="navMenusShowData" [treeControl]="treeControlShowData">
|
||||
<mat-tree-node *matTreeNodeDef="let node" (click)="onShowData(node)">
|
||||
<fa-icon *ngIf="node.iconType === 'FA'" [icon]="node.icon" class="fa-icon-small mr-2" matTooltip="{{node.name}}" matTooltipPosition="right"></fa-icon>
|
||||
<mat-icon *ngIf="!node.iconType" class="mat-icon-36" matTooltip="{{node.name}}" matTooltipPosition="right">{{node.icon}}</mat-icon>
|
||||
<span>{{node.name}}</span>
|
||||
</mat-tree-node>
|
||||
</mat-tree>
|
||||
|
||||
<mat-tree [dataSource]="navMenusShowData" [treeControl]="treeControlShowData" *ngIf="settings.menuType === 'COMPACT'">
|
||||
<mat-tree-node fxLayout="row" fxLayoutAlign="start center" *matTreeNodeDef="let node" (click)="onShowData(node)">
|
||||
<fa-icon *ngIf="node.iconType === 'FA'" [icon]="node.icon" class="fa-icon-small mr-1"></fa-icon>
|
||||
<span>{{node.name}}</span>
|
||||
</mat-tree-node>
|
||||
</mat-tree>
|
||||
|
||||
<mat-tree [dataSource]="navMenusShowData" [treeControl]="treeControlShowData" *ngIf="settings.menuType === 'MINI'">
|
||||
<mat-tree-node *matTreeNodeDef="let node" (click)="onShowData(node)" fxLayoutAlign="start center">
|
||||
<fa-icon *ngIf="node.iconType === 'FA'" [icon]="node.icon" class="fa-icon-regular" matTooltip="{{node.name}}" matTooltipPosition="right"></fa-icon>
|
||||
</mat-tree-node>
|
||||
</mat-tree>
|
||||
</div>
|
||||
<div fxLayout="column" fxFlex="10" fxLayoutAlign="end stretch" class="w-100">
|
||||
<mat-tree [dataSource]="navMenusLogout" [treeControl]="treeControlLogout" *ngIf="settings.menuType === 'REGULAR' && showLogout">
|
||||
<mat-tree [dataSource]="navMenusLogout" [treeControl]="treeControlLogout" *ngIf="showLogout">
|
||||
<mat-tree-node *matTreeNodeDef="let node" (click)="onClick(node)">
|
||||
<fa-icon *ngIf="node.iconType === 'FA'" [icon]="node.icon" class="fa-icon-small mr-2" matTooltip="{{node.name}}" matTooltipPosition="right"></fa-icon>
|
||||
<span>{{node.name}}</span>
|
||||
</mat-tree-node>
|
||||
</mat-tree>
|
||||
|
||||
<mat-tree [dataSource]="navMenusLogout" [treeControl]="treeControlLogout" *ngIf="settings.menuType === 'COMPACT' && showLogout">
|
||||
<mat-tree-node fxLayout="row" fxLayoutAlign="start center" *matTreeNodeDef="let node" (click)="onClick(node)">
|
||||
<fa-icon *ngIf="node.iconType === 'FA'" [icon]="node.icon" class="fa-icon-small mr-1"></fa-icon>
|
||||
<span>{{node.name}}</span>
|
||||
</mat-tree-node>
|
||||
</mat-tree>
|
||||
|
||||
<mat-tree [dataSource]="navMenusLogout" [treeControl]="treeControlLogout" *ngIf="settings.menuType === 'MINI' && showLogout">
|
||||
<mat-tree-node *matTreeNodeDef="let node" (click)="onClick(node)" fxLayoutAlign="start center">
|
||||
<fa-icon *ngIf="node.iconType === 'FA'" [icon]="node.icon" class="fa-icon-regular" matTooltip="{{node.name}}" matTooltipPosition="right"></fa-icon>
|
||||
</mat-tree-node>
|
||||
</mat-tree>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -26,14 +26,8 @@ export class AppSettingsComponent implements OnInit, OnDestroy {
|
||||
public information: GetInfoRoot = {};
|
||||
public userPersonas = [UserPersonaEnum.OPERATOR, UserPersonaEnum.MERCHANT];
|
||||
public currencyUnits = FIAT_CURRENCY_UNITS;
|
||||
public menus = NODE_SETTINGS.menus;
|
||||
public selectedMenu = NODE_SETTINGS.menus[0];
|
||||
public menuTypes = NODE_SETTINGS.menuTypes;
|
||||
public themeModes = NODE_SETTINGS.modes;
|
||||
public themeColors = NODE_SETTINGS.themes;
|
||||
public fontSizes = NODE_SETTINGS.fontSize;
|
||||
public selectedMenuType = NODE_SETTINGS.menuTypes[0];
|
||||
public selectedFontSize = NODE_SETTINGS.fontSize[1];
|
||||
public selectedThemeMode = NODE_SETTINGS.modes[0];
|
||||
public selectedThemeColor = NODE_SETTINGS.themes[0].id;
|
||||
public currencyUnit = 'BTC';
|
||||
@ -57,17 +51,8 @@ export class AppSettingsComponent implements OnInit, OnDestroy {
|
||||
.subscribe((rtlStore) => {
|
||||
this.appConfig = rtlStore.appConfig;
|
||||
this.selNode = rtlStore.selNode;
|
||||
this.selectedMenu = this.menus.find(menu => menu.id === this.selNode.settings.menu);
|
||||
this.selectedMenuType = this.menuTypes.find(menuType => this.selNode.settings.menuType === menuType.id);
|
||||
this.selectedThemeMode = this.themeModes.find(themeMode => this.selNode.settings.themeMode === themeMode.id);
|
||||
this.selectedThemeColor = this.selNode.settings.themeColor;
|
||||
this.selectedFontSize = this.fontSizes.find(fontSize => fontSize.class === this.selNode.settings.fontSize);
|
||||
if (window.innerWidth <= 768) {
|
||||
this.selNode.settings.menu = 'VERTICAL';
|
||||
this.selNode.settings.flgSidenavOpened = false;
|
||||
this.selNode.settings.flgSidenavPinned = false;
|
||||
this.showSettingOption = false;
|
||||
}
|
||||
this.information = rtlStore.nodeData;
|
||||
this.smallerCurrencyUnit = (undefined !== this.information && undefined !== this.information.smaller_currency_unit) ? this.information.smaller_currency_unit : 'Sats';
|
||||
this.currencyUnit = (undefined !== this.information && undefined !== this.information.currency_unit) ? this.information.currency_unit : 'BTC';
|
||||
@ -82,31 +67,12 @@ export class AppSettingsComponent implements OnInit, OnDestroy {
|
||||
|
||||
onCurrencyChange(event: any) {
|
||||
this.selNode.settings.currencyUnits = [...CURRENCY_UNITS, event.value];
|
||||
this.store.dispatch(new RTLActions.SetChildNodeSettings({userPersona: this.selNode.settings.userPersona, channelBackupPath: this.selNode.settings.channelBackupPath, satsToBTC: this.selNode.settings.satsToBTC, selCurrencyUnit: event.value, currencyUnits: this.selNode.settings.currencyUnits, fiatConversion: this.selNode.settings.fiatConversion}));
|
||||
this.store.dispatch(new RTLActions.SetChildNodeSettingsCL({userPersona: this.selNode.settings.userPersona, channelBackupPath: this.selNode.settings.channelBackupPath, satsToBTC: this.selNode.settings.satsToBTC, selCurrencyUnit: event.value, currencyUnits: this.selNode.settings.currencyUnits, fiatConversion: this.selNode.settings.fiatConversion}));
|
||||
}
|
||||
|
||||
chooseMenuType() {
|
||||
this.selNode.settings.menuType = this.selectedMenuType.id;
|
||||
this.commonService.changeContainerWidth('menuType');
|
||||
}
|
||||
|
||||
chooseFontSize() {
|
||||
this.selNode.settings.fontSize = (this.fontSizes.filter(fontSize => fontSize.id === this.selectedFontSize.id)[0]).class;
|
||||
this.store.dispatch(new RTLActions.SetChildNodeSettings({userPersona: this.selNode.settings.userPersona, channelBackupPath: this.selNode.settings.channelBackupPath, selCurrencyUnit: event.value, currencyUnits: this.selNode.settings.currencyUnits, fiatConversion: this.selNode.settings.fiatConversion}));
|
||||
this.store.dispatch(new RTLActions.SetChildNodeSettingsCL({userPersona: this.selNode.settings.userPersona, channelBackupPath: this.selNode.settings.channelBackupPath, selCurrencyUnit: event.value, currencyUnits: this.selNode.settings.currencyUnits, fiatConversion: this.selNode.settings.fiatConversion}));
|
||||
}
|
||||
|
||||
toggleSettings(toggleField: string, event?: any) {
|
||||
if(toggleField === 'menu') {
|
||||
this.selNode.settings.flgSidenavOpened = (!event.checked) ? false : true;
|
||||
setTimeout(() => {
|
||||
this.selNode.settings.menu = (!event.checked) ? 'HORIZONTAL' : 'VERTICAL';
|
||||
}, 10);
|
||||
} else {
|
||||
this.selNode.settings[toggleField] = !this.selNode.settings[toggleField];
|
||||
if(toggleField === 'flgSidenavOpened' || toggleField === 'flgSidenavPinned') {
|
||||
this.commonService.changeContainerWidth(toggleField);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
changeThemeColor(newThemeColor: string) {
|
||||
@ -124,16 +90,13 @@ export class AppSettingsComponent implements OnInit, OnDestroy {
|
||||
this.logger.info(this.selNode.settings);
|
||||
this.store.dispatch(new RTLActions.OpenSpinner('Updating Settings...'));
|
||||
this.store.dispatch(new RTLActions.SaveSettings({settings: this.selNode.settings, defaultNodeIndex: defaultNodeIndex}));
|
||||
this.store.dispatch(new RTLActions.SetChildNodeSettings({userPersona: this.selNode.settings.userPersona, channelBackupPath: this.selNode.settings.channelBackupPath, satsToBTC: this.selNode.settings.satsToBTC, selCurrencyUnit: this.selNode.settings.currencyUnit, currencyUnits: this.selNode.settings.currencyUnits, fiatConversion: this.selNode.settings.fiatConversion}));
|
||||
this.store.dispatch(new RTLActions.SetChildNodeSettingsCL({userPersona: this.selNode.settings.userPersona, channelBackupPath: this.selNode.settings.channelBackupPath, satsToBTC: this.selNode.settings.satsToBTC, selCurrencyUnit: this.selNode.settings.currencyUnit, currencyUnits: this.selNode.settings.currencyUnits, fiatConversion: this.selNode.settings.fiatConversion}));
|
||||
this.store.dispatch(new RTLActions.SetChildNodeSettings({userPersona: this.selNode.settings.userPersona, channelBackupPath: this.selNode.settings.channelBackupPath, selCurrencyUnit: this.selNode.settings.currencyUnit, currencyUnits: this.selNode.settings.currencyUnits, fiatConversion: this.selNode.settings.fiatConversion}));
|
||||
this.store.dispatch(new RTLActions.SetChildNodeSettingsCL({userPersona: this.selNode.settings.userPersona, channelBackupPath: this.selNode.settings.channelBackupPath, selCurrencyUnit: this.selNode.settings.currencyUnit, currencyUnits: this.selNode.settings.currencyUnits, fiatConversion: this.selNode.settings.fiatConversion}));
|
||||
this.done.emit();
|
||||
}
|
||||
|
||||
onResetSettings() {
|
||||
this.selNode.settings = this.previousSettings;
|
||||
this.selectedMenu = this.menus.find(menu => menu.id === this.previousSettings.menu);
|
||||
this.selectedMenuType = this.menuTypes.find(menuType => menuType.id === this.previousSettings.menuType);
|
||||
this.selectedFontSize = this.fontSizes.find(fontSize => fontSize.class === this.previousSettings.fontSize);
|
||||
this.selectedThemeMode = this.themeModes.find(themeMode => themeMode.id === this.previousSettings.themeMode);
|
||||
this.selectedThemeColor = this.previousSettings.themeColor;
|
||||
this.store.dispatch(new RTLActions.SetSelelectedNode({ lnNode: this.selNode, isInitialSetup: true }));
|
||||
|
@ -10,14 +10,8 @@ export class SSO {
|
||||
export class Settings {
|
||||
constructor(
|
||||
public userPersona: string,
|
||||
public flgSidenavOpened: boolean,
|
||||
public flgSidenavPinned: boolean,
|
||||
public menu: string,
|
||||
public menuType: string,
|
||||
public fontSize: string,
|
||||
public themeMode: string,
|
||||
public themeColor: string,
|
||||
public satsToBTC: boolean,
|
||||
public currencyUnits: Array<string>,
|
||||
public fiatConversion: boolean,
|
||||
public bitcoindConfigPath?: string,
|
||||
@ -68,7 +62,6 @@ export interface GetInfoRoot {
|
||||
export interface SelNodeChild {
|
||||
userPersona?: string;
|
||||
channelBackupPath?: string;
|
||||
satsToBTC?: boolean;
|
||||
selCurrencyUnit?: string;
|
||||
currencyUnits?: string[];
|
||||
fiatConversion?: boolean;
|
||||
|
@ -56,10 +56,7 @@ export const NODE_SETTINGS = {
|
||||
{id: 'INDIGO', name: 'RTL'},
|
||||
{id: 'PINK', name: 'BK'}
|
||||
],
|
||||
modes: [{id: 'DAY', name: 'Day'}, {id: 'NIGHT', name: 'Night'}],
|
||||
fontSize: [{id: 1, name: 'Small', class: 'SMALL'}, {id: 2, name: 'Medium', class: 'MEDIUM'}, {id: 3, name: 'Large', class: 'LARGE'}],
|
||||
menuTypes: [{id: 'REGULAR', name: 'Regular'}, {id: 'COMPACT', name: 'Compact'}, {id: 'MINI', name: 'Mini'}],
|
||||
menus: [{id: 'VERTICAL', name: 'Vertical'}, {id: 'HORIZONTAL', name: 'Horizontal'}]
|
||||
modes: [{id: 'DAY', name: 'Day'}, {id: 'NIGHT', name: 'Night'}]
|
||||
};
|
||||
|
||||
export enum UserPersonaEnum {
|
||||
|
@ -37,7 +37,6 @@ import { SigninComponent } from './components/signin/signin.component';
|
||||
import { HelpComponent } from './components/help/help.component';
|
||||
import { SideNavigationComponent } from './components/navigation/side-navigation/side-navigation.component';
|
||||
import { TopMenuComponent } from './components/navigation/top-menu/top-menu.component';
|
||||
import { HorizontalNavigationComponent } from './components/navigation/horizontal-navigation/horizontal-navigation.component';
|
||||
import { SettingsComponent } from './components/settings/settings.component';
|
||||
import { ServerConfigComponent } from './components/settings/server-config/server-config.component';
|
||||
import { ErrorComponent } from './components/error/error.component';
|
||||
@ -145,7 +144,6 @@ import { LoggerService, ConsoleLoggerService } from '../shared/services/logger.s
|
||||
NotFoundComponent,
|
||||
SideNavigationComponent,
|
||||
TopMenuComponent,
|
||||
HorizontalNavigationComponent,
|
||||
SigninComponent,
|
||||
HelpComponent,
|
||||
ServerConfigComponent,
|
||||
@ -170,7 +168,6 @@ import { LoggerService, ConsoleLoggerService } from '../shared/services/logger.s
|
||||
NotFoundComponent,
|
||||
SideNavigationComponent,
|
||||
TopMenuComponent,
|
||||
HorizontalNavigationComponent,
|
||||
SigninComponent,
|
||||
HelpComponent,
|
||||
ServerConfigComponent,
|
||||
|
@ -346,9 +346,9 @@ export class RTLEffects implements OnDestroy {
|
||||
const landingPage = isInitialSetup ? '' : 'HOME';
|
||||
let selNode = {};
|
||||
if(node.settings.fiatConversion && node.settings.currencyUnit) {
|
||||
selNode = { userPersona: node.settings.userPersona, channelBackupPath: node.settings.channelBackupPath, satsToBTC: node.settings.satsToBTC, selCurrencyUnit: node.settings.currencyUnit, currencyUnits: [...CURRENCY_UNITS, node.settings.currencyUnit], fiatConversion: node.settings.fiatConversion };
|
||||
selNode = { userPersona: node.settings.userPersona, channelBackupPath: node.settings.channelBackupPath, selCurrencyUnit: node.settings.currencyUnit, currencyUnits: [...CURRENCY_UNITS, node.settings.currencyUnit], fiatConversion: node.settings.fiatConversion };
|
||||
} else {
|
||||
selNode = { userPersona: node.settings.userPersona, channelBackupPath: node.settings.channelBackupPath, satsToBTC: node.settings.satsToBTC, selCurrencyUnit: node.settings.currencyUnit, currencyUnits: CURRENCY_UNITS, fiatConversion: node.settings.fiatConversion };
|
||||
selNode = { userPersona: node.settings.userPersona, channelBackupPath: node.settings.channelBackupPath, selCurrencyUnit: node.settings.currencyUnit, currencyUnits: CURRENCY_UNITS, fiatConversion: node.settings.fiatConversion };
|
||||
}
|
||||
this.store.dispatch(new RTLActions.ResetRootStore(node));
|
||||
this.store.dispatch(new RTLActions.ResetLNDStore(selNode));
|
||||
|
@ -13,7 +13,7 @@ export interface RootState {
|
||||
nodeData: GetInfoRoot;
|
||||
}
|
||||
|
||||
const initNodeSettings = { userPersona: 'OPERATOR', flgSidenavOpened: true, flgSidenavPinned: true, menu: 'VERTICAL', menuType: 'REGULAR', fontSize: 'MEDIUM', themeMode: 'DAY', themeColor: 'PURPLE', satsToBTC: false, channelBackupPath: '', selCurrencyUnit: 'USD', fiatConversion: false, currencyUnits: ['Sats', 'BTC', 'USD'] };
|
||||
const initNodeSettings = { userPersona: 'OPERATOR', themeMode: 'DAY', themeColor: 'PURPLE', channelBackupPath: '', selCurrencyUnit: 'USD', fiatConversion: false, currencyUnits: ['Sats', 'BTC', 'USD'] };
|
||||
const initNodeAuthentication = { configPath: '', bitcoindConfigPath: '' };
|
||||
|
||||
const initRootState: RootState = {
|
||||
|
@ -1 +1 @@
|
||||
export const VERSION = '0.6.2-beta';
|
||||
export const VERSION = '0.6.4-beta';
|
Loading…
Reference in New Issue
Block a user