Incomplete: Services UI fix

ShahanaFarooqui 2 weeks ago
parent 39b6f28765
commit 39f9377365

@ -219,12 +219,16 @@ export const updateNodeSettings = (req, res, next) => {
const node = config.nodes.find((node) => (node.index === req.session.selectedNode.index));
if (node && node.settings) {
node.settings = req.body.settings;
node.authentication.boltzMacaroonPath = req.body.authentication.boltzMacaroonPath;
node.authentication.swapMacaroonPath = req.body.authentication.swapMacaroonPath;
}
try {
fs.writeFileSync(RTLConfFile, JSON.stringify(config, null, 2), 'utf-8');
const selectedNode = common.findNode(req.session.selectedNode.index);
if (selectedNode && selectedNode.settings) {
selectedNode.settings = req.body.settings;
selectedNode.authentication.boltzMacaroonPath = req.body.authentication.boltzMacaroonPath;
selectedNode.authentication.swapMacaroonPath = req.body.authentication.swapMacaroonPath;
common.replaceNode(req, selectedNode);
}
let responseNode = JSON.parse(JSON.stringify(common.selectedNode));

@ -225,12 +225,16 @@ export const updateNodeSettings = (req, res, next) => {
const node = config.nodes.find((node) => (node.index === req.session.selectedNode.index));
if (node && node.settings) {
node.settings = req.body.settings;
node.authentication.boltzMacaroonPath = req.body.authentication.boltzMacaroonPath;
node.authentication.swapMacaroonPath = req.body.authentication.swapMacaroonPath;
}
try {
fs.writeFileSync(RTLConfFile, JSON.stringify(config, null, 2), 'utf-8');
const selectedNode = common.findNode(req.session.selectedNode.index);
if (selectedNode && selectedNode.settings) {
selectedNode.settings = req.body.settings;
selectedNode.authentication.boltzMacaroonPath = req.body.authentication.boltzMacaroonPath;
selectedNode.authentication.swapMacaroonPath = req.body.authentication.swapMacaroonPath;
common.replaceNode(req, selectedNode);
}
let responseNode = JSON.parse(JSON.stringify(common.selectedNode));

@ -9,12 +9,9 @@ import { RTLState } from '../../../../store/rtl.state';
import { rootSelectedNode } from '../../../../store/rtl.selector';
import { Node } from '../../../models/RTLconfig';
import { updateNodeSettings } from '../../../../store/rtl.actions';
import { setChildNodeSettingsLND } from '../../../../lnd/store/lnd.actions';
import { setChildNodeSettingsCLN } from '../../../../cln/store/cln.actions';
import { setChildNodeSettingsECL } from '../../../../eclair/store/ecl.actions';
import { DataService } from '../../../services/data.service';
import { CommonService } from '../../../services/common.service';
import { ServicesEnum, UI_MESSAGES, LADS_POLICY } from '../../../services/consts-enums-functions';
import { LADS_POLICY } from '../../../services/consts-enums-functions';
import { utxoBalances } from '../../../../cln/store/cln.selector';
import { Balance, FunderPolicy, LocalRemoteBalance, UTXO } from '../../../models/clnModels';
import { ApiCallStatusPayload } from '../../../models/apiCallsPayload';
@ -91,25 +88,7 @@ export class ExperimentalSettingsComponent implements OnInit, OnDestroy {
this.logger.info(this.selNode);
this.selNode.settings.enableOffers = this.enableOffers;
this.features[0].enabled = this.enableOffers;
// this.store.dispatch(updateNodeSettings({ payload: { uiMessage: UI_MESSAGES.UPDATE_SETTING, service: ServicesEnum.OFFERS, settings: { enableOffers: this.enableOffers } } }));
// this.store.dispatch(setChildNodeSettingsLND({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.selNode.settings.boltzServerUrl, enableOffers: this.enableOffers
// }
// }));
// this.store.dispatch(setChildNodeSettingsCLN({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.selNode.settings.boltzServerUrl, enableOffers: this.enableOffers
// }
// }));
// this.store.dispatch(setChildNodeSettingsECL({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.selNode.settings.boltzServerUrl, enableOffers: this.enableOffers
// }
// }));
this.store.dispatch(updateNodeSettings({ payload: this.selNode }));
}
onUpdateFundingPolicy() {

@ -31,10 +31,10 @@
<span>Fiat conversion calls <strong><a href="https://www.blockchain.com/api/exchange_rates_api" target="blank">Blockchain.com</a></strong> API to get conversion rates.</span>
</div>
<div fxLayout="row wrap" fxLayoutAlign="start center">
<mat-slide-toggle tabindex="2" color="primary" name="fiatConversion" class="mr-2" [(ngModel)]="selNode.settings.fiatConversion" (change)="!selNode.settings.currencyUnit">Enable Fiat Conversion</mat-slide-toggle>
<mat-slide-toggle tabindex="2" color="primary" name="fiatConversion" class="mr-2" [(ngModel)]="selNode.settings.fiatConversion" (change)="onFiatConversionChange($event)">Enable Fiat Conversion</mat-slide-toggle>
<mat-form-field fxFlex="25">
<mat-label>Fiat Currency</mat-label>
<mat-select #currencyUnit="ngModel" autoFocus tabindex="3" name="currencyUnit" [disabled]="!selNode.settings.fiatConversion" [required]="selNode.settings.fiatConversion" [(ngModel)]="selNode.settings.currencyUnit" (selectionChange)="onCurrencyChange($event)">
<mat-select #currencyUnit="ngModel" autoFocus tabindex="3" name="currencyUnit" [disabled]="!selNode.settings.fiatConversion" [required]="selNode.settings.fiatConversion" [(ngModel)]="selNode.settings.currencyUnit">
<mat-option *ngFor="let currencyUnit of currencyUnits" [value]="currencyUnit.id">
<span *ngIf="currencyUnit && currencyUnit.iconType === 'FA'" class="mr-1"><fa-icon [icon]="currencyUnit.symbol" /></span>
<span *ngIf="currencyUnit && currencyUnit.iconType === 'SVG'" class="mr-1"><span fxLayoutAlign="center center" [innerHTML]="currencyUnit.symbol"></span></span>

@ -5,16 +5,13 @@ import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { faMoneyBillAlt, faPaintBrush, faInfoCircle, faExclamationTriangle, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
import { CURRENCY_UNITS, UserPersonaEnum, ScreenSizeEnum, FIAT_CURRENCY_UNITS, NODE_SETTINGS, UI_MESSAGES } from '../../../services/consts-enums-functions';
import { UserPersonaEnum, ScreenSizeEnum, FIAT_CURRENCY_UNITS, NODE_SETTINGS, UI_MESSAGES } from '../../../services/consts-enums-functions';
import { Node, Settings } from '../../../models/RTLconfig';
import { LoggerService } from '../../../services/logger.service';
import { CommonService } from '../../../services/common.service';
import { RTLState } from '../../../../store/rtl.state';
import { rootSelectedNode } from '../../../../store/rtl.selector';
import { updateNodeSettings, setSelectedNode, updateSelectedNodeSettings } from '../../../../store/rtl.actions';
import { setChildNodeSettingsLND } from '../../../../lnd/store/lnd.actions';
import { setChildNodeSettingsCLN } from '../../../../cln/store/cln.actions';
import { setChildNodeSettingsECL } from '../../../../eclair/store/ecl.actions';
import { updateNodeSettings, setSelectedNode } from '../../../../store/rtl.actions';
@Component({
selector: 'rtl-node-settings',
@ -67,14 +64,14 @@ export class NodeSettingsComponent implements OnInit, OnDestroy {
});
}
onCurrencyChange(event: any) {
this.selNode.settings.currencyUnits = [...CURRENCY_UNITS, event.value];
this.store.dispatch(updateSelectedNodeSettings({ payload: this.selNode }));
this.store.dispatch(setChildNodeSettingsLND({ payload: this.selNode }));
this.store.dispatch(setChildNodeSettingsCLN({ payload: this.selNode }));
this.store.dispatch(setChildNodeSettingsECL({ payload: this.selNode }));
// this.store.dispatch(updateNodeSettings({ payload: this.selNode }));
}
// onCurrencyChange(event: any) {
// if (this.selNode.settings.fiatConversion) {
// this.selNode.settings.currencyUnit = '';
// } else {
// delete this.selNode.settings.currencyUnit;
// }
// this.store.dispatch(updateNodeSettings({ payload: this.selNode }));
// }
toggleSettings(toggleField: string, event?: any) {
this.selNode.settings[toggleField] = !this.selNode.settings[toggleField];
@ -89,6 +86,12 @@ export class NodeSettingsComponent implements OnInit, OnDestroy {
this.selNode.settings.themeMode = this.selectedThemeMode.id;
}
onFiatConversionChange(event: any) {
if (!this.selNode.settings.fiatConversion) {
delete this.selNode.settings.currencyUnit;
}
}
onUpdateNodeSettings(): boolean | void {
if (this.selNode.settings.fiatConversion && !this.selNode.settings.currencyUnit) {
return true;

@ -3,15 +3,11 @@ import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { ServicesEnum, UI_MESSAGES } from '../../../../services/consts-enums-functions';
import { Node } from '../../../../models/RTLconfig';
import { LoggerService } from '../../../../services/logger.service';
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import { updateNodeSettings } from '../../../../../store/rtl.actions';
import { RTLState } from '../../../../../store/rtl.state';
import { setChildNodeSettingsLND } from '../../../../../lnd/store/lnd.actions';
import { setChildNodeSettingsCLN } from '../../../../../cln/store/cln.actions';
import { setChildNodeSettingsECL } from '../../../../../eclair/store/ecl.actions';
import { rootSelectedNode } from '../../../../../store/rtl.selector';
@Component({
@ -67,27 +63,14 @@ export class BoltzServiceSettingsComponent implements OnInit, OnDestroy {
return true;
}
this.logger.info(this.selNode);
this.selNode.settings.boltzServerUrl = this.serverUrl;
this.selNode.authentication.boltzMacaroonPath = this.macaroonPath;
// this.store.dispatch(updateNodeSettings({ payload: { uiMessage: UI_MESSAGES.UPDATE_BOLTZ_SETTINGS, service: ServicesEnum.BOLTZ, settings: { enable: this.enableBoltz, serverUrl: this.serverUrl, macaroonPath: this.macaroonPath } } }));
// this.store.dispatch(setChildNodeSettingsLND({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.serverUrl, enableOffers: this.selNode.settings.enableOffers
// }
// }));
// this.store.dispatch(setChildNodeSettingsCLN({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.serverUrl, enableOffers: this.selNode.settings.enableOffers
// }
// }));
// this.store.dispatch(setChildNodeSettingsECL({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.serverUrl, enableOffers: this.selNode.settings.enableOffers
// }
// }));
if (!this.enableBoltz) {
delete this.selNode.settings.boltzServerUrl;
delete this.selNode.authentication.boltzMacaroonPath;
} else {
this.selNode.settings.boltzServerUrl = this.serverUrl;
this.selNode.authentication.boltzMacaroonPath = this.macaroonPath;
}
this.store.dispatch(updateNodeSettings({ payload: this.selNode }));
}
onReset() {

@ -3,15 +3,11 @@ import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { ServicesEnum, UI_MESSAGES } from '../../../../services/consts-enums-functions';
import { Node } from '../../../../models/RTLconfig';
import { LoggerService } from '../../../../services/logger.service';
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import { updateNodeSettings } from '../../../../../store/rtl.actions';
import { RTLState } from '../../../../../store/rtl.state';
import { setChildNodeSettingsLND } from '../../../../../lnd/store/lnd.actions';
import { setChildNodeSettingsCLN } from '../../../../../cln/store/cln.actions';
import { setChildNodeSettingsECL } from '../../../../../eclair/store/ecl.actions';
import { rootSelectedNode } from '../../../../../store/rtl.selector';
@Component({
@ -56,26 +52,12 @@ export class LoopServiceSettingsComponent implements OnInit, OnDestroy {
if (this.enableLoop && (!this.selNode.settings.swapServerUrl || this.selNode.settings.swapServerUrl.trim() === '' || !this.selNode.authentication.swapMacaroonPath || this.selNode.authentication.swapMacaroonPath.trim() === '')) {
return true;
}
if (!this.enableLoop) {
delete this.selNode.settings.swapServerUrl;
delete this.selNode.authentication.swapMacaroonPath;
}
this.logger.info(this.selNode);
// this.store.dispatch(updateNodeSettings({ payload: { uiMessage: UI_MESSAGES.UPDATE_LOOP_SETTINGS, service: ServicesEnum.LOOP, settings: { enable: this.enableLoop, serverUrl: this.selNode.settings.swapServerUrl, macaroonPath: this.selNode.authentication.swapMacaroonPath } } }));
// this.store.dispatch(setChildNodeSettingsLND({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.selNode.settings.boltzServerUrl, enableOffers: this.selNode.settings.enableOffers
// }
// }));
// this.store.dispatch(setChildNodeSettingsCLN({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.selNode.settings.boltzServerUrl, enableOffers: this.selNode.settings.enableOffers
// }
// }));
// this.store.dispatch(setChildNodeSettingsECL({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.selNode.settings.boltzServerUrl, enableOffers: this.selNode.settings.enableOffers
// }
// }));
this.store.dispatch(updateNodeSettings({ payload: this.selNode }));
}
onReset() {

@ -3,15 +3,11 @@ import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { ServicesEnum, UI_MESSAGES } from '../../../../services/consts-enums-functions';
import { Node } from '../../../../models/RTLconfig';
import { LoggerService } from '../../../../services/logger.service';
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import { updateNodeSettings } from '../../../../../store/rtl.actions';
import { RTLState } from '../../../../../store/rtl.state';
import { setChildNodeSettingsLND } from '../../../../../lnd/store/lnd.actions';
import { setChildNodeSettingsCLN } from '../../../../../cln/store/cln.actions';
import { setChildNodeSettingsECL } from '../../../../../eclair/store/ecl.actions';
import { rootSelectedNode } from '../../../../../store/rtl.selector';
@Component({
@ -39,28 +35,7 @@ export class PeerswapServiceSettingsComponent implements OnInit, OnDestroy {
}
onUpdateService(): boolean | void {
// this.store.dispatch(updateNodeSettings({ payload: { uiMessage: UI_MESSAGES.UPDATE_PEERSWAP_SETTINGS, service: ServicesEnum.PEERSWAP, settings: { enablePeerswap: this.enablePeerswap } } }));
// this.store.dispatch(setChildNodeSettingsLND({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.selNode.settings.boltzServerUrl, enableOffers: this.selNode.settings.enableOffers, enablePeerswap:
// this.selNode.settings.enablePeerswap
// }
// }));
// this.store.dispatch(setChildNodeSettingsCLN({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.selNode.settings.boltzServerUrl, enableOffers: this.selNode.settings.enableOffers, enablePeerswap:
// this.selNode.settings.enablePeerswap
// }
// }));
// this.store.dispatch(setChildNodeSettingsECL({
// payload: {
// 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,
// unannouncedChannels: this.selNode.settings.unannouncedChannels, lnImplementation: this.selNode.lnImplementation, swapServerUrl: this.selNode.settings.swapServerUrl, boltzServerUrl: this.selNode.settings.boltzServerUrl, enableOffers: this.selNode.settings.enableOffers, enablePeerswap:
// this.selNode.settings.enablePeerswap
// }
// }));
this.store.dispatch(updateNodeSettings({ payload: this.selNode }));
}
ngOnDestroy() {

@ -5,10 +5,6 @@
<span class="page-title">Default Node</span>
</div>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch" class="my-2">
<div fxLayout="row" fxFlex="100" class="alert alert-info">
<fa-icon class="mr-1 alert-icon" [icon]="faInfoCircle" />
<span>The setting will apply after RTL server restarts.</span>
</div>
<div fxLayout="row" fxLayoutAlign="start start">
<mat-form-field fxLayout="column" fxLayoutAlign="start start">
<mat-select autoFocus tabindex="1" name="defaultNode" [(ngModel)]="appConfig.defaultNodeIndex">

@ -2,7 +2,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { faWindowRestore, faPlus, faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import { faWindowRestore, faPlus } from '@fortawesome/free-solid-svg-icons';
import { RTLConfiguration } from '../../../models/RTLconfig';
import { LoggerService } from '../../../services/logger.service';
@ -18,7 +18,6 @@ import { rootAppConfig } from '../../../../store/rtl.selector';
})
export class AppSettingsComponent implements OnInit, OnDestroy {
public faInfoCircle = faInfoCircle;
public faWindowRestore = faWindowRestore;
public faPlus = faPlus;
public appConfig: RTLConfiguration;

@ -419,7 +419,7 @@ export enum RTLActions {
UPDATE_ROOT_NODE_SETTINGS = 'UPDATE_ROOT_NODE_SETTINGS',
UPDATE_APPLICATION_SETTINGS = 'UPDATE_APPLICATION_SETTINGS',
UPDATE_NODE_SETTINGS = 'UPDATE_NODE_SETTINGS',
UPDATE_SELECTED_NODE_SETTINGS = 'UPDATE_SELECTED_NODE_SETTINGS',
SET_SELECTED_NODE_SETTINGS = 'SET_SELECTED_NODE_SETTINGS',
SET_NODE_DATA = 'SET_NODE_DATA',
IS_AUTHORIZED = 'IS_AUTHORIZED',
IS_AUTHORIZED_RES = 'IS_AUTHORIZED_RES',

@ -46,7 +46,7 @@ export const setSelectedNode = createAction(RTLActions.SET_SELECTED_NODE, props<
export const updateNodeSettings = createAction(RTLActions.UPDATE_NODE_SETTINGS, props<{ payload: Node }>());
export const updateSelectedNodeSettings = createAction(RTLActions.UPDATE_SELECTED_NODE_SETTINGS, props<{ payload: Node }>());
export const setSelectedNodeSettings = createAction(RTLActions.SET_SELECTED_NODE_SETTINGS, props<{ payload: Node }>());
export const updateApplicationSettings = createAction(RTLActions.UPDATE_APPLICATION_SETTINGS, props<{ payload: { showSnackBar: boolean, message: string, config: RTLConfiguration } }>());

@ -26,7 +26,7 @@ import { ErrorMessageComponent } from '../shared/components/data-modal/error-mes
import { ShowPubkeyComponent } from '../shared/components/data-modal/show-pubkey/show-pubkey.component';
import { RTLState } from './rtl.state';
import { resetRootStore, setNodeData, setSelectedNode, updateRootAPICallStatus, closeSpinner, openAlert, openSpinner, openSnackBar, fetchRTLConfig, closeAllDialogs, logout, updateSelectedNodeSettings } from './rtl.actions';
import { resetRootStore, setNodeData, setSelectedNode, updateRootAPICallStatus, closeSpinner, openAlert, openSpinner, openSnackBar, fetchRTLConfig, closeAllDialogs, logout, setSelectedNodeSettings } from './rtl.actions';
import { fetchInfoLND, resetLNDStore, fetchPageSettings as fetchPageSettingsLND, setChildNodeSettingsLND } from '../lnd/store/lnd.actions';
import { fetchInfoCLN, resetCLNStore, fetchPageSettings as fetchPageSettingsCLN, setChildNodeSettingsCLN } from '../cln/store/cln.actions';
import { fetchInfoECL, resetECLStore, fetchPageSettings as fetchPageSettingsECL, setChildNodeSettingsECL } from '../eclair/store/ecl.actions';
@ -249,13 +249,16 @@ export class RTLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: Node }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.UPDATE_NODE_SETTINGS }));
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'updateNodeSettings', status: APICallStatusEnum.INITIATED } }));
if (!action.payload.settings.fiatConversion) {
delete action.payload.settings.currencyUnit;
}
delete action.payload.settings.currencyUnits;
return this.httpClient.post(API_END_POINTS.CONF_API + '/node', action.payload).
pipe(map((updatedNode: Node) => {
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'updateNodeSettings', status: APICallStatusEnum.COMPLETED } }));
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.UPDATE_NODE_SETTINGS }));
updatedNode.settings.currencyUnits = [...CURRENCY_UNITS, (updatedNode.settings?.currencyUnit ? updatedNode.settings?.currencyUnit : '')];
this.store.dispatch(updateSelectedNodeSettings({ payload: updatedNode }));
this.store.dispatch(setSelectedNodeSettings({ payload: updatedNode }));
this.store.dispatch(setChildNodeSettingsLND({ payload: updatedNode }));
this.store.dispatch(setChildNodeSettingsCLN({ payload: updatedNode }));
this.store.dispatch(setChildNodeSettingsECL({ payload: updatedNode }));

@ -1,7 +1,7 @@
import { createReducer, on } from '@ngrx/store';
import { initRootState } from './rtl.state';
import { resetRootStore, setNodeData, setApplicationSettings, updateSelectedNodeSettings, updateRootAPICallStatus } from './rtl.actions';
import { resetRootStore, setNodeData, setApplicationSettings, setSelectedNodeSettings, updateRootAPICallStatus } from './rtl.actions';
export const RootReducer = createReducer(initRootState,
on(updateRootAPICallStatus, (state, { payload }) => {
@ -26,7 +26,7 @@ export const RootReducer = createReducer(initRootState,
appConfig: state.appConfig,
selNode: payload
})),
on(updateSelectedNodeSettings, (state, { payload }) => ({
on(setSelectedNodeSettings, (state, { payload }) => ({
...state,
selNode: payload
})),

Loading…
Cancel
Save