remove isUrlRequired from form field component
This commit is contained in:
parent
33edaa217f
commit
31b33754c5
|
@ -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<any[]> {
|
||||
//TODO refactor
|
||||
return null;
|
||||
// const requestItem: RequestItem<TagCriteria> = 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue