Removed disabled buttons

Removed disabled buttons
pull/260/head
Shahana Farooqui 4 years ago
parent 99fae43a50
commit 11c73f0602

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

@ -9,8 +9,8 @@
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon/favicon-16x16.png">
<link rel="manifest" href="assets/images/favicon/site.webmanifest"> <link rel="manifest" href="assets/images/favicon/site.webmanifest">
<link rel="stylesheet" href="styles.18f10bccc271f4d6863f.css"></head> <link rel="stylesheet" href="styles.df640b2902528bb33529.css"></head>
<body> <body>
<rtl-app></rtl-app> <rtl-app></rtl-app>
<script src="runtime.04ce149e32d4ab474230.js" defer></script><script src="polyfills-es5.b8e32dec482ae69710a2.js" nomodule defer></script><script src="polyfills.ebf9033c33aa4a5af12a.js" defer></script><script src="main.51859c43394db92cafdb.js" defer></script></body> <script src="runtime.89545486fe72b18c4322.js" defer></script><script src="polyfills-es5.b8e32dec482ae69710a2.js" nomodule defer></script><script src="polyfills.ebf9033c33aa4a5af12a.js" defer></script><script src="main.0f9f26fc2693675ecd5a.js" defer></script></body>
</html> </html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +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:"3de0a26964d460363d96",6:"42170a37bd5aeec6fdbd",7:"2abf952f9d750145d6a5"}[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()}([]); !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:"3de0a26964d460363d96",6:"75a1a1653f2c3e123992",7:"ecf71a5833a87e7f5813"}[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()}([]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,3 +1,4 @@
<!-- <div fxLayout="column" id="rtl-container" class="rtl-container" [ngClass]="[settings.themeColor, settings.themeMode]" [class.horizontal]="settings.menu === 'horizontal'" [class.compact]="settings.menuType === 'compact'" [class.mini]="settings.menuType === 'mini'" [style.fontSize.px]="getFontSize()"> -->
<div fxLayout="column" id="rtl-container" class="rtl-container" [ngClass]="[settings.themeColor, settings.themeMode, settings.fontSize]" [class.horizontal]="settings.menu === 'horizontal'" [class.compact]="settings.menuType === 'compact'" [class.mini]="settings.menuType === 'mini'"> <div fxLayout="column" id="rtl-container" class="rtl-container" [ngClass]="[settings.themeColor, settings.themeMode, settings.fontSize]" [class.horizontal]="settings.menu === 'horizontal'" [class.compact]="settings.menuType === 'compact'" [class.mini]="settings.menuType === 'mini'">
<mat-toolbar fxLayout="row" fxLayoutAlign="space-between center" class="padding-gap-x bg-primary rtl-top-toolbar" *ngIf="settings.menu === 'vertical'"> <mat-toolbar fxLayout="row" fxLayoutAlign="space-between center" class="padding-gap-x bg-primary rtl-top-toolbar" *ngIf="settings.menu === 'vertical'">
<div> <div>

@ -12,7 +12,7 @@ import * as sha256 from 'sha256';
import { LoggerService } from './shared/services/logger.service'; import { LoggerService } from './shared/services/logger.service';
import { CommonService } from './shared/services/common.service'; import { CommonService } from './shared/services/common.service';
import { SessionService } from './shared/services/session.service'; import { SessionService } from './shared/services/session.service';
import { AlertTypeEnum, ScreenSizeEnum } from './shared/services/consts-enums-functions'; import { AlertTypeEnum, ScreenSizeEnum, NODE_SETTINGS } from './shared/services/consts-enums-functions';
import { RTLConfiguration, Settings, LightningNode, GetInfoRoot } from './shared/models/RTLconfig'; import { RTLConfiguration, Settings, LightningNode, GetInfoRoot } from './shared/models/RTLconfig';
import * as RTLActions from './store/rtl.actions'; import * as RTLActions from './store/rtl.actions';
@ -147,6 +147,11 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
this.logger.info('Copied Text: ' + payload); this.logger.info('Copied Text: ' + payload);
} }
getFontSize() {
return (this.settings.fontSize === NODE_SETTINGS.fontSize[0].class) ? 14 :
(this.settings.fontSize === NODE_SETTINGS.fontSize[2].class) ? 18 : 16;
}
ngOnDestroy() { ngOnDestroy() {
this.unSubs.forEach(unsub => { this.unSubs.forEach(unsub => {
unsub.next(); unsub.next();

@ -7,8 +7,7 @@
</mat-card-subtitle> </mat-card-subtitle>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<form fxLayout="column" fxLayout.gt-sm="row wrap" <form fxLayout="column" fxLayout.gt-sm="row wrap" (ngSubmit)="openChannelForm.form.valid && onOpenChannel(openChannelForm)" #openChannelForm="ngForm">
(ngSubmit)="openChannelForm.form.valid && onOpenChannel(openChannelForm)" #openChannelForm="ngForm">
<mat-form-field fxFlex="40" fxLayoutAlign="start end"> <mat-form-field fxFlex="40" fxLayoutAlign="start end">
<mat-select [(ngModel)]="selectedPeer" placeholder="Alias" name="peer_alias" tabindex="1" required <mat-select [(ngModel)]="selectedPeer" placeholder="Alias" name="peer_alias" tabindex="1" required
name="selPeer" #selPeer="ngModel"> name="selPeer" #selPeer="ngModel">

@ -16,10 +16,11 @@
</div> </div>
<mat-form-field fxFlex="65" fxFlex.gt-md="75" fxLayoutAlign="start end" [ngClass]="{'mt-2': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}"> <mat-form-field fxFlex="65" fxFlex.gt-md="75" fxLayoutAlign="start end" [ngClass]="{'mt-2': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}">
<input matInput name="lookupKey" [placeholder]="lookupFields[selectedFieldId]?.placeholder || 'Lookup Key'" (change)="clearLookupValue()" [(ngModel)]="lookupKey" tabindex="2" required> <input matInput name="lookupKey" [placeholder]="lookupFields[selectedFieldId]?.placeholder || 'Lookup Key'" (change)="clearLookupValue()" [(ngModel)]="lookupKey" tabindex="2" required>
<mat-error *ngIf="!lookupKey">{{lookupFields[selectedFieldId]?.placeholder}} is required.</mat-error>
</mat-form-field> </mat-form-field>
<div fxFlex="30" fxLayoutAlign="space-between stretch" class="mt-2"> <div fxFlex="30" fxLayoutAlign="space-between stretch" class="mt-2">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="3" type="button" (click)="resetData()">Clear</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="3" type="reset" (click)="resetData()">Clear</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" tabindex="4" type="submit" (click)="onLookup()" [disabled]="!form.valid">Lookup</button> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" tabindex="4" type="submit" (click)="onLookup()">Lookup</button>
</div> </div>
</form> </form>
<div fxFlex="100" fxLayout="column" fxLayout.gt-sm="row wrap" fxLayoutAlign.gt-sm="space-between center" fxLayoutAlign="start stretch" *ngIf="lookupValue && flgSetLookupValue" class="w-100 mt-2"> <div fxFlex="100" fxLayout="column" fxLayout.gt-sm="row wrap" fxLayoutAlign.gt-sm="space-between center" fxLayoutAlign="start stretch" *ngIf="lookupValue && flgSetLookupValue" class="w-100 mt-2">

@ -57,6 +57,7 @@ export class LookupsComponent implements OnInit, OnDestroy {
} }
onLookup() { onLookup() {
if(!this.lookupKey) { return true; }
this.flgSetLookupValue = false; this.flgSetLookupValue = false;
this.lookupValue = {}; this.lookupValue = {};
this.store.dispatch(new RTLActions.OpenSpinner('Searching ' + this.lookupFields[this.selectedFieldId].name + '...')); this.store.dispatch(new RTLActions.OpenSpinner('Searching ' + this.lookupFields[this.selectedFieldId].name + '...'));

@ -8,7 +8,7 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<div class="mt-2" fxFlex="48" fxFlex.gt-md="25"> <div class="mt-2" fxFlex="48" fxFlex.gt-md="25">
<button fxFlex="100" fxLayoutAlign="center center" mat-raised-button color="primary" (click)="onGenerateAddress()" [disabled]="undefined === selectedAddressType.addressId" tabindex="2" class="top-minus-15px">Generate Address</button> <button fxFlex="100" fxLayoutAlign="center center" mat-raised-button color="primary" (click)="onGenerateAddress()" tabindex="2" class="top-minus-15px">Generate Address</button>
</div> </div>
</div> </div>
</div> </div>

@ -4,7 +4,7 @@ import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AddressType } from '../../../shared/models/lndModels'; import { AddressType } from '../../../shared/models/lndModels';
import { ADDRESS_TYPES, AlertTypeEnum } from '../../../shared/services/consts-enums-functions'; import { ADDRESS_TYPES } from '../../../shared/services/consts-enums-functions';
import { OnChainGeneratedAddressComponent } from '../../../shared/components/data-modal/on-chain-generated-address/on-chain-generated-address.component'; import { OnChainGeneratedAddressComponent } from '../../../shared/components/data-modal/on-chain-generated-address/on-chain-generated-address.component';
import { LNDEffects } from '../../store/lnd.effects'; import { LNDEffects } from '../../store/lnd.effects';
@ -18,7 +18,7 @@ import * as fromRTLReducer from '../../../store/rtl.reducers';
}) })
export class OnChainReceiveComponent implements OnInit, OnDestroy { export class OnChainReceiveComponent implements OnInit, OnDestroy {
public addressTypes = ADDRESS_TYPES; public addressTypes = ADDRESS_TYPES;
public selectedAddressType: AddressType = {}; public selectedAddressType: AddressType = ADDRESS_TYPES[0];
public newAddress = ''; public newAddress = '';
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()];

@ -1,10 +1,12 @@
<div 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">
<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" #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-form-field> </mat-form-field>
<mat-form-field fxFlex.gt-sm="30"> <mat-form-field fxFlex.gt-sm="30">
<input matInput [(ngModel)]="transaction.amount" placeholder="Amount" name="amount" type="number" step="100" min="0" tabindex="2" #amount="ngModel" [disabled]="sweepAll"> <input matInput [(ngModel)]="transaction.amount" placeholder="Amount" name="amount" type="number" step="100" min="0" tabindex="2" required #amount="ngModel">
<span matSuffix> {{selAmountUnit}} </span> <span matSuffix> {{selAmountUnit}} </span>
<mat-error *ngIf="!transaction.amount">Amount is required.</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex.gt-sm="10" fxLayoutAlign="start end"> <mat-form-field fxFlex.gt-sm="10" fxLayoutAlign="start end">
<mat-select [value]="selAmountUnit" tabindex="3" required name="amountUnit" (selectionChange)="onAmountUnitChange($event)"> <mat-select [value]="selAmountUnit" tabindex="3" required name="amountUnit" (selectionChange)="onAmountUnitChange($event)">
@ -21,29 +23,25 @@
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="48" *ngIf="selTransType=='1'"> <mat-form-field fxFlex="48" *ngIf="selTransType=='1'">
<input matInput [(ngModel)]="transaction.blocks" placeholder="Number of Blocks" type="number" name="blocks" step="1" min="0" required tabindex="5" #blocks="ngModel"> <input matInput [(ngModel)]="transaction.blocks" placeholder="Number of Blocks" type="number" name="blocks" step="1" min="0" required tabindex="5" #blocks="ngModel">
<mat-error *ngIf="!transaction.blocks">Number of blocks is required.</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="48" *ngIf="selTransType=='2'"> <mat-form-field fxFlex="48" *ngIf="selTransType=='2'">
<input matInput [(ngModel)]="transaction.fees" placeholder="Fee ({{nodeData?.smaller_currency_unit}}/Byte)" type="number" name="fees" step="1" min="0" required tabindex="6" #fees="ngModel"> <input matInput [(ngModel)]="transaction.fees" placeholder="Fees ({{nodeData?.smaller_currency_unit}}/Byte)" type="number" name="fees" step="1" min="0" required tabindex="6" #fees="ngModel">
<mat-error *ngIf="!transaction.fees">Fees is required.</mat-error>
</mat-form-field> </mat-form-field>
</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" (click)="resetData()">Clear Fields</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="8" (click)="onSendFunds()">Send Funds</button>
[disabled]="invalidValues" type="submit" tabindex="8" (click)="onSendFunds()">
<p *ngIf="invalidValues && (address.touched || address.dirty) && (amount.touched || amount.dirty); else sendText">
Invalid Values</p>
<ng-template #sendText>
<p>Send Funds</p>
</ng-template>
</button>
</div> </div>
</div> </form>
<ng-template #sweepAllBlock> <ng-template #sweepAllBlock>
<div 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">
<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" #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-form-field> </mat-form-field>
<mat-form-field fxFlex.gt-sm="20"> <mat-form-field fxFlex.gt-sm="20">
<mat-select [(value)]="selTransType" tabindex="4"> <mat-select [(value)]="selTransType" tabindex="4">
@ -54,19 +52,18 @@
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex.gt-sm="20" fxLayoutAlign="start end" *ngIf="selTransType=='1'"> <mat-form-field fxFlex.gt-sm="20" fxLayoutAlign="start end" *ngIf="selTransType=='1'">
<input matInput [(ngModel)]="transaction.blocks" placeholder="Number of Blocks" type="number" name="blocks" step="1" min="0" required tabindex="5" #blocks="ngModel"> <input matInput [(ngModel)]="transaction.blocks" placeholder="Number of Blocks" type="number" name="blocks" step="1" min="0" required tabindex="5" #blocks="ngModel">
<mat-error *ngIf="!transaction.blocks">Number of blocks is required.</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex.gt-sm="20" fxLayoutAlign="start end" *ngIf="selTransType=='2'"> <mat-form-field fxFlex.gt-sm="20" fxLayoutAlign="start end" *ngIf="selTransType=='2'">
<input matInput [(ngModel)]="transaction.fees" placeholder="Fee ({{nodeData?.smaller_currency_unit}}/Byte)" type="number" name="fees" step="1" min="0" required tabindex="6" #feesSweep="ngModel"> <input matInput [(ngModel)]="transaction.fees" placeholder="Fees ({{nodeData?.smaller_currency_unit}}/Byte)" type="number" name="fees" step="1" min="0" required tabindex="6" #feesSweep="ngModel">
<mat-error *ngIf="!transaction.fees">Fees is required.</mat-error>
</mat-form-field> </mat-form-field>
</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" (click)="resetData()">Clear Fields</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" [disabled]="invalidValues" type="submit" tabindex="8" (click)="onSendFunds()"> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="8" (click)="onSendFunds()">Send Funds</button>
<p *ngIf="invalidValues && (addressSweep.touched || addressSweep.dirty); else sendTextSweep">Invalid Values</p>
<ng-template #sendTextSweep><p>Send Funds</p></ng-template>
</button>
</div> </div>
</div> </div>
</div> </form>
</ng-template> </ng-template>

@ -66,6 +66,8 @@ export class OnChainSendComponent implements OnInit, OnDestroy {
} }
onSendFunds() { onSendFunds() {
console.warn('ON SEND');
if(this.invalidValues) { return true; }
if(this.transaction.amount && this.selAmountUnit !== CurrencyUnitEnum.SATS) { if(this.transaction.amount && this.selAmountUnit !== CurrencyUnitEnum.SATS) {
this.commonService.convertCurrency(this.transaction.amount, this.selAmountUnit === this.amountUnits[2] ? CurrencyUnitEnum.OTHER : this.selAmountUnit, this.amountUnits[2]) this.commonService.convertCurrency(this.transaction.amount, this.selAmountUnit === this.amountUnits[2] ? CurrencyUnitEnum.OTHER : this.selAmountUnit, this.amountUnits[2])
.pipe(takeUntil(this.unSubs[1])) .pipe(takeUntil(this.unSubs[1]))
@ -146,8 +148,8 @@ export class OnChainSendComponent implements OnInit, OnDestroy {
} }
get invalidValues(): boolean { get invalidValues(): boolean {
return (this.transaction.address === '') || (this.transaction.amount <= 0) return (!this.transaction.address || this.transaction.address === '') || (!this.transaction.amount || this.transaction.amount <= 0)
|| (this.selTransType === '1' && this.transaction.blocks && this.transaction.blocks <= 0) || (this.selTransType === '2' && this.transaction.fees && this.transaction.fees <= 0); || (this.selTransType === '1' && (!this.transaction.blocks || this.transaction.blocks <= 0)) || (this.selTransType === '2' && (!this.transaction.fees || this.transaction.fees <= 0));
} }
resetData() { resetData() {

@ -1,5 +1,5 @@
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch" class="padding-gap"> <div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch" class="padding-gap">
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap"> <form fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap">
<mat-form-field fxFlex="40" fxFlex.gt-sm="30" fxLayoutAlign="start end"> <mat-form-field fxFlex="40" fxFlex.gt-sm="30" fxLayoutAlign="start end">
<mat-select [(ngModel)]="selectedPeer" placeholder="Alias" name="peer_alias" tabindex="1" required name="selPeer" #selPeer="ngModel"> <mat-select [(ngModel)]="selectedPeer" placeholder="Alias" name="peer_alias" tabindex="1" required name="selPeer" #selPeer="ngModel">
<mat-option (click)="addNewPeer()" [value]="'new'"> <mat-option (click)="addNewPeer()" [value]="'new'">
@ -9,11 +9,14 @@
{{peer.alias}} {{peer.alias}}
</mat-option> </mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="!selectedPeer">Alias is required.</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="25" fxFlex.gt-sm="30" fxLayoutAlign="start end"> <mat-form-field fxFlex="25" fxFlex.gt-sm="30" fxLayoutAlign="start end">
<input matInput [(ngModel)]="fundingAmount" placeholder="Amount" type="number" step="1000" min="1" tabindex="2" required name="amount" #amount="ngModel"> <input matInput [(ngModel)]="fundingAmount" placeholder="Amount" type="number" step="1000" min="1" tabindex="2" required name="amount" #amount="ngModel" nonNegativeAmount="{{totalBalance}}">
<mat-hint>(Wallet Bal: {{totalBalance}}, Remaining Bal: {{totalBalance - ((fundingAmount) ? fundingAmount : 0)}})</mat-hint> <mat-hint>(Wallet Bal: {{totalBalance}}, Remaining Bal: {{totalBalance - ((fundingAmount) ? fundingAmount : 0)}})</mat-hint>
<span matSuffix> {{information?.smaller_currency_unit | titlecase}} </span> <span matSuffix> {{information?.smaller_currency_unit | titlecase}} </span>
<mat-error *ngIf="!fundingAmount">Amount is required.</mat-error>
<mat-error *ngIf="amount.errors?.negative">Amount must be less than or equal to {{totalBalance}}.</mat-error>
</mat-form-field> </mat-form-field>
<div fxFlex="15" fxFlex.gt-sm="20" fxLayoutAlign="start center" [ngClass]="{'mt-2': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}"> <div fxFlex="15" fxFlex.gt-sm="20" fxLayoutAlign="start center" [ngClass]="{'mt-2': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}">
<mat-slide-toggle tabindex="3" color="primary" [(ngModel)]="isPrivate" name="isPrivate">Private Channel</mat-slide-toggle> <mat-slide-toggle tabindex="3" color="primary" [(ngModel)]="isPrivate" name="isPrivate">Private Channel</mat-slide-toggle>
@ -37,9 +40,11 @@
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="33" *ngIf="selTransType=='1'"> <mat-form-field fxFlex="33" *ngIf="selTransType=='1'">
<input matInput [(ngModel)]="transTypeValue.blocks" placeholder="Target Confirmation Blocks" type="number" name="blocks" step="1" min="0" required tabindex="7" #blocks="ngModel"> <input matInput [(ngModel)]="transTypeValue.blocks" placeholder="Target Confirmation Blocks" type="number" name="blocks" step="1" min="0" required tabindex="7" #blocks="ngModel">
<mat-error *ngIf="!transTypeValue.blocks">Target confirmation blocks is required.</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="33" *ngIf="selTransType=='2'"> <mat-form-field fxFlex="33" *ngIf="selTransType=='2'">
<input matInput [(ngModel)]="transTypeValue.fees" placeholder="Fee ({{information?.smaller_currency_unit}}/Byte)" type="number" name="fees" step="1" min="0" required tabindex="8" #fees="ngModel"> <input matInput [(ngModel)]="transTypeValue.fees" placeholder="Fees ({{information?.smaller_currency_unit}}/Byte)" type="number" name="fees" step="1" min="0" required tabindex="8" #fees="ngModel">
<mat-error *ngIf="!transTypeValue.fees">Fees is required.</mat-error>
</mat-form-field> </mat-form-field>
<div fxFlex="32" fxLayoutAlign="start center" [ngClass]="{'my-2': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}"> <div fxFlex="32" fxLayoutAlign="start center" [ngClass]="{'my-2': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}">
<mat-slide-toggle tabindex="9" color="primary" [(ngModel)]="spendUnconfirmed" name="spendUnconfirmed">Spend Unconfirmed Output</mat-slide-toggle> <mat-slide-toggle tabindex="9" color="primary" [(ngModel)]="spendUnconfirmed" name="spendUnconfirmed">Spend Unconfirmed Output</mat-slide-toggle>
@ -47,12 +52,9 @@
</div> </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="10" type="reset" (click)="resetData()">Clear Field</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="10" type="reset" (click)="resetData()">Clear Field</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" (click)="onOpenChannel()" [disabled]="selectedPeer === '' || fundingAmount == null || (totalBalance - ((fundingAmount) ? fundingAmount : 0) < 0)" type="submit" tabindex="11"> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" (click)="onOpenChannel()" type="submit" tabindex="11">Open Channel</button>
<p *ngIf="(selectedPeer === '' || fundingAmount == null) && (selPeer.touched || selPeer.dirty) && (amount.touched || amount.dirty); else openText">Invalid Values</p>
<ng-template #openText><p>Open Channel</p></ng-template>
</button>
</div> </div>
</div> </form>
<rtl-channels-tables fxLayout="row" fxFlex="100"></rtl-channels-tables> <rtl-channels-tables fxLayout="row" fxFlex="100"></rtl-channels-tables>
</div> </div>

@ -70,6 +70,7 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
} }
onOpenChannel() { onOpenChannel() {
if (!this.selectedPeer || this.selectedPeer === '' || !this.fundingAmount || (this.totalBalance - ((this.fundingAmount) ? this.fundingAmount : 0) < 0)) { return true; }
this.store.dispatch(new RTLActions.OpenSpinner('Opening Channel...')); this.store.dispatch(new RTLActions.OpenSpinner('Opening Channel...'));
let transTypeValue = '0'; let transTypeValue = '0';
if (this.selTransType === '1') { if (this.selTransType === '1') {
@ -138,6 +139,8 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
this.connectPeerWithParams(pubkey, host); this.connectPeerWithParams(pubkey, host);
}); });
} }
} else {
this.selectedPeer = '';
} }
}); });
} }

