Enhance ObjectProperty Component with Additional Value Handling
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good

- Updated ObjectProperty component to improve rendering logic for state and message values, enhancing user feedback.
- Reformatted fieldNames for better readability and maintainability in the Tree component.
This commit is contained in:
Tom Butcher 2026-09-01 12:34:34 +01:00
parent 835c287810
commit 2d881cb152

View File

@ -278,7 +278,11 @@ const ObjectProperty = ({
return ( return (
<Tree <Tree
treeData={value} treeData={value}
fieldNames={{ title: 'title', key: 'value', children: 'children' }} fieldNames={{
title: 'title',
key: 'value',
children: 'children'
}}
height={320} height={320}
virtual virtual
defaultExpandAll={false} defaultExpandAll={false}
@ -531,6 +535,8 @@ const ObjectProperty = ({
case 'state': { case 'state': {
if (value && value?.type) { if (value && value?.type) {
return <StateDisplay {...rest} state={value} /> return <StateDisplay {...rest} state={value} />
} else if (value && value?.message) {
return <Text {...textParams}>{value.message}</Text>
} else { } else {
return ( return (
<Text type='secondary' {...textParams}> <Text type='secondary' {...textParams}>