Skip to content

Refact: Enhance Property editing UI for KG Nodes#2287

Merged
danielaskdd merged 3 commits intoHKUDS:mainfrom
danielaskdd:fix-ui
Oct 30, 2025
Merged

Refact: Enhance Property editing UI for KG Nodes#2287
danielaskdd merged 3 commits intoHKUDS:mainfrom
danielaskdd:fix-ui

Conversation

@danielaskdd
Copy link
Collaborator

Refact: Enhance Property editing UI for KG Nodes

Overview

This PR fixes multiple issues in the graph visualization UI related to property editing, particularly for entity_id and entity_type updates.

Changes

1. Fix Entity Type Update Handling (79a17c3)

Problem: When updating entity_type property, the graph wasn't using the correct value.

Solution:

  • Use finalValue for none entity_id changes to ensure the new ID is properly applied
  • Maintain original value behavior for other property types
  • Fix property update logic in the graph store

2. Change Node Color According to New Entity Type

Problem: When entity_type was changed, node colors and legend weren't updating in real-time.

Solution:

  • Extracted color constants and logic to a dedicated utils/graphColor.ts module
  • Implemented resolveNodeColor function for consistent color resolution
  • Added automatic node color updates when entity_type changes
  • Updated legend to synchronize with type changes
  • Refactored and simplified color logic in useLightragGraph hook (reduced from 219 lines to more maintainable code)

3. Property Edit Dialog Optimization

Problem: Input values weren't consistently trimmed in the property edit dialog.

Solution:

  • Ensure trimmed values are used consistently throughout the edit dialog
  • Improve input value normalization

Testing Checklist

  • Entity ID updates apply correctly in the graph
  • Node colors update immediately when entity_type changes
  • Legend updates to reflect new entity_type values
  • Property edit dialog properly trims input values
  • No regression in other property editing functionality

• Use finalValue for entity_id changes
• Keep original value for other props
• Fix property update logic
- Move color constants to utils module
- Extract resolveNodeColor function
- Update node colors on type changes
- Simplify hook color logic
@danielaskdd danielaskdd merged commit bda52a8 into HKUDS:main Oct 30, 2025
1 check passed
@danielaskdd danielaskdd deleted the fix-ui branch October 30, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant