Hierarchy Node Editor Screen
Component Detail
Description
Full-screen form for creating and editing a single organization unit node. Allows setting the node name, level type, and parent assignment via a searchable dropdown. Validates that cycles are not introduced and that depth limits are respected.
hierarchy-node-editor
Summaries
The Hierarchy Node Editor is the administrative tool that keeps the organizational structure accurate and up to date. Without it, any change to the network of national associations, regions, and chapters — whether adding a new local chapter, renaming a region, or reassigning a chapter to a different parent — would require manual database intervention. This component eliminates that operational bottleneck and reduces the risk of structural errors that can corrupt access control, reporting, and program delivery. Its built-in cycle detection and cascade deletion warnings protect data integrity, preventing mistakes that could require costly manual remediation by engineering staff.
Medium-complexity screen with two distinct workflows (create and edit) and validation logic that requires coordination with the hierarchy-service for cycle detection and depth-limit enforcement. The parent assignment dropdown requires a searchable list backed by organization-unit-repository, which must handle potentially large result sets efficiently. The cascade-warning flow for deletion needs explicit QA test cases covering multi-level child nodes. Dependencies on hierarchy-service must be finalized before this screen can be completed.
Both frontend and mobile layouts need independent UX review. Accessibility testing for the form inputs and the searchable dropdown is required before sign-off, particularly for screen reader compatibility on mobile.
HierarchyNodeEditorScreen accepts an optional `unitId` — when null it renders in create mode; when provided it loads the existing unit via organization-unit-repository and populates form fields. `saveNode(name, levelType, parentId)` calls hierarchy-service which performs server-side cycle detection; the client-side `validateParentSelection(parentId)` provides immediate feedback before submission. `showCascadeWarning()` is triggered before `deleteNode(unitId)` when the target node has children, presenting a confirmation dialog listing affected descendants. The parent-assignment dropdown should implement debounced search against organization-unit-repository's search endpoint.
Use reactive form validation with BLoC/Cubit to manage form state; avoid setState for field-level validation to prevent full widget rebuilds.
Responsibilities
- Create new organization unit with name and type
- Edit existing unit name and parent assignment
- Prevent circular parent references
- Confirm deletion with cascade warning
Interfaces
HierarchyNodeEditorScreen(unitId?)
saveNode(name, levelType, parentId)
deleteNode(unitId)
validateParentSelection(parentId)
showCascadeWarning()
Relationships
Dependencies (2)
Components this component depends on