Skip to content

Commit

Permalink
fix(admin-ui): Fix error updating PaymentMethod config parameters
Browse files Browse the repository at this point in the history
Fixes #345
  • Loading branch information
michaelbromley committed May 26, 2020
1 parent ea58bc8 commit b4061a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</clr-toggle-wrapper>
</vdr-form-field>

<div class="clr-row" formGroupName="configArgs" *ngIf="(entity$ | async)?.configArgs?.length">
<div class="clr-row" formGroupName="configArgs" *ngIf="(entity$ | async)?.configArgs?.length && configArgsIsPopulated()">
<div class="clr-col">
<label>{{ 'settings.payment-method-config-options' | translate }}</label>
<section class="form-block" *ngFor="let arg of (entity$ | async)?.configArgs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ export class PaymentMethodDetailComponent extends BaseDetailComponent<PaymentMet
return arg.type as any;
}

configArgsIsPopulated(): boolean {
const configArgsGroup = this.detailForm.get('configArgs') as FormGroup | undefined;
if (!configArgsGroup) {
return false;
}
return 0 < Object.keys(configArgsGroup.controls).length;
}

save() {
this.entity$
.pipe(
Expand Down Expand Up @@ -100,6 +108,7 @@ export class PaymentMethodDetailComponent extends BaseDetailComponent<PaymentMet
}
}
}
this.changeDetector.markForCheck();
}

private parseArgValue(arg: ConfigArg): string | number | boolean {
Expand Down

0 comments on commit b4061a5

Please sign in to comment.