Skip to content

Commit

Permalink
Small improvements to the QuickConnectDialogCompoennt
Browse files Browse the repository at this point in the history
- rename noPfs property to pfsConfigured and negate values
- more exact error text when no pfs is configured
  • Loading branch information
manuelwedler committed Dec 3, 2020
1 parent 62543fd commit 57ee03d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
>
</app-token-input>
<div
*ngIf="loading || pfsError || noPfs || suggestions.length > 0"
*ngIf="loading || pfsError || !pfsConfigured || suggestions.length > 0"
[@stretchVertically]="'in'"
>
<app-connection-selector
Expand All @@ -41,7 +41,7 @@
</ng-template>
<ng-template #error>
<div
*ngIf="!noPfs; else no_pfs"
*ngIf="pfsConfigured; else no_pfs"
class="error"
fxLayoutAlign="center"
>
Expand All @@ -50,8 +50,8 @@
</ng-template>
<ng-template #no_pfs>
<div class="error" fxLayoutAlign="center">
You cannot use Quick Connect because you are using the private
routing mode
Quick Connect requires a pathfinding service, but no such
service is configured
</div>
</ng-template>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ describe('QuickConnectDialogComponent', () => {

expect(component.suggestions.length).toEqual(0);
expect(component.pfsError).toBe(true);
expect(component.noPfs).toBe(false);
expect(component.pfsConfigured).toBe(true);
expect(component.form.controls.totalAmount.disabled).toBe(true);
}));

Expand All @@ -272,7 +272,7 @@ describe('QuickConnectDialogComponent', () => {

expect(component.suggestions.length).toEqual(0);
expect(component.pfsError).toBe(true);
expect(component.noPfs).toBe(false);
expect(component.pfsConfigured).toBe(true);
expect(component.form.controls.totalAmount.disabled).toBe(true);
}));

Expand All @@ -289,7 +289,7 @@ describe('QuickConnectDialogComponent', () => {

expect(component.suggestions.length).toEqual(0);
expect(component.pfsError).toBe(true);
expect(component.noPfs).toBe(true);
expect(component.pfsConfigured).toBe(false);
expect(component.form.controls.totalAmount.disabled).toBe(true);
}));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class QuickConnectDialogComponent implements OnInit, OnDestroy {
suggestions: SuggestedConnection[] = [];
loading = false;
pfsError = false;
noPfs = false;
pfsConfigured = true;

private ngUnsubscribe = new Subject();

Expand Down Expand Up @@ -112,7 +112,7 @@ export class QuickConnectDialogComponent implements OnInit, OnDestroy {
const pathfindingServiceUrl$ = this.raidenService.getSettings().pipe(
map((settings) => {
if (!settings.pathfinding_service_address) {
this.noPfs = true;
this.pfsConfigured = false;
throw new Error('No PFS set!');
}
return settings.pathfinding_service_address;
Expand Down Expand Up @@ -172,7 +172,7 @@ export class QuickConnectDialogComponent implements OnInit, OnDestroy {
catchError((error, caught) => {
this.loading = false;
this.showError();
if (this.noPfs) {
if (!this.pfsConfigured) {
return EMPTY;
}
return caught;
Expand Down

0 comments on commit 57ee03d

Please sign in to comment.