From f8166e67e8d4681c0d99a28408debbbcccc6a69e Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Fri, 28 Oct 2022 18:32:52 -0700 Subject: [PATCH] Offer Update & ECL camelCase Fix --- backend/controllers/cln/payments.js | 3 ++- server/controllers/cln/payments.ts | 3 ++- .../routing-peers/routing-peers.component.scss | 6 ------ .../cln/sign-verify-message/sign/sign.component.scss | 6 ------ .../sign-verify-message/verify/verify.component.scss | 6 ------ .../offer-bookmarks-table.component.ts | 8 ++++---- .../send-payment-modal/send-payment.component.html | 2 +- .../routing-peers/routing-peers.component.scss | 6 ------ .../channel-backup-table.component.scss | 6 ------ .../channel-restore-table.component.scss | 6 ------ .../channel-closed-table.component.scss | 12 ------------ .../routing-peers/routing-peers.component.scss | 6 ------ .../lnd/sign-verify-message/sign/sign.component.scss | 6 ------ .../sign-verify-message/verify/verify.component.scss | 6 ------ .../page-settings/page-settings.component.html | 10 +++++----- src/app/shared/pipes/app.pipe.ts | 11 +++++++++++ src/app/shared/shared.module.ts | 4 +++- 17 files changed, 28 insertions(+), 79 deletions(-) diff --git a/backend/controllers/cln/payments.js b/backend/controllers/cln/payments.js index 62d364de..09f01dcc 100644 --- a/backend/controllers/cln/payments.js +++ b/backend/controllers/cln/payments.js @@ -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) => { diff --git a/server/controllers/cln/payments.ts b/server/controllers/cln/payments.ts index df004a0a..222b2db1 100644 --- a/server/controllers/cln/payments.ts +++ b/server/controllers/cln/payments.ts @@ -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) => { diff --git a/src/app/cln/routing/routing-peers/routing-peers.component.scss b/src/app/cln/routing/routing-peers/routing-peers.component.scss index fcd63fdf..e69de29b 100644 --- a/src/app/cln/routing/routing-peers/routing-peers.component.scss +++ b/src/app/cln/routing/routing-peers/routing-peers.component.scss @@ -1,6 +0,0 @@ -.mat-column-channelId, .mat-column-alias { - flex: 1 1 10%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/src/app/cln/sign-verify-message/sign/sign.component.scss b/src/app/cln/sign-verify-message/sign/sign.component.scss index d67b1ba8..e69de29b 100644 --- a/src/app/cln/sign-verify-message/sign/sign.component.scss +++ b/src/app/cln/sign-verify-message/sign/sign.component.scss @@ -1,6 +0,0 @@ -.mat-column-channel_point { - flex: 1 1 25%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/src/app/cln/sign-verify-message/verify/verify.component.scss b/src/app/cln/sign-verify-message/verify/verify.component.scss index d67b1ba8..e69de29b 100644 --- a/src/app/cln/sign-verify-message/verify/verify.component.scss +++ b/src/app/cln/sign-verify-message/verify/verify.component.scss @@ -1,6 +0,0 @@ -.mat-column-channel_point { - flex: 1 1 25%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.ts b/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.ts index 797547ad..9b6ddff1 100644 --- a/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.ts +++ b/src/app/cln/transactions/offers/offer-bookmarks-table/offer-bookmarks-table.component.ts @@ -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); } } diff --git a/src/app/cln/transactions/send-payment-modal/send-payment.component.html b/src/app/cln/transactions/send-payment-modal/send-payment.component.html index 165703e7..f05d4455 100644 --- a/src/app/cln/transactions/send-payment-modal/send-payment.component.html +++ b/src/app/cln/transactions/send-payment-modal/send-payment.component.html @@ -4,7 +4,7 @@
Send Payment
- + diff --git a/src/app/eclair/routing/routing-peers/routing-peers.component.scss b/src/app/eclair/routing/routing-peers/routing-peers.component.scss index fcd63fdf..e69de29b 100644 --- a/src/app/eclair/routing/routing-peers/routing-peers.component.scss +++ b/src/app/eclair/routing/routing-peers/routing-peers.component.scss @@ -1,6 +0,0 @@ -.mat-column-channelId, .mat-column-alias { - flex: 1 1 10%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/src/app/lnd/backup/channel-backup-table/channel-backup-table.component.scss b/src/app/lnd/backup/channel-backup-table/channel-backup-table.component.scss index 65e1453f..e69de29b 100644 --- a/src/app/lnd/backup/channel-backup-table/channel-backup-table.component.scss +++ b/src/app/lnd/backup/channel-backup-table/channel-backup-table.component.scss @@ -1,6 +0,0 @@ -.mat-column-channel_point { - flex: 1 1 70%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/src/app/lnd/backup/channel-restore-table/channel-restore-table.component.scss b/src/app/lnd/backup/channel-restore-table/channel-restore-table.component.scss index d67b1ba8..e69de29b 100644 --- a/src/app/lnd/backup/channel-restore-table/channel-restore-table.component.scss +++ b/src/app/lnd/backup/channel-restore-table/channel-restore-table.component.scss @@ -1,6 +0,0 @@ -.mat-column-channel_point { - flex: 1 1 25%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.scss b/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.scss index 760c785f..e69de29b 100644 --- a/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.scss +++ b/src/app/lnd/peers-channels/channels/channels-tables/channel-closed-table/channel-closed-table.component.scss @@ -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; -} diff --git a/src/app/lnd/routing/routing-peers/routing-peers.component.scss b/src/app/lnd/routing/routing-peers/routing-peers.component.scss index 891f65b2..e69de29b 100644 --- a/src/app/lnd/routing/routing-peers/routing-peers.component.scss +++ b/src/app/lnd/routing/routing-peers/routing-peers.component.scss @@ -1,6 +0,0 @@ -.mat-column-chan_id, .mat-column-alias { - flex: 1 1 25%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/src/app/lnd/sign-verify-message/sign/sign.component.scss b/src/app/lnd/sign-verify-message/sign/sign.component.scss index d67b1ba8..e69de29b 100644 --- a/src/app/lnd/sign-verify-message/sign/sign.component.scss +++ b/src/app/lnd/sign-verify-message/sign/sign.component.scss @@ -1,6 +0,0 @@ -.mat-column-channel_point { - flex: 1 1 25%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/src/app/lnd/sign-verify-message/verify/verify.component.scss b/src/app/lnd/sign-verify-message/verify/verify.component.scss index d67b1ba8..e69de29b 100644 --- a/src/app/lnd/sign-verify-message/verify/verify.component.scss +++ b/src/app/lnd/sign-verify-message/verify/verify.component.scss @@ -1,6 +0,0 @@ -.mat-column-channel_point { - flex: 1 1 25%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/src/app/shared/components/node-config/page-settings/page-settings.component.html b/src/app/shared/components/node-config/page-settings/page-settings.component.html index fbc89c4d..0de4bd03 100644 --- a/src/app/shared/components/node-config/page-settings/page-settings.component.html +++ b/src/app/shared/components/node-config/page-settings/page-settings.component.html @@ -7,11 +7,11 @@ - {{page.pageId | camelcaseWithReplace:'_'}} + {{selNode.lnImplementation === 'ECL' ? (page.pageId | camelCaseWithSpaces) : (page.pageId | camelcaseWithReplace:'_')}}
- {{table.tableId | camelcaseWithReplace:'_'}}: + {{selNode.lnImplementation === 'ECL' ? (table.tableId | camelCaseWithSpaces) : (table.tableId | camelcaseWithReplace:'_')}}: @@ -22,7 +22,7 @@ - {{field | camelcaseWithReplace:'_'}} + {{selNode.lnImplementation === 'ECL' ? (field | camelCaseWithSpaces) : (field | camelcaseWithReplace:'_')}} @@ -36,7 +36,7 @@ - {{field | camelcaseWithReplace:'_'}} + {{selNode.lnImplementation === 'ECL' ? (field | camelCaseWithSpaces) : (field | camelcaseWithReplace:'_')}} Column selected (mobile) should be between 1 and 3 @@ -44,7 +44,7 @@ - {{field | camelcaseWithReplace:'_'}} + {{selNode.lnImplementation === 'ECL' ? (field | camelCaseWithSpaces) : (field | camelcaseWithReplace:'_')}} Number of column selected should be between 2 and {{tableFieldsDef[page.pageId][table.tableId].maxColumns}} diff --git a/src/app/shared/pipes/app.pipe.ts b/src/app/shared/pipes/app.pipe.ts index 2e9b62ae..37de47a2 100644 --- a/src/app/shared/pipes/app.pipe.ts +++ b/src/app/shared/pipes/app.pipe.ts @@ -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' }) diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 7ff1960d..348252f7 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -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,