From 109ca05717962c792214991fe791eb0462ddaac8 Mon Sep 17 00:00:00 2001 From: mdelez <60604010+mdelez@users.noreply.github.com> Date: Fri, 29 Jul 2022 11:10:59 +0200 Subject: [PATCH] fix(property-form): only send API request to change the guiElement for TextValue object types (#783) --- .../property-form/property-form.component.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app/project/ontology/property-form/property-form.component.ts b/src/app/project/ontology/property-form/property-form.component.ts index d43d145b52..472860f263 100644 --- a/src/app/project/ontology/property-form/property-form.component.ts +++ b/src/app/project/ontology/property-form/property-form.component.ts @@ -455,7 +455,12 @@ export class PropertyFormComponent implements OnInit { (propertyCommentResponse: ResourcePropertyDefinitionWithAllLanguages) => { this.lastModificationDate = propertyCommentResponse.lastModificationDate; - if (!this.unsupportedPropertyType) { + // if property type is supported and is of type TextValue and the guiElement is different from its initial value, call replaceGuiElement() to update the guiElement + // this only works for the TextValue object type currently + // https://docs.dasch.swiss/latest/DSP-API/03-apis/api-v2/ontology-information/#changing-the-gui-element-and-gui-attributes-of-a-property + if (!this.unsupportedPropertyType && + this.propertyInfo.propDef.objectType === Constants.TextValue && + this.propertyInfo.propDef.guiElement !== this.propertyForm.controls['propType'].value.guiEle) { this.replaceGuiElement(); } else { this.loading = false; @@ -478,7 +483,12 @@ export class PropertyFormComponent implements OnInit { (deleteCommentResponse: ResourcePropertyDefinitionWithAllLanguages) => { this.lastModificationDate = deleteCommentResponse.lastModificationDate; - if (!this.unsupportedPropertyType) { + // if property type is supported and is of type TextValue and the guiElement is different from its initial value, call replaceGuiElement() to update the guiElement + // this only works for the TextValue object type currently + // https://docs.dasch.swiss/latest/DSP-API/03-apis/api-v2/ontology-information/#changing-the-gui-element-and-gui-attributes-of-a-property + if (!this.unsupportedPropertyType && + this.propertyInfo.propDef.objectType === Constants.TextValue && + this.propertyInfo.propDef.guiElement !== this.propertyForm.controls['propType'].value.guiEle) { this.replaceGuiElement(); } else { this.loading = false;