Extract the vulnerability assessment card into a shared component - #214
Merged
Conversation
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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Components/Shared/VulnerabilityAssessmentCard.razor(+.razor.cs) renders the "Vulnerability assessment" summary card, with parametersVulnerabilityAssessmentViewData? Assessmentandbool ShowCheckedAt.RuntimeContainerDetail,MyImageDetail, andObservedImageDetailnow use the component inside their existingMudItem xs="12" md="6"wrapper; onlyRuntimeContainerDetailpassesShowCheckedAt="true".GetVulnerabilityStatusColor/GetVulnerabilityAssessmentColor) are removed; the card and the base image chain rows callVulnerabilityDisplayFormatter.GetStatusColordirectly.VulnerabilityAssessmentCardTestscovering the populated card,ShowCheckedAton 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
summary-card,summary-label,table-secondary), same chip order and secondary lines. The U+2212 MINUS SIGN in the "resolved" chip is preserved.RuntimeContainerDetail.GetVulnerabilityStatusColorreturnedColor.Defaultfor a blank status, while the shared formatter falls through toColor.Info.VulnerabilityAssessmentViewData.Statusis a non-nullable string defaulting toNot scanned, so this path is not reachable from the view data.MyImageDetailGetVulnerabilityAssessmentColorKnownStatusReturnsExpectedColortest was dropped; the same mapping is already covered byVulnerabilityDisplayFormatterTests.Follow-up work
None