Offer Update & ECL camelCase Fix

pull/1127/head
ShahanaFarooqui 2 years ago
parent 2b368c4e39
commit f8166e67e8

@ -111,8 +111,9 @@ export const postPayment = (req, res, next) => {
if (req.body.description) {
offerToUpdate['description'] = req.body.description;
}
// eslint-disable-next-line arrow-body-style
return databaseService.validateDocument(CollectionsEnum.OFFERS, offerToUpdate).then((validated) => {
databaseService.update(req.session.selectedNode, CollectionsEnum.OFFERS, offerToUpdate, CollectionFieldsEnum.BOLT12, req.body.bolt12).then((updatedOffer) => {
return databaseService.update(req.session.selectedNode, CollectionsEnum.OFFERS, offerToUpdate, CollectionFieldsEnum.BOLT12, req.body.bolt12).then((updatedOffer) => {
logger.log({ level: 'DEBUG', fileName: 'Payments', msg: 'Offer Updated', data: updatedOffer });
return res.status(201).json({ paymentResponse: body, saveToDBResponse: updatedOffer });
}).catch((errDB) => {

@ -94,8 +94,9 @@ export const postPayment = (req, res, next) => {
const offerToUpdate: Offer = { bolt12: req.body.bolt12, amountMSat: (req.body.zeroAmtOffer ? 0 : req.body.amount), title: req.body.title, lastUpdatedAt: new Date(Date.now()).getTime() };
if (req.body.vendor) { offerToUpdate['vendor'] = req.body.vendor; }
if (req.body.description) { offerToUpdate['description'] = req.body.description; }
// eslint-disable-next-line arrow-body-style
return databaseService.validateDocument(CollectionsEnum.OFFERS, offerToUpdate).then((validated) => {
databaseService.update(req.session.selectedNode, CollectionsEnum.OFFERS, offerToUpdate, CollectionFieldsEnum.BOLT12, req.body.bolt12).then((updatedOffer) => {
return databaseService.update(req.session.selectedNode, CollectionsEnum.OFFERS, offerToUpdate, CollectionFieldsEnum.BOLT12, req.body.bolt12).then((updatedOffer) => {
logger.log({ level: 'DEBUG', fileName: 'Payments', msg: 'Offer Updated', data: updatedOffer });
return res.status(201).json({ paymentResponse: body, saveToDBResponse: updatedOffer });
}).catch((errDB) => {

@ -1,6 +0,0 @@
.mat-column-channelId, .mat-column-alias {
flex: 1 1 10%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

@ -1,6 +0,0 @@
.mat-column-channel_point {
flex: 1 1 25%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

@ -1,6 +0,0 @@
.mat-column-channel_point {
flex: 1 1 25%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

@ -7,7 +7,7 @@ import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum, PaymentTypes, AlertTypeEnum, SortOrderEnum, CLN_DEFAULT_PAGE_SETTINGS } from '../../../../shared/services/consts-enums-functions';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum, PaymentTypes, AlertTypeEnum, SortOrderEnum, CLN_DEFAULT_PAGE_SETTINGS, UI_MESSAGES } from '../../../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../../../shared/models/apiCallsPayload';
import { OfferBookmark } from '../../../../shared/models/clnModels';
import { LoggerService } from '../../../../shared/services/logger.service';
@ -19,7 +19,7 @@ import { openAlert, openConfirmation } from '../../../../store/rtl.actions';
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 { deleteOfferBookmark, sendPayment } from '../../../store/cln.actions';
import { PageSettings, TableSetting } from '../../../../shared/models/pageSettings';
@Component({
@ -82,7 +82,7 @@ export class CLNOfferBookmarksTableComponent implements OnInit, AfterViewInit, O
this.errorMessage = !this.apiCallStatus.message ? '' : (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
this.offersBookmarksJSONArr = offerBMsSeletor.offersBookmarks || [];
if (this.offersBookmarksJSONArr && this.offersBookmarksJSONArr.length > 0 && this.sort && this.paginator && this.displayedColumns.length > 0) {
if (this.offersBookmarksJSONArr && this.sort && this.paginator && this.displayedColumns.length > 0) {
this.loadOffersTable(this.offersBookmarksJSONArr);
}
this.logger.info(offerBMsSeletor);
@ -90,7 +90,7 @@ export class CLNOfferBookmarksTableComponent implements OnInit, AfterViewInit, O
}
ngAfterViewInit() {
if (this.offersBookmarksJSONArr && this.offersBookmarksJSONArr.length > 0 && this.sort && this.paginator && this.displayedColumns.length > 0) {
if (this.offersBookmarksJSONArr && this.sort && this.paginator && this.displayedColumns.length > 0) {
this.loadOffersTable(this.offersBookmarksJSONArr);
}
}

@ -4,7 +4,7 @@
<div fxFlex="95" fxLayoutAlign="start start">
<span class="page-title">Send Payment</span>
</div>
<button tabindex="12" fxFlex="10" fxLayoutAlign="center" class="btn-close-x p-0" [mat-dialog-close]="false" default mat-button>X</button>
<button tabindex="12" fxLayoutAlign="center" class="btn-close-x p-0" [mat-dialog-close]="false" default mat-button>X</button>
</mat-card-header>
<mat-card-content class="padding-gap-x-large" fxLayout="column" fxLayoutAlign="start stretch">
<mat-radio-group *ngIf="isCompatibleVersion" class="my-1" color="primary" name="paymentType" [(ngModel)]="paymentType" (change)="onPaymentTypeChange()" fxFlex="100" fxLayoutAlign="start start">

@ -1,6 +0,0 @@
.mat-column-channelId, .mat-column-alias {
flex: 1 1 10%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

@ -1,6 +0,0 @@
.mat-column-channel_point {
flex: 1 1 70%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

@ -1,6 +0,0 @@
.mat-column-channel_point {
flex: 1 1 25%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

@ -1,12 +0,0 @@
.mat-column-close_type {
flex: 0 0 16%;
min-width: 5rem;
}
.mat-column-remote_alias, .mat-column-remote_pubkey, .mat-column-channel_point,
.mat-column-chan_id, .mat-column-closing_tx_hash, .mat-column-chain_hash {
flex: 1 1 20%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

@ -1,6 +0,0 @@
.mat-column-chan_id, .mat-column-alias {
flex: 1 1 25%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

@ -1,6 +0,0 @@
.mat-column-channel_point {
flex: 1 1 25%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

@ -1,6 +0,0 @@
.mat-column-channel_point {
flex: 1 1 25%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

@ -7,11 +7,11 @@
<ng-container *ngIf="errorMessage && errorMessage.page === 'unknown'" [ngTemplateOutlet]="errorObjectBlock" [ngTemplateOutletContext]="{error: errorMessage}"></ng-container>
<mat-expansion-panel fxLayout="column" class="flat-expansion-panel mt-1" [ngClass]="{'error-border': errorMessage?.page === page.pageId}" expanded="true" *ngFor="let page of pageSettings">
<mat-expansion-panel-header>
<mat-panel-title>{{page.pageId | camelcaseWithReplace:'_'}}</mat-panel-title>
<mat-panel-title>{{selNode.lnImplementation === 'ECL' ? (page.pageId | camelCaseWithSpaces) : (page.pageId | camelcaseWithReplace:'_')}}</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="column" fxLayoutAlign="start stretch" *ngFor="let table of page.tables" class="padding-gap-x-large table-setting-row">
<div fxLayout="row" fxLayoutAlign="space-between center">
<span fxFlex="10">{{table.tableId | camelcaseWithReplace:'_'}}:</span>
<span fxFlex="10">{{selNode.lnImplementation === 'ECL' ? (table.tableId | camelCaseWithSpaces) : (table.tableId | camelcaseWithReplace:'_')}}:</span>
<mat-form-field fxFlex="10">
<mat-select [disabled]="disbalePageSize(page.pageId, table.tableId)" [(ngModel)]="table.recordsPerPage" placeholder="Records/Page" name="{{page.pageId}}{{table.tableId}}-page-size-options" tabindex="2" required>
<mat-option *ngFor="let pageSizeOption of pageSizeOptions" [value]="pageSizeOption">
@ -22,7 +22,7 @@
<mat-form-field fxFlex="10">
<mat-select [(ngModel)]="table.sortBy" placeholder="Sort By" name="{{page.pageId}}{{table.tableId}}-sort-by" tabindex="3" required>
<mat-option *ngFor="let field of table.columnSelection" [value]="field">
{{field | camelcaseWithReplace:'_'}}
{{selNode.lnImplementation === 'ECL' ? (field | camelCaseWithSpaces) : (field | camelcaseWithReplace:'_')}}
</mat-option>
</mat-select>
</mat-form-field>
@ -36,7 +36,7 @@
<mat-form-field fxFlex="15">
<mat-select [(ngModel)]="table.columnSelectionSM" placeholder="Column selection (Mobile)" name="{{page.pageId}}{{table.tableId}}-columns-selection-sm" tabindex="5" multiple required>
<mat-option *ngFor="let field of tableFieldsDef[page.pageId][table.tableId].allowedColumns" [value]="field" [disabled]="(table.columnSelectionSM.length <= 1 && table.columnSelectionSM.includes(field)) || (table.columnSelectionSM.length >= 3 && !table.columnSelectionSM.includes(field))">
{{field | camelcaseWithReplace:'_'}}
{{selNode.lnImplementation === 'ECL' ? (field | camelCaseWithSpaces) : (field | camelcaseWithReplace:'_')}}
</mat-option>
</mat-select>
<mat-hint>Column selected (mobile) should be between 1 and 3</mat-hint>
@ -44,7 +44,7 @@
<mat-form-field fxFlex="40">
<mat-select [(ngModel)]="table.columnSelection" (selectionChange)="oncolumnSelectionChange(table)" placeholder="Column selection (Desktop)" name="{{page.pageId}}{{table.tableId}}-columns-selection" tabindex="6" multiple required>
<mat-option *ngFor="let field of tableFieldsDef[page.pageId][table.tableId].allowedColumns" [value]="field" [disabled]="(table.columnSelection.length <= 2 && table.columnSelection.includes(field)) || (table.columnSelection.length >= tableFieldsDef[page.pageId][table.tableId].maxColumns && !table.columnSelection.includes(field))">
{{field | camelcaseWithReplace:'_'}}
{{selNode.lnImplementation === 'ECL' ? (field | camelCaseWithSpaces) : (field | camelcaseWithReplace:'_')}}
</mat-option>
</mat-select>
<mat-hint>Number of column selected should be between 2 and {{tableFieldsDef[page.pageId][table.tableId].maxColumns}}</mat-hint>

@ -22,6 +22,17 @@ export class CamelCasePipe implements PipeTransform {
}
@Pipe({
name: 'camelCaseWithSpaces'
})
export class CamelCase implements PipeTransform {
transform(value: string, arg1?: string, arg2?: string): string {
return value.replace(/(?:^\w|[A-Z]|\b\w)/g, (word, index) => (' ' + word.toUpperCase()));
}
}
@Pipe({
name: 'camelcaseWithReplace'
})

@ -103,7 +103,7 @@ import { AutoFocusDirective } from './directive/auto-focus.directive';
import { MonthlyDateDirective, YearlyDateDirective } from './directive/date-formats.directive';
import { MaxValidator } from './directive/max-amount.directive';
import { MinValidator } from './directive/min-amount.directive';
import { RemoveLeadingZerosPipe, CamelCasePipe, CamelCaseWithReplacePipe } from './pipes/app.pipe';
import { RemoveLeadingZerosPipe, CamelCasePipe, CamelCaseWithReplacePipe, CamelCase } from './pipes/app.pipe';
const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
suppressScrollX: false,
@ -229,6 +229,7 @@ export const DEFAULT_DATE_FORMAT: MatDateFormats = {
RemoveLeadingZerosPipe,
CamelCasePipe,
CamelCaseWithReplacePipe,
CamelCase,
MaxValidator,
MinValidator,
AppSettingsComponent,
@ -303,6 +304,7 @@ export const DEFAULT_DATE_FORMAT: MatDateFormats = {
RemoveLeadingZerosPipe,
CamelCasePipe,
CamelCaseWithReplacePipe,
CamelCase,
AuthSettingsComponent,
TransactionsReportTableComponent,
OnChainGeneratedAddressComponent,

Loading…
Cancel
Save