diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-form.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-form.ts index 360136c9..30e219d7 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-form.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-form.ts @@ -58,7 +58,7 @@ export class ContractAgreementTransferDialogForm { showAllHttpParameterizationFields: [false], httpProxiedPath: [''], - httpProxiedMethod: ['', Validators.required], + httpProxiedMethod: [''], httpProxiedQueryParams: this.formBuilder.array( new Array>(), ), @@ -66,6 +66,18 @@ export class ContractAgreementTransferDialogForm { httpProxiedBodyContentType: [''], }); + all + .get('showAllHttpParameterizationFields')! + .valueChanges.subscribe((value) => { + console.log('showAllHttpParameterizationFields', value); + if (value) { + all.get('httpProxiedMethod')!.setValidators([Validators.required]); + } else { + all.get('httpProxiedMethod')!.clearValidators(); + } + all.get('httpProxiedMethod')!.updateValueAndValidity(); + }); + switchDisabledControls( all, (value) => { diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.html index 1414fa2c..aebe4370 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.html @@ -386,6 +386,11 @@

{{ 'contract_agreement_page.http_fields' | translate }} + show all methods: + {{ form.all.controls.showAllHttpParameterizationFields.value }} + proxy method: + {{ isRequiredField('httpProxiedMethod') }} +
diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.ts index c2ae2e7c..35f749af 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.ts @@ -1,4 +1,5 @@ import {Component, Inject, OnDestroy} from '@angular/core'; +import {AbstractControl} from '@angular/forms'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; import {Observable, Subject} from 'rxjs'; import {finalize} from 'rxjs/operators'; @@ -164,4 +165,14 @@ export class ContractAgreementTransferDialogComponent implements OnDestroy { transferProcessRequestJsonLd: value.transferProcessRequest!, }; } + + isRequiredField(field: string) { + const form_field = this.form.all.get(field); + if (!form_field || !form_field.validator) { + return false; + } + + const validator = form_field.validator({} as AbstractControl); + return validator && validator.required; + } }