@ -2,13 +2,11 @@
<form fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap" #peersForm="ngForm"> <form fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap" #peersForm="ngForm">
<mat-form-field fxFlex="100" fxLayoutAlign="start end"> <mat-form-field fxFlex="100" fxLayoutAlign="start end">
<input matInput placeholder="Lightning Address (pubkey OR pubkey@ip:port)" name="peerAddress" [(ngModel)]="peerAddress" tabindex="1" required #peerAdd="ngModel"> <input matInput placeholder="Lightning Address (pubkey OR pubkey@ip:port)" name="peerAddress" [(ngModel)]="peerAddress" tabindex="1" required #peerAdd="ngModel">
<mat-error *ngIf="!peerAddress">Lightning address is required.</mat-error>
</mat-form-field> </mat-form-field>
<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="2" type="reset" (click)="resetData()">Clear Field</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="2" type="reset" (click)="resetData()">Clear Field</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" [disabled]="peerAdd.invalid" type="submit" tabindex="3" (click)="onConnectPeer()"> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="3" (click)="onConnectPeer()">Add Peer</button>
<p *ngIf="peerAdd.invalid && (peerAdd.dirty || peerAdd.touched); else connectText">Invalid Address</p>
<ng-template #connectText><p>Add Peer</p></ng-template>
</button>
</div> </div>
</form> </form>
<div fxLayout="column"> <div fxLayout="column">

