Update truncation message format in properties tooltip
(cherry picked from commit 019dff5248)
This commit is contained in:
parent
3780addc4c
commit
c2620efc5e
1 changed files with 17 additions and 5 deletions
|
|
@ -183,7 +183,8 @@ const PropertyRow = ({
|
||||||
entityType,
|
entityType,
|
||||||
sourceId,
|
sourceId,
|
||||||
targetId,
|
targetId,
|
||||||
isEditable = false
|
isEditable = false,
|
||||||
|
truncate
|
||||||
}: {
|
}: {
|
||||||
name: string
|
name: string
|
||||||
value: any
|
value: any
|
||||||
|
|
@ -197,6 +198,7 @@ const PropertyRow = ({
|
||||||
sourceId?: string
|
sourceId?: string
|
||||||
targetId?: string
|
targetId?: string
|
||||||
isEditable?: boolean
|
isEditable?: boolean
|
||||||
|
truncate?: string
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
|
|
@ -216,7 +218,12 @@ const PropertyRow = ({
|
||||||
|
|
||||||
// Format the value to convert <SEP> to newlines
|
// Format the value to convert <SEP> to newlines
|
||||||
const formattedValue = formatValueWithSeparators(value)
|
const formattedValue = formatValueWithSeparators(value)
|
||||||
const formattedTooltip = tooltip || formatValueWithSeparators(value)
|
let formattedTooltip = tooltip || formatValueWithSeparators(value)
|
||||||
|
|
||||||
|
// If this is source_id field and truncate info exists, append it to the tooltip
|
||||||
|
if (name === 'source_id' && truncate) {
|
||||||
|
formattedTooltip += `\n(Truncation-${truncate})`
|
||||||
|
}
|
||||||
|
|
||||||
// Use EditablePropertyRow for editable fields (description, entity_id and keywords)
|
// Use EditablePropertyRow for editable fields (description, entity_id and keywords)
|
||||||
if (isEditable && (name === 'description' || name === 'entity_id' || name === 'keywords')) {
|
if (isEditable && (name === 'description' || name === 'entity_id' || name === 'keywords')) {
|
||||||
|
|
@ -241,7 +248,10 @@ const PropertyRow = ({
|
||||||
// For non-editable fields, use the regular Text component
|
// For non-editable fields, use the regular Text component
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span className="text-primary/60 tracking-wide whitespace-nowrap">{getPropertyNameTranslation(name)}</span>:
|
<span className="text-primary/60 tracking-wide whitespace-nowrap">
|
||||||
|
{getPropertyNameTranslation(name)}
|
||||||
|
{name === 'source_id' && truncate && <sup className="text-red-500">†</sup>}
|
||||||
|
</span>:
|
||||||
<Text
|
<Text
|
||||||
className="hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis"
|
className="hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis"
|
||||||
tooltipClassName="max-w-96 -translate-x-13"
|
tooltipClassName="max-w-96 -translate-x-13"
|
||||||
|
|
@ -306,7 +316,7 @@ const NodePropertiesView = ({ node }: { node: NodeType }) => {
|
||||||
{Object.keys(node.properties)
|
{Object.keys(node.properties)
|
||||||
.sort()
|
.sort()
|
||||||
.map((name) => {
|
.map((name) => {
|
||||||
if (name === 'created_at') return null; // Hide created_at property
|
if (name === 'created_at' || name === 'truncate') return null; // Hide created_at and truncate properties
|
||||||
return (
|
return (
|
||||||
<PropertyRow
|
<PropertyRow
|
||||||
key={name}
|
key={name}
|
||||||
|
|
@ -316,6 +326,7 @@ const NodePropertiesView = ({ node }: { node: NodeType }) => {
|
||||||
entityId={node.properties['entity_id']}
|
entityId={node.properties['entity_id']}
|
||||||
entityType="node"
|
entityType="node"
|
||||||
isEditable={name === 'description' || name === 'entity_id'}
|
isEditable={name === 'description' || name === 'entity_id'}
|
||||||
|
truncate={node.properties['truncate']}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
|
@ -373,7 +384,7 @@ const EdgePropertiesView = ({ edge }: { edge: EdgeType }) => {
|
||||||
{Object.keys(edge.properties)
|
{Object.keys(edge.properties)
|
||||||
.sort()
|
.sort()
|
||||||
.map((name) => {
|
.map((name) => {
|
||||||
if (name === 'created_at') return null; // Hide created_at property
|
if (name === 'created_at' || name === 'truncate') return null; // Hide created_at and truncate properties
|
||||||
return (
|
return (
|
||||||
<PropertyRow
|
<PropertyRow
|
||||||
key={name}
|
key={name}
|
||||||
|
|
@ -385,6 +396,7 @@ const EdgePropertiesView = ({ edge }: { edge: EdgeType }) => {
|
||||||
sourceId={edge.sourceNode?.properties['entity_id'] || edge.source}
|
sourceId={edge.sourceNode?.properties['entity_id'] || edge.source}
|
||||||
targetId={edge.targetNode?.properties['entity_id'] || edge.target}
|
targetId={edge.targetNode?.properties['entity_id'] || edge.target}
|
||||||
isEditable={name === 'description' || name === 'keywords'}
|
isEditable={name === 'description' || name === 'keywords'}
|
||||||
|
truncate={edge.properties['truncate']}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue