mirror of
https://github.com/Ride-The-Lightning/RTL
synced 2024-11-03 23:15:24 +00:00
Issue #137 Routing hints for private channel invoice
Issue #137 Routing hints for private channel invoice
This commit is contained in:
parent
0aa7ceb4c5
commit
98e19b7c63
@ -8,5 +8,5 @@
|
||||
<link rel="stylesheet" href="styles.c7b8be38c41a5a330ca0.css"></head>
|
||||
<body>
|
||||
<rtl-app></rtl-app>
|
||||
<script type="text/javascript" src="runtime.26209474bfa8dc87a77c.js"></script><script type="text/javascript" src="polyfills.181b5a67c421a167a96a.js"></script><script type="text/javascript" src="main.0ea4778e50c6d2f27c62.js"></script></body>
|
||||
<script type="text/javascript" src="runtime.26209474bfa8dc87a77c.js"></script><script type="text/javascript" src="polyfills.181b5a67c421a167a96a.js"></script><script type="text/javascript" src="main.3aa119896269c820e9d4.js"></script></body>
|
||||
</html>
|
||||
|
File diff suppressed because one or more lines are too long
1
angular/main.3aa119896269c820e9d4.js
Normal file
1
angular/main.3aa119896269c820e9d4.js
Normal file
File diff suppressed because one or more lines are too long
@ -64,7 +64,8 @@ exports.addInvoice = (req, res, next) => {
|
||||
options.url = common.getSelLNDServerUrl() + '/invoices';
|
||||
options.form = JSON.stringify({
|
||||
memo: req.body.memo,
|
||||
value: req.body.amount
|
||||
value: req.body.amount,
|
||||
private: req.body.private
|
||||
});
|
||||
request.post(options).then((body) => {
|
||||
logger.info('\r\nInvoice: 64: ' + JSON.stringify(Date.now()) + ': INFO: Add Invoice Responce: ' + JSON.stringify(body));
|
||||
|
@ -19,7 +19,7 @@
|
||||
<input matInput [(ngModel)]="fundingAmount" placeholder="Amount ({{information?.smaller_currency_unit}})" type="number" step="1000" min="1" tabindex="2" required name="amount" #amount="ngModel">
|
||||
<mat-hint>(Wallet Bal: {{totalBalance}}, Remaining Bal: {{totalBalance - ((fundingAmount) ? fundingAmount : 0)}})</mat-hint>
|
||||
</mat-form-field>
|
||||
<div fxFlex="15" tabindex="3" fxLayoutAlign="start center">
|
||||
<div fxFlex="15" tabindex="3" fxLayoutAlign="start center" class="chkbox-options">
|
||||
<mat-checkbox [(ngModel)]="moreOptions" name="moreOptions" (change)="onMoreOptionsChange($event)">Options</mat-checkbox>
|
||||
</div>
|
||||
<span *ngIf="moreOptions" fxLayout="column" fxLayout.gt-sm="row wrap" fxFlex="80" fxLayoutAlign.gt-sm="space-between center">
|
||||
|
@ -40,3 +40,7 @@
|
||||
table {
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.chkbox-options:focus {
|
||||
outline: none !important;
|
||||
}
|
@ -8,17 +8,20 @@
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<form fxLayout="column" fxLayout.gt-sm="row wrap" (ngSubmit)="addInvoiceForm.form.valid && onAddInvoice(addInvoiceForm)" #addInvoiceForm="ngForm">
|
||||
<mat-form-field fxFlex="60" fxLayoutAlign="start end">
|
||||
<mat-form-field fxFlex="50" fxLayoutAlign="start end">
|
||||
<input matInput [(ngModel)]="memo" placeholder="Memo" tabindex="1" name="memo">
|
||||
</mat-form-field>
|
||||
<mat-form-field fxFlex="20" fxLayoutAlign="start end">
|
||||
<mat-form-field fxFlex="15" fxLayoutAlign="start end">
|
||||
<input matInput [(ngModel)]="invoiceValue" placeholder="Invoice Value ({{information?.smaller_currency_unit}})" type="number" step="100" min="1" tabindex="2" name="invoiceValue">
|
||||
</mat-form-field>
|
||||
<div fxFlex="10" fxLayoutAlign="start start">
|
||||
<button fxFlex="90" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="3">Add</button>
|
||||
<div fxFlex="15" tabindex="3" fxLayoutAlign="start center" class="chkbox-private">
|
||||
<mat-checkbox [(ngModel)]="private" matTooltip="Include routing hints for private channels" [matTooltipPosition]="'above'" name="private">Private</mat-checkbox>
|
||||
</div>
|
||||
<div fxFlex="10" fxLayoutAlign="start start">
|
||||
<button fxFlex="90" fxLayoutAlign="center center" mat-raised-button color="accent" tabindex="4" type="reset" (click)="resetData()">Clear</button>
|
||||
<button fxFlex="90" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="4">Add</button>
|
||||
</div>
|
||||
<div fxFlex="10" fxLayoutAlign="start start">
|
||||
<button fxFlex="90" fxLayoutAlign="center center" mat-raised-button color="accent" tabindex="5" type="reset" (click)="resetData()">Clear</button>
|
||||
</div>
|
||||
</form>
|
||||
</mat-card-content>
|
||||
@ -70,7 +73,7 @@
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: flgSticky;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [@newlyAddedRowAnimation]="(row.memo === newlyAddedInvoiceMemo && row.value === newlyAddedInvoiceValue && flgAnimate) ? 'added' : 'notAdded'" (click)="onInvoiceClick(row, $event)"></tr>
|
||||
</table>
|
||||
<mat-paginator [length]="totalInvoices" [pageSize]="25" [pageSizeOptions]="pageSizeOptions" (page)="onPageChange($event)"></mat-paginator>
|
||||
<mat-paginator [length]="totalInvoices" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" (page)="onPageChange($event)"></mat-paginator>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
@ -9,3 +9,7 @@
|
||||
table {
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.chkbox-private:focus {
|
||||
outline: none !important;
|
||||
}
|
@ -34,7 +34,9 @@ export class InvoicesComponent implements OnInit, OnDestroy {
|
||||
public information: GetInfo = {};
|
||||
public flgLoading: Array<Boolean | 'error'> = [true];
|
||||
public flgSticky = false;
|
||||
public private = false;
|
||||
public totalInvoices = 100;
|
||||
public pageSize = 25;
|
||||
public pageSizeOptions = [5, 10, 25, 100];
|
||||
private firstOffset = -1;
|
||||
private lastOffset = -1;
|
||||
@ -90,16 +92,8 @@ export class InvoicesComponent implements OnInit, OnDestroy {
|
||||
this.newlyAddedInvoiceMemo = this.memo;
|
||||
this.newlyAddedInvoiceValue = this.invoiceValue;
|
||||
this.store.dispatch(new RTLActions.OpenSpinner('Adding Invoice...'));
|
||||
this.store.dispatch(new RTLActions.SaveNewInvoice({memo: this.memo, invoiceValue: this.invoiceValue}));
|
||||
this.actions$
|
||||
.pipe(
|
||||
takeUntil(this.unSubs[1]),
|
||||
filter((action) => action.type === RTLActions.ADD_INVOICE)
|
||||
).subscribe((newInvoiceAction: RTLActions.AddInvoice) => {
|
||||
this.logger.info(newInvoiceAction.payload);
|
||||
this.invoicePaymentReq = newInvoiceAction.payload.payment_request;
|
||||
});
|
||||
|
||||
this.store.dispatch(new RTLActions.SaveNewInvoice({memo: this.memo, invoiceValue: this.invoiceValue, private: this.private, pageSize: this.pageSize}));
|
||||
this.resetData();
|
||||
}
|
||||
|
||||
onInvoiceClick(selRow: Invoice, event: any) {
|
||||
@ -135,6 +129,7 @@ export class InvoicesComponent implements OnInit, OnDestroy {
|
||||
resetData() {
|
||||
this.memo = '';
|
||||
this.invoiceValue = 0;
|
||||
this.private = false;
|
||||
}
|
||||
|
||||
applyFilter(selFilter: string) {
|
||||
|
@ -178,7 +178,7 @@ export class RemovePeer implements Action {
|
||||
|
||||
export class SaveNewInvoice implements Action {
|
||||
readonly type = SAVE_NEW_INVOICE;
|
||||
constructor(public payload: {memo: string, invoiceValue: number}) {}
|
||||
constructor(public payload: {memo: string, invoiceValue: number, private: boolean, pageSize: number}) {}
|
||||
}
|
||||
|
||||
export class AddInvoice implements Action {
|
||||
|
@ -246,7 +246,7 @@ export class RTLEffects implements OnDestroy {
|
||||
saveNewInvoice = this.actions$.pipe(
|
||||
ofType(RTLActions.SAVE_NEW_INVOICE),
|
||||
mergeMap((action: RTLActions.SaveNewInvoice) => {
|
||||
return this.httpClient.post(environment.INVOICES_API, {memo: action.payload.memo, amount: action.payload.invoiceValue})
|
||||
return this.httpClient.post(environment.INVOICES_API, {memo: action.payload.memo, amount: action.payload.invoiceValue, private: action.payload.private})
|
||||
.pipe(
|
||||
map((postRes: any) => {
|
||||
postRes.memo = action.payload.memo;
|
||||
@ -261,8 +261,8 @@ export class RTLEffects implements OnDestroy {
|
||||
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%',
|
||||
data: { type: 'SUCCESS', titleMessage: 'Invoice Added Successfully!', message: JSON.stringify(msg) }}));
|
||||
return {
|
||||
type: RTLActions.ADD_INVOICE,
|
||||
payload: postRes
|
||||
type: RTLActions.FETCH_INVOICES,
|
||||
payload: {num_max_invoices: action.payload.pageSize, reversed: true}
|
||||
};
|
||||
}),
|
||||
catchError((err: any) => {
|
||||
|
@ -147,9 +147,11 @@ export function RTLRootReducer(state = initialState, action: RTLActions.RTLActio
|
||||
peers: modifiedPeers
|
||||
};
|
||||
case RTLActions.ADD_INVOICE:
|
||||
const newInvoices = state.invoices;
|
||||
newInvoices.invoices.unshift(action.payload);
|
||||
return {
|
||||
...state,
|
||||
invoices: action.payload
|
||||
invoices: newInvoices
|
||||
};
|
||||
case RTLActions.SET_FEES:
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user