@ -100,11 +100,7 @@ export class PeersComponent implements OnInit, OnDestroy {
} }
onConnectPeer() { onConnectPeer() {
// if(!this.peerAddress) { if(!this.peerAddress) { return true; }
// // this.store.dispatch(new RTLActions.OpenAlert({ data: { type: AlertTypeEnum.ERROR, alertTitle: 'Error', message: { code: 'Invalid values', message: 'invalid or empty address.' }, component: ErrorMessageComponent}}));
// this.store.dispatch(new RTLActions.OpenSnackBar('Error: invalid or empty address.'));
// return true;
// }
const pattern = '^([a-zA-Z0-9]){1,66}@(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):[0-9]+$'; const pattern = '^([a-zA-Z0-9]){1,66}@(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):[0-9]+$';
const deviderIndex = this.peerAddress.search('@'); const deviderIndex = this.peerAddress.search('@');
let pubkey = ''; let pubkey = '';

@ -6,7 +6,7 @@
<div fxLayout="row" fxFlex="100" fxLayoutAlign="start start" class="padding-gap-x"> <div fxLayout="row" fxFlex="100" fxLayoutAlign="start start" class="padding-gap-x">
<mat-card fxLayout="row" fxFlex="100" fxLayoutAlign="start start"> <mat-card fxLayout="row" fxFlex="100" fxLayoutAlign="start start">
<mat-card-content fxLayout="column" fxFlex="100" fxLayoutAlign="start start" class="card-content-gap mt-1"> <mat-card-content fxLayout="column" fxFlex="100" fxLayoutAlign="start start" class="card-content-gap mt-1">
<form fxFlex="100" fxLayout="column" fxLayout.gt-sm="row wrap" fxLayoutAlign.gt-sm="space-between center" fxLayoutAlign="start stretch" class="w-100 mb-1" (ngSubmit)="routingForm.form.valid && onEventsFetch()" #routingForm="ngForm"> <form fxFlex="100" fxLayout="column" fxLayout.gt-sm="row wrap" fxLayoutAlign.gt-sm="space-between center" fxLayoutAlign="start stretch" class="w-100 mb-1" (ngSubmit)="onEventsFetch()" #routingForm="ngForm">
<div fxFlex="100" fxLayoutAlign="space-between stretch"> <div fxFlex="100" fxLayoutAlign="space-between stretch">
<mat-form-field fxFlex="49" fxLayoutAlign="start"> <mat-form-field fxFlex="49" fxLayoutAlign="start">
<input matInput [matDatepicker]="startDatepicker" placeholder="Start Date" [max]="yesterday" <input matInput [matDatepicker]="startDatepicker" placeholder="Start Date" [max]="yesterday"
@ -23,7 +23,7 @@
</div> </div>
<div fxFlex="30" fxLayoutAlign="space-between stretch" class="mt-2"> <div fxFlex="30" fxLayoutAlign="space-between stretch" class="mt-2">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="3" type="reset" (click)="resetData()">Clear</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="3" type="reset" (click)="resetData()">Clear</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" [disabled]="routingForm.invalid" type="submit" tabindex="4">Fetch Events</button> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="4">Fetch Events</button>
</div> </div>
</form> </form>
<div fxLayout="row" fxFlex="100" [ngClass]="{'error-border w-100 routing-tabs-block': flgLoading[0]==='error', 'w-100 routing-tabs-block': true}"> <div fxLayout="row" fxFlex="100" [ngClass]="{'error-border w-100 routing-tabs-block': flgLoading[0]==='error', 'w-100 routing-tabs-block': true}">

@ -483,28 +483,28 @@ export class LNDEffects implements OnDestroy {
pendingChannels.closing.num_channels = channels.pending_closing_channels.length; pendingChannels.closing.num_channels = channels.pending_closing_channels.length;
pendingChannels.total_channels = pendingChannels.total_channels + channels.pending_closing_channels.length; pendingChannels.total_channels = pendingChannels.total_channels + channels.pending_closing_channels.length;
channels.pending_closing_channels.forEach(closingChannel => { channels.pending_closing_channels.forEach(closingChannel => {
pendingChannels.closing.limbo_balance = +pendingChannels.closing.limbo_balance + +closingChannel.channel.local_balance; pendingChannels.closing.limbo_balance = +pendingChannels.closing.limbo_balance + (closingChannel.channel.local_balance ? +closingChannel.channel.local_balance : 0);
}); });
} }
if (channels.pending_force_closing_channels) { if (channels.pending_force_closing_channels) {
pendingChannels.force_closing.num_channels = channels.pending_force_closing_channels.length; pendingChannels.force_closing.num_channels = channels.pending_force_closing_channels.length;
pendingChannels.total_channels = pendingChannels.total_channels + channels.pending_force_closing_channels.length; pendingChannels.total_channels = pendingChannels.total_channels + channels.pending_force_closing_channels.length;
channels.pending_force_closing_channels.forEach(closingChannel => { channels.pending_force_closing_channels.forEach(closingChannel => {
pendingChannels.force_closing.limbo_balance = +pendingChannels.force_closing.limbo_balance + +closingChannel.channel.local_balance; pendingChannels.force_closing.limbo_balance = +pendingChannels.force_closing.limbo_balance + (closingChannel.channel.local_balance ? +closingChannel.channel.local_balance : 0);
}); });
} }
if (channels.pending_open_channels) { if (channels.pending_open_channels) {
pendingChannels.open.num_channels = channels.pending_open_channels.length; pendingChannels.open.num_channels = channels.pending_open_channels.length;
pendingChannels.total_channels = pendingChannels.total_channels + channels.pending_open_channels.length; pendingChannels.total_channels = pendingChannels.total_channels + channels.pending_open_channels.length;
channels.pending_open_channels.forEach(openingChannel => { channels.pending_open_channels.forEach(openingChannel => {
pendingChannels.open.limbo_balance = +pendingChannels.open.limbo_balance + +openingChannel.channel.local_balance; pendingChannels.open.limbo_balance = +pendingChannels.open.limbo_balance + (openingChannel.channel.local_balance ? +openingChannel.channel.local_balance : 0);
}); });
} }
if (channels.waiting_close_channels) { if (channels.waiting_close_channels) {
pendingChannels.waiting_close.num_channels = channels.waiting_close_channels.length; pendingChannels.waiting_close.num_channels = channels.waiting_close_channels.length;
pendingChannels.total_channels = pendingChannels.total_channels + channels.waiting_close_channels.length; pendingChannels.total_channels = pendingChannels.total_channels + channels.waiting_close_channels.length;
channels.waiting_close_channels.forEach(closingChannel => { channels.waiting_close_channels.forEach(closingChannel => {
pendingChannels.waiting_close.limbo_balance = +pendingChannels.waiting_close.limbo_balance + +closingChannel.channel.local_balance; pendingChannels.waiting_close.limbo_balance = +pendingChannels.waiting_close.limbo_balance + (closingChannel.channel.local_balance ? +closingChannel.channel.local_balance : 0);
}); });
} }
} }

