Components Reference

Reusable UI components live in MILTON.Client/Components/ and are consumed by the routed pages. They do not have @page directives and cannot be navigated to directly. Document-specific components are organized in the Components/Documents/ subdirectory.


Top-Level Components

Component.razor

File: Components/Component.razor

An empty placeholder component. Reserved for future use.


InstantiateTemplateDialog

File: Components/InstantiateTemplateDialog.razor

A MudBlazor dialog for creating a new document from an existing template. Opened by Templates.razor when the user clicks “Create Document” on a template card.

Parameters:

ParameterTypeDescription
TemplateTemplateResponseThe template to instantiate (required)
ProjectIdintThe owning project ID (required)

Behaviour:

  • Loads the project’s git repositories from GET /api/projects/{ProjectId}/config to populate a repository selector.
  • Provides template variable inputs (RepoUrl, Branch, plus user-defined custom variables). Variables replace {{Key}} placeholders in the template.
  • Submits to POST /api/documents/templates/instantiate.
  • On success, clears DocumentStore for the project and returns the new document ID to the caller via DialogResult.Ok.

API calls: GET /api/projects/{ProjectId}/config, POST /api/documents/templates/instantiate


Document Components (Components/Documents/)

These components form the building blocks of the document editor and template builder experiences.


BlockRenderer

File: Components/Documents/BlockRenderer.razor

Dispatches content blocks to the appropriate type-specific card component based on Block.Type.

Parameters:

ParameterTypeDescription
BlockContentBlockDtoThe content block to render (required)
OnProcessEventCallback<Guid>Callback to trigger block processing

Routing logic:

Block TypeRendered Component
RequirementRequirementCard
ScannerScannerCard
TestCaseTestCaseCard
defaultDefaultBlockView

DefaultBlockView

File: Components/Documents/DefaultBlockView.razor

Fallback renderer for content blocks that do not match a specialized card type. Displays the block type, status chip, and body text in a simple card layout.

Parameters:

ParameterTypeDescription
BlockContentBlockDtoThe content block to render (required)

DocumentPreviewPanel

File: Components/Documents/DocumentPreviewPanel.razor

A preview panel that renders a document as HTML inside a sandboxed <iframe>. Used by DocumentEditor.razor to show a live document preview.

Parameters:

ParameterTypeDescription
DocumentIdGuidThe document to preview
IsVisibleboolControls visibility (default true)

Behaviour:

  • Fetches rendered HTML from GET /api/documents/{DocumentId}/preview.
  • Auto-loads when DocumentId changes while visible.
  • Provides a zoom control (50%–125%) and a manual refresh button.
  • Shows loading, error, and empty states.

API calls: GET /api/documents/{DocumentId}/preview


RenderSection

File: Components/Documents/RenderSection.razor

Recursively renders a document section with its blocks and child sections. Used by DocumentEditor.razor as the primary content renderer.

Parameters:

ParameterTypeDescription
SectionSectionDtoThe section to render (required)
DepthintNesting depth for indentation
OnProcessEventCallback<Guid>Callback to process a block
EnableDragboolEnable drag-and-drop reordering
OnSectionReorderedEventCallbackCallback after section reorder
ProjectIdintProject ID for source file browsing

Behaviour:

  • Renders section header with title and source file count.
  • Shows an expandable source files panel with RepoFileAutocomplete for adding new files.
  • Renders top-level blocks using BlockRenderer inside a MudDropContainer for drag-and-drop reordering.
  • Persists block order changes to PUT /api/documents/sections/{SectionId}/blocks/reorder.
  • Recurses into ChildSections with incremented depth.
  • Subscribes to DocumentStateService.OnStateChanged for real-time updates and implements IDisposable to unsubscribe.

API calls: PUT /api/documents/sections/{SectionId}/blocks/reorder


RepoFileAutocomplete

File: Components/Documents/RepoFileAutocomplete.razor

An autocomplete input for browsing and selecting repository file paths. Used inside RenderSection for assigning source files to sections.

Parameters:

ParameterTypeDescription
ProjectIdintThe project whose repos to browse
LabelstringInput label (default: “Source File”)
ValuestringCurrent value (two-way bound)
ValueChangedEventCallback<string>Change callback

Behaviour:

  • Browses repository file paths via POST /api/documents/repo/browse with directory prefix caching.
  • Filters results client-side by the typed substring.
  • Directories appear first in the suggestion list.
  • Shows up to 25 suggestions.

API calls: POST /api/documents/repo/browse


RequirementCard

File: Components/Documents/RequirementCard.razor

An editable card for Requirement-type content blocks. Displays the requirement ID, status (Pending/Reviewed/Approved/Rejected), safety level (QM/ASIL A–D), body text, rationale, source file reference, and traceability links.

Parameters:

ParameterTypeDescription
BlockContentBlockDtoThe requirement block (required)

Behaviour:

  • Read mode: Shows requirement text, rationale, source file location, and a TraceView for traceability links.
  • Edit mode: Inline editing of body text, status, safety level, and rationale with save/cancel actions.
  • Saves changes via PUT /api/documents/blocks/{BlockId}.
  • Color-codes status and safety level chips.

