2
0
mirror of https://github.com/Ride-The-Lightning/RTL synced 2024-11-09 13:10:44 +00:00
CL UX
This commit is contained in:
Shahana Farooqui 2020-01-06 10:42:42 -05:00
parent 1b4f55761e
commit 18cd2a63f3
16 changed files with 92 additions and 117 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12,5 +12,5 @@
<link rel="stylesheet" href="styles.09fbe043baaff9d23c8b.css"></head> <link rel="stylesheet" href="styles.09fbe043baaff9d23c8b.css"></head>
<body> <body>
<rtl-app></rtl-app> <rtl-app></rtl-app>
<script src="runtime.8e5ce25f927cbaca2d37.js" defer></script><script src="polyfills-es5.b8e32dec482ae69710a2.js" nomodule defer></script><script src="polyfills.ebf9033c33aa4a5af12a.js" defer></script><script src="main.e5b7d4371169014e6bcc.js" defer></script></body> <script src="runtime.8deac02ce6d4425fd8dd.js" defer></script><script src="polyfills-es5.b8e32dec482ae69710a2.js" nomodule defer></script><script src="polyfills.ebf9033c33aa4a5af12a.js" defer></script><script src="main.8e4a4bb61cc96d800a13.js" defer></script></body>
</html> </html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],f=r[2],p=0,s=[];p<i.length;p++)a=i[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({}[e]||e)+"."+{1:"77d491bf73b15683870f",6:"fa6978c7cfab730bba7f",7:"c980f15da42efcfbed5b"}[e]+".js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var f=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var f=0;f<i.length;f++)r(i[f]);var l=c;t()}([]);

View File

@ -1 +0,0 @@
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],f=r[2],p=0,s=[];p<a.length;p++)i=a[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++)0!==o[t[a]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={0:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({}[e]||e)+"."+{1:"77d491bf73b15683870f",6:"b479355282ea9b377ebc",7:"22cd396798191c8cb98f"}[e]+".js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var f=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var l=c;t()}([]);

View File

@ -1,6 +1,7 @@
var request = require('request-promise'); var request = require('request-promise');
var common = require('../../common'); var common = require('../../common');
var logger = require('../logger'); var logger = require('../logger');
var swtch = require('./switch');
var options = {}; var options = {};
exports.getFees = (req, res, next) => { exports.getFees = (req, res, next) => {
@ -36,18 +37,18 @@ exports.getFees = (req, res, next) => {
let month_start_time = current_time - 2629743; let month_start_time = current_time - 2629743;
let week_start_time = current_time - 604800; let week_start_time = current_time - 604800;
let day_start_time = current_time - 86400; let day_start_time = current_time - 86400;
return getFwdTransactions(month_start_time, current_time) return swtch.getAllForwardingEvents(month_start_time, current_time, 0, 1000)
.then((history) => { .then((history) => {
let daily_tx_count = history.filter(event => { logger.info({fileName: 'Fees', msg: 'Forwarding History Received: ' + JSON.stringify(history)});
return event.timestamp >= day_start_time; let daily_tx_count = history.forwarding_events.filter(event => event.timestamp >= day_start_time);
});
body.daily_tx_count = daily_tx_count && daily_tx_count.length ? daily_tx_count.length : 0; body.daily_tx_count = daily_tx_count && daily_tx_count.length ? daily_tx_count.length : 0;
let weekly_tx_count = history.filter(event => event.timestamp >= week_start_time); let weekly_tx_count = history.forwarding_events.filter(event => event.timestamp >= week_start_time);
body.weekly_tx_count = weekly_tx_count && weekly_tx_count.length ? weekly_tx_count.length : 0; body.weekly_tx_count = weekly_tx_count && weekly_tx_count.length ? weekly_tx_count.length : 0;
body.monthly_tx_count = history && history.length ? history.length : 0; body.monthly_tx_count = history.forwarding_events && history.forwarding_events.length ? history.forwarding_events.length : 0;
return res.status(200).json(body); return res.status(200).json(body);
}) })
.catch(err => { .catch(err => {
logger.error({fileName: 'Fees', lineNum: 54, msg: 'Fetch Fee Error: ' + JSON.stringify(err)});
return res.status(500).json({ return res.status(500).json({
message: "Fetching fee failed!", message: "Fetching fee failed!",
error: err.error error: err.error
@ -62,37 +63,3 @@ exports.getFees = (req, res, next) => {
}); });
}); });
}; };
getFwdTransactions = (start_time, end_time) => {
return new Promise(function(resolve, reject) {
options.url = common.getSelLNServerUrl() + '/switch';
options.form = JSON.stringify({
start_time: start_time,
end_time: end_time
});
logger.info({fileName: 'Fees', msg: 'Switch Post Options: ' + JSON.stringify(options)});
request.post(options).then((body) => {
try {
logger.info({fileName: 'Fees', msg: 'Switch Post Response: ' + JSON.stringify(body)});
if(undefined === body || body.error) {
logger.error({fileName: 'Fees', lineNum: 78, msg: 'Switch Post Error: ' + JSON.stringify((undefined === body) ? 'Error From Server!' : body.error)});
res.status(500).json({
message: "Switch post failed!",
error: (undefined === body) ? 'Error From Server!' : body.error
});
} else {
if (undefined !== body.forwarding_events && body.forwarding_events.length > 0) {
body.forwarding_events.forEach(event => {
event.timestamp_str = (undefined === event.timestamp) ? '' : common.convertTimestampToDate(event.timestamp);
});
body.forwarding_events = common.sortDescByKey(body.forwarding_events, 'timestamp');
logger.info({fileName: 'Fees', msg: 'Forwarding History Received: ' + JSON.stringify(body)});
resolve(body.forwarding_events);
}
}
} catch (err) {
resolve(err);
}
})
});
}

View File

@ -3,28 +3,20 @@ var common = require('../../common');
var logger = require('../logger'); var logger = require('../logger');
var options = {}; var options = {};
exports.forwardingHistory = (req, res, next) => { exports.getAllForwardingEvents = (start, end, offset, max_events) => {
return new Promise(function(resolve, reject) {
options = common.getOptions(); options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/switch'; options.url = common.getSelLNServerUrl() + '/switch';
options.form = {}; options.form = {};
if (undefined !== req.body.num_max_events) { if (start) { options.form.start_time = start; }
options.form.num_max_events = req.body.num_max_events; if (end) { options.form.end_time = end; }
} options.form.num_max_events = max_events ? max_events : 1000;
if (undefined !== req.body.index_offset) { options.form.index_offset = offset ? offset : 0;
options.form.index_offset = req.body.index_offset;
}
if (undefined !== req.body.end_time) {
options.form.end_time = req.body.end_time;
}
if (undefined !== req.body.start_time) {
options.form.start_time = req.body.start_time;
}
options.form = JSON.stringify(options.form); options.form = JSON.stringify(options.form);
logger.info({fileName: 'Switch', msg: 'Forwarding History Start Time: ' + options.form.start_time}); logger.info({fileName: 'Switch', msg: 'Forwarding History Params: ' + options.form});
logger.info({fileName: 'Switch', msg: 'Forwarding History End Time: ' + options.form.end_time});
request.post(options).then((body) => { request.post(options).then((body) => {
if(undefined === body || body.error) { if(undefined === body || body.error) {
logger.error({fileName: 'Switch', lineNum: 27, msg: 'Forwarding History Error: ' + JSON.stringify((undefined === body) ? 'Error From Server!' : body.error)}); logger.error({fileName: 'Switch', lineNum: 31, msg: 'Forwarding History Error: ' + JSON.stringify((undefined === body) ? 'Error From Server!' : body.error)});
res.status(500).json({ res.status(500).json({
message: "Switch post failed!", message: "Switch post failed!",
error: (undefined === body) ? 'Error From Server!' : body.error error: (undefined === body) ? 'Error From Server!' : body.error
@ -37,12 +29,26 @@ exports.forwardingHistory = (req, res, next) => {
body.forwarding_events = common.sortDescByKey(body.forwarding_events, 'timestamp'); body.forwarding_events = common.sortDescByKey(body.forwarding_events, 'timestamp');
} }
logger.info({fileName: 'Switch', msg: 'Forwarding History Received: ' + JSON.stringify(body)}); logger.info({fileName: 'Switch', msg: 'Forwarding History Received: ' + JSON.stringify(body)});
res.status(201).json(body); resolve(body);
} }
}) })
.catch(function (err) { .catch(function (err) {
logger.error({fileName: 'Switch', lineNum: 44, msg: 'Forwarding History Error: ' + JSON.stringify(err)}); logger.error({fileName: 'Switch', lineNum: 48, msg: 'Forwarding History Error: ' + JSON.stringify(err)});
return res.status(500).json({ resolve({
message: "Switch post failed!",
error: err.error
});
});
});
}
exports.forwardingHistory = (req, res, next) => {
this.getAllForwardingEvents(req.body.start_time, req.body.end_time, 0, 1000).then(function(values) {
logger.info({fileName: 'Switch', msg: 'All Forwarding Events: ' + JSON.stringify(values)});
res.status(201).json(values);
}).catch(err => {
logger.error({fileName: 'Switch', lineNum: 60, msg: 'Get All Forwarding Events: ' + JSON.stringify(err)});
res.status(500).json({
message: "Switch post failed!", message: "Switch post failed!",
error: err.error error: err.error
}); });

View File

@ -8,7 +8,7 @@
<div fxLayout="row"> <div fxLayout="row">
<div fxLayout="column" fxFlex="50" fxLayoutAlign="end start" class="my-1"> <div fxLayout="column" fxFlex="50" fxLayoutAlign="end start" class="my-1">
<h4 fxLayoutAlign="start" class="font-bold-500">Alias</h4> <h4 fxLayoutAlign="start" class="font-bold-500">Alias</h4>
<span class="foreground-secondary-text">{{lookupResult.alias}}<span class="ml-2" [ngStyle]="{'background-color': '#' + lookupResult.color}">#{{lookupResult.color}}</span></span> <span class="foreground-secondary-text">{{lookupResult.alias}}<span class="ml-2" [ngStyle]="{'background-color': '#' + lookupResult.color}">{{lookupResult.color ? '#' + lookupResult.color : ''}}</span></span>
<mat-divider class="my-1"></mat-divider> <mat-divider class="my-1"></mat-divider>
</div> </div>
<div fxLayout="column" fxFlex="50" fxLayoutAlign="end start" class="my-1"> <div fxLayout="column" fxFlex="50" fxLayoutAlign="end start" class="my-1">

View File

@ -1,4 +1,4 @@
<form fxLayout="column" fxFlex="98" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start" class="padding-gap overflow-x-hidden"> <form fxLayout="column" fxFlex="98" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start" class="padding-gap overflow-x-hidden" (submit)="onSendFunds()" (reset)="resetData()" #form="ngForm">
<mat-form-field fxFlex.gt-sm="55"> <mat-form-field fxFlex.gt-sm="55">
<input matInput [(ngModel)]="transaction.address" placeholder="Bitcoin Address" tabindex="1" name="address" required #address="ngModel"> <input matInput [(ngModel)]="transaction.address" placeholder="Bitcoin Address" tabindex="1" name="address" required #address="ngModel">
<mat-error *ngIf="!transaction.address">Bitcoin address is required.</mat-error> <mat-error *ngIf="!transaction.address">Bitcoin address is required.</mat-error>
@ -31,7 +31,7 @@
</div> </div>
<div fxLayout="column" fxFlex="100" fxFlex.gt-sm="40" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start"></div> <div fxLayout="column" fxFlex="100" fxFlex.gt-sm="40" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start"></div>
<div fxLayout="row" fxFlex="100" fxFlex.gt-sm="30" fxLayoutAlign="space-between stretch" class="mt-2"> <div fxLayout="row" fxFlex="100" fxFlex.gt-sm="30" fxLayoutAlign="space-between stretch" class="mt-2">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="7" type="reset" (click)="resetData()">Clear Fields</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="7" type="reset">Clear Fields</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="8" (click)="onSendFunds()">Send Funds</button> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="8">Send Funds</button>
</div> </div>
</form> </form>

View File

@ -1,17 +1,15 @@
import { Component, Input, OnInit, OnDestroy } from '@angular/core'; import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { DecimalPipe } from '@angular/common'; import { DecimalPipe } from '@angular/common';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { takeUntil, take } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { MatSnackBar } from '@angular/material/snack-bar';
import { SelNodeChild, GetInfoRoot } from '../../../shared/models/RTLconfig'; import { SelNodeChild, GetInfoRoot } from '../../../shared/models/RTLconfig';
import { GetInfoCL, BalanceCL, OnChainCL } from '../../../shared/models/clModels'; import { GetInfoCL, BalanceCL, OnChainCL } from '../../../shared/models/clModels';
import { CURRENCY_UNITS, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, AlertTypeEnum, DataTypeEnum, ADDRESS_TYPES, FEE_RATE_TYPES } from '../../../shared/services/consts-enums-functions'; import { CURRENCY_UNITS, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, AlertTypeEnum, ADDRESS_TYPES, FEE_RATE_TYPES } from '../../../shared/services/consts-enums-functions';
import { RTLConfiguration } from '../../../shared/models/RTLconfig'; import { RTLConfiguration } from '../../../shared/models/RTLconfig';
import { CommonService } from '../../../shared/services/common.service'; import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service'; import { LoggerService } from '../../../shared/services/logger.service';
import * as sha256 from 'sha256';
import { RTLEffects } from '../../../store/rtl.effects'; import { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions'; import * as RTLActions from '../../../store/rtl.actions';
@ -24,6 +22,7 @@ import { MessageDataField } from '../../../shared/models/alertData';
styleUrls: ['./on-chain-send.component.scss'] styleUrls: ['./on-chain-send.component.scss']
}) })
export class CLOnChainSendComponent implements OnInit, OnDestroy { export class CLOnChainSendComponent implements OnInit, OnDestroy {
@ViewChild('form', { static: false }) form: any;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild = {};
public appConfig: RTLConfiguration; public appConfig: RTLConfiguration;
public nodeData: GetInfoRoot; public nodeData: GetInfoRoot;
@ -43,7 +42,7 @@ export class CLOnChainSendComponent implements OnInit, OnDestroy {
public currencyUnitFormats = CURRENCY_UNIT_FORMATS; public currencyUnitFormats = CURRENCY_UNIT_FORMATS;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private commonService: CommonService, private decimalPipe: DecimalPipe, private snackBar: MatSnackBar) {} constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private commonService: CommonService, private decimalPipe: DecimalPipe) {}
ngOnInit() { ngOnInit() {
this.store.select('root') this.store.select('root')
@ -97,6 +96,7 @@ export class CLOnChainSendComponent implements OnInit, OnDestroy {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Funds...')); this.store.dispatch(new RTLActions.OpenSpinner('Sending Funds...'));
this.store.dispatch(new RTLActions.SetChannelTransactionCL(this.transaction)); this.store.dispatch(new RTLActions.SetChannelTransactionCL(this.transaction));
this.transaction = {}; this.transaction = {};
this.form.resetForm();
} }
get invalidValues(): boolean { get invalidValues(): boolean {

View File

@ -10,7 +10,7 @@ import { Location } from '@angular/common';
import { environment, API_URL } from '../../../environments/environment'; import { environment, API_URL } from '../../../environments/environment';
import { LoggerService } from '../../shared/services/logger.service'; import { LoggerService } from '../../shared/services/logger.service';
import { SessionService } from '../../shared/services/session.service'; import { SessionService } from '../../shared/services/session.service';
import { GetInfoCL, FeesCL, BalanceCL, LocalRemoteBalanceCL, PaymentCL, FeeRatesCL, ListInvoicesCL, InvoiceCL, GetInfoChainCL } from '../../shared/models/clModels'; import { GetInfoCL, FeesCL, BalanceCL, LocalRemoteBalanceCL, PaymentCL, FeeRatesCL, ListInvoicesCL, InvoiceCL } from '../../shared/models/clModels';
import * as fromRTLReducer from '../../store/rtl.reducers'; import * as fromRTLReducer from '../../store/rtl.reducers';
import * as RTLActions from '../../store/rtl.actions'; import * as RTLActions from '../../store/rtl.actions';
@ -674,10 +674,8 @@ export class CLEffects implements OnDestroy {
this.logger.info(postRes); this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner()); this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.FetchBalanceCL()); this.store.dispatch(new RTLActions.FetchBalanceCL());
return { this.store.dispatch(new RTLActions.OpenSnackBar('Fund Sent Successfully.'));
type: RTLActions.OPEN_ALERT, return { type: RTLActions.VOID };
payload: { data: { type: AlertTypeEnum.SUCCESS, titleMessage: 'Fund Sent Successfully!' } }
};
}), }),
catchError((err: any) => { catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorCl({ action: 'SetChannelTransactionCL', code: err.status, message: err.error.error })); this.store.dispatch(new RTLActions.EffectErrorCl({ action: 'SetChannelTransactionCL', code: err.status, message: err.error.error }));

View File

@ -1,4 +1,4 @@
<form fxLayout="column" fxFlex="98" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start" *ngIf="!sweepAll; else sweepAllBlock;" class="padding-gap overflow-x-hidden"> <form fxLayout="column" fxFlex="98" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start" *ngIf="!sweepAll; else sweepAllBlock;" class="padding-gap overflow-x-hidden" (submit)="onSendFunds()" (reset)="resetData()" #form="ngForm">
<mat-form-field fxFlex.gt-sm="55"> <mat-form-field fxFlex.gt-sm="55">
<input matInput [(ngModel)]="transaction.address" placeholder="Bitcoin Address" tabindex="1" name="address" required #address="ngModel"> <input matInput [(ngModel)]="transaction.address" placeholder="Bitcoin Address" tabindex="1" name="address" required #address="ngModel">
<mat-error *ngIf="!transaction.address">Bitcoin address is required.</mat-error> <mat-error *ngIf="!transaction.address">Bitcoin address is required.</mat-error>
@ -32,13 +32,13 @@
</div> </div>
<div fxLayout="column" fxFlex="100" fxFlex.gt-sm="40" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start"></div> <div fxLayout="column" fxFlex="100" fxFlex.gt-sm="40" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start"></div>
<div fxLayout="row" fxFlex="100" fxFlex.gt-sm="30" fxLayoutAlign="space-between stretch" class="mt-2"> <div fxLayout="row" fxFlex="100" fxFlex.gt-sm="30" fxLayoutAlign="space-between stretch" class="mt-2">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="7" type="reset" (click)="resetData()">Clear Fields</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="7" type="reset">Clear Fields</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="8" (click)="onSendFunds()">Send Funds</button> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="8">Send Funds</button>
</div> </div>
</form> </form>
<ng-template #sweepAllBlock> <ng-template #sweepAllBlock>
<form fxLayout="column" fxFlex="100" class="padding-gap overflow-x-hidden"> <form fxLayout="column" fxFlex="100" class="padding-gap overflow-x-hidden">
<div fxLayout="column" fxFlex="98" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start"> <div fxLayout="column" fxFlex="98" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start" (submit)="onSendFunds()" (reset)="resetData()" #formSweepAll>
<mat-form-field fxFlex.gt-sm="55"> <mat-form-field fxFlex.gt-sm="55">
<input matInput [(ngModel)]="transaction.address" placeholder="Bitcoin Address" tabindex="1" name="address" required #addressSweep="ngModel"> <input matInput [(ngModel)]="transaction.address" placeholder="Bitcoin Address" tabindex="1" name="address" required #addressSweep="ngModel">
<mat-error *ngIf="!transaction.address">Bitcoin address is required.</mat-error> <mat-error *ngIf="!transaction.address">Bitcoin address is required.</mat-error>
@ -61,8 +61,8 @@
</div> </div>
<div> <div>
<div fxFlex="100" fxFlex.gt-sm="30" fxLayout="row" fxLayoutAlign="space-between stretch" class="mt-2"> <div fxFlex="100" fxFlex.gt-sm="30" fxLayout="row" fxLayoutAlign="space-between stretch" class="mt-2">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="7" type="reset" (click)="resetData()">Clear Fields</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="7" type="reset">Clear Fields</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="8" (click)="onSendFunds()">Send Funds</button> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="8">Send Funds</button>
</div> </div>
</div> </div>
</form> </form>

View File

@ -1,4 +1,4 @@
import { Component, Input, OnInit, OnDestroy } from '@angular/core'; import { Component, Input, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { DecimalPipe } from '@angular/common'; import { DecimalPipe } from '@angular/common';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { takeUntil, take } from 'rxjs/operators'; import { takeUntil, take } from 'rxjs/operators';
@ -24,6 +24,8 @@ import { MessageDataField } from '../../../shared/models/alertData';
styleUrls: ['./on-chain-send.component.scss'] styleUrls: ['./on-chain-send.component.scss']
}) })
export class OnChainSendComponent implements OnInit, OnDestroy { export class OnChainSendComponent implements OnInit, OnDestroy {
@ViewChild('form', { static: false }) form: any;
@ViewChild('formSweepAll', { static: false }) formSweepAll: any;
@Input() sweepAll = false; @Input() sweepAll = false;
private _sweepBalance = 0; private _sweepBalance = 0;
get sweepBalance() { get sweepBalance() {
@ -144,6 +146,8 @@ export class OnChainSendComponent implements OnInit, OnDestroy {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Funds...')); this.store.dispatch(new RTLActions.OpenSpinner('Sending Funds...'));
this.store.dispatch(new RTLActions.SetChannelTransaction(this.transaction)); this.store.dispatch(new RTLActions.SetChannelTransaction(this.transaction));
this.transaction = {}; this.transaction = {};
if(this.form) { this.form.resetForm(); }
if(this.formSweepAll) { this.formSweepAll.resetForm(); }
} }
get invalidValues(): boolean { get invalidValues(): boolean {