Web UI: BOM merge resolution view #47

Closed
opened 2026-02-09 00:17:47 +00:00 by forbes · 0 comments
Owner

Summary

Add merge resolution UI to the BOM tab in the web app. After an assembly BOM merge (#45), the BOM page should clearly distinguish assembly-sourced entries from manual ones, show unreferenced warnings, and let users explicitly remove or keep unreferenced items.

Requirements

1. Source badge on BOM entries

Each BOM entry row should display a small badge indicating its source:

  • assembly — synced from FreeCAD assembly via BOM merge
  • manual — added via web UI, CSV import, or API

The source field is returned in the existing BOMEntryResponse (after #44).

2. Unreferenced item warnings

When a BOM merge leaves unreferenced assembly-sourced entries (items previously synced from the assembly that are no longer present), the BOM tab should:

  • Show a warning banner: "N items were previously synced from the assembly but are no longer referenced"
  • Highlight those rows visually (e.g., amber background or strikethrough)
  • Provide per-row actions: Remove (delete from BOM) or Keep (convert source to manual)

3. Detecting unreferenced items

An entry is "unreferenced" if it has source = 'assembly' and was included in the diff.removed array from the last merge. Two approaches:

Option A (simple): The frontend checks the merge response warnings when it arrives via SSE, and marks those part numbers in its local state. This is ephemeral — reloading the page clears the warnings.

Option B (persistent): Add an unreferenced_at timestamp column to the relationships table. The merge endpoint sets this on removed entries. The BOM query returns it, and the frontend renders the warning. The column is cleared when the entry reappears in a future merge or is explicitly kept.

Recommend Option B for persistence, but either approach works.

Implementation

Frontend (web/src/components/items/BOMTab.tsx)

  • Add source badge column to BOM table
  • Add unreferenced warning banner (conditionally rendered)
  • Add row highlight for unreferenced entries
  • Add "Remove" and "Keep as manual" actions for unreferenced rows
  • "Keep as manual" calls PUT /api/items/{pn}/bom/{childPn} with {"source": "manual"} (requires Update handler to support source field change — or a new dedicated endpoint)

Backend (if Option B)

  • Migration: ALTER TABLE relationships ADD COLUMN unreferenced_at TIMESTAMPTZ
  • Update HandleMergeBOM: set unreferenced_at = now() on removed entries, clear it on entries that reappear
  • Update BOMEntryResponse: add unreferenced_at field
  • Update HandleUpdateBOMEntry: allow changing source field

Dependencies

  • #44 (source column) — must be done first
  • #45 (merge endpoint) — should exist before this UI is useful

Mockup

┌─ BOM: ASM-001 ──────────────────────────────────────────────┐
│ ⚠ 1 item previously synced from assembly is no longer       │
│   referenced. Review below.                        [Dismiss] │
├──────────────────────────────────────────────────────────────┤
│ Part       │ Description  │ Qty │ Source   │ Actions         │
│────────────┼──────────────┼─────┼──────────┼──���──────────────│
│ PRT-100    │ Base Plate   │  1  │ assembly │                 │
│ ASM-200    │ Gearbox      │  2  │ assembly │                 │
│ PRT-300    │ Cover        │  1  │ manual   │                 │
│ ⚠ PRT-400 │ Old Bracket  │  2  │ assembly │ [Remove] [Keep] │
└──────────────────────────────────────────────────────────────┘
## Summary Add merge resolution UI to the BOM tab in the web app. After an assembly BOM merge (#45), the BOM page should clearly distinguish assembly-sourced entries from manual ones, show unreferenced warnings, and let users explicitly remove or keep unreferenced items. ## Requirements ### 1. Source badge on BOM entries Each BOM entry row should display a small badge indicating its source: - `assembly` — synced from FreeCAD assembly via BOM merge - `manual` — added via web UI, CSV import, or API The `source` field is returned in the existing `BOMEntryResponse` (after #44). ### 2. Unreferenced item warnings When a BOM merge leaves unreferenced assembly-sourced entries (items previously synced from the assembly that are no longer present), the BOM tab should: - Show a warning banner: "N items were previously synced from the assembly but are no longer referenced" - Highlight those rows visually (e.g., amber background or strikethrough) - Provide per-row actions: **Remove** (delete from BOM) or **Keep** (convert source to `manual`) ### 3. Detecting unreferenced items An entry is "unreferenced" if it has `source = 'assembly'` and was included in the `diff.removed` array from the last merge. Two approaches: **Option A (simple):** The frontend checks the merge response warnings when it arrives via SSE, and marks those part numbers in its local state. This is ephemeral — reloading the page clears the warnings. **Option B (persistent):** Add an `unreferenced_at` timestamp column to the `relationships` table. The merge endpoint sets this on removed entries. The BOM query returns it, and the frontend renders the warning. The column is cleared when the entry reappears in a future merge or is explicitly kept. Recommend **Option B** for persistence, but either approach works. ## Implementation ### Frontend (`web/src/components/items/BOMTab.tsx`) - Add source badge column to BOM table - Add unreferenced warning banner (conditionally rendered) - Add row highlight for unreferenced entries - Add "Remove" and "Keep as manual" actions for unreferenced rows - "Keep as manual" calls `PUT /api/items/{pn}/bom/{childPn}` with `{"source": "manual"}` (requires Update handler to support `source` field change — or a new dedicated endpoint) ### Backend (if Option B) - Migration: `ALTER TABLE relationships ADD COLUMN unreferenced_at TIMESTAMPTZ` - Update `HandleMergeBOM`: set `unreferenced_at = now()` on removed entries, clear it on entries that reappear - Update `BOMEntryResponse`: add `unreferenced_at` field - Update `HandleUpdateBOMEntry`: allow changing `source` field ## Dependencies - #44 (source column) — must be done first - #45 (merge endpoint) — should exist before this UI is useful ## Mockup ``` ┌─ BOM: ASM-001 ──────────────────────────────────────────────┐ │ ⚠ 1 item previously synced from assembly is no longer │ │ referenced. Review below. [Dismiss] │ ├──────────────────────────────────────────────────────────────┤ │ Part │ Description │ Qty │ Source │ Actions │ │────────────┼──────────────┼─────┼──────────┼──���──────────────│ │ PRT-100 │ Base Plate │ 1 │ assembly │ │ │ ASM-200 │ Gearbox │ 2 │ assembly │ │ │ PRT-300 │ Cover │ 1 │ manual │ │ │ ⚠ PRT-400 │ Old Bracket │ 2 │ assembly │ [Remove] [Keep] │ └──────────────────────────────────────────────────────────────┘ ```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo#47