From 31b33754c50fbdcb4b84731140e3edf2c8af8518 Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 16 May 2024 11:46:57 +0300 Subject: [PATCH] remove isUrlRequired from form field component --- .../form-field/form-field.component.ts | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts index 19ada7038..4e54f597f 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts @@ -123,21 +123,6 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn this.isRequired = this.field.validations?.includes(DescriptionTemplateFieldValidationType.Required); switch (this.field?.data?.fieldType) { - case DescriptionTemplateFieldType.FREE_TEXT: - const isUrlRequired = this.field.validations?.includes(DescriptionTemplateFieldValidationType.Url) || false; - if (isUrlRequired) this.propertiesFormGroup?.get(this.field.id).get('textValue').addValidators(ValidatorURL.validator) - break; - - case DescriptionTemplateFieldType.TAGS: - this.tagsAutoCompleteConfiguration = { - filterFn: this.filterTags.bind(this), - initialItems: (excludedItems: any[]) => this.filterTags('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))), - displayFn: (item) => { try { return this.showTag(item) } catch { return '' } }, - titleFn: (item) => { try { return item['name'] } catch { return '' } }, - valueAssign: (item) => { try { return this.addTag(item) } catch { return '' } } - }; - this.parseTags(); - break; case DescriptionTemplateFieldType.DATASET_IDENTIFIER: // const value = this.propertiesFormGroup.get(this.field.id).get('value').value; @@ -221,16 +206,6 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn } } - filterTags(value: string): Observable { - //TODO refactor - return null; - // const requestItem: RequestItem = new RequestItem(); - // const criteria: TagCriteria = new TagCriteria(); - // criteria.like = value; - // requestItem.criteria = criteria; - // return this.externalSourcesService.searchDatasetTags(requestItem); - } - showTag(ev: any) { if (typeof ev === 'string') { return ev; @@ -239,19 +214,6 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn } } - addTag(ev: any) { - // let item: ExternalTagEditorModel; - // //this.filteredTags = this.formGroup.get('tags').value; - // if (typeof ev === 'string') { - // item = new ExternalTagEditorModel('', ev); - // } else { - // item = ev; - // } - // if (item.name !== '') { - // return item; - // } - } - getDatasetIdControl(name: string): UntypedFormControl { return this.propertiesFormGroup.get(this.field.id).get(name) as UntypedFormControl; }