Add truncation indicator and update property labels in graph view

• Add truncate tooltip to source_id field
• Add visual truncation indicator (†)
• Bump API version to 0242
This commit is contained in:
yangdx 2025-10-20 23:03:01 +08:00
parent e0fd31a60d
commit 637b850ec5
7 changed files with 29 additions and 17 deletions

View file

@ -1 +1 @@
__api_version__ = "0241" __api_version__ = "0242"

View file

@ -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(${truncate} truncated)`
}
// 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']}
/> />
) )
})} })}

View file

@ -318,10 +318,10 @@
"description": "الوصف", "description": "الوصف",
"entity_id": "الاسم", "entity_id": "الاسم",
"entity_type": "النوع", "entity_type": "النوع",
"source_id": "معرف المصدر", "source_id": "C-ID",
"Neighbour": "الجار", "Neighbour": "الجار",
"file_path": "المصدر", "file_path": "File",
"keywords": "الكلمات الرئيسية", "keywords": "Keyword",
"weight": "الوزن" "weight": "الوزن"
} }
}, },

View file

@ -318,9 +318,9 @@
"description": "Description", "description": "Description",
"entity_id": "Name", "entity_id": "Name",
"entity_type": "Type", "entity_type": "Type",
"source_id": "SrcID", "source_id": "C-ID",
"Neighbour": "Neigh", "Neighbour": "Neigh",
"file_path": "Source", "file_path": "File",
"keywords": "Keys", "keywords": "Keys",
"weight": "Weight" "weight": "Weight"
} }

View file

@ -318,9 +318,9 @@
"description": "Description", "description": "Description",
"entity_id": "Nom", "entity_id": "Nom",
"entity_type": "Type", "entity_type": "Type",
"source_id": "ID source", "source_id": "C-ID",
"Neighbour": "Voisin", "Neighbour": "Voisin",
"file_path": "Source", "file_path": "File",
"keywords": "Keys", "keywords": "Keys",
"weight": "Poids" "weight": "Poids"
} }

View file

@ -318,9 +318,9 @@
"description": "描述", "description": "描述",
"entity_id": "名称", "entity_id": "名称",
"entity_type": "类型", "entity_type": "类型",
"source_id": "信源ID", "source_id": "C-ID",
"Neighbour": "邻接", "Neighbour": "邻接",
"file_path": "信源", "file_path": "文件",
"keywords": "Keys", "keywords": "Keys",
"weight": "权重" "weight": "权重"
} }

View file

@ -318,9 +318,9 @@
"description": "描述", "description": "描述",
"entity_id": "名稱", "entity_id": "名稱",
"entity_type": "類型", "entity_type": "類型",
"source_id": "來源ID", "source_id": "C-ID",
"Neighbour": "鄰接", "Neighbour": "鄰接",
"file_path": "來源", "file_path": "檔案",
"keywords": "Keys", "keywords": "Keys",
"weight": "權重" "weight": "權重"
} }