From fd57fe648fb81aac3a3bedb94065dec00c0a7c61 Mon Sep 17 00:00:00 2001 From: pkupczyk <piotr.kupczyk@id.ethz.ch> Date: Fri, 23 Dec 2022 13:10:39 +0100 Subject: [PATCH] SSDM-13282 : Admin UI - improve error handling --- .../EntityTypeFormControllerChange.js | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/openbis_ng_ui/src/js/components/types/form/entitytype/EntityTypeFormControllerChange.js b/openbis_ng_ui/src/js/components/types/form/entitytype/EntityTypeFormControllerChange.js index 2f76e81b9e3..5f4eb8c8776 100644 --- a/openbis_ng_ui/src/js/components/types/form/entitytype/EntityTypeFormControllerChange.js +++ b/openbis_ng_ui/src/js/components/types/form/entitytype/EntityTypeFormControllerChange.js @@ -243,27 +243,32 @@ export default class EntityTypeFormControllerChange extends PageControllerChange ) { const { object, facade } = this.controller - facade.loadTypeUsages(object).then(typeUsages => { - this.context.setState(state => { - const index = state.properties.findIndex( - property => property.id === newProperty.id - ) - if (index === -1) { - return {} - } - const newProperties = Array.from(state.properties) - newProperties[index] = { - ...newProperties[index], - initialValueForExistingEntities: { - ...newProperties[index].initialValueForExistingEntities, - visible: typeUsages > 0 + facade + .loadTypeUsages(object) + .then(typeUsages => { + this.context.setState(state => { + const index = state.properties.findIndex( + property => property.id === newProperty.id + ) + if (index === -1) { + return {} } - } - return { - properties: newProperties - } + const newProperties = Array.from(state.properties) + newProperties[index] = { + ...newProperties[index], + initialValueForExistingEntities: { + ...newProperties[index].initialValueForExistingEntities, + visible: typeUsages > 0 + } + } + return { + properties: newProperties + } + }) + }) + .catch(error => { + AppController.getInstance().errorChange(error) }) - }) } else { _.assign(newProperty, { initialValueForExistingEntities: { -- GitLab