Skip to content

Extract the vulnerability assessment card into a shared component - #214

Merged
LarsLaskowski merged 1 commit into
mainfrom
claude/issue-206-dtr5qb
Jul 27, 2026
Merged

Extract the vulnerability assessment card into a shared component#214
LarsLaskowski merged 1 commit into
mainfrom
claude/issue-206-dtr5qb

Conversation

@LarsLaskowski

@LarsLaskowski LarsLaskowski commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • New Components/Shared/VulnerabilityAssessmentCard.razor (+ .razor.cs) renders the "Vulnerability assessment" summary card, with parameters VulnerabilityAssessmentViewData? Assessment and bool ShowCheckedAt.
  • RuntimeContainerDetail, MyImageDetail, and ObservedImageDetail now use the component inside their existing MudItem xs="12" md="6" wrapper; only RuntimeContainerDetail passes ShowCheckedAt="true".
  • The three per-page colour wrappers (GetVulnerabilityStatusColor / GetVulnerabilityAssessmentColor) are removed; the card and the base image chain rows call VulnerabilityDisplayFormatter.GetStatusColor directly.
  • Added VulnerabilityAssessmentCardTests covering the populated card, ShowCheckedAt on and off, omitted optional lines, and a null assessment.

Why

The card was duplicated verbatim across three detail pages, so every change had to be made three times. Consolidating it first keeps the follow-up reworks to a single place.

Linked issues

Closes #206

Review notes

  • Pure refactor: no CSS changes, same classes (summary-card, summary-label, table-secondary), same chip order and secondary lines. The U+2212 MINUS SIGN in the "resolved" chip is preserved.
  • One behaviour nuance: RuntimeContainerDetail.GetVulnerabilityStatusColor returned Color.Default for a blank status, while the shared formatter falls through to Color.Info. VulnerabilityAssessmentViewData.Status is a non-nullable string defaulting to Not scanned, so this path is not reachable from the view data.
  • The obsolete reflection-based MyImageDetailGetVulnerabilityAssessmentColorKnownStatusReturnsExpectedColor test was dropped; the same mapping is already covered by VulnerabilityDisplayFormatterTests.

Follow-up work

None

The "Vulnerability assessment" summary card was duplicated verbatim on the
runtime container, own image, and observed image detail pages. A new shared
VulnerabilityAssessmentCard component now renders the card and takes the
assessment plus a ShowCheckedAt flag, which only the runtime container page
sets. The three per-page colour wrapper methods are gone; the card and the
remaining base image chain rows call VulnerabilityDisplayFormatter.GetStatusColor
directly. Refs #206
@sonarqubecloud

Copy link
Copy Markdown

@LarsLaskowski
LarsLaskowski merged commit 5abaf8d into main Jul 27, 2026
4 checks passed
@LarsLaskowski
LarsLaskowski deleted the claude/issue-206-dtr5qb branch July 27, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract the vulnerability assessment card into a shared component

2 participants