yangdx
commited on
Commit
·
11a9ac3
1
Parent(s):
5d25c62
Fix tooltips missing for editable properties
Browse files
lightrag_webui/src/components/graph/EditablePropertyRow.tsx
CHANGED
@@ -19,6 +19,7 @@ interface EditablePropertyRowProps {
|
|
19 |
targetId?: string // Target node ID (for edge type)
|
20 |
onValueChange?: (newValue: any) => void // Optional callback when value changes
|
21 |
isEditable?: boolean // Whether this property can be edited
|
|
|
22 |
}
|
23 |
|
24 |
/**
|
@@ -34,7 +35,8 @@ const EditablePropertyRow = ({
|
|
34 |
sourceId,
|
35 |
targetId,
|
36 |
onValueChange,
|
37 |
-
isEditable = false
|
|
|
38 |
}: EditablePropertyRowProps) => {
|
39 |
const { t } = useTranslation()
|
40 |
const [isEditing, setIsEditing] = useState(false)
|
@@ -101,7 +103,11 @@ const EditablePropertyRow = ({
|
|
101 |
<div className="flex items-center gap-1">
|
102 |
<PropertyName name={name} />
|
103 |
<EditIcon onClick={handleEditClick} />:
|
104 |
-
<PropertyValue
|
|
|
|
|
|
|
|
|
105 |
<PropertyEditDialog
|
106 |
isOpen={isEditing}
|
107 |
onClose={handleCancel}
|
|
|
19 |
targetId?: string // Target node ID (for edge type)
|
20 |
onValueChange?: (newValue: any) => void // Optional callback when value changes
|
21 |
isEditable?: boolean // Whether this property can be edited
|
22 |
+
tooltip?: string // Optional tooltip to display on hover
|
23 |
}
|
24 |
|
25 |
/**
|
|
|
35 |
sourceId,
|
36 |
targetId,
|
37 |
onValueChange,
|
38 |
+
isEditable = false,
|
39 |
+
tooltip
|
40 |
}: EditablePropertyRowProps) => {
|
41 |
const { t } = useTranslation()
|
42 |
const [isEditing, setIsEditing] = useState(false)
|
|
|
103 |
<div className="flex items-center gap-1">
|
104 |
<PropertyName name={name} />
|
105 |
<EditIcon onClick={handleEditClick} />:
|
106 |
+
<PropertyValue
|
107 |
+
value={currentValue}
|
108 |
+
onClick={onClick}
|
109 |
+
tooltip={tooltip || (typeof currentValue === 'string' ? currentValue : JSON.stringify(currentValue, null, 2))}
|
110 |
+
/>
|
111 |
<PropertyEditDialog
|
112 |
isOpen={isEditing}
|
113 |
onClose={handleCancel}
|
lightrag_webui/src/components/graph/PropertiesView.tsx
CHANGED
@@ -207,6 +207,7 @@ const PropertyRow = ({
|
|
207 |
sourceId={sourceId}
|
208 |
targetId={targetId}
|
209 |
isEditable={true}
|
|
|
210 |
/>
|
211 |
)
|
212 |
}
|
|
|
207 |
sourceId={sourceId}
|
208 |
targetId={targetId}
|
209 |
isEditable={true}
|
210 |
+
tooltip={tooltip || (typeof value === 'string' ? value : JSON.stringify(value, null, 2))}
|
211 |
/>
|
212 |
)
|
213 |
}
|
lightrag_webui/src/components/graph/PropertyRowComponents.tsx
CHANGED
@@ -38,14 +38,16 @@ export const EditIcon = ({ onClick }: EditIconProps) => (
|
|
38 |
interface PropertyValueProps {
|
39 |
value: any
|
40 |
onClick?: () => void
|
|
|
41 |
}
|
42 |
|
43 |
-
export const PropertyValue = ({ value, onClick }: PropertyValueProps) => (
|
44 |
<div className="flex items-center gap-1">
|
45 |
<Text
|
46 |
className="hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis"
|
47 |
tooltipClassName="max-w-80"
|
48 |
text={value}
|
|
|
49 |
side="left"
|
50 |
onClick={onClick}
|
51 |
/>
|
|
|
38 |
interface PropertyValueProps {
|
39 |
value: any
|
40 |
onClick?: () => void
|
41 |
+
tooltip?: string
|
42 |
}
|
43 |
|
44 |
+
export const PropertyValue = ({ value, onClick, tooltip }: PropertyValueProps) => (
|
45 |
<div className="flex items-center gap-1">
|
46 |
<Text
|
47 |
className="hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis"
|
48 |
tooltipClassName="max-w-80"
|
49 |
text={value}
|
50 |
+
tooltip={tooltip || (typeof value === 'string' ? value : JSON.stringify(value, null, 2))}
|
51 |
side="left"
|
52 |
onClick={onClick}
|
53 |
/>
|