Skip to content
Snippets Groups Projects
Commit fd57fe64 authored by piotr.kupczyk@id.ethz.ch's avatar piotr.kupczyk@id.ethz.ch
Browse files

SSDM-13282 : Admin UI - improve error handling

parent 9b9a1c07
No related branches found
No related tags found
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
...@@ -243,27 +243,32 @@ export default class EntityTypeFormControllerChange extends PageControllerChange ...@@ -243,27 +243,32 @@ export default class EntityTypeFormControllerChange extends PageControllerChange
) { ) {
const { object, facade } = this.controller const { object, facade } = this.controller
facade.loadTypeUsages(object).then(typeUsages => { facade
this.context.setState(state => { .loadTypeUsages(object)
const index = state.properties.findIndex( .then(typeUsages => {
property => property.id === newProperty.id this.context.setState(state => {
) const index = state.properties.findIndex(
if (index === -1) { property => property.id === newProperty.id
return {} )
} if (index === -1) {
const newProperties = Array.from(state.properties) return {}
newProperties[index] = {
...newProperties[index],
initialValueForExistingEntities: {
...newProperties[index].initialValueForExistingEntities,
visible: typeUsages > 0
} }
} const newProperties = Array.from(state.properties)
return { newProperties[index] = {
properties: newProperties ...newProperties[index],
} initialValueForExistingEntities: {
...newProperties[index].initialValueForExistingEntities,
visible: typeUsages > 0
}
}
return {
properties: newProperties
}
})
})
.catch(error => {
AppController.getInstance().errorChange(error)
}) })
})
} else { } else {
_.assign(newProperty, { _.assign(newProperty, {
initialValueForExistingEntities: { initialValueForExistingEntities: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment