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,
sourceId,
targetId,
isEditable = false
isEditable = false,
truncate
}: {
name: string
value: any
@ -197,6 +198,7 @@ const PropertyRow = ({
sourceId?: string
targetId?: string
isEditable?: boolean
truncate?: string
}) => {
const { t } = useTranslation()
@ -216,7 +218,12 @@ const PropertyRow = ({
// Format the value to convert <SEP> to newlines
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)
if (isEditable && (name === 'description' || name === 'entity_id' || name === 'keywords')) {
@ -241,7 +248,10 @@ const PropertyRow = ({
// For non-editable fields, use the regular Text component
return (
<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
className="hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis"
tooltipClassName="max-w-96 -translate-x-13"
@ -306,7 +316,7 @@ const NodePropertiesView = ({ node }: { node: NodeType }) => {
{Object.keys(node.properties)
.sort()
.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 (
<PropertyRow
key={name}
@ -316,6 +326,7 @@ const NodePropertiesView = ({ node }: { node: NodeType }) => {
entityId={node.properties['entity_id']}
entityType="node"
isEditable={name === 'description' || name === 'entity_id'}
truncate={node.properties['truncate']}
/>
)
})}
@ -373,7 +384,7 @@ const EdgePropertiesView = ({ edge }: { edge: EdgeType }) => {
{Object.keys(edge.properties)
.sort()
.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 (
<PropertyRow
key={name}
@ -385,6 +396,7 @@ const EdgePropertiesView = ({ edge }: { edge: EdgeType }) => {
sourceId={edge.sourceNode?.properties['entity_id'] || edge.source}
targetId={edge.targetNode?.properties['entity_id'] || edge.target}
isEditable={name === 'description' || name === 'keywords'}
truncate={edge.properties['truncate']}
/>
)
})}

View file

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

View file

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

View file

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

View file

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

View file

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