Enhance ObjectProperty component by adding AlertsDisplay for rendering alerts; update value checks for improved data handling and styling adjustments.

This commit is contained in:
Tom Butcher 2025-09-05 23:20:27 +01:00
parent 0eac407db4
commit e2a96949b3

View File

@ -38,6 +38,7 @@ import ObjectTypeSelect from './ObjectTypeSelect'
import ObjectTypeDisplay from './ObjectTypeDisplay'
import CodeBlockEditor from './CodeBlockEditor'
import StateDisplay from './StateDisplay'
import AlertsDisplay from './AlertsDisplay'
const { Text } = Typography
@ -105,6 +106,10 @@ const ObjectProperty = ({
suffix = suffix(objectData)
}
if (masterFilter && typeof masterFilter == 'function' && objectData) {
masterFilter = masterFilter(objectData)
}
if (!value) {
value = getPropertyValue(objectData, name)
}
@ -116,7 +121,7 @@ const ObjectProperty = ({
formItemName = name ? name.split('.') : undefined
}
var textParams = {}
var textParams = { style: { whiteSpace: 'nowrap' } }
if (disabled == true) {
textParams = { ...textParams, delete: true, type: 'secondary' }
@ -317,7 +322,7 @@ const ObjectProperty = ({
)
}
case 'object': {
if (value && value.name) {
if (value && value._id) {
return <ObjectDisplay object={value} objectType={objectType} />
} else {
return (
@ -385,9 +390,9 @@ const ObjectProperty = ({
)
}
}
case 'mm': {
if (value != null) {
return <Text {...textParams}>{`${value} mm`}</Text>
case 'alerts': {
if (value != null && value?.length != 0) {
return <AlertsDisplay alerts={value} />
} else {
return (
<Text type='secondary' {...textParams}>