API calls: PUT /api/documents/blocks/{BlockId}


ScannerCard

File: Components/Documents/ScannerCard.razor

A card for Scanner-type content blocks that display repository scan status and configuration.

Parameters:

ParameterTypeDescription
BlockContentBlockDtoThe scanner block (required)
OnProcessEventCallback<Guid>Callback to trigger processing

Behaviour:

  • Displays scanner configuration: repository URL, branch, granularity, and ignore patterns.
  • Shows progress indicators during active scanning (Leiden clustering algorithm).
  • Transitions through Pending → Processing → Completed states.

SectionSettingsDrawer

File: Components/Documents/SectionSettingsDrawer.razor

A persistent right-side drawer for editing per-section style and layout settings. Used by the template editor pages.

Parameters:

ParameterTypeDescription
IsOpenboolDrawer open state (two-way bound)
SelectedSectionTemplateSectionDefThe section being configured
StyleSectionStyleSection style object (two-way bound)
DepthintSection nesting depth
OnChangedEventCallbackCallback when settings change

Setting panels:

  • Typography: Font family, font size, heading size, line height, letter spacing.
  • Spacing: Margin (top/bottom) and padding (top/bottom/left/right).

SectionTreeItem

File: Components/Documents/SectionTreeItem.razor

A recursive tree view item for the document section sidebar in DocumentEditor.

Parameters:

ParameterTypeDescription
SectionSectionDtoThe section to display (required)
DocumentIdGuidThe parent document ID
SelectedSectionIdGuid?Currently selected section

Behaviour:

  • Renders as a MudTreeViewItem with child sections recursively nested.
  • Appends requirement blocks as leaf nodes under their parent section, displaying the requirement ID or a truncated body preview.
  • Clicking a requirement leaf scrolls the main content area to the corresponding block via fragment navigation (#block-{blockId}).

TemplatePreviewPanel

File: Components/Documents/TemplatePreviewPanel.razor

A live preview panel for template editing. Renders the current template definition as HTML in a sandboxed iframe. Used by CreateTemplate.razor and EditTemplate.razor.

Parameters:

ParameterTypeDescription
SectionsList<TemplateSectionDef>Template section definitions
DocumentStyleDocumentStyle?Document-level style settings
VariablesDictionary<string, string>?Template variable values
IsVisibleboolControls visibility (default true)

Behaviour:

  • Debounces preview requests (800ms) to avoid excessive API calls during rapid editing.
  • Posts the current template structure to POST /api/documents/templates/preview and renders the returned HTML.
  • Provides zoom control (50%–125%) and manual refresh.
  • Implements IDisposable to cancel pending debounce timers.

API calls: POST /api/documents/templates/preview


TemplateSectionEditor

File: Components/Documents/TemplateSectionEditor.razor

A recursive section editor used by both CreateTemplate and EditTemplate. Provides the full UI for defining template sections, context sources, and AI configuration.

Parameters:

ParameterTypeDescription
SectionTemplateSectionDefThe section being edited (required)
DepthintCurrent nesting depth
OnRemoveEventCallbackCallback to remove this section
AvailableReposList<GitRepositoryDto>Available repositories for context sources
AvailableDocsList<DocumentSummaryResponse>Available documents for reference sources
ProjectIdintProject ID

Behaviour:

  • Edits section title and optional system prompt (custom AI instruction).
  • Manages context sources with three types:
    • Clustering: Repository scanning with Leiden algorithm, configurable block type (Requirement/TestCase/Text), optional LLM naming.
    • Repository: Direct file reference from a repository branch.
    • Document: Cross-reference to another document in the project.
  • “Scan & Cluster” button triggers POST /api/documents/templates/scan and populates child sections from clustering results.
  • Displays source files assigned to cluster-generated sub-sections.
  • Recurses for child sections.

API calls: POST /api/documents/templates/scan


TestCaseCard

File: Components/Documents/TestCaseCard.razor

A read-only card for TestCase-type content blocks. Displays test result status, execution metadata, and traceability links.

Parameters:

ParameterTypeDescription
BlockContentBlockDtoThe test case block (required)

Displayed fields:

  • Result: Pass / Fail / Skip / Error (color-coded icon and chip).
  • Duration: Execution time in milliseconds.
  • Tester name and execution date.
  • Failure message: Shown as an error alert when present.
  • Pipeline ID: CI/CD pipeline reference.
  • Traceability: Rendered via embedded TraceView.

TraceView

File: Components/Documents/TraceView.razor

Displays traceability links for a content block. Shows how blocks relate to each other through link types like Verifies, Satisfies, DerivedFrom, and Implements.

Parameters:

ParameterTypeDescription
BlockIdGuidThe block to show trace links for (required)
AutoLoadboolWhether to load links automatically (default true)

Behaviour:

  • Fetches trace links from GET /api/documents/blocks/{BlockId}/tracelinks.
  • Renders each link as a color-coded chip with directional arrow (→ outgoing, ← incoming).
  • Link types: Verifies (green), Satisfies (blue), DerivedFrom (yellow), Implements (default).

API calls: GET /api/documents/blocks/{BlockId}/tracelinks