mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2025-02-22 14:22:48 +01:00
LND Services Page Layout
This commit is contained in:
parent
f5fe776cd0
commit
8986fb6771
53 changed files with 340 additions and 485 deletions
|
@ -21,12 +21,6 @@ import { NotFoundComponent } from './shared/components/not-found/not-found.compo
|
|||
import { ErrorComponent } from './shared/components/error/error.component';
|
||||
import { AuthGuard } from './shared/services/auth.guard';
|
||||
import { ExperimentalSettingsComponent } from './shared/components/node-config/experimental-settings/experimental-settings.component';
|
||||
import { PeerswapComponent } from './shared/components/ln-services/peerswap/peerswap.component';
|
||||
import { PeerswapServiceSettingsComponent } from './shared/components/node-config/services-settings/peerswap-service-settings/peerswap-service-settings.component';
|
||||
import { SwapPeersComponent } from './shared/components/ln-services/peerswap/swap-peers/swap-peers.component';
|
||||
import { PeerswapsOutComponent } from './shared/components/ln-services/peerswap/swaps-out/swaps-out.component';
|
||||
import { PeerswapsInComponent } from './shared/components/ln-services/peerswap/swaps-in/swaps-in.component';
|
||||
import { PeerswapsCancelledComponent } from './shared/components/ln-services/peerswap/swaps-cancelled/swaps-cancelled.component';
|
||||
|
||||
export const routes: Routes = [
|
||||
{ path: '', pathMatch: 'full', redirectTo: 'login' },
|
||||
|
@ -50,8 +44,7 @@ export const routes: Routes = [
|
|||
path: 'services', component: ServicesSettingsComponent, canActivate: [AuthGuard], children: [
|
||||
{ path: '', pathMatch: 'full', redirectTo: 'loop' },
|
||||
{ path: 'loop', component: LoopServiceSettingsComponent, canActivate: [AuthGuard] },
|
||||
{ path: 'boltz', component: BoltzServiceSettingsComponent, canActivate: [AuthGuard] },
|
||||
{ path: 'peerswap', component: PeerswapServiceSettingsComponent, canActivate: [AuthGuard] }
|
||||
{ path: 'boltz', component: BoltzServiceSettingsComponent, canActivate: [AuthGuard] }
|
||||
]
|
||||
},
|
||||
{ path: 'experimental', component: ExperimentalSettingsComponent, canActivate: [AuthGuard] },
|
||||
|
@ -64,16 +57,7 @@ export const routes: Routes = [
|
|||
{ path: 'loop', pathMatch: 'full', redirectTo: 'loop/loopout' },
|
||||
{ path: 'loop/:selTab', component: LoopComponent },
|
||||
{ path: 'boltz', pathMatch: 'full', redirectTo: 'boltz/swapout' },
|
||||
{ path: 'boltz/:selTab', component: BoltzRootComponent },
|
||||
{
|
||||
path: 'peerswap', component: PeerswapComponent, canActivate: [AuthGuard], children: [
|
||||
{ path: '', pathMatch: 'full', redirectTo: 'peers' },
|
||||
{ path: 'peers', component: SwapPeersComponent, canActivate: [AuthGuard] },
|
||||
{ path: 'psout', component: PeerswapsOutComponent, canActivate: [AuthGuard] },
|
||||
{ path: 'psin', component: PeerswapsInComponent, canActivate: [AuthGuard] },
|
||||
{ path: 'pscancelled', component: PeerswapsCancelledComponent, canActivate: [AuthGuard] }
|
||||
]
|
||||
}
|
||||
{ path: 'boltz/:selTab', component: BoltzRootComponent }
|
||||
]
|
||||
},
|
||||
{ path: 'help', component: HelpComponent },
|
||||
|
|
|
@ -20,7 +20,7 @@ import { RTLEffects } from '../../../store/rtl.effects';
|
|||
import { CLNOpenLiquidityChannelComponent } from '../open-liquidity-channel-modal/open-liquidity-channel-modal.component';
|
||||
import { clnPageSettings, nodeInfoAndNodeSettingsAndBalance } from '../../store/cln.selector';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-liquidity-ads-list',
|
||||
|
@ -69,7 +69,7 @@ export class CLNLiquidityAdsListComponent implements OnInit, OnDestroy {
|
|||
|
||||
ngOnInit(): void {
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -16,7 +16,7 @@ import { CommonService } from '../../../../shared/services/common.service';
|
|||
import { RTLState } from '../../../../store/rtl.state';
|
||||
import { openAlert } from '../../../../store/rtl.actions';
|
||||
import { clnPageSettings, utxos } from '../../../store/cln.selector';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-on-chain-utxos',
|
||||
|
@ -56,7 +56,7 @@ export class CLNOnChainUtxosComponent implements OnInit, AfterViewInit, OnDestro
|
|||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.tableSetting.tableId = this.isDustUTXO ? 'dust_utxos' : 'utxos';
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import { openAlert, openConfirmation } from '../../../../../store/rtl.actions';
|
|||
import { RTLState } from '../../../../../store/rtl.state';
|
||||
import { channelLookup, closeChannel, updateChannel } from '../../../../store/cln.actions';
|
||||
import { channels, clnPageSettings, nodeInfoAndBalanceAndNumPeers } from '../../../../store/cln.selector';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-channel-open-table',
|
||||
|
@ -72,7 +72,7 @@ export class CLNChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
|
|||
this.logger.info(infoBalNumpeersSelector);
|
||||
});
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[1])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -20,7 +20,7 @@ import { openAlert, openConfirmation } from '../../../../../store/rtl.actions';
|
|||
import { RTLState } from '../../../../../store/rtl.state';
|
||||
import { closeChannel } from '../../../../store/cln.actions';
|
||||
import { channels, clnPageSettings, nodeInfoAndBalanceAndNumPeers } from '../../../../store/cln.selector';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-channel-pending-table',
|
||||
|
@ -74,7 +74,7 @@ export class CLNChannelPendingTableComponent implements OnInit, AfterViewInit, O
|
|||
this.logger.info(infoBalNumpeersSelector);
|
||||
});
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[1])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import { RTLState } from '../../../store/rtl.state';
|
|||
import { openAlert, openConfirmation } from '../../../store/rtl.actions';
|
||||
import { detachPeer } from '../../store/cln.actions';
|
||||
import { clnPageSettings, nodeInfoAndBalance, peers } from '../../store/cln.selector';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-peers',
|
||||
|
@ -67,7 +67,7 @@ export class CLNPeersComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
this.availableBalance = infoBalSelector.balance.totalBalance || 0;
|
||||
});
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[1])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -12,7 +12,7 @@ import { RTLState } from '../../../store/rtl.state';
|
|||
import { payments, listInvoices, clnPageSettings } from '../../store/cln.selector';
|
||||
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
|
||||
import { LoggerService } from '../../../shared/services/logger.service';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-transactions-report',
|
||||
|
@ -53,7 +53,7 @@ export class CLNTransactionsReportComponent implements OnInit, OnDestroy {
|
|||
this.screenSize = this.commonService.getScreenSize();
|
||||
this.showYAxisLabel = !(this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM);
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
if (settings.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
|
||||
this.displayedColumns = ['date', 'amount_paid', 'amount_received'];
|
||||
|
|
|
@ -19,7 +19,7 @@ import { openAlert } from '../../../store/rtl.actions';
|
|||
import { getForwardingHistory } from '../../store/cln.actions';
|
||||
import { clnPageSettings, failedForwardingHistory } from '../../store/cln.selector';
|
||||
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-failed-history',
|
||||
|
@ -59,7 +59,7 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
|
|||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.FAILED } }));
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import { RTLState } from '../../../store/rtl.state';
|
|||
import { openAlert } from '../../../store/rtl.actions';
|
||||
import { clnPageSettings, forwardingHistory } from '../../store/cln.selector';
|
||||
import { getForwardingHistory } from '../../store/cln.actions';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-forwarding-history',
|
||||
|
@ -58,7 +58,7 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
|
|||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import { openAlert } from '../../../store/rtl.actions';
|
|||
import { getForwardingHistory } from '../../store/cln.actions';
|
||||
import { clnPageSettings, localFailedForwardingHistory } from '../../store/cln.selector';
|
||||
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-local-failed-history',
|
||||
|
@ -60,7 +60,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
|
|||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED } }));
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import { CommonService } from '../../../shared/services/common.service';
|
|||
|
||||
import { RTLState } from '../../../store/rtl.state';
|
||||
import { clnPageSettings, forwardingHistory } from '../../store/cln.selector';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
|
||||
import { getForwardingHistory } from '../../store/cln.actions';
|
||||
|
||||
@Component({
|
||||
|
@ -61,7 +61,7 @@ export class CLNRoutingPeersComponent implements OnInit, OnChanges, AfterViewIni
|
|||
}
|
||||
});
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -3,8 +3,8 @@ import { createAction, props } from '@ngrx/store';
|
|||
import { CLNActions } from '../../shared/services/consts-enums-functions';
|
||||
import { ApiCallStatusPayload } from '../../shared/models/apiCallsPayload';
|
||||
import { SelNodeChild } from '../../shared/models/RTLconfig';
|
||||
import { GetInfo, Fees, Peer, Payment, QueryRoutes, Channel, FeeRates, Invoice, ListInvoices, OnChain, UTXO, SaveChannel, GetNewAddress, DetachPeer, UpdateChannel, CloseChannel, SendPayment, GetQueryRoutes, ChannelLookup, OfferInvoice, Offer, OfferBookmark, ListForwards, FetchListForwards, LocalFailedEvent, ForwardingEvent } from '../../shared/models/clnModels';
|
||||
import { PageSettingsCLN } from '../../shared/models/pageSettings';
|
||||
import { GetInfo, Fees, Peer, Payment, QueryRoutes, Channel, FeeRates, Invoice, ListInvoices, OnChain, UTXO, SaveChannel, GetNewAddress, DetachPeer, UpdateChannel, CloseChannel, SendPayment, GetQueryRoutes, ChannelLookup, OfferInvoice, Offer, OfferBookmark, ListForwards, FetchListForwards } from '../../shared/models/clnModels';
|
||||
import { PageSettings } from '../../shared/models/pageSettings';
|
||||
|
||||
export const updateCLAPICallStatus = createAction(CLNActions.UPDATE_API_CALL_STATUS_CLN, props<{ payload: ApiCallStatusPayload }>());
|
||||
|
||||
|
@ -12,11 +12,11 @@ export const resetCLStore = createAction(CLNActions.RESET_CLN_STORE, props<{ pay
|
|||
|
||||
export const setChildNodeSettingsCL = createAction(CLNActions.SET_CHILD_NODE_SETTINGS_CLN, props<{ payload: SelNodeChild }>());
|
||||
|
||||
export const fetchPageSettingsCL = createAction(CLNActions.FETCH_PAGE_SETTINGS_CLN);
|
||||
export const fetchPageSettings = createAction(CLNActions.FETCH_PAGE_SETTINGS_CLN);
|
||||
|
||||
export const setPageSettings = createAction(CLNActions.SET_PAGE_SETTINGS_CLN, props<{ payload: PageSettingsCLN[] }>());
|
||||
export const setPageSettings = createAction(CLNActions.SET_PAGE_SETTINGS_CLN, props<{ payload: PageSettings[] }>());
|
||||
|
||||
export const savePageSettings = createAction(CLNActions.SAVE_PAGE_SETTINGS_CLN, props<{ payload: PageSettingsCLN[] }>());
|
||||
export const savePageSettings = createAction(CLNActions.SAVE_PAGE_SETTINGS_CLN, props<{ payload: PageSettings[] }>());
|
||||
|
||||
export const fetchInfoCL = createAction(CLNActions.FETCH_INFO_CLN, props<{ payload: { loadPage: string } }>());
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import { AlertTypeEnum, APICallStatusEnum, UI_MESSAGES, CLNWSEventTypeEnum, CLNA
|
|||
import { closeAllDialogs, closeSpinner, logout, openAlert, openSnackBar, openSpinner, setApiUrl, setNodeData } from '../../store/rtl.actions';
|
||||
|
||||
import { RTLState } from '../../store/rtl.state';
|
||||
import { addUpdateOfferBookmark, fetchBalance, fetchChannels, fetchFeeRates, fetchFees, fetchInvoices, fetchLocalRemoteBalance, fetchPayments, fetchPeers, fetchUTXOs, setLookup, setPeers, setQueryRoutes, updateCLAPICallStatus, updateInvoice, setOfferInvoice, sendPaymentStatus, setForwardingHistory, fetchPageSettingsCL } from './cln.actions';
|
||||
import { addUpdateOfferBookmark, fetchBalance, fetchChannels, fetchFeeRates, fetchFees, fetchInvoices, fetchLocalRemoteBalance, fetchPayments, fetchPeers, fetchUTXOs, setLookup, setPeers, setQueryRoutes, updateCLAPICallStatus, updateInvoice, setOfferInvoice, sendPaymentStatus, setForwardingHistory, fetchPageSettings } from './cln.actions';
|
||||
import { allAPIsCallStatus } from './cln.selector';
|
||||
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload';
|
||||
import { CLNOfferInformationComponent } from '../transactions/offers/offer-information-modal/offer-information.component';
|
||||
|
@ -1004,7 +1004,7 @@ export class CLNEffects implements OnDestroy {
|
|||
newRoute = '/cln/home';
|
||||
}
|
||||
this.router.navigate([newRoute]);
|
||||
this.store.dispatch(fetchPageSettingsCL());
|
||||
this.store.dispatch(fetchPageSettings());
|
||||
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: 1000000, index_offset: 0, reversed: true } }));
|
||||
this.store.dispatch(fetchFees());
|
||||
this.store.dispatch(fetchChannels());
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
} from './cln.actions';
|
||||
import { Channel, OfferBookmark } from '../../shared/models/clnModels';
|
||||
import { CLNForwardingEventsStatusEnum, CLN_DEFAULT_PAGE_SETTINGS } from '../../shared/services/consts-enums-functions';
|
||||
import { PageSettingsCLN } from '../../shared/models/pageSettings';
|
||||
import { PageSettings } from '../../shared/models/pageSettings';
|
||||
|
||||
export const CLNReducer = createReducer(initCLNState,
|
||||
on(updateCLAPICallStatus, (state, { payload }) => {
|
||||
|
@ -219,7 +219,7 @@ export const CLNReducer = createReducer(initCLNState,
|
|||
};
|
||||
}),
|
||||
on(setPageSettings, (state, { payload }) => {
|
||||
const newPageSettings: PageSettingsCLN[] = [];
|
||||
const newPageSettings: PageSettings[] = [];
|
||||
CLN_DEFAULT_PAGE_SETTINGS.forEach((defaultPage) => {
|
||||
const pageSetting = payload.find((p) => p.pageId === defaultPage.pageId) || null;
|
||||
if (pageSetting) {
|
||||
|
|
|
@ -2,12 +2,12 @@ import { SelNodeChild } from '../../shared/models/RTLconfig';
|
|||
import { APICallStatusEnum, CLN_DEFAULT_PAGE_SETTINGS, UserPersonaEnum } from '../../shared/services/consts-enums-functions';
|
||||
import { GetInfo, Fees, Balance, LocalRemoteBalance, Peer, Payment, Channel, FeeRates, ListInvoices, UTXO, Offer, OfferBookmark, ListForwards } from '../../shared/models/clnModels';
|
||||
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload';
|
||||
import { PageSettingsCLN } from '../../shared/models/pageSettings';
|
||||
import { PageSettings } from '../../shared/models/pageSettings';
|
||||
|
||||
export interface CLNState {
|
||||
apisCallStatus: ApiCallsListCL;
|
||||
nodeSettings: SelNodeChild | null;
|
||||
pageSettings: PageSettingsCLN[];
|
||||
pageSettings: PageSettings[];
|
||||
information: GetInfo;
|
||||
fees: Fees;
|
||||
feeRatesPerKB: FeeRates;
|
||||
|
|
|
@ -24,7 +24,7 @@ import { RTLState } from '../../../../store/rtl.state';
|
|||
import { openAlert, openConfirmation } from '../../../../store/rtl.actions';
|
||||
import { deleteExpiredInvoice, invoiceLookup, saveNewInvoice } from '../../../store/cln.actions';
|
||||
import { clnNodeInformation, clnNodeSettings, clnPageSettings, listInvoices } from '../../../store/cln.selector';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-lightning-invoices-table',
|
||||
|
@ -78,7 +78,7 @@ export class CLNLightningInvoicesTableComponent implements OnInit, AfterViewInit
|
|||
this.information = nodeInfo;
|
||||
});
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[2])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -20,7 +20,7 @@ import { clnPageSettings, offerBookmarks } from '../../../store/cln.selector';
|
|||
import { CLNOfferInformationComponent } from '../offer-information-modal/offer-information.component';
|
||||
import { CLNLightningSendPaymentsComponent } from '../../send-payment-modal/send-payment.component';
|
||||
import { deleteOfferBookmark } from '../../../store/cln.actions';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-offer-bookmarks-table',
|
||||
|
@ -56,7 +56,7 @@ export class CLNOfferBookmarksTableComponent implements OnInit, AfterViewInit, O
|
|||
|
||||
ngOnInit() {
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -27,7 +27,7 @@ import { RTLState } from '../../../../store/rtl.state';
|
|||
import { openAlert, openConfirmation } from '../../../../store/rtl.actions';
|
||||
import { disableOffer } from '../../../store/cln.actions';
|
||||
import { clnNodeInformation, clnNodeSettings, clnPageSettings, offers } from '../../../store/cln.selector';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-offers-table',
|
||||
|
@ -80,7 +80,7 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
|
|||
this.information = nodeInfo;
|
||||
});
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[2])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -24,7 +24,7 @@ import { RTLState } from '../../../store/rtl.state';
|
|||
import { openAlert, openConfirmation } from '../../../store/rtl.actions';
|
||||
import { sendPayment } from '../../store/cln.actions';
|
||||
import { clnNodeInformation, clnNodeSettings, clnPageSettings, payments } from '../../store/cln.selector';
|
||||
import { PageSettingsCLN, TableSetting } from '../../../shared/models/pageSettings';
|
||||
import { PageSettings, TableSetting } from '../../../shared/models/pageSettings';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-lightning-payments',
|
||||
|
@ -75,7 +75,7 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
|
|||
this.information = nodeInfo;
|
||||
});
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[2])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = '';
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
<mat-cell fxLayoutAlign="end center" *matCellDef="let channel">{{channel.channel.capacity | number}}</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="actions">
|
||||
<mat-header-cell fxLayoutAlign="end center" class="pl-3 pr-4" *matHeaderCellDef>Actions</mat-header-cell>
|
||||
<mat-header-cell fxLayoutAlign="end center" class="pl-3 pr-4" *matHeaderCellDef>
|
||||
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">Actions</div>
|
||||
</mat-header-cell>
|
||||
<mat-cell fxLayoutAlign="end center" *matCellDef="let channel" class="px-3">
|
||||
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">
|
||||
<mat-select placeholder="Actions" tabindex="1" class="mr-0">
|
||||
|
@ -74,7 +76,9 @@
|
|||
<mat-cell fxLayoutAlign="end center" *matCellDef="let channel">{{channel.channel.capacity | number}}</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="actions">
|
||||
<mat-header-cell fxLayoutAlign="end center" class="pl-4 pr-3" *matHeaderCellDef>Actions</mat-header-cell>
|
||||
<mat-header-cell fxLayoutAlign="end center" class="pl-4 pr-3" *matHeaderCellDef>
|
||||
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">Actions</div>
|
||||
</mat-header-cell>
|
||||
<mat-cell fxLayoutAlign="end center" *matCellDef="let channel" class="pl-4">
|
||||
<button mat-stroked-button color="primary" type="button" tabindex="2" (click)="onForceClosingClick(channel)"class="table-actions-button">View Info</button>
|
||||
</mat-cell>
|
||||
|
@ -123,7 +127,9 @@
|
|||
number}}</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="actions">
|
||||
<mat-header-cell fxLayoutAlign="end center" class="pl-4 pr-3" *matHeaderCellDef>Actions</mat-header-cell>
|
||||
<mat-header-cell fxLayoutAlign="end center" class="pl-4 pr-3" *matHeaderCellDef>
|
||||
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">Actions</div>
|
||||
</mat-header-cell>
|
||||
<mat-cell fxLayoutAlign="end center" *matCellDef="let channel" class="pl-4">
|
||||
<button mat-stroked-button color="primary" type="button" tabindex="3" (click)="onClosingClick(channel)"class="table-actions-button">View Info</button>
|
||||
</mat-cell>
|
||||
|
@ -178,7 +184,9 @@
|
|||
number}}</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="actions">
|
||||
<mat-header-cell fxLayoutAlign="end center" class="pl-4 pr-3" *matHeaderCellDef>Actions</mat-header-cell>
|
||||
<mat-header-cell fxLayoutAlign="end center" class="pl-4 pr-3" *matHeaderCellDef>
|
||||
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">Actions</div>
|
||||
</mat-header-cell>
|
||||
<mat-cell fxLayoutAlign="end center" *matCellDef="let channel" class="pl-4">
|
||||
<button mat-stroked-button color="primary" type="button" tabindex="4" (click)="onWaitClosingClick(channel)"class="table-actions-button">View Info</button>
|
||||
</mat-cell>
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
GetInfo, Peer, NetworkInfo, Fees, Channel, Invoice, ListInvoices, ChannelsTransaction, ClosedChannel, Transaction, SwitchReq,
|
||||
SwitchRes, QueryRoutes, LightningNode, UTXO, ListPayments, SavePeer, SaveInvoice, SaveChannel, CloseChannel, FetchInvoices, FetchPayments, SendPayment, GetNewAddress, GetQueryRoutes, InitWallet, ChannelLookup, SetRestoreChannelsList, NewlyAddedPeer, BlockchainBalance, SetPendingChannels, BackupChannels, SetAllLightningTransactions, Payment
|
||||
} from '../../shared/models/lndModels';
|
||||
import { PageSettings } from '../../shared/models/pageSettings';
|
||||
|
||||
export const updateLNDAPICallStatus = createAction(LNDActions.UPDATE_API_CALL_STATUS_LND, props<{ payload: ApiCallStatusPayload }>());
|
||||
|
||||
|
@ -14,6 +15,12 @@ export const resetLNDStore = createAction(LNDActions.RESET_LND_STORE, props<{ pa
|
|||
|
||||
export const setChildNodeSettingsLND = createAction(LNDActions.SET_CHILD_NODE_SETTINGS_LND, props<{ payload: SelNodeChild }>());
|
||||
|
||||
export const fetchPageSettings = createAction(LNDActions.FETCH_PAGE_SETTINGS_LND);
|
||||
|
||||
export const setPageSettings = createAction(LNDActions.SET_PAGE_SETTINGS_LND, props<{ payload: PageSettings[] }>());
|
||||
|
||||
export const savePageSettings = createAction(LNDActions.SAVE_PAGE_SETTINGS_LND, props<{ payload: PageSettings[] }>());
|
||||
|
||||
export const fetchInfoLND = createAction(LNDActions.FETCH_INFO_LND, props<{ payload: { loadPage: string } }>());
|
||||
|
||||
export const setInfo = createAction(LNDActions.SET_INFO_LND, props<{ payload: GetInfo }>());
|
||||
|
|
|
@ -19,7 +19,7 @@ import { RTLActions, LNDActions, AlertTypeEnum, APICallStatusEnum, FEE_LIMIT_TYP
|
|||
import { closeAllDialogs, closeSpinner, logout, openAlert, openSnackBar, openSpinner, setApiUrl, setNodeData } from '../../store/rtl.actions';
|
||||
import { RTLState } from '../../store/rtl.state';
|
||||
|
||||
import { backupChannels, fetchBalanceBlockchain, fetchClosedChannels, fetchFees, fetchInfoLND, fetchInvoices, fetchNetwork, fetchPayments, fetchPeers, fetchPendingChannels, fetchTransactions, setForwardingHistory, setLookup, setPeers, setQueryRoutes, setRestoreChannelsList, updateLNDAPICallStatus, updateInvoice, fetchChannels, paymentLookup, updatePayment } from './lnd.actions';
|
||||
import { backupChannels, fetchBalanceBlockchain, fetchClosedChannels, fetchFees, fetchInfoLND, fetchInvoices, fetchNetwork, fetchPayments, fetchPeers, fetchPendingChannels, fetchTransactions, setForwardingHistory, setPeers, setQueryRoutes, setRestoreChannelsList, updateLNDAPICallStatus, updateInvoice, fetchChannels, updatePayment, fetchPageSettings } from './lnd.actions';
|
||||
import { allAPIsCallStatus, lndNodeInformation } from './lnd.selector';
|
||||
import { ApiCallsListLND } from '../../shared/models/apiCallsPayload';
|
||||
import { WebSocketClientService } from '../../shared/services/web-socket.service';
|
||||
|
@ -1188,6 +1188,52 @@ export class LNDEffects implements OnDestroy {
|
|||
}))
|
||||
);
|
||||
|
||||
pageSettingsFetch = createEffect(() => this.actions.pipe(
|
||||
ofType(LNDActions.FETCH_PAGE_SETTINGS_LND),
|
||||
mergeMap(() => {
|
||||
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchPageSettings', status: APICallStatusEnum.INITIATED } }));
|
||||
return this.httpClient.get(environment.PAGE_SETTINGS_API).pipe(
|
||||
map((pageSettings: any) => {
|
||||
this.logger.info(pageSettings);
|
||||
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchPageSettings', status: APICallStatusEnum.COMPLETED } }));
|
||||
return {
|
||||
type: LNDActions.SET_PAGE_SETTINGS_LND,
|
||||
payload: pageSettings || []
|
||||
};
|
||||
}),
|
||||
catchError((err: any) => {
|
||||
this.handleErrorWithoutAlert('FetchPageSettings', UI_MESSAGES.NO_SPINNER, 'Fetching Page Settings Failed.', err);
|
||||
return of({ type: RTLActions.VOID });
|
||||
})
|
||||
);
|
||||
})
|
||||
));
|
||||
|
||||
savePageSettings = createEffect(() => this.actions.pipe(
|
||||
ofType(LNDActions.SAVE_PAGE_SETTINGS_LND),
|
||||
mergeMap((action: { type: string, payload: any }) => {
|
||||
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.UPDATE_PAGE_SETTINGS }));
|
||||
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'SavePageSettings', status: APICallStatusEnum.INITIATED } }));
|
||||
return this.httpClient.post(environment.PAGE_SETTINGS_API, action.payload).
|
||||
pipe(
|
||||
map((postRes: any) => {
|
||||
this.logger.info(postRes);
|
||||
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'SavePageSettings', status: APICallStatusEnum.COMPLETED } }));
|
||||
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.UPDATE_PAGE_SETTINGS }));
|
||||
this.store.dispatch(openSnackBar({ payload: 'Page Layout Updated Successfully!' }));
|
||||
return {
|
||||
type: LNDActions.SET_PAGE_SETTINGS_LND,
|
||||
payload: postRes || []
|
||||
};
|
||||
}),
|
||||
catchError((err: any) => {
|
||||
this.handleErrorWithoutAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', err);
|
||||
return of({ type: RTLActions.VOID });
|
||||
})
|
||||
);
|
||||
})
|
||||
));
|
||||
|
||||
initializeRemainingData(info: any, landingPage: string) {
|
||||
this.sessionService.setItem('lndUnlocked', 'true');
|
||||
const node_data = {
|
||||
|
@ -1210,6 +1256,7 @@ export class LNDEffects implements OnDestroy {
|
|||
newRoute = '/lnd/home';
|
||||
}
|
||||
this.router.navigate([newRoute]);
|
||||
this.store.dispatch(fetchPageSettings());
|
||||
this.store.dispatch(fetchBalanceBlockchain());
|
||||
this.store.dispatch(fetchChannels());
|
||||
this.store.dispatch(fetchPendingChannels());
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import { createReducer, on } from '@ngrx/store';
|
||||
|
||||
import { initLNDState } from './lnd.state';
|
||||
import { addInvoice, removeChannel, removePeer, resetLNDStore, setChannels, setAllLightningTransactions, setBalanceBlockchain, setChildNodeSettingsLND, setClosedChannels, setFees, setForwardingHistory, setInfo, setInvoices, setNetwork, setPayments, setPeers, setPendingChannels, setTransactions, setUTXOs, updateLNDAPICallStatus, updateInvoice, updatePayment } from './lnd.actions';
|
||||
import { addInvoice, removeChannel, removePeer, resetLNDStore, setChannels, setAllLightningTransactions, setBalanceBlockchain, setChildNodeSettingsLND, setClosedChannels, setFees, setForwardingHistory, setInfo, setInvoices, setNetwork, setPayments, setPeers, setPendingChannels, setTransactions, setUTXOs, updateLNDAPICallStatus, updateInvoice, updatePayment, setPageSettings } from './lnd.actions';
|
||||
import { Channel, ClosedChannel, SetAllLightningTransactions } from '../../shared/models/lndModels';
|
||||
import { PageSettings } from '../../shared/models/pageSettings';
|
||||
import { LND_DEFAULT_PAGE_SETTINGS } from '../../shared/services/consts-enums-functions';
|
||||
|
||||
let flgTransactionsSet = false;
|
||||
let flgUTXOsSet = false;
|
||||
|
@ -220,6 +222,31 @@ export const LNDReducer = createReducer(initLNDState,
|
|||
...state,
|
||||
forwardingHistory: updatedPayload
|
||||
};
|
||||
}),
|
||||
on(setPageSettings, (state, { payload }) => {
|
||||
const newPageSettings: PageSettings[] = [];
|
||||
LND_DEFAULT_PAGE_SETTINGS.forEach((defaultPage) => {
|
||||
const pageSetting = payload.find((p) => p.pageId === defaultPage.pageId) || null;
|
||||
if (pageSetting) {
|
||||
const tablesSettings = JSON.parse(JSON.stringify(pageSetting.tables));
|
||||
pageSetting.tables = []; // To maintain settings order
|
||||
defaultPage.tables.forEach((defaultTable) => {
|
||||
const tableSetting = tablesSettings.find((t) => t.tableId === defaultTable.tableId) || null;
|
||||
if (tableSetting) {
|
||||
pageSetting.tables.push(tableSetting);
|
||||
} else {
|
||||
pageSetting.tables.push(JSON.parse(JSON.stringify(defaultTable)));
|
||||
}
|
||||
});
|
||||
newPageSettings.push(pageSetting);
|
||||
} else {
|
||||
newPageSettings.push(JSON.parse(JSON.stringify(defaultPage)));
|
||||
}
|
||||
});
|
||||
return {
|
||||
...state,
|
||||
pageSettings: newPageSettings
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import { LNDState } from './lnd.state';
|
|||
|
||||
export const lndState = createFeatureSelector<LNDState>('lnd');
|
||||
export const lndNodeSettings = createSelector(lndState, (state: LNDState) => state.nodeSettings);
|
||||
export const lndPageSettings = createSelector(lndState, (state: LNDState) => ({ pageSettings: state.pageSettings, apiCallStatus: state.apisCallStatus.FetchPageSettings }));
|
||||
export const lndNodeInformation = createSelector(lndState, (state: LNDState) => state.information);
|
||||
export const nodeInfoStatus = createSelector(lndState, (state: LNDState) => ({ information: state.information, apiCallStatus: state.apisCallStatus.FetchInfo }));
|
||||
export const allAPIsCallStatus = createSelector(lndState, (state: LNDState) => state.apisCallStatus);
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import { SelNodeChild } from '../../shared/models/RTLconfig';
|
||||
import { ApiCallsListLND } from '../../shared/models/apiCallsPayload';
|
||||
import { APICallStatusEnum, UserPersonaEnum } from '../../shared/services/consts-enums-functions';
|
||||
import { APICallStatusEnum, LND_DEFAULT_PAGE_SETTINGS, UserPersonaEnum } from '../../shared/services/consts-enums-functions';
|
||||
import { GetInfo, Peer, Fees, NetworkInfo, BlockchainBalance, Channel, ListInvoices, PendingChannels, ClosedChannel, Transaction, SwitchRes, PendingChannelsSummary, UTXO, ListPayments, LightningBalance, ChannelsSummary } from '../../shared/models/lndModels';
|
||||
import { PageSettings } from '../../shared/models/pageSettings';
|
||||
|
||||
export interface LNDState {
|
||||
apisCallStatus: ApiCallsListLND;
|
||||
nodeSettings: SelNodeChild | null;
|
||||
pageSettings: PageSettings[];
|
||||
information: GetInfo;
|
||||
peers: Peer[];
|
||||
fees: Fees;
|
||||
|
@ -27,6 +29,7 @@ export interface LNDState {
|
|||
|
||||
export const initLNDState: LNDState = {
|
||||
apisCallStatus: {
|
||||
FetchPageSettings: { status: APICallStatusEnum.UN_INITIATED },
|
||||
FetchInfo: { status: APICallStatusEnum.UN_INITIATED },
|
||||
FetchFees: { status: APICallStatusEnum.UN_INITIATED },
|
||||
FetchPeers: { status: APICallStatusEnum.UN_INITIATED },
|
||||
|
@ -43,6 +46,7 @@ export const initLNDState: LNDState = {
|
|||
FetchNetwork: { status: APICallStatusEnum.UN_INITIATED }
|
||||
},
|
||||
nodeSettings: { userPersona: UserPersonaEnum.OPERATOR, fiatConversion: false, channelBackupPath: '', currencyUnits: [], selCurrencyUnit: '', lnImplementation: '', swapServerUrl: '' },
|
||||
pageSettings: LND_DEFAULT_PAGE_SETTINGS,
|
||||
information: {},
|
||||
peers: [],
|
||||
fees: {
|
||||
|
|
|
@ -12,49 +12,61 @@
|
|||
<div [perfectScrollbar] class="table-container" fxFlex="100">
|
||||
<mat-progress-bar *ngIf="flgLoading[0]===true" mode="indeterminate"></mat-progress-bar>
|
||||
<table mat-table #table [dataSource]="listSwaps" matSort [ngClass]="{'overflow-auto error-border': flgLoading[0]==='error','overflow-auto': true}">
|
||||
<ng-container matColumnDef="state">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> State </th>
|
||||
<td mat-cell *matCellDef="let swap">{{LoopStateEnum[swap?.state]}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="initiation_time">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Initiation Time </th>
|
||||
<td mat-cell *matCellDef="let swap">{{(swap.initiation_time/1000000) | date:'dd/MMM/y HH:mm'}}</td>
|
||||
<td mat-cell *matCellDef="let swap">{{(swap?.initiation_time/1000000) | date:'dd/MMM/y HH:mm'}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="last_update_time">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Last Update Time </th>
|
||||
<td mat-cell *matCellDef="let swap">{{(swap.last_update_time/1000000) | date:'dd/MMM/y HH:mm'}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> ID </th>
|
||||
<td mat-cell *matCellDef="let swap">{{swap.id}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="id_bytes">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> ID (Bytes) </th>
|
||||
<td mat-cell *matCellDef="let swap">{{swap.id_bytes}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="state">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> State </th>
|
||||
<td mat-cell *matCellDef="let swap">{{LoopStateEnum[swap.state]}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="htlc_address">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> HTLC Address </th>
|
||||
<td mat-cell *matCellDef="let swap">{{swap.htlc_address}}</td>
|
||||
<td mat-cell *matCellDef="let swap">{{(swap?.last_update_time/1000000) | date:'dd/MMM/y HH:mm'}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="amt">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Amount (Sats) </th>
|
||||
<td mat-cell *matCellDef="let swap">
|
||||
<span fxLayoutAlign="end center">{{swap.amt | number}}</span>
|
||||
<span fxLayoutAlign="end center">{{swap?.amt | number}}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="cost_server">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Cost Server (Sats) </th>
|
||||
<td mat-cell *matCellDef="let swap"><span fxLayoutAlign="end center">{{swap.cost_server | number}}</span></td>
|
||||
<td mat-cell *matCellDef="let swap"><span fxLayoutAlign="end center">{{swap?.cost_server | number}}</span></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="cost_offchain">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Cost Offchain (Sats) </th>
|
||||
<td mat-cell *matCellDef="let swap"><span fxLayoutAlign="end center">{{swap.cost_offchain | number}}</span></td>
|
||||
<td mat-cell *matCellDef="let swap"><span fxLayoutAlign="end center">{{swap?.cost_offchain | number}}</span></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="cost_onchain">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Cost Onchain (Sats) </th>
|
||||
<td mat-cell *matCellDef="let swap"><span fxLayoutAlign="end center">
|
||||
{{swap?.cost_onchain | number}} </span></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="htlc_address">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> HTLC Address </th>
|
||||
<td mat-cell *matCellDef="let swap" class="pl-1">
|
||||
<span fxLayout="row" class="ellipsis-parent" [ngStyle]="{'max-width': (screenSize === screenSizeEnum.XS) ? '10rem' : '20rem'}">
|
||||
<span class="ellipsis-child">{{swap?.htlc_address}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> ID </th>
|
||||
<td mat-cell *matCellDef="let swap" class="pl-1">
|
||||
<span fxLayout="row" class="ellipsis-parent" [ngStyle]="{'max-width': (screenSize === screenSizeEnum.XS) ? '10rem' : '20rem'}">
|
||||
<span class="ellipsis-child">{{swap?.id}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="id_bytes">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> ID (Bytes) </th>
|
||||
<td mat-cell *matCellDef="let swap" class="pl-1">
|
||||
<span fxLayout="row" class="ellipsis-parent" [ngStyle]="{'max-width': (screenSize === screenSizeEnum.XS) ? '10rem' : '20rem'}">
|
||||
<span class="ellipsis-child">{{swap?.id_bytes}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef class="px-3">
|
||||
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
.mat-column-htlc_address, .mat-column-id, .mat-column-id_bytes {
|
||||
flex: 0 0 15%;
|
||||
width: 15%;
|
||||
& .ellipsis-parent {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
.mat-column-actions {
|
||||
min-height: 4.8rem;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
import { Component, OnChanges, OnDestroy, ViewChild, Input, AfterViewInit, SimpleChanges } from '@angular/core';
|
||||
import { Component, OnChanges, OnDestroy, ViewChild, Input, AfterViewInit, SimpleChanges, OnInit } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Actions } from '@ngrx/effects';
|
||||
import { faHistory } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { LoopSwapStatus } from '../../../../models/loopModels';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, LoopTypeEnum, LoopStateEnum } from '../../../../services/consts-enums-functions';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, LoopTypeEnum, LoopStateEnum, SortOrderEnum, LND_DEFAULT_PAGE_SETTINGS } from '../../../../services/consts-enums-functions';
|
||||
import { LoggerService } from '../../../../services/logger.service';
|
||||
import { CommonService } from '../../../../services/common.service';
|
||||
import { LoopService } from '../../../../services/loop.service';
|
||||
|
||||
import { RTLState } from '../../../../../store/rtl.state';
|
||||
import { openAlert } from '../../../../../store/rtl.actions';
|
||||
import { PageSettings, TableSetting } from '../../../../models/pageSettings';
|
||||
import { lndPageSettings } from '../../../../../lnd/store/lnd.selector';
|
||||
import { ApiCallStatusPayload } from '../../../../models/apiCallsPayload';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-swaps',
|
||||
|
@ -25,7 +27,7 @@ import { openAlert } from '../../../../../store/rtl.actions';
|
|||
{ provide: MatPaginatorIntl, useValue: getPaginatorLabel('Swaps') }
|
||||
]
|
||||
})
|
||||
export class SwapsComponent implements AfterViewInit, OnChanges, OnDestroy {
|
||||
export class SwapsComponent implements OnInit, AfterViewInit, OnChanges, OnDestroy {
|
||||
|
||||
@Input() selectedSwapType: LoopTypeEnum = LoopTypeEnum.LOOP_OUT;
|
||||
@Input() swapsData: LoopSwapStatus[] = [];
|
||||
|
@ -33,6 +35,8 @@ export class SwapsComponent implements AfterViewInit, OnChanges, OnDestroy {
|
|||
@Input() emptyTableMessage = 'No swaps available.';
|
||||
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
|
||||
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
|
||||
public PAGE_ID = 'loop';
|
||||
public tableSetting: TableSetting = { tableId: 'loop', recordsPerPage: PAGE_SIZE, sortBy: 'initiation_time', sortOrder: SortOrderEnum.DESCENDING };
|
||||
public LoopStateEnum = LoopStateEnum;
|
||||
public faHistory = faHistory;
|
||||
public swapCaption = 'Loop Out';
|
||||
|
@ -47,15 +51,24 @@ export class SwapsComponent implements AfterViewInit, OnChanges, OnDestroy {
|
|||
|
||||
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<RTLState>, private loopService: LoopService) {
|
||||
this.screenSize = this.commonService.getScreenSize();
|
||||
if (this.screenSize === ScreenSizeEnum.XS) {
|
||||
this.displayedColumns = ['state', 'amt', 'actions'];
|
||||
} else if (this.screenSize === ScreenSizeEnum.SM) {
|
||||
this.displayedColumns = ['state', 'amt', 'actions'];
|
||||
} else if (this.screenSize === ScreenSizeEnum.MD) {
|
||||
this.displayedColumns = ['state', 'initiation_time', 'amt', 'actions'];
|
||||
} else {
|
||||
this.displayedColumns = ['state', 'initiation_time', 'amt', 'cost_server', 'cost_offchain', 'cost_onchain', 'actions'];
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.store.select(lndPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.tableSetting = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId) || LND_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSetting.tableId)!;
|
||||
if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
|
||||
this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelectionSM));
|
||||
} else {
|
||||
this.displayedColumns = JSON.parse(JSON.stringify(this.tableSetting.columnSelection));
|
||||
}
|
||||
this.displayedColumns.push('actions');
|
||||
this.pageSize = this.tableSetting.recordsPerPage ? +this.tableSetting.recordsPerPage : PAGE_SIZE;
|
||||
if (this.swapsData && this.swapsData.length > 0 && this.sort && this.paginator) {
|
||||
this.loadSwapsTable(this.swapsData);
|
||||
}
|
||||
this.logger.info(this.displayedColumns);
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
@ -74,7 +87,7 @@ export class SwapsComponent implements AfterViewInit, OnChanges, OnDestroy {
|
|||
}
|
||||
|
||||
onSwapClick(selSwap: LoopSwapStatus, event: any) {
|
||||
this.loopService.getSwap(selSwap.id_bytes?.replace(/\//g, '_')?.replace(/\+/g, '-') || '').pipe(takeUntil(this.unSubs[2])).
|
||||
this.loopService.getSwap(selSwap.id_bytes?.replace(/\//g, '_')?.replace(/\+/g, '-') || '').pipe(takeUntil(this.unSubs[1])).
|
||||
subscribe((fetchedSwap: LoopSwapStatus) => {
|
||||
const reorderedSwap = [
|
||||
[{ key: 'state', value: LoopStateEnum[fetchedSwap.state || ''], title: 'Status', width: 50, type: DataTypeEnum.STRING },
|
||||
|
@ -104,6 +117,7 @@ export class SwapsComponent implements AfterViewInit, OnChanges, OnDestroy {
|
|||
this.listSwaps = new MatTableDataSource<LoopSwapStatus>([...swaps]);
|
||||
this.listSwaps.sort = this.sort;
|
||||
this.listSwaps.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
|
||||
this.listSwaps.sort?.sort({ id: this.tableSetting.sortBy, start: this.tableSetting.sortOrder, disableClear: true });
|
||||
this.listSwaps.filterPredicate = (swap: LoopSwapStatus, fltr: string) => JSON.stringify(swap).toLowerCase().includes(fltr);
|
||||
this.listSwaps.paginator = this.paginator;
|
||||
this.applyFilter();
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<div fxLayout="row" fxLayoutAlign="start center" class="page-title-container">
|
||||
<fa-icon [icon]="faHandshake" class="page-title-img mr-1"></fa-icon>
|
||||
<span class="page-title">Peerswap</span>
|
||||
</div>
|
||||
<div fxLayout="column" class="padding-gap-x">
|
||||
<mat-card>
|
||||
<mat-card-content fxLayout="column">
|
||||
<nav mat-tab-nav-bar>
|
||||
<div role="tab" mat-tab-link *ngFor="let link of links" class="mat-tab-label" [active]="activeTab.link === link.link" (click)="activeTab = link" routerLink="{{link.link}}">{{link.name}}</div>
|
||||
</nav>
|
||||
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch" class="mat-tab-body-wrapper mb-2">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
|
@ -1,52 +0,0 @@
|
|||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { StoreModule } from '@ngrx/store';
|
||||
|
||||
import { RootReducer } from '../../../../store/rtl.reducers';
|
||||
import { LNDReducer } from '../../../../lnd/store/lnd.reducers';
|
||||
import { CLNReducer } from '../../../../cln/store/cln.reducers';
|
||||
import { ECLReducer } from '../../../../eclair/store/ecl.reducers';
|
||||
import { LoopService } from '../../../services/loop.service';
|
||||
|
||||
import { PeerswapComponent } from './peerswap.component';
|
||||
import { SharedModule } from '../../../shared.module';
|
||||
import { mockDataService } from '../../../test-helpers/mock-services';
|
||||
import { CommonService } from '../../../services/common.service';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { DataService } from '../../../services/data.service';
|
||||
|
||||
describe('PeerswapComponent', () => {
|
||||
let component: PeerswapComponent;
|
||||
let fixture: ComponentFixture<PeerswapComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [PeerswapComponent],
|
||||
imports: [
|
||||
BrowserAnimationsModule,
|
||||
SharedModule,
|
||||
RouterTestingModule,
|
||||
StoreModule.forRoot({ root: RootReducer, lnd: LNDReducer, cln: CLNReducer, ecl: ECLReducer })
|
||||
],
|
||||
providers: [
|
||||
CommonService,
|
||||
{ provide: DataService, useClass: mockDataService }
|
||||
]
|
||||
}).
|
||||
compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PeerswapComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
});
|
|
@ -1,41 +0,0 @@
|
|||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Router, ResolveEnd, Event } from '@angular/router';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil, filter } from 'rxjs/operators';
|
||||
import { faHandshake } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-peerswap',
|
||||
templateUrl: './peerswap.component.html',
|
||||
styleUrls: ['./peerswap.component.scss']
|
||||
})
|
||||
export class PeerswapComponent implements OnInit, OnDestroy {
|
||||
|
||||
public faHandshake = faHandshake;
|
||||
public links = [{ link: 'peers', name: 'Peers' }, { link: 'psout', name: 'Peerswap Out' }, { link: 'psin', name: 'Peerswap In' }, { link: 'pscancelled', name: 'Cancelled Peerswaps' }];
|
||||
public activeTab = this.links[0];
|
||||
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
|
||||
|
||||
constructor(private router: Router) { }
|
||||
|
||||
ngOnInit() {
|
||||
const linkFound = this.links.find((link) => this.router.url.includes(link.link));
|
||||
this.activeTab = linkFound ? linkFound : this.links[0];
|
||||
this.router.events.pipe(takeUntil(this.unSubs[0]), filter((e) => e instanceof ResolveEnd)).
|
||||
subscribe({
|
||||
next: (value: ResolveEnd | Event) => {
|
||||
const linkFound = this.links.find((link) => (<ResolveEnd>value).urlAfterRedirects.includes(link.link));
|
||||
this.activeTab = linkFound ? linkFound : this.links[0];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.unSubs.forEach((completeSub) => {
|
||||
completeSub.next(<any>null);
|
||||
completeSub.complete();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
<h1>Swap Peers</h1>
|
|
@ -1,35 +0,0 @@
|
|||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SharedModule } from '../../../../shared.module';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { SwapPeersComponent } from './swap-peers.component';
|
||||
|
||||
describe('SwapPeersComponent', () => {
|
||||
let component: SwapPeersComponent;
|
||||
let fixture: ComponentFixture<SwapPeersComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SwapPeersComponent],
|
||||
imports: [
|
||||
BrowserAnimationsModule,
|
||||
SharedModule
|
||||
],
|
||||
providers: []
|
||||
}).
|
||||
compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SwapPeersComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
});
|
|
@ -1,22 +0,0 @@
|
|||
import { Component, OnDestroy } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-peerswap-peers',
|
||||
templateUrl: './swap-peers.component.html',
|
||||
styleUrls: ['./swap-peers.component.scss']
|
||||
})
|
||||
export class SwapPeersComponent implements OnDestroy {
|
||||
|
||||
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.unSubs.forEach((completeSub) => {
|
||||
completeSub.next(<any>null);
|
||||
completeSub.complete();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
<h1>Peerswaps Cancelled</h1>
|
|
@ -1,35 +0,0 @@
|
|||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SharedModule } from '../../../../shared.module';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { PeerswapsCancelledComponent } from './swaps-cancelled.component';
|
||||
|
||||
describe('PeerswapsCancelledComponent', () => {
|
||||
let component: PeerswapsCancelledComponent;
|
||||
let fixture: ComponentFixture<PeerswapsCancelledComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [PeerswapsCancelledComponent],
|
||||
imports: [
|
||||
BrowserAnimationsModule,
|
||||
SharedModule
|
||||
],
|
||||
providers: []
|
||||
}).
|
||||
compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PeerswapsCancelledComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
});
|
|
@ -1,22 +0,0 @@
|
|||
import { Component, OnDestroy } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-peerswap-cancelled',
|
||||
templateUrl: './swaps-cancelled.component.html',
|
||||
styleUrls: ['./swaps-cancelled.component.scss']
|
||||
})
|
||||
export class PeerswapsCancelledComponent implements OnDestroy {
|
||||
|
||||
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.unSubs.forEach((completeSub) => {
|
||||
completeSub.next(<any>null);
|
||||
completeSub.complete();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
<h1>Peerswaps In</h1>
|
|
@ -1,35 +0,0 @@
|
|||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SharedModule } from '../../../../shared.module';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { PeerswapsInComponent } from './swaps-in.component';
|
||||
|
||||
describe('PeerswapsInComponent', () => {
|
||||
let component: PeerswapsInComponent;
|
||||
let fixture: ComponentFixture<PeerswapsInComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [PeerswapsInComponent],
|
||||
imports: [
|
||||
BrowserAnimationsModule,
|
||||
SharedModule
|
||||
],
|
||||
providers: []
|
||||
}).
|
||||
compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PeerswapsInComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
});
|
|
@ -1,22 +0,0 @@
|
|||
import { Component, OnDestroy } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-peer-swaps-in',
|
||||
templateUrl: './swaps-in.component.html',
|
||||
styleUrls: ['./swaps-in.component.scss']
|
||||
})
|
||||
export class PeerswapsInComponent implements OnDestroy {
|
||||
|
||||
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.unSubs.forEach((completeSub) => {
|
||||
completeSub.next(<any>null);
|
||||
completeSub.complete();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
<h1>Peerswaps Out</h1>
|
|
@ -1,35 +0,0 @@
|
|||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SharedModule } from '../../../../shared.module';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { PeerswapsOutComponent } from './swaps-out.component';
|
||||
|
||||
describe('PeerswapsOutComponent', () => {
|
||||
let component: PeerswapsOutComponent;
|
||||
let fixture: ComponentFixture<PeerswapsOutComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [PeerswapsOutComponent],
|
||||
imports: [
|
||||
BrowserAnimationsModule,
|
||||
SharedModule
|
||||
],
|
||||
providers: []
|
||||
}).
|
||||
compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PeerswapsOutComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
});
|
|
@ -1,22 +0,0 @@
|
|||
import { Component, OnDestroy } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-peer-swaps-out',
|
||||
templateUrl: './swaps-out.component.html',
|
||||
styleUrls: ['./swaps-out.component.scss']
|
||||
})
|
||||
export class PeerswapsOutComponent implements OnDestroy {
|
||||
|
||||
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.unSubs.forEach((completeSub) => {
|
||||
completeSub.next(<any>null);
|
||||
completeSub.complete();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -1,18 +1,21 @@
|
|||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { combineLatest, Subject } from 'rxjs';
|
||||
import { filter, takeUntil, withLatestFrom } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Actions } from '@ngrx/effects';
|
||||
import { faPenRuler, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
import { APICallStatusEnum, CLNActions, CLN_DEFAULT_PAGE_SETTINGS, CLN_TABLES_DEF, PAGE_SIZE_OPTIONS, ScreenSizeEnum, SORT_ORDERS } from '../../../services/consts-enums-functions';
|
||||
import { APICallStatusEnum, CLNActions, CLN_DEFAULT_PAGE_SETTINGS, CLN_TABLES_DEF, LNDActions, LND_DEFAULT_PAGE_SETTINGS, LND_TABLES_DEF, PAGE_SIZE_OPTIONS, ScreenSizeEnum, SORT_ORDERS } from '../../../services/consts-enums-functions';
|
||||
import { LoggerService } from '../../../services/logger.service';
|
||||
import { CommonService } from '../../../services/common.service';
|
||||
import { RTLState } from '../../../../store/rtl.state';
|
||||
import { TableSetting, PageSettingsCLN } from '../../../models/pageSettings';
|
||||
import { clnPageSettings } from '../../../../cln/store/cln.selector';
|
||||
import { TableSetting, PageSettings } from '../../../models/pageSettings';
|
||||
import { clnNodeSettings, clnPageSettings } from '../../../../cln/store/cln.selector';
|
||||
import { savePageSettings } from '../../../../cln/store/cln.actions';
|
||||
import { ApiCallStatusPayload } from '../../../models/apiCallsPayload';
|
||||
import { rootSelectedNode } from '../../../../store/rtl.selector';
|
||||
import { SelNodeChild, ConfigSettingsNode } from '../../../models/RTLconfig';
|
||||
import { lndNodeSettings, lndPageSettings } from '../../../../lnd/store/lnd.selector';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-page-settings',
|
||||
|
@ -23,12 +26,13 @@ export class PageSettingsComponent implements OnInit, OnDestroy {
|
|||
|
||||
public faPenRuler = faPenRuler;
|
||||
public faExclamationTriangle = faExclamationTriangle;
|
||||
public selNode: ConfigSettingsNode;
|
||||
public screenSize = '';
|
||||
public screenSizeEnum = ScreenSizeEnum;
|
||||
public pageSizeOptions = PAGE_SIZE_OPTIONS;
|
||||
public pageSettings: PageSettingsCLN[] = [];
|
||||
public initialPageSettings: PageSettingsCLN[] = Object.assign([], CLN_DEFAULT_PAGE_SETTINGS);
|
||||
public tableFieldsDef = CLN_TABLES_DEF;
|
||||
public pageSettings: PageSettings[] = [];
|
||||
public initialPageSettings: PageSettings[] = [];
|
||||
public tableFieldsDef = {};
|
||||
public sortOrders = SORT_ORDERS;
|
||||
public apiCallStatus: ApiCallStatusPayload | null = null;
|
||||
public apiCallStatusEnum = APICallStatusEnum;
|
||||
|
@ -40,23 +44,79 @@ export class PageSettingsComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettingsCLN[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.errorMessage = null;
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
this.errorMessage = this.apiCallStatus.message || null;
|
||||
}
|
||||
this.pageSettings = settings.pageSettings;
|
||||
this.initialPageSettings = settings.pageSettings;
|
||||
this.logger.info(settings);
|
||||
});
|
||||
this.actions.pipe(takeUntil(this.unSubs[1]), filter((action) => action.type === CLNActions.UPDATE_API_CALL_STATUS_CLN || action.type === CLNActions.SAVE_PAGE_SETTINGS_CLN)).
|
||||
subscribe((action: any) => {
|
||||
if (action.type === CLNActions.UPDATE_API_CALL_STATUS_CLN && action.payload.status === APICallStatusEnum.ERROR && action.payload.action === 'SavePageSettings') {
|
||||
this.errorMessage = JSON.parse(action.payload.message);
|
||||
}
|
||||
});
|
||||
this.store.select(rootSelectedNode).pipe(takeUntil(this.unSubs[0])).subscribe((selNode) => {
|
||||
this.selNode = selNode;
|
||||
this.logger.info(this.selNode);
|
||||
switch (this.selNode.lnImplementation) {
|
||||
case 'CLN':
|
||||
this.initialPageSettings = Object.assign([], CLN_DEFAULT_PAGE_SETTINGS);
|
||||
this.tableFieldsDef = CLN_TABLES_DEF;
|
||||
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[1]),
|
||||
withLatestFrom(this.store.select(clnNodeSettings))).
|
||||
subscribe(([settings, nodeSettings]: [{ pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }, (SelNodeChild | null)]) => {
|
||||
const updatedPageSettings = JSON.parse(JSON.stringify(settings.pageSettings));
|
||||
this.errorMessage = null;
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
this.errorMessage = this.apiCallStatus.message || null;
|
||||
this.pageSettings = updatedPageSettings;
|
||||
this.initialPageSettings = updatedPageSettings;
|
||||
} else {
|
||||
if (!nodeSettings?.enableOffers) {
|
||||
const transactionsPage = updatedPageSettings.find((pg) => pg.pageId === 'transactions');
|
||||
transactionsPage?.tables.splice(transactionsPage?.tables.findIndex((tb) => tb.tableId === 'offers'), 1);
|
||||
transactionsPage?.tables.splice(transactionsPage?.tables.findIndex((tb) => tb.tableId === 'offer_bookmarks'), 1);
|
||||
}
|
||||
if (!nodeSettings?.enablePeerswap) {
|
||||
updatedPageSettings.splice(updatedPageSettings.findIndex((pg) => pg.pageId === 'peerswap'), 1);
|
||||
}
|
||||
this.pageSettings = updatedPageSettings;
|
||||
this.initialPageSettings = updatedPageSettings;
|
||||
}
|
||||
this.logger.info(updatedPageSettings);
|
||||
});
|
||||
this.actions.pipe(takeUntil(this.unSubs[2]), filter((action) => action.type === CLNActions.UPDATE_API_CALL_STATUS_CLN || action.type === CLNActions.SAVE_PAGE_SETTINGS_CLN)).
|
||||
subscribe((action: any) => {
|
||||
if (action.type === CLNActions.UPDATE_API_CALL_STATUS_CLN && action.payload.status === APICallStatusEnum.ERROR && action.payload.action === 'SavePageSettings') {
|
||||
this.errorMessage = JSON.parse(action.payload.message);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
this.initialPageSettings = Object.assign([], LND_DEFAULT_PAGE_SETTINGS);
|
||||
this.tableFieldsDef = LND_TABLES_DEF;
|
||||
this.store.select(lndPageSettings).pipe(takeUntil(this.unSubs[1]),
|
||||
withLatestFrom(this.store.select(lndNodeSettings))).
|
||||
subscribe(([settings, nodeSettings]: [{ pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }, (SelNodeChild | null)]) => {
|
||||
const updatedPageSettings: PageSettings[] = JSON.parse(JSON.stringify(settings.pageSettings));
|
||||
this.errorMessage = null;
|
||||
this.apiCallStatus = settings.apiCallStatus;
|
||||
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
|
||||
this.errorMessage = this.apiCallStatus.message || null;
|
||||
this.pageSettings = updatedPageSettings;
|
||||
this.initialPageSettings = updatedPageSettings;
|
||||
} else {
|
||||
if (!nodeSettings?.swapServerUrl || nodeSettings.swapServerUrl.trim() === '') {
|
||||
updatedPageSettings.splice(updatedPageSettings.findIndex((pg) => pg.pageId === 'loop'), 1);
|
||||
}
|
||||
if (!nodeSettings?.boltzServerUrl || nodeSettings.boltzServerUrl.trim() === '') {
|
||||
updatedPageSettings.splice(updatedPageSettings.findIndex((pg) => pg.pageId === 'boltz'), 1);
|
||||
}
|
||||
this.pageSettings = updatedPageSettings;
|
||||
this.initialPageSettings = updatedPageSettings;
|
||||
}
|
||||
this.logger.info(updatedPageSettings);
|
||||
});
|
||||
this.actions.pipe(takeUntil(this.unSubs[2]), filter((action) => action.type === LNDActions.UPDATE_API_CALL_STATUS_LND || action.type === LNDActions.SAVE_PAGE_SETTINGS_LND)).
|
||||
subscribe((action: any) => {
|
||||
if (action.type === LNDActions.UPDATE_API_CALL_STATUS_LND && action.payload.status === APICallStatusEnum.ERROR && action.payload.action === 'SavePageSettings') {
|
||||
this.errorMessage = JSON.parse(action.payload.message);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
oncolumnSelectionChange(table: TableSetting) {
|
||||
|
|
|
@ -30,6 +30,7 @@ export interface ApiCallsListLND {
|
|||
FetchAllChannels: ApiCallStatusPayload;
|
||||
FetchBalanceBlockchain: ApiCallStatusPayload;
|
||||
// Non-initial calls
|
||||
FetchPageSettings: ApiCallStatusPayload;
|
||||
FetchPeers: ApiCallStatusPayload;
|
||||
FetchClosedChannels: ApiCallStatusPayload;
|
||||
FetchInvoices: ApiCallStatusPayload;
|
||||
|
|
|
@ -11,7 +11,7 @@ export class TableSetting {
|
|||
|
||||
}
|
||||
|
||||
export class PageSettingsCLN {
|
||||
export class PageSettings {
|
||||
|
||||
pageId: string;
|
||||
tables: TableSetting[];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { MatPaginatorIntl } from '@angular/material/paginator';
|
||||
import { PageSettingsCLN } from '../models/pageSettings';
|
||||
import { PageSettings } from '../models/pageSettings';
|
||||
|
||||
export function getPaginatorLabel(field: string) {
|
||||
const appPaginator = new MatPaginatorIntl();
|
||||
|
@ -384,6 +384,9 @@ export enum LNDActions {
|
|||
RESET_LND_STORE = 'RESET_LND_STORE',
|
||||
UPDATE_API_CALL_STATUS_LND = 'UPDATE_API_CALL_STATUS_LND',
|
||||
SET_CHILD_NODE_SETTINGS_LND = 'SET_CHILD_NODE_SETTINGS_LND',
|
||||
FETCH_PAGE_SETTINGS_LND = 'FETCH_PAGE_SETTINGS_LND',
|
||||
SET_PAGE_SETTINGS_LND = 'SET_PAGE_SETTINGS_LND',
|
||||
SAVE_PAGE_SETTINGS_LND = 'SAVE_PAGE_SETTINGS_LND',
|
||||
FETCH_INFO_LND = 'FETCH_INFO_LND',
|
||||
SET_INFO_LND = 'SET_INFO_LND',
|
||||
FETCH_PEERS_LND = 'FETCH_PEERS_LND',
|
||||
|
@ -674,7 +677,7 @@ export enum SortOrderEnum {
|
|||
|
||||
export const SORT_ORDERS = ['asc', 'desc'];
|
||||
|
||||
export const CLN_DEFAULT_PAGE_SETTINGS: PageSettingsCLN[] = [
|
||||
export const CLN_DEFAULT_PAGE_SETTINGS: PageSettings[] = [
|
||||
{ pageId: 'on_chain', tables: [
|
||||
{ tableId: 'utxos', recordsPerPage: PAGE_SIZE, sortBy: 'blockheight', sortOrder: SortOrderEnum.DESCENDING,
|
||||
columnSelectionSM: ['txid', 'value'],
|
||||
|
@ -815,3 +818,38 @@ export const CLN_TABLES_DEF = {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const LND_DEFAULT_PAGE_SETTINGS: PageSettings[] = [
|
||||
{ pageId: 'loop', tables: [
|
||||
{ tableId: 'loop', recordsPerPage: PAGE_SIZE, sortBy: 'initiation_time', sortOrder: SortOrderEnum.DESCENDING,
|
||||
columnSelectionSM: ['state', 'amt'],
|
||||
columnSelection: ['state', 'initiation_time', 'amt', 'cost_server', 'cost_offchain', 'cost_onchain'] }
|
||||
] },
|
||||
{ pageId: 'boltz', tables: [
|
||||
{ tableId: 'swap_in', recordsPerPage: PAGE_SIZE, sortBy: 'status', sortOrder: SortOrderEnum.DESCENDING,
|
||||
columnSelectionSM: ['status', 'id', 'expectedAmount'],
|
||||
columnSelection: ['status', 'id', 'lockupAddress', 'expectedAmount', 'timeoutBlockHeight'] },
|
||||
{ tableId: 'swap_out', recordsPerPage: PAGE_SIZE, sortBy: 'status', sortOrder: SortOrderEnum.DESCENDING,
|
||||
columnSelectionSM: ['status', 'id', 'onchainAmount'],
|
||||
columnSelection: ['status', 'id', 'claimAddress', 'onchainAmount', 'timeoutBlockHeight'] }
|
||||
] }
|
||||
];
|
||||
|
||||
export const LND_TABLES_DEF = {
|
||||
loop: {
|
||||
loop: {
|
||||
maxColumns: 8,
|
||||
allowedColumns: ['state', 'initiation_time', 'last_update_time', 'amt', 'cost_server', 'cost_offchain', 'cost_onchain', 'htlc_address', 'id', 'id_bytes']
|
||||
}
|
||||
},
|
||||
boltz: {
|
||||
swap_in: {
|
||||
maxColumns: 7,
|
||||
allowedColumns: ['status', 'id', 'lockupAddress', 'expectedAmount', 'privateKey', 'preimage', 'redeemScript', 'invoice', 'timeoutBlockHeight', 'lockupTransactionId', 'refundTransactionId']
|
||||
},
|
||||
swap_out: {
|
||||
maxColumns: 7,
|
||||
allowedColumns: ['status', 'id', 'claimAddress', 'onchainAmount', 'privateKey', 'preimage', 'redeemScript', 'invoice', 'timeoutBlockHeight', 'lockupTransactionId', 'claimTransactionId']
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -97,11 +97,6 @@ import { SwapServiceInfoComponent } from './components/ln-services/boltz/swap-se
|
|||
import { SwapModalComponent } from './components/ln-services/boltz/swap-modal/swap-modal.component';
|
||||
import { SwapInInfoGraphicsComponent } from './components/ln-services/boltz/swap-in-info-graphics/info-graphics.component';
|
||||
import { SwapOutInfoGraphicsComponent } from './components/ln-services/boltz/swap-out-info-graphics/info-graphics.component';
|
||||
import { PeerswapComponent } from './components/ln-services/peerswap/peerswap.component';
|
||||
import { SwapPeersComponent } from './components/ln-services/peerswap/swap-peers/swap-peers.component';
|
||||
import { PeerswapsCancelledComponent } from './components/ln-services/peerswap/swaps-cancelled/swaps-cancelled.component';
|
||||
import { PeerswapsInComponent } from './components/ln-services/peerswap/swaps-in/swaps-in.component';
|
||||
import { PeerswapsOutComponent } from './components/ln-services/peerswap/swaps-out/swaps-out.component';
|
||||
|
||||
import { ClipboardDirective } from './directive/clipboard.directive';
|
||||
import { AutoFocusDirective } from './directive/auto-focus.directive';
|
||||
|
@ -273,12 +268,7 @@ export const DEFAULT_DATE_FORMAT: MatDateFormats = {
|
|||
SwapServiceInfoComponent,
|
||||
SwapModalComponent,
|
||||
SwapInInfoGraphicsComponent,
|
||||
SwapOutInfoGraphicsComponent,
|
||||
PeerswapComponent,
|
||||
SwapPeersComponent,
|
||||
PeerswapsCancelledComponent,
|
||||
PeerswapsInComponent,
|
||||
PeerswapsOutComponent
|
||||
SwapOutInfoGraphicsComponent
|
||||
],
|
||||
declarations: [
|
||||
AppSettingsComponent,
|
||||
|
@ -339,12 +329,7 @@ export const DEFAULT_DATE_FORMAT: MatDateFormats = {
|
|||
SwapServiceInfoComponent,
|
||||
SwapModalComponent,
|
||||
SwapInInfoGraphicsComponent,
|
||||
SwapOutInfoGraphicsComponent,
|
||||
PeerswapComponent,
|
||||
SwapPeersComponent,
|
||||
PeerswapsCancelledComponent,
|
||||
PeerswapsInComponent,
|
||||
PeerswapsOutComponent
|
||||
SwapOutInfoGraphicsComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: LoggerService, useClass: ConsoleLoggerService },
|
||||
|
|
Loading…
Add table
Reference in a new issue