@ -13,7 +13,7 @@
<span matSuffix> {{selTimeUnit | titlecase}} </span> <span matSuffix> {{selTimeUnit | titlecase}} </span>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="15" fxLayoutAlign="start end" *ngIf="showDetails" [ngClass]="{'mr-2': screenSize === screenSizeEnum.LG}"> <mat-form-field fxFlex="15" fxLayoutAlign="start end" *ngIf="showDetails" [ngClass]="{'mr-2': screenSize === screenSizeEnum.LG}">
<mat-select [value]="selTimeUnit" tabindex="4" required name="timeUnit" (selectionChange)="onTimeUnitChange($event)"> <mat-select [value]="selTimeUnit" tabindex="4" name="timeUnit" (selectionChange)="onTimeUnitChange($event)">
<mat-option *ngFor="let timeUnit of timeUnits" [value]="timeUnit">{{timeUnit | titlecase}}</mat-option> <mat-option *ngFor="let timeUnit of timeUnits" [value]="timeUnit">{{timeUnit | titlecase}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -22,17 +22,11 @@
</div> </div>
<div fxLayout="row" fxFlex="100" fxFlex.gt-sm="30" fxLayoutAlign="space-between start" *ngIf="showDetails" class="mt-2"> <div fxLayout="row" fxFlex="100" fxFlex.gt-sm="30" fxLayoutAlign="space-between start" *ngIf="showDetails" class="mt-2">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="5" type="reset" (click)="resetData()">Clear Field</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="5" type="reset" (click)="resetData()">Clear Field</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" [disabled]="addInvoiceForm.form.invalid" (click)="onAddInvoice(addInvoiceForm)" tabindex="6"> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" (click)="onAddInvoice(addInvoiceForm)" tabindex="6">Create Invoice</button>
<p *ngIf="addInvoiceForm.form.invalid; else createText">Invalid values</p>
<ng-template #createText><p>Create Invoice</p></ng-template>
</button>
</div> </div>
<div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between stretch" *ngIf="!showDetails"> <div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between stretch" *ngIf="!showDetails" class="mt-1">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="5" type="reset" (click)="resetData()">Clear Field</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="5" type="reset" (click)="resetData()">Clear Field</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" [disabled]="addInvoiceForm.form.invalid" (click)="onAddInvoice(addInvoiceForm)" tabindex="6"> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" (click)="onAddInvoice(addInvoiceForm)" tabindex="6">Create Invoice</button>
<p *ngIf="addInvoiceForm.form.invalid; else createText">Invalid values</p>
<ng-template #createText><p>Create Invoice</p></ng-template>
</button>
</div> </div>
</form> </form>
<div fxLayout="column" fxLayoutAlign="start stretch" *ngIf="showDetails"> <div fxLayout="column" fxLayoutAlign="start stretch" *ngIf="showDetails">

@ -3,20 +3,15 @@
<mat-form-field class="w-100"> <mat-form-field class="w-100">
<input matInput placeholder="Payment Request" name="paymentRequest" [(ngModel)]="paymentRequest" tabindex="1" (keyup)="onPaymentRequestEntry()" required #paymentReq="ngModel"> <input matInput placeholder="Payment Request" name="paymentRequest" [(ngModel)]="paymentRequest" tabindex="1" (keyup)="onPaymentRequestEntry()" required #paymentReq="ngModel">
<mat-hint *ngIf="paymentRequest && paymentDecodedHint !== ''">{{paymentDecodedHint}}</mat-hint> <mat-hint *ngIf="paymentRequest && paymentDecodedHint !== ''">{{paymentDecodedHint}}</mat-hint>
<mat-error *ngIf="!paymentRequest">Payment request is required.</mat-error>
</mat-form-field> </mat-form-field>
<div fxLayout="row" fxFlex="100" fxFlex.gt-sm="30" fxLayoutAlign="space-between stretch" *ngIf="showDetails" class="mt-2"> <div fxLayout="row" fxFlex="100" fxFlex.gt-sm="30" fxLayoutAlign="space-between stretch" *ngIf="showDetails" class="mt-2">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="2" type="reset" (click)="resetData()">Clear Field</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="2" type="reset" (click)="resetData()">Clear Field</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" [disabled]="paymentReq.invalid" (click)="onSendPayment();" tabindex="3"> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" (click)="onSendPayment();" tabindex="3">Send Payment</button>
<p *ngIf="paymentReq.invalid && (paymentReq.dirty || paymentReq.touched); else sendText">Invalid Req</p>
<ng-template #sendText><p>Send Payment</p></ng-template>
</button>
</div> </div>
<div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between stretch" *ngIf="!showDetails"> <div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between stretch" *ngIf="!showDetails" class="mt-1">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="2" type="reset" (click)="resetData()">Clear Field</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="2" type="reset" (click)="resetData()">Clear Field</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" [disabled]="paymentReq.invalid" (click)="onSendPayment();" tabindex="3"> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" (click)="onSendPayment();" tabindex="3">Send Payment</button>
<p *ngIf="paymentReq.invalid && (paymentReq.dirty || paymentReq.touched); else sendText">Invalid Req</p>
<ng-template #sendText><p>Send Payment</p></ng-template>
</button>
</div> </div>
</form> </form>
<div fxLayout="column" fxLayoutAlign="start stretch" [ngClass]="{'display-none': !showDetails}"> <div fxLayout="column" fxLayoutAlign="start stretch" [ngClass]="{'display-none': !showDetails}">

@ -94,6 +94,8 @@ export class LightningPaymentsComponent implements OnInit, OnDestroy {
} }
onSendPayment() { onSendPayment() {
console.warn('SEND PAYMENT');
if(!this.paymentRequest) { return true; }
if (undefined !== this.paymentDecoded.timestamp_str) { if (undefined !== this.paymentDecoded.timestamp_str) {
this.sendPayment(); this.sendPayment();
} else { } else {

@ -2,16 +2,15 @@
<form fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap" (ngSubmit)="queryRoutesForm.form.valid && onQueryRoutes()" #queryRoutesForm="ngForm"> <form fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap" (ngSubmit)="queryRoutesForm.form.valid && onQueryRoutes()" #queryRoutesForm="ngForm">
<mat-form-field fxFlex="69" fxLayoutAlign="start end"> <mat-form-field fxFlex="69" fxLayoutAlign="start end">
<input matInput placeholder="Destination Pubkey" name="destinationPubkey" [(ngModel)]="destinationPubkey" tabindex="1" required #destPubkey="ngModel"> <input matInput placeholder="Destination Pubkey" name="destinationPubkey" [(ngModel)]="destinationPubkey" tabindex="1" required #destPubkey="ngModel">
<mat-error *ngIf="!destinationPubkey">Destination pubkey is required.</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="29" fxLayoutAlign="start end"> <mat-form-field fxFlex="29" fxLayoutAlign="start end">
<input matInput placeholder="Amount (Sats)" name="amount" [(ngModel)]="amount" tabindex="2" type="number" step="1000" min="0" required #destAmount="ngModel"> <input matInput placeholder="Amount (Sats)" name="amount" [(ngModel)]="amount" tabindex="2" type="number" step="1000" min="0" required #destAmount="ngModel">
<mat-error *ngIf="!amount">Amount is required.</mat-error>
</mat-form-field> </mat-form-field>
<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="3" type="reset" (click)="resetData()">Clear</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="3" type="reset" (click)="resetData()">Clear</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" [disabled]="destPubkey.invalid || destAmount.invalid" type="submit" tabindex="4"> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="4">Query Route</button>
<p *ngIf="(destPubkey.invalid && (destPubkey.dirty || destPubkey.touched) || (destAmount.invalid && (destAmount.dirty || destAmount.touched))); else queryText">Invalid Pubkey/Amount</p>
<ng-template #queryText><p>Query Route</p></ng-template>
</button>
</div> </div>
</form> </form>
<div fxLayout="row" fxLayoutAlign="start center" class="padding-gap-x page-sub-title-container mt-2"> <div fxLayout="row" fxLayoutAlign="start center" class="padding-gap-x page-sub-title-container mt-2">

@ -66,6 +66,7 @@ export class QueryRoutesComponent implements OnInit, OnDestroy {
} }
onQueryRoutes() { onQueryRoutes() {
if(!this.destinationPubkey || !this.amount) { return true; }
this.flgLoading[0] = true; this.flgLoading[0] = true;
this.store.dispatch(new RTLActions.GetQueryRoutes({destPubkey: this.destinationPubkey, amount: this.amount})); this.store.dispatch(new RTLActions.GetQueryRoutes({destPubkey: this.destinationPubkey, amount: this.amount}));
} }

@ -20,37 +20,37 @@
<mat-form-field fxFlex="49" fxLayoutAlign="start"> <mat-form-field fxFlex="49" fxLayoutAlign="start">
<input matInput type="password" placeholder="Password" name="initWalletPassword" formControlName="initWalletPassword" tabindex="5" required> <input matInput type="password" placeholder="Password" name="initWalletPassword" formControlName="initWalletPassword" tabindex="5" required>
<mat-hint>Enter Wallet Password</mat-hint> <mat-hint>Enter Wallet Password</mat-hint>
<mat-error *ngIf="passwordFormGroup.controls.initWalletPassword.errors?.required">Password is required.</mat-error>
<mat-error *ngIf="passwordFormGroup.controls.initWalletPassword.errors?.minlength">Password must be at least 8 characters in length.</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="49" fxLayoutAlign="start"> <mat-form-field fxFlex="49" fxLayoutAlign="start">
<input matInput type="password" placeholder="Confirm Password" name="initWalletConfirmPassword" formControlName="initWalletConfirmPassword" tabindex="6" required> <input matInput type="password" placeholder="Confirm Password" name="initWalletConfirmPassword" formControlName="initWalletConfirmPassword" tabindex="6" required>
<mat-hint>Confirm Wallet Password</mat-hint> <mat-hint>Confirm Wallet Password ({{passwordFormGroup.errors?.unmatchedPasswords}})</mat-hint>
<mat-error *ngIf="passwordFormGroup.controls.initWalletConfirmPassword.errors?.required">Confirm password is required.</mat-error>
<mat-error *ngIf="passwordFormGroup.controls.initWalletConfirmPassword.errors?.minlength">Confirm password must be at least 8 characters in length.</mat-error>
</mat-form-field> </mat-form-field>
<div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between center" class="my-2">
<button mat-raised-button color="primary" fxFlex="100" fxFlex.gt-xs="50" fxFlex.gt-md="25" [disabled]="!passwordFormGroup.valid" tabindex="7" type="submit" matStepperNext>Next</button>
</div>
<div *ngIf="passwordFormGroup.controls.initWalletPassword.errors?.minlength && (passwordFormGroup.controls.initWalletPassword.touched || passwordFormGroup.controls.initWalletPassword.dirty)" class="validation-error-message">
<mat-icon class="validation-error-icon red">cancel</mat-icon>Password must be at least 8 characters in length.
</div>
<div *ngIf="passwordFormGroup.errors?.unmatchedPasswords && (passwordFormGroup.controls.initWalletPassword.touched || passwordFormGroup.controls.initWalletPassword.dirty) && (passwordFormGroup.controls.initWalletConfirmPassword.touched || passwordFormGroup.controls.initWalletConfirmPassword.dirty)" class="validation-error-message"> <div *ngIf="passwordFormGroup.errors?.unmatchedPasswords && (passwordFormGroup.controls.initWalletPassword.touched || passwordFormGroup.controls.initWalletPassword.dirty) && (passwordFormGroup.controls.initWalletConfirmPassword.touched || passwordFormGroup.controls.initWalletConfirmPassword.dirty)" class="validation-error-message">
<mat-icon class="validation-error-icon red">cancel</mat-icon>Passwords do not match. <mat-icon class="validation-error-icon red">cancel</mat-icon>Passwords do not match.
</div> </div>
<div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between center" class="my-2">
<button mat-raised-button color="primary" fxFlex="100" fxFlex.gt-xs="50" fxFlex.gt-md="25" tabindex="7" type="submit" matStepperNext>Next</button>
</div>
</form> </form>
</mat-step> </mat-step>
<mat-step [stepControl]="cipherFormGroup" label="Cipher" state="cipher"> <mat-step [stepControl]="cipherFormGroup" label="Cipher" state="cipher">
<form [formGroup]="cipherFormGroup" fxLayout="column" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start" class="mt-1"> <form [formGroup]="cipherFormGroup" fxLayout="column" fxLayout.gt-sm="row wrap" fxLayoutAlign="start stretch" fxLayoutAlign.gt-sm="space-between start" class="mt-1">
<div fxFlex="100" fxLayout="column" fxLayoutAlign="start stretch"> <div fxFlex="100" fxLayout="column" fxLayoutAlign="start stretch">
<mat-slide-toggle [labelPosition]="'before'" fxFlex="20" tabindex="8" color="primary" class="chkbox-wallet" formControlName="existingCipher" name="existingCipher">Existing Cipher</mat-slide-toggle> <mat-slide-toggle [labelPosition]="'before'" fxFlex="20" tabindex="8" color="primary" class="chkbox-wallet" formControlName="existingCipher" name="existingCipher">Existing Cipher</mat-slide-toggle>
<mat-form-field fxFlex="75" fxLayoutAlign="start"> <mat-form-field fxFlex="75" fxLayoutAlign="start" class="my-1">
<input matInput type="input" placeholder="Comma separated array of 24 words cipher seed" name="cipherSeed" formControlName="cipherSeed" tabindex="9" required> <input autofocus matInput type="input" placeholder="Comma separated array of 24 words cipher seed" name="cipherSeed" formControlName="cipherSeed" tabindex="9" required>
<mat-hint>Cipher Seed</mat-hint> <mat-hint>Cipher Seed</mat-hint>
<mat-error *ngIf="cipherFormGroup.controls.cipherSeed.errors?.required">Cipher seed is required.</mat-error>
<mat-error *ngIf="!cipherFormGroup.controls.cipherSeed.errors?.required && cipherFormGroup.controls.cipherSeed.errors?.invalidCipher">Invalid Cipher. Enter comma separated 24 words cipher seed.</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxLayout.lt-sm="column" fxLayout="row wrap" fxFlex="100" fxFlex.gt-md="40" fxLayoutAlign="space-between space-between" class="mb-2"> <div fxLayout.lt-sm="column" fxLayout="row wrap" fxFlex="100" fxFlex.gt-md="40" fxLayoutAlign="space-between space-between" class="mb-2">
<button mat-stroked-button color="primary" fxFlex="48" type="reset" tabindex="10" matStepperPrevious class="mt-1">Back</button> <button mat-stroked-button color="primary" fxFlex="48" type="reset" tabindex="10" matStepperPrevious class="mt-1">Back</button>
<button mat-raised-button color="primary" fxFlex="48" [disabled]="!cipherFormGroup.valid" tabindex="11" type="submit" matStepperNext class="mt-1">Next</button> <button mat-raised-button color="primary" fxFlex="48" tabindex="11" type="submit" matStepperNext class="mt-1">Next</button>
</div>
<div *ngIf="cipherFormGroup.errors?.invalidCipher && cipherFormGroup.controls.existingCipher.value && (cipherFormGroup.controls.cipherSeed.touched || cipherFormGroup.controls.cipherSeed.dirty)" class="validation-error-message">
<mat-icon class="validation-error-icon red">cancel</mat-icon>Invalid Cipher. Enter comma separated 24 words cipher seed.
</div> </div>
</form> </form>
</mat-step> </mat-step>
@ -61,12 +61,13 @@
<mat-form-field fxFlex="75" fxLayoutAlign="start"> <mat-form-field fxFlex="75" fxLayoutAlign="start">
<input matInput type="input" type="password" placeholder="Passphrase" name="passphrase" formControlName="passphrase" tabindex="12" required> <input matInput type="input" type="password" placeholder="Passphrase" name="passphrase" formControlName="passphrase" tabindex="12" required>
<mat-hint>Enter Passphrase</mat-hint> <mat-hint>Enter Passphrase</mat-hint>
<mat-error *ngIf="passphraseFormGroup.controls.passphrase.errors?.required">Passphrase is required.</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxLayout.lt-sm="column" fxLayout="row wrap" fxFlex="100" fxFlex.gt-md="40" fxLayoutAlign="space-between space-between" class="mb-2"> <div fxLayout.lt-sm="column" fxLayout="row wrap" fxFlex="100" fxFlex.gt-md="40" fxLayoutAlign="space-between space-between" class="mb-2">
<button fxFlex="48" fxFlex.gt-sm="32" fxLayoutAlign="center center" mat-stroked-button color="warn" tabindex="13" type="reset" (click)="resetData()" class="mt-1">Clear</button> <button fxFlex="48" fxFlex.gt-sm="32" fxLayoutAlign="center center" mat-stroked-button color="warn" tabindex="13" type="reset" (click)="resetData()" class="mt-1">Clear</button>
<button mat-stroked-button fxFlex="48" fxFlex.gt-sm="32" tabindex="14" color="primary" type="button" matStepperPrevious class="mt-1">Back</button> <button mat-stroked-button fxFlex="48" fxFlex.gt-sm="32" tabindex="14" color="primary" type="button" matStepperPrevious class="mt-1">Back</button>
<button mat-raised-button fxFlex="100" fxFlex.gt-sm="32" color="primary" [disabled]="!passphraseFormGroup.valid" (click)="onInitWallet()" tabindex="15" type="submit" class="mt-1">Initialize Wallet</button> <button mat-raised-button fxFlex="100" fxFlex.gt-sm="32" color="primary" (click)="onInitWallet()" tabindex="15" type="submit" class="mt-1">Initialize Wallet</button>
</div> </div>
</form> </form>
</mat-step> </mat-step>

@ -18,10 +18,8 @@ export const matchedPasswords: ValidatorFn = (control: FormGroup): ValidationErr
}; };
export const cipherSeedLength: ValidatorFn = (control: FormGroup): ValidationErrors | null => { export const cipherSeedLength: ValidatorFn = (control: FormGroup): ValidationErrors | null => {
const existingCipher = control.get('existingCipher'); const cipherArr = control.value ? control.value.toString().trim().split(',') : [];
const cipherSeed = control.get('cipherSeed'); return cipherArr && cipherArr.length !== 24 ? { 'invalidCipher': true } : null;
const cipherArr = cipherSeed.value.toString().trim().split(',');
return existingCipher.value && cipherArr && cipherArr.length !== 24 ? { 'invalidCipher': true } : null;
}; };
@Component({ @Component({
@ -53,8 +51,8 @@ export class InitializeWalletComponent implements OnInit, OnDestroy {
}, {validators: matchedPasswords}); }, {validators: matchedPasswords});
this.cipherFormGroup = this.formBuilder.group({ this.cipherFormGroup = this.formBuilder.group({
existingCipher: [false], existingCipher: [false],
cipherSeed: [{value: '', disabled: true}] cipherSeed: [{value: '', disabled: true}, [cipherSeedLength]]
}, {validators: cipherSeedLength}); });
this.passphraseFormGroup = this.formBuilder.group({ this.passphraseFormGroup = this.formBuilder.group({
enterPassphrase: [false], enterPassphrase: [false],
passphrase: [{value: '', disabled: true}] passphrase: [{value: '', disabled: true}]
@ -109,6 +107,7 @@ export class InitializeWalletComponent implements OnInit, OnDestroy {
} }
onInitWallet() { onInitWallet() {
if (this.passwordFormGroup.invalid || this.cipherFormGroup.invalid || this.passphraseFormGroup.invalid) { return true; }
this.store.dispatch(new RTLActions.OpenSpinner('Initializing...')); this.store.dispatch(new RTLActions.OpenSpinner('Initializing...'));
if (this.cipherFormGroup.controls.existingCipher.value) { if (this.cipherFormGroup.controls.existingCipher.value) {
const cipherArr = this.cipherFormGroup.controls.cipherSeed.value.toString().trim().split(','); const cipherArr = this.cipherFormGroup.controls.cipherSeed.value.toString().trim().split(',');

@ -3,10 +3,11 @@
<mat-form-field fxFlex="100" fxLayoutAlign="start"> <mat-form-field fxFlex="100" fxLayoutAlign="start">
<input matInput type="password" placeholder="Password" name="walletPassword" [(ngModel)]="walletPassword" tabindex="1" required> <input matInput type="password" placeholder="Password" name="walletPassword" [(ngModel)]="walletPassword" tabindex="1" required>
<mat-hint>Enter Wallet Password</mat-hint> <mat-hint>Enter Wallet Password</mat-hint>
<mat-error *ngIf="!walletPassword">Wallet password is required.</mat-error>
</mat-form-field> </mat-form-field>
<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="2" type="reset" (click)="resetData()">Clear Field</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="2" type="reset" (click)="resetData()">Clear Field</button>
<button mat-raised-button fxFlex="48" color="primary" [disabled]="walletPassword == ''" (click)="onUnlockWallet()" tabindex="3">Unlock Wallet</button> <button mat-raised-button fxFlex="48" color="primary" type="submit" (click)="onUnlockWallet()" tabindex="3">Unlock Wallet</button>
</div> </div>
</form> </form>
</div> </div>

@ -18,6 +18,7 @@ export class UnlockWalletComponent implements OnInit {
} }
onUnlockWallet() { onUnlockWallet() {
if(!this.walletPassword) { return true; }
this.store.dispatch(new RTLActions.OpenSpinner('Unlocking...')); this.store.dispatch(new RTLActions.OpenSpinner('Unlocking...'));
this.store.dispatch(new RTLActions.UnlockWallet({pwd: window.btoa(this.walletPassword)})); this.store.dispatch(new RTLActions.UnlockWallet({pwd: window.btoa(this.walletPassword)}));
} }

@ -38,14 +38,12 @@
</div> </div>
</div> </div>
</div> </div>
<div fxLayout="row" fxLayoutAlign="end center" fxFlex="100"> <div fxLayout="row" fxLayoutAlign="end center">
<div fxFlex.lt-md="100" fxLayoutAlign="space-between"> <button *ngIf="(!showQRField || showQRField == '') && (showCopyName === '')" fxFlex="20" fxLayoutAlign="center center" tabindex="1" autoFocus mat-raised-button color="primary" type="submit" [mat-dialog-close]="false" default>OK</button>
<button *ngIf="(!showQRField || showQRField == '') && (showCopyName === '')" fxLayoutAlign="center center" tabindex="1" autoFocus mat-raised-button color="primary" type="submit" [mat-dialog-close]="false" default>OK</button> <button *ngIf="showCopyName !== ''" fxFlex="20" class="mr-2" fxLayoutAlign="center center" tabindex="1" mat-stroked-button color="primary" type="button" [mat-dialog-close]="false" default>Close</button>
<button *ngIf="showCopyName !== ''" fxLayoutAlign="center center" tabindex="1" mat-stroked-button color="primary" type="button" [mat-dialog-close]="false" default>Close</button> <button *ngIf="showCopyName !== ''" fxFlex="30" fxLayoutAlign="center center" autoFocus mat-raised-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="showCopyField" (copied)="onCopyField($event)">Copy {{showCopyName}}</button>
<button *ngIf="showCopyName !== ''" fxLayoutAlign="center center" autoFocus mat-raised-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="showCopyField" (copied)="onCopyField($event)">Copy {{showCopyName}}</button> <button *ngIf="showQRField !== ''" fxFlex="20" class="mr-2" fxLayoutAlign="center center" tabindex="1" class="mr-2" mat-stroked-button color="primary" type="button" [mat-dialog-close]="false" default>Close</button>
<button *ngIf="showQRField !== ''" fxLayoutAlign="center center" tabindex="1" class="mr-2" mat-stroked-button color="primary" type="button" [mat-dialog-close]="false" default>Close</button> <button *ngIf="showQRField !== ''" fxFlex="30" fxLayoutAlign="center center" autoFocus mat-raised-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="showQRField" (copied)="onCopyField($event)">Copy {{showQRName}}</button>
<button *ngIf="showQRField !== ''" fxLayoutAlign="center center" autoFocus mat-raised-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="showQRField" (copied)="onCopyField($event)">Copy {{showQRName}}</button>
</div>
</div> </div>
</div> </div>
</mat-card-content> </mat-card-content>

@ -7,11 +7,12 @@
<button tabindex="8" fxFlex="5" fxLayoutAlign="center" class="btn-close-x p-0" (click)="onClose(false)" mat-button>X</button> <button tabindex="8" fxFlex="5" fxLayoutAlign="center" class="btn-close-x p-0" (click)="onClose(false)" mat-button>X</button>
</mat-card-header> </mat-card-header>
<mat-card-content class="mt-5px"> <mat-card-content class="mt-5px">
<div fxLayout="column"> <form fxLayout="column">
<p *ngIf="data.titleMessage" fxLayoutAlign="start center" class="pb-1">{{data.titleMessage}}</p> <p *ngIf="data.titleMessage" fxLayoutAlign="start center" class="pb-1">{{data.titleMessage}}</p>
<div *ngIf="flgShowInput" fxLayoutAlign="space-between center"> <div *ngIf="flgShowInput" fxLayoutAlign="space-between center" class="mb-2">
<mat-form-field *ngFor="let getInput of getInputs; index as i" [fxFlex]="getInput.width"> <mat-form-field *ngFor="let getInput of getInputs; index as i" [fxFlex]="getInput.width">
<input matInput [placeholder]="getInput.placeholder" name="input{{i}}" [min]="getInput.min" [type]="getInput.inputType" [(ngModel)]="getInput.inputValue" [tabindex]="i+1" required> <input matInput [placeholder]="getInput.placeholder" name="input{{i}}" [min]="getInput.min" [type]="getInput.inputType" [(ngModel)]="getInput.inputValue" [tabindex]="i+1" required>
<mat-error *ngIf="!getInput.inputValue">{{getInput.placeholder}} is required.</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="messageObjs?.length>0"> <div *ngIf="messageObjs?.length>0">
@ -36,11 +37,11 @@
</div> </div>
</div> </div>
<div fxLayout="row" fxLayoutAlign="end center"> <div fxLayout="row" fxLayoutAlign="end center">
<button autoFocus mat-stroked-button color="primary" fxFlex="20" type="button" fxLayoutAlign="center center" class="mr-2" (click)="onClose(false)" tabindex="2" default>{{noBtnText}}</button> <button autoFocus mat-stroked-button color="primary" fxFlex="20" type="reset" fxLayoutAlign="center center" class="mr-2" (click)="onClose(false)" tabindex="2" default>{{noBtnText}}</button>
<button *ngIf="flgShowInput" mat-raised-button color="primary" fxLayoutAlign="center center" fxFlex="25" type="button" tabindex="3" (click)="onClose(getInputs)" [disabled]="!getInputs[0].inputValue">{{yesBtnText}}</button> <button *ngIf="flgShowInput" mat-raised-button color="primary" fxLayoutAlign="center center" fxFlex="25" type="submit" tabindex="3" (click)="onClose(getInputs)">{{yesBtnText}}</button>
<button *ngIf="!flgShowInput" mat-raised-button color="primary" fxLayoutAlign="center center" fxFlex="25" type="button" tabindex="4" (click)="onClose(true)">{{yesBtnText}}</button> <button *ngIf="!flgShowInput" mat-raised-button color="primary" fxLayoutAlign="center center" fxFlex="25" type="submit" tabindex="4" (click)="onClose(true)">{{yesBtnText}}</button>
</div> </div>
</div> </form>
</mat-card-content> </mat-card-content>
</div> </div>
</div> </div>

@ -40,6 +40,7 @@ export class ConfirmationMessageComponent implements OnInit {
} }
onClose(dialogRes: any) { onClose(dialogRes: any) {
if (dialogRes && this.getInputs.some(input => !input.inputValue)) { return true; }
this.store.dispatch(new RTLActions.CloseConfirmation(dialogRes)); this.store.dispatch(new RTLActions.CloseConfirmation(dialogRes));
} }
} }

@ -7,7 +7,7 @@
<button tabindex="8" fxFlex="5" fxLayoutAlign="center" class="btn-close-x p-0" (click)="onClose()" mat-button>X</button> <button tabindex="8" fxFlex="5" fxLayoutAlign="center" class="btn-close-x p-0" (click)="onClose()" mat-button>X</button>
</mat-card-header> </mat-card-header>
<mat-card-content class="mt-5px"> <mat-card-content class="mt-5px">
<div fxLayout="column"> <form fxLayout="column" (ngSubmit)="openChannelForm.form.valid && onOpenChannel()" #openChannelForm="ngForm">
<mat-expansion-panel class="flat-expansion-panel"> <mat-expansion-panel class="flat-expansion-panel">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
@ -47,9 +47,11 @@
</div> </div>
<div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between center" class="mt-1"> <div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between center" class="mt-1">
<mat-form-field fxFlex="60" fxLayoutAlign="start end"> <mat-form-field fxFlex="60" fxLayoutAlign="start end">
<input matInput [(ngModel)]="fundingAmount" placeholder="Amount" type="number" step="1000" min="1" max="{{totalBalance}}" tabindex="1" required name="amount" #amount="ngModel"> <input matInput [(ngModel)]="fundingAmount" placeholder="Amount" type="number" step="1000" min="1" max="{{totalBalance}}" tabindex="1" required name="amount" #amount="ngModel" nonNegativeAmount="{{totalBalance}}">
<mat-hint>(Remaining Bal: {{totalBalance - ((fundingAmount) ? fundingAmount : 0)}})</mat-hint> <mat-hint>(Remaining Bal: {{totalBalance - ((fundingAmount) ? fundingAmount : 0)}})</mat-hint>
<span matSuffix> {{information?.smaller_currency_unit}} </span> <span matSuffix> {{information?.smaller_currency_unit}} </span>
<mat-error *ngIf="!fundingAmount">Amount is required.</mat-error>
<mat-error *ngIf="amount.errors?.negative">Amount must be less than or equal to {{totalBalance}}.</mat-error>
</mat-form-field> </mat-form-field>
<div fxFlex="35" fxLayoutAlign="start center"> <div fxFlex="35" fxLayoutAlign="start center">
<mat-slide-toggle tabindex="2" color="primary" [(ngModel)]="isPrivate" name="isPrivate">Private Channel</mat-slide-toggle> <mat-slide-toggle tabindex="2" color="primary" [(ngModel)]="isPrivate" name="isPrivate">Private Channel</mat-slide-toggle>
@ -68,9 +70,11 @@
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="30" *ngIf="selTransType=='1'"> <mat-form-field fxFlex="30" *ngIf="selTransType=='1'">
<input matInput [(ngModel)]="transTypeValue.blocks" placeholder="Target Confirmation Blocks" type="number" name="blocks" step="1" min="0" required tabindex="4" #blocks="ngModel"> <input matInput [(ngModel)]="transTypeValue.blocks" placeholder="Target Confirmation Blocks" type="number" name="blocks" step="1" min="0" required tabindex="4" #blocks="ngModel">
<mat-error *ngIf="!transTypeValue.blocks">Target confirmation block is required.</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="30" *ngIf="selTransType=='2'"> <mat-form-field fxFlex="30" *ngIf="selTransType=='2'">
<input matInput [(ngModel)]="transTypeValue.fees" placeholder="Fee ({{information?.smaller_currency_unit}}/Byte)" type="number" name="fees" step="1" min="0" required tabindex="5" #fees="ngModel"> <input matInput [(ngModel)]="transTypeValue.fees" placeholder="Fee ({{information?.smaller_currency_unit}}/Byte)" type="number" name="fees" step="1" min="0" required tabindex="5" #fees="ngModel">
<mat-error *ngIf="!transTypeValue.fees">Fee is required.</mat-error>
</mat-form-field> </mat-form-field>
<div fxFlex="35" fxLayoutAlign="start center"> <div fxFlex="35" fxLayoutAlign="start center">
<mat-slide-toggle tabindex="6" color="primary" [(ngModel)]="spendUnconfirmed" name="spendUnconfirmed">Spend Unconfirmed Output</mat-slide-toggle> <mat-slide-toggle tabindex="6" color="primary" [(ngModel)]="spendUnconfirmed" name="spendUnconfirmed">Spend Unconfirmed Output</mat-slide-toggle>
@ -81,20 +85,14 @@
<div *ngIf="newlyAdded" fxLayoutAlign="space-between center" fxFlex="60"> <div *ngIf="newlyAdded" fxLayoutAlign="space-between center" fxFlex="60">
<button fxFlex="33" fxLayoutAlign="center center" mat-stroked-button color="warn" (click)="onClose()" tabindex="7">Do It Later</button> <button fxFlex="33" fxLayoutAlign="center center" mat-stroked-button color="warn" (click)="onClose()" tabindex="7">Do It Later</button>
<button fxFlex="32" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="8" type="reset" (click)="resetData()">Clear Field</button> <button fxFlex="32" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="8" type="reset" (click)="resetData()">Clear Field</button>
<button autoFocus fxFlex="33" fxLayoutAlign="center center" mat-raised-button color="primary" (click)="onOpenChannel()" [disabled]="fundingAmount == null || (totalBalance - ((fundingAmount) ? fundingAmount : 0) < 0)" type="submit" tabindex="9"> <button autoFocus fxFlex="33" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="9">Open Channel</button>
<p *ngIf="(fundingAmount == null) && (amount.touched || amount.dirty); else openText">Invalid Values</p>
<ng-template #openText><p>Open Channel</p></ng-template>
</button>
</div> </div>
<div *ngIf="!newlyAdded" fxLayout="row" fxLayoutAlign="space-between stretch" fxFlex="30" class="mt-2"> <div *ngIf="!newlyAdded" fxLayout="row" fxLayoutAlign="space-between stretch" fxFlex="30" class="mt-2">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="7" type="reset" (click)="resetData()">Clear Field</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="7" type="reset" (click)="resetData()">Clear Field</button>
<button autoFocus fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" (click)="onOpenChannel()" [disabled]="fundingAmount == null || (totalBalance - ((fundingAmount) ? fundingAmount : 0) < 0)" type="submit" tabindex="8"> <button autoFocus fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" type="submit" tabindex="8">Open Channel</button>
<p *ngIf="(fundingAmount == null) && (amount.touched || amount.dirty); else openText">Invalid Values</p>
<ng-template #openText><p>Open Channel</p></ng-template>
</button>
</div> </div>
</div> </div>
</div> </form>
</mat-card-content> </mat-card-content>
</div> </div>
</div> </div>

@ -50,6 +50,7 @@ export class OpenChannelComponent implements OnInit {
} }
onOpenChannel() { onOpenChannel() {
if (!this.fundingAmount || ((this.totalBalance - this.fundingAmount) < 0) || (this.selTransType === '1' && !this.transTypeValue.blocks) || (this.selTransType === '2' && !this.transTypeValue.fees)) { return true; }
let transTypeValue = '0'; let transTypeValue = '0';
if (this.selTransType === '1') { if (this.selTransType === '1') {
transTypeValue = this.transTypeValue.blocks; transTypeValue = this.transTypeValue.blocks;

@ -8,13 +8,13 @@
<mat-card-content class="card-content-gap"> <mat-card-content class="card-content-gap">
<form (ngSubmit)="onSignin()" #signinForm="ngForm" fxLayout="column" fxLayout.gt-sm="row wrap" fxLayoutAlign="start" fxLayoutAlign.gt-sm="space-between"> <form (ngSubmit)="onSignin()" #signinForm="ngForm" fxLayout="column" fxLayout.gt-sm="row wrap" fxLayoutAlign="start" fxLayoutAlign.gt-sm="space-between">
<mat-form-field fxFlex="100" fxLayoutAlign="start"> <mat-form-field fxFlex="100" fxLayoutAlign="start">
<input matInput placeholder="Password" type="password" id="password" name="password" [(ngModel)]="password" <input matInput placeholder="Password" type="password" id="password" name="password" [(ngModel)]="password" tabindex="1" required>
tabindex="1" required>
<mat-hint>{{hintStr}}</mat-hint> <mat-hint>{{hintStr}}</mat-hint>
<mat-error *ngIf="!password">Password is required.</mat-error>
</mat-form-field> </mat-form-field>
<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="2" type="reset" (click)="resetData()">Clear</button> <button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="2" type="reset" (click)="resetData()">Clear</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" tabindex="3" type="submit" [disabled]="!password">Login</button> <button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" tabindex="3" type="submit">Login</button>
</div> </div>
</form> </form>
</mat-card-content> </mat-card-content>

@ -49,6 +49,7 @@ export class SigninComponent implements OnInit, OnDestroy {
} }
onSignin() { onSignin() {
if(!this.password) { return true; }
this.store.dispatch(new RTLActions.Signin(sha256(this.password))); this.store.dispatch(new RTLActions.Signin(sha256(this.password)));
} }

@ -0,0 +1,18 @@
import { Directive, Input } from "@angular/core";
import { Validator, AbstractControl, NG_VALIDATORS } from "@angular/forms";
@Directive({
selector: "[nonNegativeAmount]",
providers: [{
provide: NG_VALIDATORS,
useExisting: NonNegativeAmountValidator,
multi: true
}]
})
export class NonNegativeAmountValidator implements Validator {
@Input('nonNegativeAmount') nonNegativeAmount: number;
validate(c: AbstractControl): any {
return (this.nonNegativeAmount && (this.nonNegativeAmount - +c.value < 0 )) ? { 'negative' : true } : null;
}
}

@ -43,6 +43,7 @@ import { ErrorComponent } from './components/error/error.component';
import { CurrencyUnitConverterComponent } from './components/currency-unit-converter/currency-unit-converter.component'; import { CurrencyUnitConverterComponent } from './components/currency-unit-converter/currency-unit-converter.component';
import { ClipboardDirective } from './directive/clipboard.directive'; import { ClipboardDirective } from './directive/clipboard.directive';
import { AutoFocusDirective } from './directive/auto-focus.directive'; import { AutoFocusDirective } from './directive/auto-focus.directive';
import { NonNegativeAmountValidator } from './directive/non-negative-amount.directive';
import { RemoveLeadingZerosPipe } from './pipes/app.pipe'; import { RemoveLeadingZerosPipe } from './pipes/app.pipe';
import { OpenChannelComponent } from './components/data-modal/open-channel/open-channel.component'; import { OpenChannelComponent } from './components/data-modal/open-channel/open-channel.component';
import { ShowPubkeyComponent } from './components/data-modal/show-pubkey/show-pubkey.component'; import { ShowPubkeyComponent } from './components/data-modal/show-pubkey/show-pubkey.component';
@ -144,6 +145,7 @@ import { SocketService } from './services/socket.service';
CurrencyUnitConverterComponent, CurrencyUnitConverterComponent,
ClipboardDirective, ClipboardDirective,
AutoFocusDirective, AutoFocusDirective,
NonNegativeAmountValidator,
QRCodeModule, QRCodeModule,
NgxChartsModule, NgxChartsModule,
RemoveLeadingZerosPipe, RemoveLeadingZerosPipe,
@ -169,6 +171,7 @@ import { SocketService } from './services/socket.service';
ErrorComponent, ErrorComponent,
ClipboardDirective, ClipboardDirective,
AutoFocusDirective, AutoFocusDirective,
NonNegativeAmountValidator,
RemoveLeadingZerosPipe, RemoveLeadingZerosPipe,
OpenChannelComponent, OpenChannelComponent,
ShowPubkeyComponent ShowPubkeyComponent

@ -99,7 +99,7 @@
.fa-icon-small, .top-icon-small, .modal-info-header { .fa-icon-small, .top-icon-small, .modal-info-header {
font-size: $regular-font-size * 1.2; font-size: $regular-font-size * 1.2;
} }
.top-toolbar-icon.icon-pinned, .mat-step-header .mat-step-icon .mat-icon { .top-toolbar-icon.icon-pinned {
font-size: $regular-font-size * 1.3; font-size: $regular-font-size * 1.3;
} }
.top-toolbar-icon .top-toolbar-img, .sidenav-img svg { .top-toolbar-icon .top-toolbar-img, .sidenav-img svg {
@ -115,6 +115,9 @@
.material-icons { .material-icons {
font-size: $regular-font-size * 2; font-size: $regular-font-size * 2;
} }
.mat-step-header .mat-step-icon .mat-icon {
font-size: initial;
}
.mat-expansion-panel-header, .mat-menu-item, .mat-list .mat-list-item, .mat-nav-list .mat-list-item, .mat-option, .mat-select, .mat-selection-list .mat-list-item { .mat-expansion-panel-header, .mat-menu-item, .mat-list .mat-list-item, .mat-nav-list .mat-list-item, .mat-option, .mat-select, .mat-selection-list .mat-list-item {
font-size: $regular-font-size !important; font-size: $regular-font-size !important;
} }

@ -301,7 +301,7 @@
color: $primary-color; color: $primary-color;
} }
.page-title-container, .page-sub-title-container, .mat-form-field-infix .mat-form-field-label-wrapper .mat-form-field-label { .page-title-container, .page-sub-title-container {
color: $foreground-text; color: $foreground-text;
} }

@ -949,12 +949,6 @@ table {
align-items: start; align-items: start;
} }
button.mat-button-base { .mat-vertical-content-container {
margin: 0 1rem; margin-left: 2rem !important;
&:last-child {
margin: 0 0 0 1rem;
}
// & .mat-button-wrapper {
// padding: 0 2rem;
// }
} }
Loading…
Cancel
Save