feat(kc): remaining viewers — Dependencies, Jobs, Macros, and Approvals #41

Closed
opened 2026-02-18 21:16:46 +00:00 by forbes · 0 comments
Owner

Summary

Implement the four remaining viewer widgets. These are lower complexity than the Metadata Editor and can be developed in parallel after the Manifest Viewer pipeline is proven. Each viewer is an independent QWidget registered in the create_viewer_widget() factory.

5a. Dependency Table (silo/dependencies.json)

┌──────────────────────────────────────────────────┐
│  Assembly Dependencies                           │
├──────────────────────────────────────────────────┤
│  Label              PN            Rev  Qty  ✓/✗  │
│  Base Plate         KC-BRK-0042    2    1   ✓    │
│  M6 SHCS            KC-HDW-0108    1    4   ✓    │
│  Cover Panel        KC-PNL-0003    1    1   ✗    │
│                                                  │
│  ✗ = not resolved locally. [Download Missing →]  │
└──────────────────────────────────────────────────┘
  • Widget: QTableView with QStandardItemModel
  • Columns: Label, Part Number, Revision, Quantity, Resolution Status (✓/✗)
  • Resolution status: Checks whether the referenced .kc file exists locally
  • Download button: Triggers SiloSync.download_file() for unresolved items (disabled offline)
  • Double-click: Opens the resolved document if local
  • Tree icon: silo-dependencies.svg — git-branch, Teal #94e2d5

