mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2025-02-22 14:22:48 +01:00
Boltz Page Layout
This commit is contained in:
parent
8986fb6771
commit
c930b8e121
7 changed files with 160 additions and 59 deletions
|
@ -14,46 +14,100 @@
|
|||
<table mat-table #table [dataSource]="listSwaps" matSort [ngClass]="{'overflow-auto error-border': flgLoading[0]==='error','overflow-auto': true}">
|
||||
<ng-container matColumnDef="status">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
|
||||
<td mat-cell *matCellDef="let swap">{{swapStateEnum[swap.status]}}</td>
|
||||
<td mat-cell *matCellDef="let swap">{{swapStateEnum[swap?.status]}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Swap ID </th>
|
||||
<td mat-cell *matCellDef="let swap">{{swap.id}}</td>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> Swap ID </th>
|
||||
<td mat-cell *matCellDef="let swap" class="pl-1">{{swap?.id}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="claimAddress">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Claim Address </th>
|
||||
<td mat-cell *matCellDef="let swap">{{swap.claimAddress}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="onchainAmount">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Onchain Amount (Sats) </th>
|
||||
<td mat-cell *matCellDef="let swap">
|
||||
<span fxLayoutAlign="end center">{{swap.onchainAmount | number}}</span>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> Claim 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?.claimAddress}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="lockupAddress">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Lockup Address </th>
|
||||
<td mat-cell *matCellDef="let swap">{{swap.lockupAddress}}</td>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> Lockup 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?.lockupAddress}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="onchainAmount">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before" class="pl-1"> Onchain Amount (Sats) </th>
|
||||
<td mat-cell *matCellDef="let swap" class="pl-1">
|
||||
<span fxLayoutAlign="end center">{{swap?.onchainAmount | number}}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="expectedAmount">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Expected Amount (Sats) </th>
|
||||
<td mat-cell *matCellDef="let swap">
|
||||
<span fxLayoutAlign="end center">{{swap.expectedAmount | number}}</span>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before" class="pl-1"> Expected Amount (Sats) </th>
|
||||
<td mat-cell *matCellDef="let swap" class="pl-1">
|
||||
<span fxLayoutAlign="end center">{{swap?.expectedAmount | number}}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="error">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> Error </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?.error}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="privateKey">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> Private Key </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?.privateKey}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="preimage">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> Preimage </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?.preimage}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="redeemScript">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> Redeem Script </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?.redeemScript}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="invoice">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> Invoice </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?.invoice}}</span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="timeoutBlockHeight">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Timeout Block Height </th>
|
||||
<td mat-cell *matCellDef="let swap">
|
||||
<span fxLayoutAlign="end center">{{swap.timeoutBlockHeight | number}}</span>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before" class="pl-1"> Timeout Block Height </th>
|
||||
<td mat-cell *matCellDef="let swap" class="pl-1">
|
||||
<span fxLayoutAlign="end center">{{swap?.timeoutBlockHeight | number}}</span>
|
||||
</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>
|
||||
</td>
|
||||
<ng-container matColumnDef="lockupTransactionId">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> Lockup Tx ID </th>
|
||||
<td mat-cell *matCellDef="let swap" class="pl-1">{{swap?.lockupTransactionId}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="claimTransactionId">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> Claim Tx ID </th>
|
||||
<td mat-cell *matCellDef="let swap" class="pl-1">{{swap?.claimTransactionId}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="refundTransactionId">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="pl-1"> Refund Tx ID </th>
|
||||
<td mat-cell *matCellDef="let swap" class="pl-1">{{swap?.refundTransactionId}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef class="px-3">
|
||||
<th mat-header-cell *matHeaderCellDef class="pl-1 pr-3">
|
||||
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">
|
||||
<mat-select placeholder="Actions" tabindex="1" class="mr-0">
|
||||
<mat-select-trigger></mat-select-trigger>
|
||||
|
@ -61,7 +115,7 @@
|
|||
</mat-select>
|
||||
</div>
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let swap" class="pl-3" fxLayoutAlign="end center">
|
||||
<td mat-cell *matCellDef="let swap" class="pl-1" fxLayoutAlign="end center">
|
||||
<button mat-stroked-button color="primary" type="button" tabindex="4"
|
||||
(click)="onSwapClick(swap, $event)"class="table-actions-button">View Info</button>
|
||||
</td>
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
.mat-column-claimAddress, .mat-column-lockupAddress, .mat-column-error, .mat-column-privateKey, .mat-column-preimage, .mat-column-redeemScript, .mat-column-invoice {
|
||||
flex: 0 0 10%;
|
||||
width: 10%;
|
||||
& .ellipsis-parent {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
.mat-column-actions {
|
||||
min-height: 4.8rem;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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';
|
||||
|
@ -8,13 +8,16 @@ import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
|
|||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { Swap, ReverseSwap } from '../../../../models/boltzModels';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, SwapTypeEnum, SwapStateEnum } from '../../../../services/consts-enums-functions';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, SwapTypeEnum, SwapStateEnum, SortOrderEnum, LND_DEFAULT_PAGE_SETTINGS } from '../../../../services/consts-enums-functions';
|
||||
import { LoggerService } from '../../../../services/logger.service';
|
||||
import { CommonService } from '../../../../services/common.service';
|
||||
import { BoltzService } from '../../../../services/boltz.service';
|
||||
|
||||
import { openAlert } from '../../../../../store/rtl.actions';
|
||||
import { RTLState } from '../../../../../store/rtl.state';
|
||||
import { PageSettings, TableSetting } from '../../../../models/pageSettings';
|
||||
import { lndPageSettings } from '../../../../../lnd/store/lnd.selector';
|
||||
import { ApiCallStatusPayload } from '../../../../models/apiCallsPayload';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-boltz-swaps',
|
||||
|
@ -24,7 +27,7 @@ import { RTLState } from '../../../../../store/rtl.state';
|
|||
{ provide: MatPaginatorIntl, useValue: getPaginatorLabel('Swaps') }
|
||||
]
|
||||
})
|
||||
export class BoltzSwapsComponent implements AfterViewInit, OnChanges, OnDestroy {
|
||||
export class BoltzSwapsComponent implements OnInit, AfterViewInit, OnChanges, OnDestroy {
|
||||
|
||||
@Input() selectedSwapType: SwapTypeEnum = SwapTypeEnum.SWAP_OUT;
|
||||
@Input() swapsData: Swap[] | ReverseSwap[] = [];
|
||||
|
@ -32,6 +35,9 @@ export class BoltzSwapsComponent 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 = 'boltz';
|
||||
public tableSettingSwapOut: TableSetting = { tableId: 'swap_out', recordsPerPage: PAGE_SIZE, sortBy: 'status', sortOrder: SortOrderEnum.DESCENDING };
|
||||
public tableSettingSwapIn: TableSetting = { tableId: 'swap_in', recordsPerPage: PAGE_SIZE, sortBy: 'status', sortOrder: SortOrderEnum.DESCENDING };
|
||||
public swapStateEnum = SwapStateEnum;
|
||||
public faHistory = faHistory;
|
||||
public swapCaption = 'Swap Out';
|
||||
|
@ -46,7 +52,19 @@ export class BoltzSwapsComponent implements AfterViewInit, OnChanges, OnDestroy
|
|||
|
||||
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<RTLState>, private boltzService: BoltzService) {
|
||||
this.screenSize = this.commonService.getScreenSize();
|
||||
this.setTableColumns();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.store.select(lndPageSettings).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
|
||||
this.tableSettingSwapOut = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSettingSwapOut.tableId) || LND_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSettingSwapOut.tableId)!;
|
||||
this.tableSettingSwapIn = settings.pageSettings.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSettingSwapIn.tableId) || LND_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === this.PAGE_ID)?.tables.find((table) => table.tableId === this.tableSettingSwapIn.tableId)!;
|
||||
this.setTableColumns();
|
||||
if (this.swapsData && this.swapsData.length > 0 && this.sort && this.paginator) {
|
||||
this.loadSwapsTable(this.swapsData);
|
||||
}
|
||||
this.logger.info(this.displayedColumns);
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
@ -64,20 +82,22 @@ export class BoltzSwapsComponent implements AfterViewInit, OnChanges, OnDestroy
|
|||
}
|
||||
|
||||
setTableColumns() {
|
||||
if (this.screenSize === ScreenSizeEnum.XS) {
|
||||
this.displayedColumns = (this.selectedSwapType === SwapTypeEnum.SWAP_IN) ?
|
||||
['status', 'id', 'expectedAmount', 'actions'] : ['status', 'id', 'onchainAmount', 'actions'];
|
||||
} else if (this.screenSize === ScreenSizeEnum.SM) {
|
||||
this.displayedColumns = (this.selectedSwapType === SwapTypeEnum.SWAP_IN) ?
|
||||
['status', 'id', 'expectedAmount', 'actions'] : ['status', 'id', 'onchainAmount', 'actions'];
|
||||
} else if (this.screenSize === ScreenSizeEnum.MD) {
|
||||
this.displayedColumns = (this.selectedSwapType === SwapTypeEnum.SWAP_IN) ?
|
||||
['status', 'id', 'expectedAmount', 'timeoutBlockHeight', 'actions'] :
|
||||
['status', 'id', 'onchainAmount', 'timeoutBlockHeight', 'actions'];
|
||||
if (this.selectedSwapType === SwapTypeEnum.SWAP_IN) {
|
||||
if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
|
||||
this.displayedColumns = JSON.parse(JSON.stringify(this.tableSettingSwapIn.columnSelectionSM));
|
||||
} else {
|
||||
this.displayedColumns = JSON.parse(JSON.stringify(this.tableSettingSwapIn.columnSelection));
|
||||
}
|
||||
this.displayedColumns.push('actions');
|
||||
this.pageSize = this.tableSettingSwapIn.recordsPerPage ? +this.tableSettingSwapIn.recordsPerPage : PAGE_SIZE;
|
||||
} else {
|
||||
this.displayedColumns = (this.selectedSwapType === SwapTypeEnum.SWAP_IN) ?
|
||||
['status', 'id', 'lockupAddress', 'expectedAmount', 'timeoutBlockHeight', 'actions'] :
|
||||
['status', 'id', 'claimAddress', 'onchainAmount', 'timeoutBlockHeight', 'actions'];
|
||||
if (this.screenSize === ScreenSizeEnum.XS || this.screenSize === ScreenSizeEnum.SM) {
|
||||
this.displayedColumns = JSON.parse(JSON.stringify(this.tableSettingSwapOut.columnSelectionSM));
|
||||
} else {
|
||||
this.displayedColumns = JSON.parse(JSON.stringify(this.tableSettingSwapOut.columnSelection));
|
||||
}
|
||||
this.displayedColumns.push('actions');
|
||||
this.pageSize = this.tableSettingSwapOut.recordsPerPage ? +this.tableSettingSwapOut.recordsPerPage : PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,16 +113,16 @@ export class BoltzSwapsComponent implements AfterViewInit, OnChanges, OnDestroy
|
|||
fetchedSwap = (this.selectedSwapType === SwapTypeEnum.SWAP_IN) ? fetchedSwap.swap : fetchedSwap.reverseSwap;
|
||||
const reorderedSwap = [
|
||||
[{ key: 'status', value: SwapStateEnum[fetchedSwap.status], title: 'Status', width: 50, type: DataTypeEnum.STRING },
|
||||
{ key: 'id', value: fetchedSwap.id, title: 'ID', width: 50, type: DataTypeEnum.STRING }],
|
||||
{ key: 'id', value: fetchedSwap.id, title: 'ID', width: 50, type: DataTypeEnum.STRING }],
|
||||
[{ key: 'amount', value: fetchedSwap.onchainAmount ? fetchedSwap.onchainAmount : fetchedSwap.expectedAmount ? fetchedSwap.expectedAmount : 0, title: fetchedSwap.onchainAmount ? 'Onchain Amount (Sats)' : fetchedSwap.expectedAmount ? 'Expected Amount (Sats)' : 'Amount (Sats)', width: 50, type: DataTypeEnum.NUMBER },
|
||||
{ key: 'timeoutBlockHeight', value: fetchedSwap.timeoutBlockHeight, title: 'Timeout Block Height', width: 50, type: DataTypeEnum.NUMBER }],
|
||||
{ key: 'timeoutBlockHeight', value: fetchedSwap.timeoutBlockHeight, title: 'Timeout Block Height', width: 50, type: DataTypeEnum.NUMBER }],
|
||||
[{ key: 'address', value: fetchedSwap.claimAddress ? fetchedSwap.claimAddress : fetchedSwap.lockupAddress ? fetchedSwap.lockupAddress : '', title: fetchedSwap.claimAddress ? 'Claim Address' : fetchedSwap.lockupAddress ? 'Lockup Address' : 'Address', width: 100, type: DataTypeEnum.STRING }],
|
||||
[{ key: 'invoice', value: fetchedSwap.invoice, title: 'Invoice', width: 100, type: DataTypeEnum.STRING }],
|
||||
[{ key: 'privateKey', value: fetchedSwap.privateKey, title: 'Private Key', width: 100, type: DataTypeEnum.STRING }],
|
||||
[{ key: 'preimage', value: fetchedSwap.preimage, title: 'Preimage', width: 100, type: DataTypeEnum.STRING }],
|
||||
[{ key: 'redeemScript', value: fetchedSwap.redeemScript, title: 'Redeem Script', width: 100, type: DataTypeEnum.STRING }],
|
||||
[{ key: 'lockupTransactionId', value: fetchedSwap.lockupTransactionId, title: 'Lockup Transaction ID', width: 50, type: DataTypeEnum.STRING },
|
||||
{ key: 'transactionId', value: fetchedSwap.claimTransactionId ? fetchedSwap.claimTransactionId : fetchedSwap.refundTransactionId ? fetchedSwap.refundTransactionId : '', title: fetchedSwap.claimTransactionId ? 'Claim Transaction ID' : fetchedSwap.refundTransactionId ? 'Refund Transaction ID' : 'Transaction ID', width: 50, type: DataTypeEnum.STRING }]
|
||||
{ key: 'transactionId', value: fetchedSwap.claimTransactionId ? fetchedSwap.claimTransactionId : fetchedSwap.refundTransactionId ? fetchedSwap.refundTransactionId : '', title: fetchedSwap.claimTransactionId ? 'Claim Transaction ID' : fetchedSwap.refundTransactionId ? 'Refund Transaction ID' : 'Transaction ID', width: 50, type: DataTypeEnum.STRING }]
|
||||
];
|
||||
this.store.dispatch(openAlert({
|
||||
payload: {
|
||||
|
@ -121,6 +141,11 @@ export class BoltzSwapsComponent implements AfterViewInit, OnChanges, OnDestroy
|
|||
this.listSwaps = swaps ? new MatTableDataSource<Swap>([...swaps]) : new MatTableDataSource<Swap>([]);
|
||||
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);
|
||||
if (this.selectedSwapType === SwapTypeEnum.SWAP_IN) {
|
||||
this.listSwaps.sort?.sort({ id: this.tableSettingSwapIn.sortBy, start: this.tableSettingSwapIn.sortOrder, disableClear: true });
|
||||
} else {
|
||||
this.listSwaps.sort?.sort({ id: this.tableSettingSwapOut.sortBy, start: this.tableSettingSwapOut.sortOrder, disableClear: true });
|
||||
}
|
||||
this.listSwaps.filterPredicate = (swap: Swap, fltr: string) => JSON.stringify(swap).toLowerCase().includes(fltr);
|
||||
if (this.paginator) {
|
||||
this.paginator.firstPage();
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
{{field | camelcaseWithReplace:'_'}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-hint>Columns (mobile) should be between 1 and 2</mat-hint>
|
||||
<mat-hint>Columns (mobile) should be between 1 and 3</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field fxFlex="40">
|
||||
<mat-select [(ngModel)]="table.columnSelection" (selectionChange)="oncolumnSelectionChange(table)" placeholder="Column selection (Desktop)" name="{{table.tableId}}-columns-selection" tabindex="6" multiple required>
|
||||
|
|
|
@ -11,11 +11,12 @@ import { CommonService } from '../../../services/common.service';
|
|||
import { RTLState } from '../../../../store/rtl.state';
|
||||
import { TableSetting, PageSettings } from '../../../models/pageSettings';
|
||||
import { clnNodeSettings, clnPageSettings } from '../../../../cln/store/cln.selector';
|
||||
import { savePageSettings } from '../../../../cln/store/cln.actions';
|
||||
import { savePageSettings as savePageSettingsCLN } 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';
|
||||
import { savePageSettings as savePageSettingsLND } from '../../../../lnd/store/lnd.actions';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-page-settings',
|
||||
|
@ -32,6 +33,7 @@ export class PageSettingsComponent implements OnInit, OnDestroy {
|
|||
public pageSizeOptions = PAGE_SIZE_OPTIONS;
|
||||
public pageSettings: PageSettings[] = [];
|
||||
public initialPageSettings: PageSettings[] = [];
|
||||
public defaultSettings: PageSettings[] = [];
|
||||
public tableFieldsDef = {};
|
||||
public sortOrders = SORT_ORDERS;
|
||||
public apiCallStatus: ApiCallStatusPayload | null = null;
|
||||
|
@ -50,6 +52,7 @@ export class PageSettingsComponent implements OnInit, OnDestroy {
|
|||
switch (this.selNode.lnImplementation) {
|
||||
case 'CLN':
|
||||
this.initialPageSettings = Object.assign([], CLN_DEFAULT_PAGE_SETTINGS);
|
||||
this.defaultSettings = 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))).
|
||||
|
@ -85,6 +88,7 @@ export class PageSettingsComponent implements OnInit, OnDestroy {
|
|||
|
||||
default:
|
||||
this.initialPageSettings = Object.assign([], LND_DEFAULT_PAGE_SETTINGS);
|
||||
this.defaultSettings = 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))).
|
||||
|
@ -130,13 +134,21 @@ export class PageSettingsComponent implements OnInit, OnDestroy {
|
|||
return true;
|
||||
}
|
||||
this.errorMessage = '';
|
||||
this.store.dispatch(savePageSettings({ payload: this.pageSettings }));
|
||||
switch (this.selNode.lnImplementation) {
|
||||
case 'CLN':
|
||||
this.store.dispatch(savePageSettingsCLN({ payload: this.pageSettings }));
|
||||
break;
|
||||
|
||||
default:
|
||||
this.store.dispatch(savePageSettingsLND({ payload: this.pageSettings }));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
onTableReset(currPageId: string, currTable: TableSetting) {
|
||||
const pageIdx = this.pageSettings.findIndex((page) => page.pageId === currPageId);
|
||||
const tableIdx = this.pageSettings[pageIdx].tables.findIndex((table) => table.tableId === currTable.tableId);
|
||||
const tableToReplace = CLN_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === currPageId)?.tables.find((table) => table.tableId === currTable.tableId) || this.pageSettings.find((page) => page.pageId === currPageId)?.tables.find((table) => table.tableId === currTable.tableId);
|
||||
const tableToReplace = this.defaultSettings.find((page) => page.pageId === currPageId)?.tables.find((table) => table.tableId === currTable.tableId) || this.pageSettings.find((page) => page.pageId === currPageId)?.tables.find((table) => table.tableId === currTable.tableId);
|
||||
this.pageSettings[pageIdx].tables.splice(tableIdx, 1, tableToReplace!);
|
||||
}
|
||||
|
||||
|
@ -146,7 +158,7 @@ export class PageSettingsComponent implements OnInit, OnDestroy {
|
|||
this.pageSettings = JSON.parse(JSON.stringify(this.initialPageSettings));
|
||||
} else {
|
||||
this.errorMessage = null;
|
||||
this.pageSettings = JSON.parse(JSON.stringify(CLN_DEFAULT_PAGE_SETTINGS));
|
||||
this.pageSettings = JSON.parse(JSON.stringify(this.defaultSettings));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ export interface Swap {
|
|||
export interface ChannelCreationInfo {
|
||||
swapId?: string;
|
||||
status?: string;
|
||||
error?: string;
|
||||
inboundLiquidity?: number;
|
||||
private?: boolean;
|
||||
fundingTransactionId?: string;
|
||||
|
@ -34,6 +35,7 @@ export interface ChannelCreation {
|
|||
export interface ReverseSwap {
|
||||
id?: string;
|
||||
status?: string;
|
||||
error?: string;
|
||||
privateKey?: string;
|
||||
preimage?: string;
|
||||
redeemScript?: string;
|
||||
|
|
|
@ -826,12 +826,12 @@ export const LND_DEFAULT_PAGE_SETTINGS: PageSettings[] = [
|
|||
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'] }
|
||||
columnSelection: ['status', 'id', 'claimAddress', 'onchainAmount', 'timeoutBlockHeight'] },
|
||||
{ tableId: 'swap_in', recordsPerPage: PAGE_SIZE, sortBy: 'status', sortOrder: SortOrderEnum.DESCENDING,
|
||||
columnSelectionSM: ['status', 'id', 'expectedAmount'],
|
||||
columnSelection: ['status', 'id', 'lockupAddress', 'expectedAmount', 'timeoutBlockHeight'] }
|
||||
] }
|
||||
];
|
||||
|
||||
|
@ -843,13 +843,13 @@ export const LND_TABLES_DEF = {
|
|||
}
|
||||
},
|
||||
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']
|
||||
allowedColumns: ['status', 'id', 'claimAddress', 'onchainAmount', 'error', 'privateKey', 'preimage', 'redeemScript', 'invoice', 'timeoutBlockHeight', 'lockupTransactionId', 'claimTransactionId']
|
||||
},
|
||||
swap_in: {
|
||||
maxColumns: 7,
|
||||
allowedColumns: ['status', 'id', 'lockupAddress', 'expectedAmount', 'error', 'privateKey', 'preimage', 'redeemScript', 'invoice', 'timeoutBlockHeight', 'lockupTransactionId', 'refundTransactionId']
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue