Skip to content

Commit

Permalink
fix(property-form): only send API request to change the guiElement fo…
Browse files Browse the repository at this point in the history
…r TextValue object types (#783)
  • Loading branch information
mdelez committed Jul 29, 2022
1 parent e73ab41 commit 109ca05
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/app/project/ontology/property-form/property-form.component.ts
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 109ca05

Please sign in to comment.