5b. Job Viewer (silo/jobs/*.yaml)

┌──────────────────────────────────────────────────┐
│  default.yaml                       [Edit] [Run] │
├──────────────────────────────────────────────────┤
│  (YAML source with syntax highlighting)          │
├──────────────────────────────────────────────────┤
│  Last Run: 2026-02-13 20:31 · completed · 42s   │
│  Runner: worker-01                               │
│  Result: 15 nodes validated, 0 errors            │
│  [View Full Log →]                               │
└──────────────────────────────────────────────────┘
  • Source panel: QPlainTextEdit with a YAML QSyntaxHighlighter. Read-only by default; Edit button toggles writable.
  • Status panel: Shows last run result, duration, runner (fetched from server if connected; placeholder if offline).
  • Run button: Triggers POST /api/jobs — disabled when offline.
  • Save-back: Changes to YAML source are written to silo/jobs/{filename} on document save via the dirty tracking system.
  • Tree icon: silo-job.svg — play-circle, Mauve #cba6f7

5c. Macro Editor (silo/macros/*.py)

┌──────────────────────────────────────────────────┐
│  on_save.py                  Trigger: [pre_save] │
├──────────────────────────────────────────────────┤
│  (Python source with syntax highlighting)        │
│                                                  │
│                        [Run Now]  [Save]         │
└──────────────────────────────────────────────────┘
  • Editor: Reuse FreeCAD's PythonEditor (Scintilla-based) if available. Fall back to QPlainTextEdit with manual QSyntaxHighlighter if QScintilla is not importable.
  • Trigger selector: QComboBox with values: pre_save, post_save, manual, on_open (from silo/macros/manifest.json).
  • Run Now: Executes script via exec() in FreeCAD's Python console context. Output goes to Report View.
  • Save-back: Uses dirty tracking system for write-back on document save.
  • Tree icon: silo-macro.svg — file-code, Yellow #f9e2af

5d. Approvals Viewer (silo/approvals.json)

┌──────────────────────────────────────────────────┐
│  ECO-2026-047              [pending_review]      │
├──────────────────────────────────────────────────┤
│  ✓ jane.smith      design_lead    approved       │
│    2026-02-13 16:00                              │
│  ○ bob.jones        quality        pending       │
│                                                  │
│         [Open in Silo Web UI →]                  │
└──────────────────────────────────────────────────┘
  • Widget: QVBoxLayout with status cards
  • Status icons: Approved = green check, Pending = empty circle, Rejected = red X
  • ECO header: ID and overall state as colored badge
  • Link button: Opens the ECO page in the system browser via QDesktopServices.openUrl()
  • Read-only: Approval actions happen in the Silo web UI, not in Create
  • Tree icon: silo-approvals.svg — shield-check, Peach #fab387

Files to modify

File Change
src/Mod/Create/silo_viewers.py Add SiloDependencyTable, SiloJobViewer, SiloMacroEditor, SiloApprovalsViewer classes. Register all in create_viewer_widget() factory.

Acceptance criteria

  • Double-clicking "Dependencies" opens a table view with columns and resolution status
  • Double-clicking a resolved dependency row opens that document
  • Download button downloads unresolved dependencies when connected
  • Double-clicking a Job node opens split YAML source + status panel
  • Job YAML has syntax highlighting
  • Job Edit button toggles between read-only and editable
  • Double-clicking a Macro node opens Python editor with trigger selector
  • Macro Run Now executes the script and outputs to Report View
  • Double-clicking "Approvals" opens status cards with correct approval states
  • Approvals "Open in Silo Web UI" button opens browser
  • All viewers inherit Catppuccin Mocha theme

Dependencies

  • Phase 1 foundation (#37)
  • Phase 2 Manifest Viewer (#38) — for factory and MDI pipeline
  • Phase 3 Metadata Editor (#39) — for dirty tracking (Jobs and Macros are editable)

References

  • docs/KC_SPECIFICATION.md §4.4–4.8 (approvals, dependencies, macros, jobs schemas)
  • docs/SILO_VIEWPORT_PLAN.md Phase 5
  • Silo Metadata Viewport Specification §5.4–5.7
## Summary Implement the four remaining viewer widgets. These are lower complexity than the Metadata Editor and can be developed in parallel after the Manifest Viewer pipeline is proven. Each viewer is an independent `QWidget` registered in the `create_viewer_widget()` factory. ## 5a. Dependency Table (`silo/dependencies.json`) ``` ┌──────────────────────────────────────────────────┐ │ Assembly Dependencies │ ├──────────────────────────────────────────────────┤ │ Label PN Rev Qty ✓/✗ │ │ Base Plate KC-BRK-0042 2 1 ✓ │ │ M6 SHCS KC-HDW-0108 1 4 ✓ │ │ Cover Panel KC-PNL-0003 1 1 ✗ │ │ │ │ ✗ = not resolved locally. [Download Missing →] │ └──────────────────────────────────────────────────┘ ``` - **Widget**: `QTableView` with `QStandardItemModel` - **Columns**: Label, Part Number, Revision, Quantity, Resolution Status (✓/✗) - **Resolution status**: Checks whether the referenced `.kc` file exists locally - **Download button**: Triggers `SiloSync.download_file()` for unresolved items (disabled offline) - **Double-click**: Opens the resolved document if local - **Tree icon**: `silo-dependencies.svg` — git-branch, Teal `#94e2d5` ## 5b. Job Viewer (`silo/jobs/*.yaml`) ``` ┌──────────────────────────────────────────────────┐ │ default.yaml [Edit] [Run] │ ├──────────────────────────────────────────────────┤ │ (YAML source with syntax highlighting) │ ├──────────────────────────────────────────────────┤ │ Last Run: 2026-02-13 20:31 · completed · 42s │ │ Runner: worker-01 │ │ Result: 15 nodes validated, 0 errors │ │ [View Full Log →] │ └──────────────────────────────────────────────────┘ ``` - **Source panel**: `QPlainTextEdit` with a YAML `QSyntaxHighlighter`. Read-only by default; Edit button toggles writable. - **Status panel**: Shows last run result, duration, runner (fetched from server if connected; placeholder if offline). - **Run button**: Triggers `POST /api/jobs` — disabled when offline. - **Save-back**: Changes to YAML source are written to `silo/jobs/{filename}` on document save via the dirty tracking system. - **Tree icon**: `silo-job.svg` — play-circle, Mauve `#cba6f7` ## 5c. Macro Editor (`silo/macros/*.py`) ``` ┌──────────────────────────────────────────────────┐ │ on_save.py Trigger: [pre_save] │ ├──────────────────────────────────────────────────┤ │ (Python source with syntax highlighting) │ │ │ │ [Run Now] [Save] │ └──────────────────────────────────────────────────┘ ``` - **Editor**: Reuse FreeCAD's `PythonEditor` (Scintilla-based) if available. Fall back to `QPlainTextEdit` with manual `QSyntaxHighlighter` if QScintilla is not importable. - **Trigger selector**: `QComboBox` with values: `pre_save`, `post_save`, `manual`, `on_open` (from `silo/macros/manifest.json`). - **Run Now**: Executes script via `exec()` in FreeCAD's Python console context. Output goes to Report View. - **Save-back**: Uses dirty tracking system for write-back on document save. - **Tree icon**: `silo-macro.svg` — file-code, Yellow `#f9e2af` ## 5d. Approvals Viewer (`silo/approvals.json`) ``` ┌──────────────────────────────────────────────────┐ │ ECO-2026-047 [pending_review] │ ├──────────────────────────────────────────────────┤ │ ✓ jane.smith design_lead approved │ │ 2026-02-13 16:00 │ │ ○ bob.jones quality pending │ │ │ │ [Open in Silo Web UI →] │ └──────────────────────────────────────────────────┘ ``` - **Widget**: `QVBoxLayout` with status cards - **Status icons**: Approved = green check, Pending = empty circle, Rejected = red X - **ECO header**: ID and overall state as colored badge - **Link button**: Opens the ECO page in the system browser via `QDesktopServices.openUrl()` - **Read-only**: Approval actions happen in the Silo web UI, not in Create - **Tree icon**: `silo-approvals.svg` — shield-check, Peach `#fab387` ## Files to modify | File | Change | |------|--------| | `src/Mod/Create/silo_viewers.py` | Add `SiloDependencyTable`, `SiloJobViewer`, `SiloMacroEditor`, `SiloApprovalsViewer` classes. Register all in `create_viewer_widget()` factory. | ## Acceptance criteria - [ ] Double-clicking "Dependencies" opens a table view with columns and resolution status - [ ] Double-clicking a resolved dependency row opens that document - [ ] Download button downloads unresolved dependencies when connected - [ ] Double-clicking a Job node opens split YAML source + status panel - [ ] Job YAML has syntax highlighting - [ ] Job Edit button toggles between read-only and editable - [ ] Double-clicking a Macro node opens Python editor with trigger selector - [ ] Macro Run Now executes the script and outputs to Report View - [ ] Double-clicking "Approvals" opens status cards with correct approval states - [ ] Approvals "Open in Silo Web UI" button opens browser - [ ] All viewers inherit Catppuccin Mocha theme ## Dependencies - Phase 1 foundation (#37) - Phase 2 Manifest Viewer (#38) — for factory and MDI pipeline - Phase 3 Metadata Editor (#39) — for dirty tracking (Jobs and Macros are editable) ## References - `docs/KC_SPECIFICATION.md` §4.4–4.8 (approvals, dependencies, macros, jobs schemas) - `docs/SILO_VIEWPORT_PLAN.md` Phase 5 - Silo Metadata Viewport Specification §5.4–5.7
forbes added the enhancement label 2026-02-18 21:16:46 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo-mod#41