KB-4F8F

M002-WCR-UI Report

6 min read Revision 1
reportm002workflow-modulesupervisor-uigovernance

M002-WCR-UI Report

Date: 2026-03-03 PR: #426 PR URL: https://github.com/Huyen1974/web-test/pull/426 Status: OPEN, CI GREEN, waiting user review/merge

Scope

Build supervisor-facing Workflows UI on top of M-002 Phase 2A foundation:

  • Extend existing Directus schema only (no new collections)
  • Add Workflows navigation + list/detail pages
  • Add Process Registry, Workflow Matrix, and WCR Intake UI
  • Keep Phase 1/2A workflow viewer/modeler foundation intact

Schema Changes

Applied via DOT only on cloud Directus.

workflows added fields

  • process_code (string, unique)
  • sort (integer)
  • parent_workflow_id (self FK -> workflows.id)
  • level (integer, default 1)

workflow_steps added fields

  • trigger_in_text (text, nullable)
  • trigger_out_text (text, nullable)

Evidence

  • dot-schema-workflows-ensure --cloud created process_code, sort, parent_workflow_id, level, and self relation workflows.parent_workflow_id -> workflows
  • dot-schema-workflow-governance-ensure --cloud created workflow_steps.trigger_in_text and workflow_steps.trigger_out_text
  • Directus current state after apply:
    • workflows = 14 fields
    • workflow_steps = 16 fields
    • workflow_step_relations = 8 fields

Data Updates

Updated existing workflow #1 in Directus:

  • process_code = WF-001
  • sort = 1
  • level = 1
  • parent_workflow_id = null

Updated all 10 workflow #1 steps with supervisor-readable trigger text derived from live relations, including migrated AI review block steps.

Examples:

  • Review Task.trigger_in_text = "Sau khi Task Submitted hoan thanh"
  • Approved?.trigger_out_text = "→ Approved hoac → Rejected"
  • Pass?.trigger_out_text = "→ Approve hoac → Request Changes"

Components Created

New components

  • web/components/modules/workflow-module/partials/ProcessRegistryView.vue
  • web/components/modules/workflow-module/partials/WorkflowMatrixView.vue
  • web/components/modules/workflow-module/partials/WcrIntakePanel.vue

New pages/routes

  • web/pages/knowledge/workflows/index.vue -> /knowledge/workflows
  • web/pages/knowledge/workflows/[id].vue -> /knowledge/workflows/:id

New server APIs

  • web/server/api/workflows/registry.get.ts
  • web/server/api/workflows/[id]/matrix.get.ts
  • web/server/api/workflows/[id]/change-requests.get.ts

Modified integration files

  • web/components/navigation/TheHeader.vue
  • web/composables/useWorkflows.ts
  • web/server/utils/directusService.ts
  • web/types/workflows.ts
  • web/types/workflow-dsl.ts
  • dot/bin/dot-schema-workflows-ensure
  • dot/bin/dot-schema-workflow-governance-ensure

UI Behavior Delivered

Registry page

  • Pagination: 25 items/page
  • Search: title + process_code
  • Filters: status + level
  • Tree render: grouped by parent_workflow_id, indented by level
  • Step count shown per workflow

Detail page

  • Header shows workflow code, title, description, level, status
  • Tabs:
    • Bang buoc -> WorkflowMatrixView
    • So do BPMN -> existing WorkflowViewer
    • De xuat thay doi -> WcrIntakePanel
  • Existing CommentModule is preserved when workflow has task_id

WCR intake

  • Natural-language description input
  • change_type dropdown
  • optional position_context
  • existing WCR list + status badge + detail view

Validation

Local code validation

  • pnpm typecheck -> PASS
  • pnpm build -> PASS
  • Existing pre-existing build warnings remain:
    • PostCSS/SVGO warning for .bg-checkerboard SVG data URL
    • Large chunk warnings

Cloud/schema validation

  • DOT dry-run matched expected 6 new fields only
  • DOT apply completed successfully on cloud Directus
  • Directus item verify confirmed workflow #1 metadata and step trigger fields were persisted

Git / CI validation

  • Branch: feat/m002-wcr-ui
  • Commit: ebacf87 (feat: add workflow supervisor UI)
  • PR: #426
  • mergeStateStatus = CLEAN
  • Final PR checks snapshot: SUCCESS
    • Nuxt 3 CI build
    • Terraform Deploy Quality Gate
    • Terraform Deploy Pass Gate
    • Terraform Deploy E2E Smoke Test
    • Critical File Guard
    • required-docs-guard
    • Firebase Deploy deploy step

Before / After Evidence

Before

  • No top-level Workflows navigation item
  • No /knowledge/workflows route
  • workflows had no process_code/sort/parent_workflow_id/level
  • workflow_steps had no supervisor-readable trigger text fields

After

  • Workflows added to main navigation in app code
  • Supervisor registry/detail routes added
  • Workflow #1 labeled WF-001
  • Workflow #1 matrix can display persisted trigger_in_text / trigger_out_text
  • WCR intake panel available from workflow detail page

Known Deferrals

  • TD-060: max-3-level hierarchy not yet enforced by Directus Flow/hook
  • TD-061: matrix row -> BPMN node highlight not implemented to avoid changing WorkflowViewer core logic in this mission

Notes

  • No new collection was created
  • No raw SQL or migration files were used
  • CommentModule was not modified
  • DSL backend and WorkflowViewer core logic were not changed
  • Local page-level curl verification from ephemeral nuxt dev could not be completed reliably in this sandbox; functional confidence is based on typecheck, production-like build, live Directus schema/data verification, and PR CI green