peerswap: swaps list

cln-peer-swap
ShahanaFarooqui 10 months ago
parent 556b8dd51f
commit ff3325320c

@ -13,6 +13,6 @@
<style>html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:95%}@media only screen and (max-width: 56.25em){html{font-size:90%}}@media only screen and (max-width: 37.5em){html{font-size:80%}}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}</style><link rel="stylesheet" href="styles.40cd0dae59c4a141.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.40cd0dae59c4a141.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.0cda23fc08980625.js" type="module"></script><script src="polyfills.aa01d8f6b94657cb.js" type="module"></script><script src="main.296bd7dbd23a5330.js" type="module"></script>
<script src="runtime.d76250364bcc5081.js" type="module"></script><script src="polyfills.aa01d8f6b94657cb.js" type="module"></script><script src="main.cfcb8ecb74659273.js" type="module"></script>
</body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
(()=>{"use strict";var e,v={},m={};function r(e){var f=m[e];if(void 0!==f)return f.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(f,t,i,o)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,o]=e[n],c=!0,d=0;d<t.length;d++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[d]))?t.splice(d--,1):(c=!1,o<a&&(a=o));if(c){e.splice(n--,1);var u=i();void 0!==u&&(f=u)}}return f}o=o||0;for(var n=e.length;n>0&&e[n-1][2]>o;n--)e[n]=e[n-1];e[n]=[t,i,o]},r.d=(e,f)=>{for(var t in f)r.o(f,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:f[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((f,t)=>(r.f[t](e,f),f),[])),r.u=e=>e+"."+{167:"b8e9be471e438940",267:"3050ada6a6d9afd8",315:"75fdf809ce9cafd8",636:"31bce185d86aca35"}[e]+".js",r.miniCssF=e=>{},r.o=(e,f)=>Object.prototype.hasOwnProperty.call(e,f),(()=>{var e={},f="RTLApp:";r.l=(t,i,o,n)=>{if(e[t])e[t].push(i);else{var a,c;if(void 0!==o)for(var d=document.getElementsByTagName("script"),u=0;u<d.length;u++){var l=d[u];if(l.getAttribute("src")==t||l.getAttribute("data-webpack")==f+o){a=l;break}}a||(c=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",f+o),a.src=r.tu(t)),e[t]=[i];var s=(g,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(y=>y(b)),g)return g(b)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:f=>f},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(i,o)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)o.push(n[2]);else if(666!=i){var a=new Promise((l,s)=>n=e[i]=[l,s]);o.push(n[2]=a);var c=r.p+r.u(i),d=new Error;r.l(c,l=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var s=l&&("load"===l.type?"missing":l.type),p=l&&l.target&&l.target.src;d.message="Loading chunk "+i+" failed.\n("+s+": "+p+")",d.name="ChunkLoadError",d.type=s,d.request=p,n[1](d)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var f=(i,o)=>{var d,u,[n,a,c]=o,l=0;if(n.some(p=>0!==e[p])){for(d in a)r.o(a,d)&&(r.m[d]=a[d]);if(c)var s=c(r)}for(i&&i(o);l<n.length;l++)r.o(e,u=n[l])&&e[u]&&e[u][0](),e[u]=0;return r.O(s)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(f.bind(null,0)),t.push=f.bind(null,t.push.bind(t))})()})();

@ -0,0 +1 @@
(()=>{"use strict";var e,v={},m={};function r(e){var o=m[e];if(void 0!==o)return o.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(o,t,i,d)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,d]=e[n],c=!0,f=0;f<t.length;f++)(!1&d||a>=d)&&Object.keys(r.O).every(b=>r.O[b](t[f]))?t.splice(f--,1):(c=!1,d<a&&(a=d));if(c){e.splice(n--,1);var u=i();void 0!==u&&(o=u)}}return o}d=d||0;for(var n=e.length;n>0&&e[n-1][2]>d;n--)e[n]=e[n-1];e[n]=[t,i,d]},r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((o,t)=>(r.f[t](e,o),o),[])),r.u=e=>e+"."+{167:"b8e9be471e438940",267:"3050ada6a6d9afd8",315:"75fdf809ce9cafd8",636:"31bce185d86aca35"}[e]+".js",r.miniCssF=e=>{},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={},o="RTLApp:";r.l=(t,i,d,n)=>{if(e[t])e[t].push(i);else{var a,c;if(void 0!==d)for(var f=document.getElementsByTagName("script"),u=0;u<f.length;u++){var l=f[u];if(l.getAttribute("src")==t||l.getAttribute("data-webpack")==o+d){a=l;break}}a||(c=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",o+d),a.src=r.tu(t)),e[t]=[i];var s=(g,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(y=>y(b)),g)return g(b)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:o=>o},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(i,d)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)d.push(n[2]);else if(666!=i){var a=new Promise((l,s)=>n=e[i]=[l,s]);d.push(n[2]=a);var c=r.p+r.u(i),f=new Error;r.l(c,l=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var s=l&&("load"===l.type?"missing":l.type),p=l&&l.target&&l.target.src;f.message="Loading chunk "+i+" failed.\n("+s+": "+p+")",f.name="ChunkLoadError",f.type=s,f.request=p,n[1](f)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var o=(i,d)=>{var f,u,[n,a,c]=d,l=0;if(n.some(p=>0!==e[p])){for(f in a)r.o(a,f)&&(r.m[f]=a[f]);if(c)var s=c(r)}for(i&&i(d);l<n.length;l++)r.o(e,u=n[l])&&e[u]&&e[u][0](),e[u]=0;return r.O(s)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})()})();

@ -116,7 +116,7 @@
<mat-option (click)="onDownloadCSV()">Download CSV</mat-option>
</mat-select>
</div>
</th>
</th>
<td *matCellDef="let channel" mat-cell fxLayoutAlign="end center">
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">
<mat-select placeholder="Actions" tabindex="2" class="mr-0">

@ -11,13 +11,13 @@
<div fxFlex.gt-xs="30" fxLayoutAlign.gt-xs="space-between center" fxLayout="row" fxLayoutAlign="space-between stretch">
<mat-form-field fxLayout="column" fxFlex="49">
<mat-label>Filter By</mat-label>
<mat-select tabindex="1" name="filterBy" [(ngModel)]="selFilterBy" (selectionChange)="selFilter=''; applyFilter()">
<mat-select tabindex="1" name="filterBy" [(ngModel)]="selFilterBy" (selectionChange)="selFilter=''; applyFilter()">
<perfect-scrollbar><mat-option *ngFor="let column of ['all'].concat(displayedColumns.slice(0, -1))" [value]="column">{{getLabel(column)}}</mat-option></perfect-scrollbar>
</mat-select>
</mat-form-field>
<mat-form-field fxLayout="column" fxFlex="49">
<mat-label>Filter</mat-label>
<input matInput name="filter" [(ngModel)]="selFilter" (input)="applyFilter()" (keyup)="applyFilter()">
<input matInput name="filter" [(ngModel)]="selFilter" (input)="applyFilter()" (keyup)="applyFilter()">
</mat-form-field>
</div>
</div>

@ -993,7 +993,7 @@ export class CLNEffects implements OnDestroy {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchSwaps', status: APICallStatusEnum.COMPLETED } }));
return {
type: CLNActions.SET_SWAPS_CLN,
payload: Object.keys(res).length === 0 ? [] : res
payload: res.swaps && res.swaps.length && res.swaps.length > 0 ? res.swaps : []
};
}), catchError((err: any) => {
this.handleErrorWithoutAlert('FetchSwaps', UI_MESSAGES.NO_SPINNER, 'Fetching Swaps Failed.', err);
@ -1180,7 +1180,7 @@ export class CLNEffects implements OnDestroy {
[{ key: 'state', value: this.swapStatePipe.transform(swapRes.state || ''), title: 'State', width: 50, type: DataTypeEnum.STRING },
{ key: 'role', value: this.titleCasePipe.transform(swapRes.role), title: 'Role', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'alias', value: swapRes.alias, title: 'Alias', width: 50, type: DataTypeEnum.STRING },
{ key: 'short_channel_id', value: swapRes.short_channel_id, title: 'Short Channel ID', width: 50, type: DataTypeEnum.STRING }],
{ key: 'channel_id', value: swapRes.channel_id, title: 'Short Channel ID', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'amount', value: this.decimalPipe.transform(swapRes.amount), title: 'Amount (Sats)', width: 50, type: DataTypeEnum.STRING },
{ key: 'created_at', value: this.datePipe.transform(new Date(swapRes.created_at || ''), 'dd/MMM/YYYY HH:mm'), title: 'Created At', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'peer_node_id', value: swapRes.peer_node_id, title: 'Peer Node Id', width: 100, type: DataTypeEnum.STRING }],

@ -19,12 +19,14 @@ import { fetchSwapPeers } from '../../../../../cln/store/cln.actions';
import { swapPeers } from '../../../../../cln/store/cln.selector';
import { PSSwapOutModalComponent } from '../swap-out-modal/swap-out-modal.component';
import { PSSwapInModalComponent } from '../swap-in-modal/swap-in-modal.component';
import { MAT_SELECT_CONFIG } from '@angular/material/select';
@Component({
selector: 'rtl-peerswap-peers',
templateUrl: './swap-peers.component.html',
styleUrls: ['./swap-peers.component.scss'],
providers: [
{ provide: MAT_SELECT_CONFIG, useValue: { overlayPanelClass: 'rtl-select-overlay' } },
{ provide: MatPaginatorIntl, useValue: getPaginatorLabel('Peers') }
]
})

@ -1,61 +1,75 @@
<div fxLayout="column" fxLayoutAlign="start stretch" class="padding-gap-x">
<div fxLayout="column" fxLayout.gt-xs="row wrap" fxLayoutAlign.gt-xs="start center" fxLayoutAlign="start stretch"
class="page-sub-title-container">
<div fxLayout="column">
<div fxLayout="column" fxLayout.gt-xs="row" fxLayoutAlign.gt-xs="start center" fxLayoutAlign="start stretch" class="page-sub-title-container">
<div fxFlex="70" class="padding-gap-x">
<fa-icon class="mr-1" [icon]="selSwapList === swapLists[0] ? faPersonArrowUpFromLine : selSwapList === swapLists[1] ? faPersonArrowDownToLine : faPersonCircleXmark"></fa-icon>
{{selSwapList === swapLists[0] ? 'Swapouts' : selSwapList === swapLists[1] ? 'Swapins' : 'Canceled Swaps'}}
</div>
<mat-form-field fxFlex="30">
<input matInput placeholder="Filter" [(ngModel)]="selFilter" (keyup)="applyFilter()">
</mat-form-field>
<div fxFlex.gt-xs="30" fxLayoutAlign.gt-xs="space-between center" fxLayout="row" fxLayoutAlign="space-between stretch">
<mat-form-field fxLayout="column" fxFlex="49">
<mat-label>Filter By</mat-label>
<mat-select tabindex="1" name="filterBy" [(ngModel)]="selFilterBy" (selectionChange)="selFilter=''; applyFilter()">
<perfect-scrollbar><mat-option *ngFor="let column of filterColumns" [value]="column">{{getLabel(column)}}</mat-option></perfect-scrollbar>
</mat-select>
</mat-form-field>
<mat-form-field fxLayout="column" fxFlex="49">
<mat-label>Filter</mat-label>
<input matInput name="filter" [(ngModel)]="selFilter" (input)="applyFilter()" (keyup)="applyFilter()">
</mat-form-field>
</div>
</div>
<div fxLayout="column" fxLayoutAlign="start center" fxFlex="100" class="table-container" [perfectScrollbar]>
<mat-progress-bar *ngIf="apiCallStatus?.status === apiCallStatusEnum.INITIATED" mode="indeterminate">
</mat-progress-bar>
<table #table class="overflow-auto" fxFlex="100" mat-table matSort [dataSource]="swaps" [ngClass]="{'error-border': errorMessage !== ''}">
<ng-container matColumnDef="id">
<div fxLayout="column" fxFlex="100" class="table-container" [perfectScrollbar]>
<mat-progress-bar *ngIf="apiCallStatus?.status === apiCallStatusEnum.INITIATED" mode="indeterminate"></mat-progress-bar>
<table #table mat-table matSort class="overflow-x-hidden overflow-y-hidden" [matSortActive]="tableSetting.sortBy" [matSortDirection]="tableSetting.sortOrder" [dataSource]="swaps" [ngClass]="{'error-border': errorMessage !== ''}">
<ng-container matColumnDef="role">
<th *matHeaderCellDef mat-header-cell mat-sort-header matTooltip="role"></th>
<td *matCellDef="let swap" mat-cell>
<fa-icon *ngIf="swap.role === peerswapRoles.SENDER" matTooltip="Sender" matTooltipPosition="right" class="mr-1" [ngClass]="{'mr-0': screenSize === screenSizeEnum.XS}" [icon]="faArrowRightFromBracket"></fa-icon>
<fa-icon *ngIf="swap.role === peerswapRoles.RECEIVER" matTooltip="Receiver" matTooltipPosition="right" class="mr-1" [ngClass]="{'mr-0': screenSize === screenSizeEnum.XS}" [icon]="faArrowRightToBracket"></fa-icon>
</td>
</ng-container>
<ng-container matColumnDef="state">
<th *matHeaderCellDef mat-header-cell mat-sort-header>State</th>
<td *matCellDef="let swap" mat-cell>{{swap?.state | swapState}}</td>
</ng-container>
<ng-container matColumnDef="created_at">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Created At</th>
<td *matCellDef="let swap" mat-cell>
{{swap?.created_at * 1000 | date:'dd/MMM/y HH:mm'}}
</td>
</ng-container>
<ng-container matColumnDef="swap_id">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Swap Id</th>
<td *matCellDef="let swap" mat-cell>
<span fxLayout="row" class="ellipsis-parent"
[ngStyle]="{'max-width': (screenSize === screenSizeEnum.XS) ? '10rem' : '25rem'}">
<div class="ellipsis-parent" [ngStyle]="{'width': (screenSize === screenSizeEnum.XS) ? '6rem' : colWidth}">
<span class="ellipsis-child">
<fa-icon *ngIf="swap.role === peerswapRoles.SENDER" matTooltip="Sender" matTooltipPosition="right" class="mr-1" [ngClass]="{'mr-0': screenSize === screenSizeEnum.XS}" [icon]="faArrowRightFromBracket"></fa-icon>
<fa-icon *ngIf="swap.role === peerswapRoles.RECEIVER" matTooltip="Receiver" matTooltipPosition="right" class="mr-1" [ngClass]="{'mr-0': screenSize === screenSizeEnum.XS}" [icon]="faArrowRightToBracket"></fa-icon>
{{swap?.id}}
</span>
</span>
</div>
</td>
</ng-container>
<ng-container matColumnDef="alias">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Node Alias</th>
<td *matCellDef="let swap" mat-cell>{{swap?.alias}}</td>
</ng-container>
<ng-container matColumnDef="short_channel_id">
<th *matHeaderCellDef mat-header-cellmat-sort-header class="pl-1">Short Channel ID</th>
<td *matCellDef="let swap" mat-cell class="pl-1">{{swap?.short_channel_id}}</td>
</ng-container>
<ng-container matColumnDef="created_at">
<th *matHeaderCellDef mat-header-cellmat-sort-header>Created At</th>
<td *matCellDef="let swap" mat-cell>
{{swap?.created_at | date:'dd/MMM/y HH:mm'}}
<div class="ellipsis-parent" [ngStyle]="{'width': (screenSize === screenSizeEnum.XS) ? '6rem' : colWidth}">
<span class="ellipsis-child">{{swap?.alias}}</span>
</div>
</td>
</ng-container>
<ng-container matColumnDef="state">
<th *matHeaderCellDef mat-header-cellmat-sort-header>State</th>
<td *matCellDef="let swap" mat-cell>{{swap?.state | swapState}}</td>
<ng-container matColumnDef="short_channel_id">
<th *matHeaderCellDef mat-header-cell mat-sort-header class="pl-1">Short Channel ID</th>
<td *matCellDef="let swap" mat-cell class="pl-1">{{swap?.channel_id}}</td>
</ng-container>
<ng-container matColumnDef="amount">
<th *matHeaderCellDef mat-header-cellmat-sort-header arrowPosition="before">Amount (Sats)</th>
<td *matCellDef="let swap" mat-cell><span fxLayoutAlign="end center">{{swap?.amount | number }}</span>
</td>
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount (Sats)</th>
<td *matCellDef="let swap" mat-cell><span fxLayoutAlign="end center">{{swap?.amount | number }}</span></td>
</ng-container>
<ng-container matColumnDef="cancel_message">
<th *matHeaderCellDef mat-header-cellmat-sort-header class="pl-2">Cancel Message</th>
<th *matHeaderCellDef mat-header-cell mat-sort-header class="pl-2">Cancel Message</th>
<td *matCellDef="let swap" mat-cell class="pl-2">{{swap?.cancel_message}}</td>
</ng-container>
<ng-container matColumnDef="actions">
<th *matHeaderCellDef mat-header-cellclass="px-3">
<div class="bordered-box table-actions-select">
<th *matHeaderCellDef mat-header-cell [ngClass]="{'px-3': screenSize !== screenSizeEnum.XS}">
<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>
<mat-option (click)="onDownloadCSV()">Download CSV</mat-option>
@ -76,13 +90,13 @@
<ng-container matColumnDef="no_swap">
<td *matFooterCellDef mat-footer-cell colspan="4">
<p
*ngIf="(!swaps?.data || (swaps?.data && swaps?.data.length && swaps?.data?.length<1)) && apiCallStatus?.status === apiCallStatusEnum.COMPLETED">
*ngIf="swaps?.data?.length < 1 && apiCallStatus?.status === apiCallStatusEnum.COMPLETED">
No swap available.</p>
<p
*ngIf="(!swaps?.data || (swaps?.data && swaps?.data.length && swaps?.data?.length<1)) && apiCallStatus?.status === apiCallStatusEnum.INITIATED">
*ngIf="swaps?.data?.length < 1 && apiCallStatus?.status === apiCallStatusEnum.INITIATED">
Getting swaps...</p>
<p
*ngIf="(!swaps?.data || (swaps?.data && swaps?.data.length && swaps?.data?.length<1)) && apiCallStatus?.status === apiCallStatusEnum.ERROR">
*ngIf="swaps?.data?.length < 1 && apiCallStatus?.status === apiCallStatusEnum.ERROR">
{{errorMessage}}</p>
</td>
</ng-container>

@ -1,8 +1,6 @@
.mat-column-id {
flex: 0 0 20%;
width: 20%;
& .ellipsis-parent {
display: flex;
}
.mat-column-role {
max-width: 2.2rem;
width: 2.2rem;
text-overflow: unset;
}

@ -10,7 +10,7 @@ import { MatTableDataSource } from '@angular/material/table';
import { faArrowRightFromBracket, faArrowRightToBracket, faPersonArrowDownToLine, faPersonArrowUpFromLine, faPersonCircleXmark } from '@fortawesome/free-solid-svg-icons';
import { Swap } from '../../../../models/peerswapModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum, DataTypeEnum, AlertTypeEnum, PeerswapRoles } from '../../../../services/consts-enums-functions';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum, DataTypeEnum, AlertTypeEnum, PeerswapRoles, CLN_PAGE_DEFS, SortOrderEnum, CLN_DEFAULT_PAGE_SETTINGS } from '../../../../services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../../../shared/services/logger.service';
import { CommonService } from '../../../../../shared/services/common.service';
@ -18,14 +18,17 @@ import { CommonService } from '../../../../../shared/services/common.service';
import { RTLState } from '../../../../../store/rtl.state';
import { openAlert } from '../../../../../store/rtl.actions';
import { fetchSwaps, getSwap } from '../../../../../cln/store/cln.actions';
import { swaps } from '../../../../../cln/store/cln.selector';
import { SwapStatePipe } from '../../../../pipes/app.pipe';
import { clnPageSettings, swaps } from '../../../../../cln/store/cln.selector';
import { CamelCaseWithReplacePipe, SwapStatePipe } from '../../../../pipes/app.pipe';
import { ColumnDefinition, PageSettings, TableSetting } from 'src/app/shared/models/pageSettings';
import { MAT_SELECT_CONFIG } from '@angular/material/select';
@Component({
selector: 'rtl-peer-swaps-list',
templateUrl: './swaps-list.component.html',
styleUrls: ['./swaps-list.component.scss'],
providers: [
{ provide: MAT_SELECT_CONFIG, useValue: { overlayPanelClass: 'rtl-select-overlay' } },
{ provide: MatPaginatorIntl, useValue: getPaginatorLabel('Swaps') }
]
})
@ -38,9 +41,14 @@ export class PeerswapsListComponent implements OnInit, AfterViewInit, OnDestroy
public faPersonCircleXmark = faPersonCircleXmark;
public faArrowRightFromBracket = faArrowRightFromBracket;
public faArrowRightToBracket = faArrowRightToBracket;
public nodePageDefs = CLN_PAGE_DEFS;
public selFilterBy = 'all';
public colWidth = '20rem';
public PAGE_ID = 'peerswap';
public tableSetting: TableSetting = { tableId: 'psout', recordsPerPage: PAGE_SIZE, sortBy: 'created_at', sortOrder: SortOrderEnum.DESCENDING };
public psPageSettings: PageSettings[] = CLN_DEFAULT_PAGE_SETTINGS;
public displayedColumns: any[] = [];
public allSwapsData: any = null;
public swapsData: Swap[] = [];
public swaps: any;
public flgSticky = false;
public pageSize = PAGE_SIZE;
@ -51,25 +59,41 @@ export class PeerswapsListComponent implements OnInit, AfterViewInit, OnDestroy
public selFilter = '';
public swapLists = ['psout', 'psin', 'pscanceled'];
public selSwapList = this.swapLists[0];
public filterColumns = [];
public peerswapRoles = PeerswapRoles;
public apiCallStatus: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<RTLState>, private datePipe: DatePipe, private router: Router, private swapStatePipe: SwapStatePipe, private titleCasePipe: TitleCasePipe) {
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<RTLState>, private datePipe: DatePipe, private router: Router, private swapStatePipe: SwapStatePipe, private titleCasePipe: TitleCasePipe, private camelCaseWithReplace: CamelCaseWithReplacePipe) {
this.screenSize = this.commonService.getScreenSize();
}
ngOnInit() {
this.selSwapList = this.router.url.substring(this.router.url.lastIndexOf('/') + 1);
this.tableSetting.tableId = this.selSwapList;
this.updateTableDef();
this.router.events.pipe(takeUntil(this.unSubs[0]), filter((e) => e instanceof ResolveEnd)).
subscribe({
next: (value: ResolveEnd) => {
this.selSwapList = value.url.substring(value.url.lastIndexOf('/') + 1);
this.loadTableWithSelection();
this.tableSetting.tableId = this.selSwapList;
this.updateTableDef();
if (this.allSwapsData && this.sort && this.paginator) {
this.loadSwapsTable();
}
}
});
this.store.select(clnPageSettings).pipe(takeUntil(this.unSubs[1])).
subscribe((settings: { pageSettings: PageSettings[], apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = settings.apiCallStatus;
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
this.errorMessage = this.apiCallStatus.message || '';
}
this.psPageSettings = settings.pageSettings || CLN_DEFAULT_PAGE_SETTINGS;
});
this.store.select(swaps).pipe(takeUntil(this.unSubs[1])).
this.store.select(swaps).pipe(takeUntil(this.unSubs[2])).
subscribe((swapsSeletor: { swapOuts: Swap[], swapIns: Swap[], swapsCanceled: Swap[], apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = swapsSeletor.apiCallStatus;
@ -81,8 +105,8 @@ export class PeerswapsListComponent implements OnInit, AfterViewInit, OnDestroy
}
if (this.apiCallStatus?.status === APICallStatusEnum.COMPLETED) {
this.allSwapsData = { swapOuts: swapsSeletor.swapOuts, swapIns: swapsSeletor.swapIns, swapsCanceled: swapsSeletor.swapsCanceled };
if (this.sort && this.paginator) {
this.loadTableWithSelection();
if (this.allSwapsData && this.sort && this.paginator) {
this.loadSwapsTable();
}
}
this.logger.info(swapsSeletor);
@ -91,65 +115,7 @@ export class PeerswapsListComponent implements OnInit, AfterViewInit, OnDestroy
ngAfterViewInit(): void {
if (this.allSwapsData) {
this.loadTableWithSelection();
}
}
loadTableWithSelection() {
switch (this.selSwapList) {
case this.swapLists[0]:
if (this.screenSize === ScreenSizeEnum.XS) {
this.flgSticky = false;
this.displayedColumns = ['id', 'state', 'amount', 'actions'];
} else if (this.screenSize === ScreenSizeEnum.SM) {
this.flgSticky = false;
this.displayedColumns = ['id', 'alias', 'short_channel_id', 'state', 'amount', 'actions'];
} else if (this.screenSize === ScreenSizeEnum.MD) {
this.flgSticky = false;
this.displayedColumns = ['id', 'alias', 'short_channel_id', 'created_at', 'state', 'amount', 'actions'];
} else {
this.flgSticky = true;
this.displayedColumns = ['id', 'alias', 'short_channel_id', 'created_at', 'state', 'amount', 'actions'];
}
this.swapsData = this.allSwapsData?.swapOuts || [];
break;
case this.swapLists[1]:
if (this.screenSize === ScreenSizeEnum.XS) {
this.flgSticky = false;
this.displayedColumns = ['id', 'state', 'amount', 'actions'];
} else if (this.screenSize === ScreenSizeEnum.SM) {
this.flgSticky = false;
this.displayedColumns = ['id', 'alias', 'short_channel_id', 'state', 'amount', 'actions'];
} else if (this.screenSize === ScreenSizeEnum.MD) {
this.flgSticky = false;
this.displayedColumns = ['id', 'alias', 'short_channel_id', 'created_at', 'state', 'amount', 'actions'];
} else {
this.flgSticky = true;
this.displayedColumns = ['id', 'alias', 'short_channel_id', 'created_at', 'state', 'amount', 'actions'];
}
this.swapsData = this.allSwapsData?.swapIns || [];
break;
case this.swapLists[2]:
if (this.screenSize === ScreenSizeEnum.XS) {
this.flgSticky = false;
this.displayedColumns = ['id', 'amount', 'cancel_message', 'actions'];
} else if (this.screenSize === ScreenSizeEnum.SM) {
this.flgSticky = false;
this.displayedColumns = ['id', 'alias', 'short_channel_id', 'amount', 'cancel_message', 'actions'];
} else if (this.screenSize === ScreenSizeEnum.MD) {
this.flgSticky = false;
this.displayedColumns = ['id', 'alias', 'short_channel_id', 'created_at', 'amount', 'cancel_message', 'actions'];
} else {
this.flgSticky = true;
this.displayedColumns = ['id', 'alias', 'short_channel_id', 'created_at', 'amount', 'cancel_message', 'actions'];
}
this.swapsData = this.allSwapsData?.swapsCanceled || [];
break;
default:
break;
}
if (this.swapsData && this.swapsData.length && this.swapsData.length > 0 && this.sort && this.paginator) {
this.loadswapsTable(this.swapsData);
this.loadSwapsTable();
}
}
@ -158,10 +124,10 @@ export class PeerswapsListComponent implements OnInit, AfterViewInit, OnDestroy
[{ key: 'id', value: selSwap.id, title: 'Swap Id', width: 100, type: DataTypeEnum.STRING }],
[{ key: 'state', value: this.swapStatePipe.transform(selSwap.state || ''), title: 'State', width: 50, type: DataTypeEnum.STRING },
{ key: 'role', value: this.titleCasePipe.transform(selSwap.role), title: 'Role', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'alias', value: selSwap.alias, title: 'Alias', width: 50, type: DataTypeEnum.STRING },
{ key: 'short_channel_id', value: selSwap.short_channel_id, title: 'Short Channel ID', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'amount', value: selSwap.amount, title: 'Amount (Sats)', width: 50, type: DataTypeEnum.NUMBER },
{ key: 'created_at', value: this.datePipe.transform(new Date(selSwap.created_at || ''), 'dd/MMM/YYYY HH:mm'), title: 'Created At', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'created_at', value: this.datePipe.transform(new Date((+selSwap.created_at || 0) * 1000), 'dd/MMM/YYYY HH:mm'), title: 'Created At', width: 50, type: DataTypeEnum.STRING },
{ key: 'amount', value: selSwap.amount, title: 'Amount (Sats)', width: 50, type: DataTypeEnum.NUMBER }],
[{ key: 'alias', value: (selSwap.alias === selSwap.peer_node_id ? selSwap.alias.substring(0, 17) + '...' : selSwap.alias), title: 'Alias', width: 50, type: DataTypeEnum.STRING },
{ key: 'short_channel_id', value: selSwap.channel_id, title: 'Short Channel ID', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'peer_node_id', value: selSwap.peer_node_id, title: 'Peer Node Id', width: 100, type: DataTypeEnum.STRING }],
[{ key: 'initiator_node_id', value: selSwap.initiator_node_id, title: 'Initiator Node Id', width: 100, type: DataTypeEnum.STRING }]
];
@ -185,8 +151,9 @@ export class PeerswapsListComponent implements OnInit, AfterViewInit, OnDestroy
}));
}
loadswapsTable(swaps: Swap[]) {
this.swaps = new MatTableDataSource<Swap>([...swaps]);
loadSwapsTable() {
const selectedSwapData = (this.selSwapList === this.swapLists[0]) ? this.allSwapsData?.swapOuts : (this.selSwapList === this.swapLists[1]) ? this.allSwapsData?.swapIns : (this.selSwapList === this.swapLists[2]) ? this.allSwapsData?.swapsCanceled : [];
this.swaps = new MatTableDataSource<Swap>([...selectedSwapData]);
this.swaps.sort = this.sort;
this.swaps.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
this.swaps.filterPredicate = (swap: Swap, fltr: string) => {
@ -194,10 +161,10 @@ export class PeerswapsListComponent implements OnInit, AfterViewInit, OnDestroy
(swap.id ? swap.id : '') +
(swap.alias ? swap.alias.toLowerCase() : '') +
(swap.role ? swap.role : '') +
(swap.short_channel_id ? swap.short_channel_id : '') +
(swap.channel_id ? swap.channel_id : '') +
(swap.amount ? swap.amount : '') +
(swap.state ? swap.state : '') +
((swap.created_at) ? this.datePipe.transform(new Date(swap.created_at), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') +
((swap.created_at) ? this.datePipe.transform(new Date(+swap.created_at * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') +
(swap.cancel_message ? swap.cancel_message.toLowerCase : '');
return newSwap?.includes(fltr) || false;
};
@ -211,7 +178,7 @@ export class PeerswapsListComponent implements OnInit, AfterViewInit, OnDestroy
}
onDownloadCSV() {
if (this.swaps && this.swaps.data && this.swapsData.length && this.swaps.data.length > 0) {
if (this.swaps && this.swaps.data && this.swaps.data.length && this.swaps.data.length > 0) {
this.commonService.downloadFile(this.swaps.data, 'Peerswap-' + this.selSwapList);
}
}
@ -220,6 +187,26 @@ export class PeerswapsListComponent implements OnInit, AfterViewInit, OnDestroy
this.swaps.filter = this.selFilter.trim().toLowerCase();
}
getLabel(column: string) {
const returnColumn: ColumnDefinition = this.nodePageDefs[this.PAGE_ID][this.tableSetting.tableId].allowedColumns.find((col) => col.column === column);
return returnColumn ? returnColumn.label ? returnColumn.label : this.camelCaseWithReplace.transform(returnColumn.column, '_') : this.commonService.titleCase(column);
}
updateTableDef() {
this.tableSetting = JSON.parse(JSON.stringify(this.psPageSettings.find((page) => page.pageId === this.PAGE_ID).tables.find((table) => table.tableId === this.selSwapList)));
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.unshift('role');
this.displayedColumns.push('actions');
this.pageSize = this.tableSetting.recordsPerPage ? +this.tableSetting.recordsPerPage : PAGE_SIZE;
this.colWidth = this.displayedColumns.length ? ((this.commonService.getContainerSize().width / this.displayedColumns.length) / 14) + 'rem' : '20rem';
this.filterColumns = ['all', ...this.displayedColumns.slice(0, -1)];
this.logger.info(this.displayedColumns);
}
ngOnDestroy() {
this.unSubs.forEach((completeSub) => {
completeSub.next(<any>null);

@ -137,8 +137,10 @@ export class CLNPageDefinitions {
graph_lookup: {
query_routes: TableDefinition;
};
// peerswap: {
// swaps: TableDefinition;
// };
peerswap: {
psout: TableDefinition;
psin: TableDefinition;
pscanceled: TableDefinition;
};
};

@ -85,7 +85,7 @@ export interface Swap {
initiator_node_id?: string;
peer_node_id?: string;
amount?: number;
short_channel_id?: string;
channel_id?: string;
opening_tx_id?: string;
claim_tx_id?: string;
cancel_message?: string;

@ -810,11 +810,17 @@ export const CLN_DEFAULT_PAGE_SETTINGS: PageSettings[] = [
{ tableId: 'query_routes', recordsPerPage: PAGE_SIZE, sortBy: 'msatoshi', sortOrder: SortOrderEnum.DESCENDING,
columnSelectionSM: ['alias', 'direction', 'msatoshi'],
columnSelection: ['alias', 'channel', 'direction', 'delay', 'msatoshi'] }
// ] },
// { pageId: 'peerswap', tables: [
// { tableId: 'swaps', recordsPerPage: PAGE_SIZE, sortBy: 'created_at', sortOrder: SortOrderEnum.DESCENDING,
// columnSelectionSM: ['id', 'state', 'amount'],
// columnSelection: ['id', 'alias', 'short_channel_id', 'created_at', 'state', 'amount'] }
] },
{ pageId: 'peerswap', tables: [
{ tableId: 'psout', recordsPerPage: PAGE_SIZE, sortBy: 'created_at', sortOrder: SortOrderEnum.DESCENDING,
columnSelectionSM: ['state', 'created_at', 'amount'],
columnSelection: ['state', 'created_at', 'swap_id', 'alias', 'short_channel_id', 'amount'] },
{ tableId: 'psin', recordsPerPage: PAGE_SIZE, sortBy: 'created_at', sortOrder: SortOrderEnum.DESCENDING,
columnSelectionSM: ['state', 'created_at', 'amount'],
columnSelection: ['state', 'created_at', 'swap_id', 'alias', 'short_channel_id', 'amount'] },
{ tableId: 'pscanceled', recordsPerPage: PAGE_SIZE, sortBy: 'created_at', sortOrder: SortOrderEnum.DESCENDING,
columnSelectionSM: ['created_at', 'amount', 'cancel_message'],
columnSelection: ['created_at', 'swap_id', 'alias', 'short_channel_id', 'amount', 'cancel_message'] }
] }
];
@ -921,12 +927,20 @@ export const CLN_PAGE_DEFS: CLNPageDefinitions = {
maxColumns: 6,
allowedColumns: [{ column:'id' }, { column:'alias' }, { column:'channel' }, { column:'direction' }, { column:'delay' }, { column:'msatoshi', label: 'Amount' }]
}
// },
// peerswap: {
// swaps: {
// maxColumns: 6,
// allowedColumns: [{ column:'id' }, { column:'alias' }, { column:'short_channel_id' }, { column:'created_at' }, { column:'state' }, { column:'amount' }]
// }
},
peerswap: {
psout: {
maxColumns: 6,
allowedColumns: [{ column:'state' }, { column:'created_at' }, { column:'swap_id' }, { column:'alias' }, { column:'short_channel_id' }, { column:'amount' }]
},
psin: {
maxColumns: 6,
allowedColumns: [{ column:'state' }, { column:'created_at' }, { column:'swap_id' }, { column:'alias' }, { column:'short_channel_id' }, { column:'amount' }]
},
pscanceled: {
maxColumns: 6,
allowedColumns: [{ column:'created_at' }, { column:'swap_id' }, { column:'alias' }, { column:'short_channel_id' }, { column:'amount' }, { column:'cancel_message' }]
}
}
};

Loading…
Cancel
Save