choizhang
commited on
Commit
·
1cd73e0
1
Parent(s):
4d5e0aa
feat: Add double-click editing prompt text and optimize editable attribute line style
Browse files
lightrag_webui/src/components/graph/EditablePropertyRow.tsx
CHANGED
@@ -5,6 +5,7 @@ import Input from '@/components/ui/Input'
|
|
5 |
import { toast } from 'sonner'
|
6 |
import { updateEntity, updateRelation, checkEntityNameExists } from '@/api/lightrag'
|
7 |
import { useGraphStore } from '@/stores/graph'
|
|
|
8 |
|
9 |
interface EditablePropertyRowProps {
|
10 |
name: string
|
@@ -222,9 +223,17 @@ const EditablePropertyRow = ({
|
|
222 |
|
223 |
return (
|
224 |
<div className="flex items-center gap-2">
|
225 |
-
<
|
226 |
{getPropertyNameTranslation(name)}
|
227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
{isEditing ? (
|
229 |
<div className="flex-1">
|
230 |
<Input
|
@@ -238,20 +247,17 @@ const EditablePropertyRow = ({
|
|
238 |
/>
|
239 |
</div>
|
240 |
) : (
|
241 |
-
// Wrap Text component in a div to handle onDoubleClick
|
242 |
<div
|
243 |
-
className={`flex-1 overflow-hidden ${isEditableField ? 'cursor-text' : ''}`}
|
244 |
onDoubleClick={isEditableField ? handleDoubleClick : undefined}
|
245 |
>
|
246 |
<Text
|
247 |
-
className="hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis block w-full"
|
248 |
tooltipClassName="max-w-80"
|
249 |
-
// Ensure the text prop always receives a string representation
|
250 |
text={String(value)}
|
251 |
tooltip={tooltip || (typeof value === 'string' ? value : JSON.stringify(value, null, 2))}
|
252 |
side="left"
|
253 |
onClick={onClick}
|
254 |
-
// Removed onDoubleClick from Text component
|
255 |
/>
|
256 |
</div>
|
257 |
)}
|
|
|
5 |
import { toast } from 'sonner'
|
6 |
import { updateEntity, updateRelation, checkEntityNameExists } from '@/api/lightrag'
|
7 |
import { useGraphStore } from '@/stores/graph'
|
8 |
+
import { PencilIcon } from 'lucide-react'
|
9 |
|
10 |
interface EditablePropertyRowProps {
|
11 |
name: string
|
|
|
223 |
|
224 |
return (
|
225 |
<div className="flex items-center gap-2">
|
226 |
+
<div className="flex items-center gap-1 text-primary/60 tracking-wide whitespace-nowrap">
|
227 |
{getPropertyNameTranslation(name)}
|
228 |
+
{isEditableField && (
|
229 |
+
<div className="group relative">
|
230 |
+
<PencilIcon className="w-3 h-3 opacity-50 hover:opacity-100" />
|
231 |
+
<div className="absolute left-5 transform -translate-y-full -top-2 bg-primary/90 text-white text-xs px-3 py-1.5 rounded shadow-lg border border-primary/20 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-[100]">
|
232 |
+
{t('graphPanel.propertiesView.doubleClickToEdit')}
|
233 |
+
</div>
|
234 |
+
</div>
|
235 |
+
)}
|
236 |
+
</div>:
|
237 |
{isEditing ? (
|
238 |
<div className="flex-1">
|
239 |
<Input
|
|
|
247 |
/>
|
248 |
</div>
|
249 |
) : (
|
|
|
250 |
<div
|
251 |
+
className={`flex-1 overflow-hidden ${isEditableField ? 'cursor-text' : ''}`}
|
252 |
onDoubleClick={isEditableField ? handleDoubleClick : undefined}
|
253 |
>
|
254 |
<Text
|
255 |
+
className="hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis block w-full"
|
256 |
tooltipClassName="max-w-80"
|
|
|
257 |
text={String(value)}
|
258 |
tooltip={tooltip || (typeof value === 'string' ? value : JSON.stringify(value, null, 2))}
|
259 |
side="left"
|
260 |
onClick={onClick}
|
|
|
261 |
/>
|
262 |
</div>
|
263 |
)}
|
lightrag_webui/src/locales/ar.json
CHANGED
@@ -35,32 +35,6 @@
|
|
35 |
"common": {
|
36 |
"cancel": "إلغاء"
|
37 |
},
|
38 |
-
"graphPanel": {
|
39 |
-
"propertiesView": {
|
40 |
-
"errors": {
|
41 |
-
"duplicateName": "اسم العقدة موجود بالفعل",
|
42 |
-
"updateFailed": "فشل تحديث العقدة",
|
43 |
-
"tryAgainLater": "يرجى المحاولة مرة أخرى لاحقاً"
|
44 |
-
},
|
45 |
-
"success": {
|
46 |
-
"entityUpdated": "تم تحديث العقدة بنجاح",
|
47 |
-
"relationUpdated": "تم تحديث العلاقة بنجاح"
|
48 |
-
},
|
49 |
-
"node": {
|
50 |
-
"title": "عقدة",
|
51 |
-
"id": "المعرف",
|
52 |
-
"labels": "التسميات",
|
53 |
-
"degree": "الدرجة",
|
54 |
-
"properties": "الخصائص",
|
55 |
-
"relationships": "العلاقات (ضمن الرسم البياني الفرعي)",
|
56 |
-
"expandNode": "توسيع العقدة",
|
57 |
-
"pruneNode": "تقليم العقدة",
|
58 |
-
"deleteAllNodesError": "رفض حذف جميع العقد في الرسم البياني",
|
59 |
-
"nodesRemoved": "تم حذف {{count}} عقدة، بما في ذلك العقد اليتيمة",
|
60 |
-
"noNewNodes": "لم يتم العثور على عقد قابلة للتوسيع"
|
61 |
-
}
|
62 |
-
}
|
63 |
-
},
|
64 |
"documentPanel": {
|
65 |
"clearDocuments": {
|
66 |
"button": "مسح",
|
@@ -262,6 +236,16 @@
|
|
262 |
"vectorStorage": "تخزين المتجهات"
|
263 |
},
|
264 |
"propertiesView": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
"node": {
|
266 |
"title": "عقدة",
|
267 |
"id": "المعرف",
|
|
|
35 |
"common": {
|
36 |
"cancel": "إلغاء"
|
37 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
"documentPanel": {
|
39 |
"clearDocuments": {
|
40 |
"button": "مسح",
|
|
|
236 |
"vectorStorage": "تخزين المتجهات"
|
237 |
},
|
238 |
"propertiesView": {
|
239 |
+
"errors": {
|
240 |
+
"duplicateName": "اسم العقدة موجود بالفعل",
|
241 |
+
"updateFailed": "فشل تحديث العقدة",
|
242 |
+
"tryAgainLater": "يرجى المحاولة مرة أخرى لاحقًا"
|
243 |
+
},
|
244 |
+
"doubleClickToEdit": "انقر نقرًا مزدوجًا للتعديل",
|
245 |
+
"success": {
|
246 |
+
"entityUpdated": "تم تحديث العقدة بنجاح",
|
247 |
+
"relationUpdated": "تم تحديث العلاقة بنجاح"
|
248 |
+
},
|
249 |
"node": {
|
250 |
"title": "عقدة",
|
251 |
"id": "المعرف",
|
lightrag_webui/src/locales/en.json
CHANGED
@@ -240,6 +240,7 @@
|
|
240 |
"updateFailed": "Failed to update node",
|
241 |
"tryAgainLater": "Please try again later"
|
242 |
},
|
|
|
243 |
"success": {
|
244 |
"entityUpdated": "Node updated successfully",
|
245 |
"relationUpdated": "Relation updated successfully"
|
|
|
240 |
"updateFailed": "Failed to update node",
|
241 |
"tryAgainLater": "Please try again later"
|
242 |
},
|
243 |
+
"doubleClickToEdit": "Double click to edit",
|
244 |
"success": {
|
245 |
"entityUpdated": "Node updated successfully",
|
246 |
"relationUpdated": "Relation updated successfully"
|
lightrag_webui/src/locales/fr.json
CHANGED
@@ -35,32 +35,7 @@
|
|
35 |
"common": {
|
36 |
"cancel": "Annuler"
|
37 |
},
|
38 |
-
|
39 |
-
"propertiesView": {
|
40 |
-
"errors": {
|
41 |
-
"duplicateName": "Le nom du nœud existe déjà",
|
42 |
-
"updateFailed": "Échec de la mise à jour du nœud",
|
43 |
-
"tryAgainLater": "Veuillez réessayer plus tard"
|
44 |
-
},
|
45 |
-
"success": {
|
46 |
-
"entityUpdated": "Nœud mis à jour avec succès",
|
47 |
-
"relationUpdated": "Relation mise à jour avec succès"
|
48 |
-
},
|
49 |
-
"node": {
|
50 |
-
"title": "Nœud",
|
51 |
-
"id": "ID",
|
52 |
-
"labels": "Étiquettes",
|
53 |
-
"degree": "Degré",
|
54 |
-
"properties": "Propriétés",
|
55 |
-
"relationships": "Relations(dans le sous-graphe)",
|
56 |
-
"expandNode": "Développer le nœud",
|
57 |
-
"pruneNode": "Élaguer le nœud",
|
58 |
-
"deleteAllNodesError": "Refus de supprimer tous les nœuds du graphe",
|
59 |
-
"nodesRemoved": "{{count}} nœuds supprimés, y compris les nœuds orphelins",
|
60 |
-
"noNewNodes": "Aucun nœud extensible trouvé"
|
61 |
-
}
|
62 |
-
}
|
63 |
-
},
|
64 |
"documentPanel": {
|
65 |
"clearDocuments": {
|
66 |
"button": "Effacer",
|
@@ -262,6 +237,16 @@
|
|
262 |
"vectorStorage": "Stockage vectoriel"
|
263 |
},
|
264 |
"propertiesView": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
"node": {
|
266 |
"title": "Nœud",
|
267 |
"id": "ID",
|
|
|
35 |
"common": {
|
36 |
"cancel": "Annuler"
|
37 |
},
|
38 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
"documentPanel": {
|
40 |
"clearDocuments": {
|
41 |
"button": "Effacer",
|
|
|
237 |
"vectorStorage": "Stockage vectoriel"
|
238 |
},
|
239 |
"propertiesView": {
|
240 |
+
"errors": {
|
241 |
+
"duplicateName": "Le nom du nœud existe déjà",
|
242 |
+
"updateFailed": "Échec de la mise à jour du nœud",
|
243 |
+
"tryAgainLater": "Veuillez réessayer plus tard"
|
244 |
+
},
|
245 |
+
"doubleClickToEdit": "Double-cliquez pour modifier",
|
246 |
+
"success": {
|
247 |
+
"entityUpdated": "Nœud mis à jour avec succès",
|
248 |
+
"relationUpdated": "Relation mise à jour avec succès"
|
249 |
+
},
|
250 |
"node": {
|
251 |
"title": "Nœud",
|
252 |
"id": "ID",
|
lightrag_webui/src/locales/zh.json
CHANGED
@@ -241,6 +241,7 @@
|
|
241 |
"updateFailed": "更新节点失败",
|
242 |
"tryAgainLater": "请稍后重试"
|
243 |
},
|
|
|
244 |
"success": {
|
245 |
"entityUpdated": "节点更新成功",
|
246 |
"relationUpdated": "关系更新成功"
|
|
|
241 |
"updateFailed": "更新节点失败",
|
242 |
"tryAgainLater": "请稍后重试"
|
243 |
},
|
244 |
+
"doubleClickToEdit": "双击编辑",
|
245 |
"success": {
|
246 |
"entityUpdated": "节点更新成功",
|
247 |
"relationUpdated": "关系更新成功"
|