diff --git a/src/app/routes/connector-ui/policy-definition-create-page/policy-definition-create-page/policy-definition-create-page-form.ts b/src/app/routes/connector-ui/policy-definition-create-page/policy-definition-create-page/policy-definition-create-page-form.ts index 1c2af7cc9..ad66bdab3 100644 --- a/src/app/routes/connector-ui/policy-definition-create-page/policy-definition-create-page/policy-definition-create-page-form.ts +++ b/src/app/routes/connector-ui/policy-definition-create-page/policy-definition-create-page/policy-definition-create-page-form.ts @@ -1,5 +1,6 @@ import {Injectable} from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {DataOfferFormValidators} from 'src/app/core/validators/data-offer-form-validators'; import {ExpressionFormControls} from '../../../../component-library/policy-editor/editor/expression-form-controls'; import {noWhitespacesOrColonsValidator} from '../../../../core/validators/no-whitespaces-or-colons-validator'; import { @@ -24,11 +25,16 @@ export class PolicyDefinitionCreatePageForm { constructor( private formBuilder: FormBuilder, private expressionFormControls: ExpressionFormControls, + private validators: DataOfferFormValidators, ) {} buildFormGroup(): FormGroup { return this.formBuilder.nonNullable.group({ - id: ['', [Validators.required, noWhitespacesOrColonsValidator]], + id: [ + '', + [Validators.required, noWhitespacesOrColonsValidator], + [this.validators.policyIdExistsValidator], + ], treeControls: this.expressionFormControls.formGroup, }); } diff --git a/src/app/routes/connector-ui/policy-definition-create-page/policy-definition-create-page/policy-definition-create-page.component.html b/src/app/routes/connector-ui/policy-definition-create-page/policy-definition-create-page/policy-definition-create-page.component.html index 06b7ef5d3..79c30368a 100644 --- a/src/app/routes/connector-ui/policy-definition-create-page/policy-definition-create-page/policy-definition-create-page.component.html +++ b/src/app/routes/connector-ui/policy-definition-create-page/policy-definition-create-page/policy-definition-create-page.component.html @@ -10,6 +10,9 @@ {{ validationMessages.invalidWhitespacesOrColonsMessage }} + {{ + validationMessages.idExistsErrorMessage + }}
Policy Expression