only use name variant after modal closes

This commit is contained in:
Art Lowel
2020-04-03 10:23:55 +02:00
parent 924e623b6a
commit 62002f94ef
2 changed files with 11 additions and 8 deletions

View File

@@ -75,7 +75,7 @@ export class OrgUnitSearchResultListSubmissionElementComponent extends SearchRes
if (!this.allSuggestions.includes(value)) { if (!this.allSuggestions.includes(value)) {
this.openModal(value) this.openModal(value)
.then(() => { .then(() => {
// user clicked ok: store the name variant in the item
const newName: MetadataValue = new MetadataValue(); const newName: MetadataValue = new MetadataValue();
newName.value = value; newName.value = value;
@@ -89,9 +89,12 @@ export class OrgUnitSearchResultListSubmissionElementComponent extends SearchRes
}, },
}); });
this.itemDataService.update(updatedItem).pipe(take(1)).subscribe(); this.itemDataService.update(updatedItem).pipe(take(1)).subscribe();
}) }).catch(() => {
// user clicked cancel: use the name variant only for this relation, no further action required
}).finally(() => {
this.select(value);
})
} }
this.select(value);
} }
openModal(value): Promise<any> { openModal(value): Promise<any> {

View File

@@ -75,7 +75,7 @@ export class PersonSearchResultListSubmissionElementComponent extends SearchResu
if (!this.allSuggestions.includes(value)) { if (!this.allSuggestions.includes(value)) {
this.openModal(value) this.openModal(value)
.then(() => { .then(() => {
// user clicked ok: store the name variant in the item
const newName: MetadataValue = new MetadataValue(); const newName: MetadataValue = new MetadataValue();
newName.value = value; newName.value = value;
@@ -89,12 +89,12 @@ export class PersonSearchResultListSubmissionElementComponent extends SearchResu
}, },
}); });
this.itemDataService.update(updatedItem).pipe(take(1)).subscribe(); this.itemDataService.update(updatedItem).pipe(take(1)).subscribe();
} }).catch(() => {
).catch(() => { // user clicked cancel: use the name variant only for this relation, no further action required
/* empty, don't throw console error */ }).finally(() => {
this.select(value);
}) })
} }
this.select(value);
} }
openModal(value): Promise<any> { openModal(value): Promise<any> {