diff --git a/docs/areas/web-ui.md b/docs/areas/web-ui.md
index 7cd7a14b..646b647b 100644
--- a/docs/areas/web-ui.md
+++ b/docs/areas/web-ui.md
@@ -62,6 +62,7 @@ to read the state the other areas compute and to start manual scans; it computes
- The status of a vulnerability assessment, `Findings detected`, takes the tone of its highest severity with at least
one finding (critical, high, medium or low); without a counted known severity it is low. Any other status ignores
the severities, so `Failed` stays red. A severity chip uses the tone of its own severity; an unknown one is low.
+- The runtime container list shows the highest active severity as chip (`Unknown` in the low tone), beside it the status chip for a status other than `Findings detected`, and the count line `{count} active · {n} critical, …` in the order critical, high, medium, low, unknown.
- The severity bar shows the active findings as segments in the order critical, high, medium, low, each as wide as
its count and at least 4 px; findings of an unknown severity count as low. A legend lists the counts and the bar
is announced as `Severity distribution: ...`. Without findings nothing is shown.
@@ -79,7 +80,7 @@ to read the state the other areas compute and to start manual scans; it computes
| `/my-images/{id}` | My Image details | One observed image: reference, latest scan, derived-runtime hint, running containers, base image chain, update findings with tag candidates, and — when there are any — vulnerability findings and its 20 most recent scan runs |
| `/observed-images` | Observed Images | The registration form and the manually registered images with latest scan, active update findings, derived-runtime hint and vulnerability status |
| `/observed-images/{id}` | Observed Image detail | One observed image: reference, latest scan, whether it is an own or a manual image, derived-runtime hint, running containers (own images only), base image chain, vulnerability findings and update findings with tag candidates; no scan history |
-| `/runtime-containers` | Runtime Containers | Every currently known container with instance, tag (and the version an alias resolves to), CPU, memory and network usage with a short trend of up to the 12 latest samples, update state, available update and vulnerability status; a link to the own image when the container runs one |
+| `/runtime-containers` | Runtime Containers | A panel `Container inventory` with the meta text `{n} containers on {m} Docker instances`; seven columns: container (name, tag with the version an alias resolves to, link to the own image), instance, CPU, memory and network usage with a trend of up to the 12 latest samples, update state with the available version, and vulnerabilities (chip, count line, last check, rescan, base image warning); [0082](../decisions/0082-the-runtime-container-list-names-the-highest-active-severity-and-keeps-a-failed-checks-status-beside-it.md) |
| `/runtime-containers/{instanceId}/{containerId}` | Runtime Container detail | One container: image and digest, Compose project, linked own image, update state and message, derived-runtime hint, base image chain, resource usage history, manual tag preference, available tag candidates, update findings, vulnerability findings and the scans of its 20 most recent snapshots; for a container of a Docker instance with Portainer enabled, the *Container actions* section with the 20 most recent action runs of the container |
| `/docker-instances` | Docker Instances | Configured Docker instances with endpoint, connection kind, latest runtime scan status and time, current resource usage and number of containers; with exactly one instance its current usage and usage history are shown on this page directly |
| `/docker-instances/{id}` | Docker Instance detail | The containers currently observed on one instance with linked own image and resource usage |
@@ -106,7 +107,7 @@ to read the state the other areas compute and to start manual scans; it computes
| Register and scan | Observed Images | Registers an image from name (trimmed), image reference and optional description ([Image catalog](image-catalog.md)), scans it immediately as a manual observed-image scan and opens its detail page; a reference already tracked as an enabled own image is rejected with an `Open own image` link to that image and starts no scan |
| Check image updates | Runtime Containers | Runs a manual runtime container scan of all enabled Docker instances |
| Refresh vulnerabilities | Scan History, shown only when vulnerability scanning is enabled | Runs a manual vulnerability refresh of all live images; the page also shows when the next scheduled refresh is expected |
-| Rescan (per image) | Observed Images, My Images, Runtime Containers | Runs a manual vulnerability refresh of that one image version; next to it the time of the last check or "Never scanned"; the button is announced as `Rescan vulnerabilities` |
+| Rescan (per image) | Observed Images, My Images, Runtime Containers | Runs a manual vulnerability refresh of that one image version; with it the time of the last check or "Never scanned"; the button is announced as `Rescan vulnerabilities` |
| Select / Clear selection | Runtime Container detail | Stores or removes a manual tag preference for that container ([Update detection](update-detection.md)); it does not change or redeploy the container |
| Start / Stop / Restart | Runtime Container detail, *Container actions* section | Starts, stops or restarts that container through Portainer after a confirmation, and records the action as an action run ([Container actions](container-actions.md)) |
@@ -341,6 +342,8 @@ never their values.
map to tones in one mapping, beside the chip colors of unconverted pages.
- [0080](../decisions/0080-the-dashboard-counts-the-containers-advisories-and-own-images-it-lists.md) — The dashboard
counts the containers, advisories and own images it lists.
+- [0082](../decisions/0082-the-runtime-container-list-names-the-highest-active-severity-and-keeps-a-failed-checks-status-beside-it.md) — The
+ runtime container list names the highest active severity and keeps a failed check's status beside it.
## Not here
diff --git a/docs/decisions/0082-the-runtime-container-list-names-the-highest-active-severity-and-keeps-a-failed-checks-status-beside-it.md b/docs/decisions/0082-the-runtime-container-list-names-the-highest-active-severity-and-keeps-a-failed-checks-status-beside-it.md
new file mode 100644
index 00000000..72153dc7
--- /dev/null
+++ b/docs/decisions/0082-the-runtime-container-list-names-the-highest-active-severity-and-keeps-a-failed-checks-status-beside-it.md
@@ -0,0 +1,38 @@
+# 0082: The runtime container list names the highest active severity and keeps a failed check's status beside it
+
+- **Status:** Accepted
+- **Date:** 2026-11-30
+- **Area:** Web UI
+- **Source:** Issue #455
+- **Supersedes:** —
+
+## Context
+
+The flat refresh (#450) gives the Runtime Containers list a Vulnerabilities column of its own. Issue #455 replaces the
+*Runtime vulnerabilities* chip and the compact severity chips by one chip and one line: the highest severity present
+and `{count} active · {breakdown}`. The list item carries two independent values: the image version's stored
+assessment status and its active findings. A failed or unavailable check leaves the findings of an earlier check active
+while the status turns `Failed` or `Unavailable`. Until now the count line showed the stored assessment message, which
+after such a check is the failure message, so the failure was visible. A severity chip alone would hide it.
+
+## Options considered
+
+1. **Severity chip, and the status chip beside it whenever the status is not `Findings detected` (chosen)** — the
+ failed check stays visible in the row as a red `Failed` chip; such rows show two chips.
+2. **Severity chip only** — the mockup's look in every row, but after a failed check the row looks as if the findings
+ were current, and nothing says the check failed.
+3. **Status chip only, in the tone of the highest severity** — one chip per row, but `Findings detected` says less than
+ the severity the issue asks for, and a failed check would still lose its severity.
+4. **Keep the assessment message as the count line** — shows the failure text, but the line no longer carries the
+ severities the removed chips showed.
+
+## Decision
+
+With active findings the Vulnerabilities cell of the runtime container list shows the highest active severity as its
+chip and the severity counts as its count line; a status other than `Findings detected` is shown as a second chip
+beside it. The texts, tones and order are stated in [Web UI](../areas/web-ui.md).
+
+## Consequences
+
+The stored assessment message no longer appears on the list; the detail page still shows it. The pages converted later
+in #450 (My Images, Observed Images) can take the same cell; whether they do is decided in their issues.
diff --git a/docs/decisions/README.md b/docs/decisions/README.md
index 1cbd1154..1610cdf9 100644
--- a/docs/decisions/README.md
+++ b/docs/decisions/README.md
@@ -147,4 +147,5 @@ once in the [area document](../areas/README.md) of the record's area, and the re
| [0079](0079-statuses-map-to-tones-in-one-mapping-beside-the-chip-colors-of-unconverted-pages.md) | Statuses map to tones in one mapping, beside the chip colors of unconverted pages | Accepted | 2026-11-28 |
| [0080](0080-the-dashboard-counts-the-containers-advisories-and-own-images-it-lists.md) | The dashboard counts the containers, advisories and own images it lists | Accepted | 2026-11-29 |
| [0081](0081-the-navigation-row-shows-from-1360-px-and-a-drawer-below.md) | The navigation row shows from 1360 px, and a drawer below | Accepted | 2026-11-29 |
+| [0082](0082-the-runtime-container-list-names-the-highest-active-severity-and-keeps-a-failed-checks-status-beside-it.md) | The runtime container list names the highest active severity and keeps a failed check's status beside it | Accepted | 2026-11-30 |
diff --git a/src/DockerUpdateGuard/Components/Common/VulnerabilityRescanControl.razor b/src/DockerUpdateGuard/Components/Common/VulnerabilityRescanControl.razor
index 54e4296e..e599a7f6 100644
--- a/src/DockerUpdateGuard/Components/Common/VulnerabilityRescanControl.razor
+++ b/src/DockerUpdateGuard/Components/Common/VulnerabilityRescanControl.razor
@@ -1,14 +1,35 @@
-
- @(CheckedAtUtc is DateTimeOffset checkedAtUtc ? $"Checked {TimestampFormatter.Format(checkedAtUtc)}" : "Never scanned")
-
+@{
+ RenderFragment rescanButton = @
-
-
-@if (string.IsNullOrWhiteSpace(_errorMessage) == false)
+ ;
+}
+@if (LeadingContent is not null || TrailingContent is not null)
{
- @_errorMessage
+
+
+ @LeadingContent
+ @CheckedText
+ @if (string.IsNullOrWhiteSpace(_errorMessage) == false)
+ {
+ @_errorMessage
+ }
+ @TrailingContent
+
+ @rescanButton
+
}
+else
+{
+
+ @CheckedText
+ @rescanButton
+
+ @if (string.IsNullOrWhiteSpace(_errorMessage) == false)
+ {
+ @_errorMessage
+ }
+}
\ No newline at end of file
diff --git a/src/DockerUpdateGuard/Components/Common/VulnerabilityRescanControl.razor.cs b/src/DockerUpdateGuard/Components/Common/VulnerabilityRescanControl.razor.cs
index f486adfb..fad67556 100644
--- a/src/DockerUpdateGuard/Components/Common/VulnerabilityRescanControl.razor.cs
+++ b/src/DockerUpdateGuard/Components/Common/VulnerabilityRescanControl.razor.cs
@@ -1,6 +1,7 @@
using DockerUpdateGuard.Data.Entities;
using DockerUpdateGuard.Images.Interfaces;
using DockerUpdateGuard.Infrastructure;
+using DockerUpdateGuard.UI;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.DependencyInjection;
@@ -46,6 +47,18 @@ public partial class VulnerabilityRescanControl
[Parameter]
public EventCallback OnRescanned { get; set; }
+ ///
+ /// Optional content shown above the last check time; when this or TrailingContent is set, the control renders its split layout with the rescan button in its own column
+ ///
+ [Parameter]
+ public RenderFragment? LeadingContent { get; set; }
+
+ ///
+ /// Optional content shown below the last check time and a failed rescan's error; when this or LeadingContent is set, the control renders its split layout with the rescan button in its own column
+ ///
+ [Parameter]
+ public RenderFragment? TrailingContent { get; set; }
+
///
/// Service-scope factory
///
@@ -58,6 +71,11 @@ public partial class VulnerabilityRescanControl
[Inject]
public ILogger Logger { get; set; } = null!;
+ ///
+ /// Text of the last check time, or the hint that the image was never scanned
+ ///
+ private string CheckedText => CheckedAtUtc is DateTimeOffset checkedAtUtc ? $"Checked {TimestampFormatter.Format(checkedAtUtc)}" : "Never scanned";
+
#endregion // Properties
#region Methods
diff --git a/src/DockerUpdateGuard/Components/Pages/RuntimeContainers.razor b/src/DockerUpdateGuard/Components/Pages/RuntimeContainers.razor
index 9254bf31..53bac526 100644
--- a/src/DockerUpdateGuard/Components/Pages/RuntimeContainers.razor
+++ b/src/DockerUpdateGuard/Components/Pages/RuntimeContainers.razor
@@ -3,30 +3,28 @@
Runtime Containers
-
+
+
+
+ @if (_isBusy)
+ {
+
+ Checking image updates...
+ }
+ else
+ {
+ Check image updates
+ }
+
+
+
@if (string.IsNullOrWhiteSpace(_errorMessage) == false)
{
@@ -52,99 +50,108 @@
}
else
{
-
-
-
+
+
- Container
- Instance
- CPU
- Memory
- Network
- Update State
+ Container
+ Instance
+ CPU
+ Memory
+ Network
+ Update
+ Vulnerabilities
-
-
-
-
@context.ContainerName
- @if (context.LinkedObservedImageId is Guid observedImageId)
+
+
+ @context.ContainerName
+ @if (string.IsNullOrWhiteSpace(context.ResolvedVersionTag))
+ {
+ @context.CurrentTag
+ }
+ else
+ {
+ @($"{context.CurrentTag} ({context.ResolvedVersionTag})")
+ }
+ @if (context.LinkedObservedImageId is Guid observedImageId)
+ {
+ @($"Own image · {context.LinkedObservedImageName ?? "linked image"}")
+ }
+
+ @context.DockerInstanceName
+
+ @FormatCpu(context.CurrentResourceUsage)
+ @if (HasResourceHistory(context))
+ {
+
+ }
+
+
+ @FormatMemory(context.CurrentResourceUsage)
+ @if (HasResourceHistory(context))
+ {
+
+ }
+
+
+ @FormatNetwork(context.CurrentResourceUsage)
+ @if (HasResourceHistory(context))
+ {
+
+ }
+
+
+
+ @if (string.IsNullOrWhiteSpace(context.AvailableUpdateVersionTag) == false)
+ {
+ @context.AvailableUpdateVersionTag
+ }
+
+
+
+
+
+ @if (context.VulnerabilitySeveritySummary.TotalCount > 0)
+ {
+
+ @if (RuntimeContainerListFormatter.IsStatusShownBesideSeverity(context))
+ {
+
+ }
+ }
+ else
+ {
+
+ }
+
+ @if (context.VulnerabilitySeveritySummary.TotalCount > 0)
{
-
-
-
-
-
+ @RuntimeContainerListFormatter.FormatActiveFindings(context.VulnerabilitySeveritySummary)
}
-
- @if (string.IsNullOrWhiteSpace(context.ResolvedVersionTag))
- {
- @context.CurrentTag
- }
- else
- {
- @($"{context.CurrentTag} ({context.ResolvedVersionTag})")
- }
- @TimestampFormatter.Format(context.RecordedAtUtc)
-
- @context.DockerInstanceName
-
- @FormatCpu(context.CurrentResourceUsage)
- @if (HasResourceHistory(context))
- {
-
- }
-
-
- @FormatMemory(context.CurrentResourceUsage)
- @if (HasResourceHistory(context))
- {
-
- }
-
-
- @FormatNetwork(context.CurrentResourceUsage)
- @if (HasResourceHistory(context))
- {
-
- }
-
-
- @context.UpdateState
- @if (string.IsNullOrWhiteSpace(context.AvailableUpdateVersionTag) == false)
- {
- @context.AvailableUpdateVersionTag
- }
- @if (context.ActiveVulnerabilityFindingCount > 0)
- {
- Runtime vulnerabilities
-
- @($"{context.ActiveVulnerabilityFindingCount} active · {context.VulnerabilitySummary}")
- }
-
- @if (context.ActiveBaseImageVulnerabilityFindingCount > 0)
- {
- Base images affected
- @context.BaseImageVulnerabilitySummary
- }
-
+
+
+ @if (context.ActiveBaseImageVulnerabilityFindingCount > 0)
+ {
+
+ @context.BaseImageVulnerabilitySummary
+ }
+
+
+
-
+
}
-
+
\ No newline at end of file
diff --git a/src/DockerUpdateGuard/Components/Pages/RuntimeContainers.razor.cs b/src/DockerUpdateGuard/Components/Pages/RuntimeContainers.razor.cs
index 514c83ab..312ce26f 100644
--- a/src/DockerUpdateGuard/Components/Pages/RuntimeContainers.razor.cs
+++ b/src/DockerUpdateGuard/Components/Pages/RuntimeContainers.razor.cs
@@ -8,8 +8,6 @@
using Microsoft.AspNetCore.Components;
-using MudBlazor;
-
namespace DockerUpdateGuard.Components.Pages;
///
@@ -106,45 +104,6 @@ public sealed partial class RuntimeContainers : IDisposable
#region Static methods
- ///
- /// Resolve the chip color for an update state
- ///
- /// Update state
- /// Chip color
- private static Color GetUpdateStateColor(string? state)
- {
- if (string.IsNullOrWhiteSpace(state))
- {
- return Color.Default;
- }
-
- return state.ToUpperInvariant() switch
- {
- "UPDATE AVAILABLE" => Color.Warning,
- "UP TO DATE" => Color.Success,
- "MANUAL REVIEW REQUIRED" => Color.Info,
- "FAILED" => Color.Error,
- "UNSUPPORTED" => Color.Default,
- _ => Color.Info,
- };
- }
-
- ///
- /// Resolve the chip color for a vulnerability status
- ///
- /// Vulnerability status
- /// Severity summary of the active findings
- /// Chip color
- private static Color GetVulnerabilityStatusColor(string? status, VulnerabilitySeveritySummaryViewData? severitySummary)
- {
- if (string.IsNullOrWhiteSpace(status))
- {
- return Color.Default;
- }
-
- return VulnerabilityDisplayFormatter.GetStatusColor(status, severitySummary);
- }
-
///
/// Format CPU usage
///
diff --git a/src/DockerUpdateGuard/UI/RuntimeContainerListFormatter.cs b/src/DockerUpdateGuard/UI/RuntimeContainerListFormatter.cs
new file mode 100644
index 00000000..4515572b
--- /dev/null
+++ b/src/DockerUpdateGuard/UI/RuntimeContainerListFormatter.cs
@@ -0,0 +1,77 @@
+namespace DockerUpdateGuard.UI;
+
+///
+/// Composes the texts and display decisions of the runtime container list
+///
+internal static class RuntimeContainerListFormatter
+{
+ #region Methods
+
+ ///
+ /// Formats the meta text of the container inventory panel
+ ///
+ /// Listed runtime containers
+ /// Meta text
+ public static string FormatInventoryMeta(IReadOnlyList containers)
+ {
+ var instanceCount = containers.Select(container => container.DockerInstanceId)
+ .Distinct()
+ .Count();
+
+ return $"{DashboardTextFormatter.FormatCount(containers.Count, "container", "containers")} on {DashboardTextFormatter.FormatCount(instanceCount, "Docker instance", "Docker instances")}";
+ }
+
+ ///
+ /// Formats the count line of the active findings
+ ///
+ /// Active finding counts per severity
+ /// Count line
+ public static string FormatActiveFindings(VulnerabilitySeveritySummaryViewData summary)
+ {
+ if (summary.TotalCount == 0)
+ {
+ return string.Empty;
+ }
+
+ var counts = new List();
+
+ AddCount(counts, summary.CriticalCount, "critical");
+ AddCount(counts, summary.HighCount, "high");
+ AddCount(counts, summary.MediumCount, "medium");
+ AddCount(counts, summary.LowCount, "low");
+ AddCount(counts, summary.OtherCount, "unknown");
+
+ return $"{summary.TotalCount} active · {string.Join(", ", counts)}";
+ }
+
+ ///
+ /// Determines whether the vulnerability status is shown as a chip beside the severity chip
+ ///
+ /// Listed runtime container
+ /// true when the status chip is shown
+ public static bool IsStatusShownBesideSeverity(RuntimeContainerListItemData container)
+ {
+ return container.VulnerabilitySeveritySummary.TotalCount > 0
+ && string.Equals(container.VulnerabilityStatus, "Findings detected", StringComparison.OrdinalIgnoreCase) == false;
+ }
+
+ #endregion // Methods
+
+ #region Helper methods
+
+ ///
+ /// Adds a count text when the count is above zero
+ ///
+ /// Count texts
+ /// Count
+ /// Severity label
+ private static void AddCount(List counts, int count, string label)
+ {
+ if (count > 0)
+ {
+ counts.Add($"{count} {label}");
+ }
+ }
+
+ #endregion // Helper methods
+}
\ No newline at end of file
diff --git a/src/DockerUpdateGuard/wwwroot/app.css b/src/DockerUpdateGuard/wwwroot/app.css
index cb26e654..8d30c1e3 100644
--- a/src/DockerUpdateGuard/wwwroot/app.css
+++ b/src/DockerUpdateGuard/wwwroot/app.css
@@ -580,6 +580,30 @@ a {
margin-top: 0;
}
+.vulnerability-rescan-control--split {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) auto;
+ align-items: start;
+ gap: 0.35rem;
+}
+
+.vulnerability-rescan-control--split > .mud-tooltip-root {
+ align-self: start;
+}
+
+.vulnerability-rescan-control__details {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 0.2rem;
+ min-width: 0;
+}
+
+.vulnerability-rescan-control--split .vulnerability-rescan-control__details .table-secondary {
+ display: block;
+ margin-top: 0;
+}
+
.section-table {
font-variant-numeric: tabular-nums;
}
@@ -983,56 +1007,59 @@ a {
box-shadow: inset 3px 0 0 var(--dug-sev-low);
}
-.runtime-containers-table .runtime-containers-table__resource {
- width: 1%;
- white-space: nowrap;
-}
-
-.runtime-containers-table .runtime-containers-table__update-state {
+.runtime-containers-table .runtime-containers-table__container,
+.runtime-containers-table .runtime-containers-table__update,
+.runtime-containers-table .runtime-containers-table__vulnerabilities {
min-width: 0;
white-space: normal;
+ overflow-wrap: anywhere;
}
-.runtime-containers-table .runtime-containers-table__update-state .table-secondary {
- overflow-wrap: anywhere;
+.runtime-containers-table .runtime-containers-table__container .table-secondary {
+ display: block;
}
-.runtime-containers-table .runtime-containers-table__name {
- display: inline-flex;
- align-items: center;
- gap: 0.45rem;
+.runtime-containers-table .runtime-containers-table__network {
+ white-space: nowrap;
}
-.runtime-containers-table .runtime-containers-table__name-icon-link {
- display: inline-flex;
- align-items: center;
- color: var(--dug-primary);
+.runtime-containers-table .runtime-containers-table__version {
+ display: block;
+ margin-top: 0.2rem;
+ font-size: 13px;
+ font-weight: 500;
+ font-variant-numeric: tabular-nums;
}
-.runtime-containers-table .runtime-containers-table__name-icon-link:hover {
- color: var(--dug-link);
+.runtime-containers-table .runtime-containers-table__chips {
+ display: inline-flex;
+ flex-wrap: wrap;
+ gap: 0.35rem;
}
-.runtime-containers-table .runtime-containers-table__name-icon {
- opacity: 0.9;
+.runtime-containers-table .runtime-containers-table__findings {
+ color: var(--dug-text);
+ font-size: 13px;
}
.runtime-containers-table .runtime-containers-table__sparkline {
width: 100%;
- max-width: 9rem;
- height: 1.9rem;
+ max-width: 96px;
+ height: 22px;
margin-top: 0.35rem;
}
.runtime-containers-table .runtime-containers-table__sparkline svg {
width: 100%;
- height: 100%;
+ height: 22px;
+ max-width: 96px;
overflow: visible;
}
.runtime-containers-table .runtime-containers-table__sparkline-line {
fill: none;
- stroke-width: 2;
+ stroke-width: 1.6;
+ vector-effect: non-scaling-stroke;
stroke-linecap: round;
stroke-linejoin: round;
}
@@ -1108,9 +1135,37 @@ a {
}
}
-@media (min-width: 1280px) {
- .runtime-containers-table .runtime-containers-table__update-state {
- min-width: 18rem;
+@media (min-width: 960.02px) {
+ .runtime-containers-table .mud-table-root {
+ min-width: 1100px;
+ }
+
+ .runtime-containers-table .runtime-containers-table__container {
+ width: 17.2%;
+ }
+
+ .runtime-containers-table .runtime-containers-table__instance {
+ width: 10.6%;
+ }
+
+ .runtime-containers-table .runtime-containers-table__cpu {
+ width: 9.3%;
+ }
+
+ .runtime-containers-table .runtime-containers-table__memory {
+ width: 10.6%;
+ }
+
+ .runtime-containers-table .runtime-containers-table__network {
+ width: 18.5%;
+ }
+
+ .runtime-containers-table .runtime-containers-table__update {
+ width: 13.9%;
+ }
+
+ .runtime-containers-table .runtime-containers-table__vulnerabilities {
+ width: 19.9%;
}
}
@@ -1149,19 +1204,20 @@ a {
display: none;
}
- .runtime-containers-table .runtime-containers-table__update-state {
+ .runtime-containers-table .runtime-containers-table__container,
+ .runtime-containers-table .runtime-containers-table__update,
+ .runtime-containers-table .runtime-containers-table__vulnerabilities {
flex-direction: column;
align-items: flex-start;
gap: 0.35rem;
}
- .runtime-containers-table .runtime-containers-table__update-state .table-secondary {
- max-width: 100%;
+ .runtime-containers-table .runtime-containers-table__vulnerabilities .vulnerability-rescan-control {
+ width: 100%;
}
.runtime-containers-table .runtime-containers-table__sparkline {
max-width: 100%;
- height: 2.25rem;
}
.dug-chart {
diff --git a/src/Tests/DockerUpdateGuard.Tests/AppStylesheetRescanControlTests.cs b/src/Tests/DockerUpdateGuard.Tests/AppStylesheetRescanControlTests.cs
new file mode 100644
index 00000000..06d152d7
--- /dev/null
+++ b/src/Tests/DockerUpdateGuard.Tests/AppStylesheetRescanControlTests.cs
@@ -0,0 +1,67 @@
+using DockerUpdateGuard.Tests.Helper;
+
+namespace DockerUpdateGuard.Tests;
+
+///
+/// Tests for the rules of wwwroot/app.css that style the vulnerability rescan control
+///
+[TestClass]
+public class AppStylesheetRescanControlTests
+{
+ #region Constants
+
+ ///
+ /// Shipped stylesheet below the host project directory
+ ///
+ private const string StylesheetPath = "wwwroot/app.css";
+
+ ///
+ /// Class of the split layout
+ ///
+ private const string SplitClass = "vulnerability-rescan-control--split";
+
+ #endregion // Constants
+
+ #region Methods
+
+ ///
+ /// Verify the lines of the split layout's details part are block-level again, although the control's inline rule hits every secondary text of the control
+ ///
+ [TestMethod]
+ [TestCategory("AC6")]
+ public void AppStylesheetRescanControlSplitDetailsLinesAreBlockLevel()
+ {
+ var rules = StylesheetReader.GetRules(StylesheetReader.ReadHostFile(StylesheetPath))
+ .SelectMany(rule => StylesheetReader.SplitTopLevel(rule.Selector, ',').Select(entry => (Entry: entry, rule.Body)))
+ .Where(rule => rule.Entry.Contains("table-secondary", StringComparison.Ordinal))
+ .ToList();
+ var blockRules = rules.Where(rule => rule.Entry.Contains(SplitClass, StringComparison.Ordinal)
+ && rule.Entry.Contains("__details", StringComparison.Ordinal)
+ && HasDisplay(rule.Body, "block"))
+ .ToList();
+ var inlineRules = rules.Where(rule => HasDisplay(rule.Body, "inline"))
+ .ToList();
+ var inlineScopedAway = inlineRules.Count > 0
+ && inlineRules.All(rule => rule.Entry.Contains($":not(.{SplitClass})", StringComparison.Ordinal));
+
+ Assert.IsTrue(blockRules.Count > 0 || inlineScopedAway, "The table-secondary lines inside the split layout's details part must be display: block, or the inline rule must exclude the split layout");
+ }
+
+ #endregion // Methods
+
+ #region Helper methods
+
+ ///
+ /// Check whether a rule body sets display to a value
+ ///
+ /// Rule body
+ /// Expected display value
+ /// true when the body declares it
+ private static bool HasDisplay(string body, string value)
+ {
+ return StylesheetReader.GetDeclarationList(body)
+ .Any(declaration => declaration.Name == "display" && declaration.Value == value);
+ }
+
+ #endregion // Helper methods
+}
\ No newline at end of file
diff --git a/src/Tests/DockerUpdateGuard.Tests/AppStylesheetRuntimeContainersTests.cs b/src/Tests/DockerUpdateGuard.Tests/AppStylesheetRuntimeContainersTests.cs
new file mode 100644
index 00000000..cb1752e2
--- /dev/null
+++ b/src/Tests/DockerUpdateGuard.Tests/AppStylesheetRuntimeContainersTests.cs
@@ -0,0 +1,146 @@
+using DockerUpdateGuard.Tests.Helper;
+
+namespace DockerUpdateGuard.Tests;
+
+///
+/// Tests for the rules of wwwroot/app.css that style the runtime containers table
+///
+[TestClass]
+public class AppStylesheetRuntimeContainersTests
+{
+ #region Constants
+
+ ///
+ /// Shipped stylesheet below the host project directory
+ ///
+ private const string StylesheetPath = "wwwroot/app.css";
+
+ ///
+ /// Media context of the table layout, which starts above MudBlazor's card query that includes 960 px
+ ///
+ private const string TableContext = "@media (min-width: 960.02px)";
+
+ ///
+ /// Media context of the card layout of table rows
+ ///
+ private const string RowCardContext = "@media (max-width: 959.98px)";
+
+ ///
+ /// Prefix of the page's class names
+ ///
+ private const string Prefix = "runtime-containers-table__";
+
+ #endregion // Constants
+
+ #region Methods
+
+ ///
+ /// Verify the sparklines are thin fixed-size lines
+ ///
+ [TestMethod]
+ [TestCategory("AC7")]
+ public void AppStylesheetRuntimeContainersSparklinesAreThinFixedSizeLines()
+ {
+ var box = GetTopLevelDeclarations(entry => entry.EndsWith($"{Prefix}sparkline", StringComparison.Ordinal) || entry.EndsWith($"{Prefix}sparkline svg", StringComparison.Ordinal));
+ var line = GetTopLevelDeclarations(entry => entry.EndsWith($"{Prefix}sparkline-line", StringComparison.Ordinal));
+
+ Assert.AreEqual("22px", box.GetValueOrDefault("height"), "The sparkline must be 22 px high");
+ Assert.AreEqual("96px", box.GetValueOrDefault("max-width"), "The sparkline must be at most 96 px wide");
+ Assert.AreEqual("1.6", line.GetValueOrDefault("stroke-width"), "The line must be 1.6 wide");
+ Assert.AreEqual("non-scaling-stroke", line.GetValueOrDefault("vector-effect"), "The line width must not scale with the box");
+ Assert.AreEqual("none", line.GetValueOrDefault("fill"), "The line must have no fill");
+ }
+
+ ///
+ /// Verify a rule keeps the network value on one line
+ ///
+ [TestMethod]
+ [TestCategory("AC7")]
+ public void AppStylesheetRuntimeContainersNetworkValueDoesNotWrap()
+ {
+ var declarations = GetTopLevelDeclarations(entry => entry.Contains($"{Prefix}network", StringComparison.Ordinal));
+
+ Assert.AreEqual("nowrap", declarations.GetValueOrDefault("white-space"), "A rule of the network column or value must set white-space: nowrap");
+ }
+
+ ///
+ /// Verify the table-only rules sit in the media query above MudBlazor's card query and nowhere else
+ ///
+ /// End of the selector
+ /// Property name
+ /// Property value
+ [TestMethod]
+ [TestCategory("AC9")]
+ [DataRow(".runtime-containers-table .mud-table-root", "min-width", "1100px")]
+ [DataRow($"{Prefix}container", "width", "17.2%")]
+ [DataRow($"{Prefix}instance", "width", "10.6%")]
+ [DataRow($"{Prefix}cpu", "width", "9.3%")]
+ [DataRow($"{Prefix}memory", "width", "10.6%")]
+ [DataRow($"{Prefix}network", "width", "18.5%")]
+ [DataRow($"{Prefix}update", "width", "13.9%")]
+ [DataRow($"{Prefix}vulnerabilities", "width", "19.9%")]
+ public void AppStylesheetRuntimeContainersTableScrollsInsidePanelFrom960Px(string selectorEnd, string property, string value)
+ {
+ var contexts = GetEntries().Where(rule => rule.Entry.EndsWith(selectorEnd, StringComparison.Ordinal)
+ && StylesheetReader.GetDeclarationList(rule.Body).Any(declaration => declaration.Name == property && declaration.Value == value))
+ .Select(rule => rule.Context)
+ .ToList();
+
+ Assert.IsNotEmpty(contexts, $"A rule for '{selectorEnd}' must set {property}: {value}");
+ Assert.IsTrue(contexts.All(context => context == TableContext), $"The {property} of '{selectorEnd}' must be set only inside {TableContext}");
+ }
+
+ ///
+ /// Verify the cards stack the lines of the multi-line cells, with the label first
+ ///
+ /// Column class suffix
+ [TestMethod]
+ [TestCategory("AC9")]
+ [DataRow("container")]
+ [DataRow("update")]
+ [DataRow("vulnerabilities")]
+ public void AppStylesheetRuntimeContainersCardCellsStackTheirLines(string column)
+ {
+ var declarations = GetEntries().Where(rule => rule.Context == RowCardContext && rule.Entry.EndsWith($"{Prefix}{column}", StringComparison.Ordinal))
+ .SelectMany(rule => StylesheetReader.GetDeclarationList(rule.Body))
+ .ToDictionary(declaration => declaration.Name, declaration => declaration.Value);
+
+ Assert.AreEqual("column", declarations.GetValueOrDefault("flex-direction"), $"The {column} cell must stack its lines in the card");
+ Assert.AreEqual("flex-start", declarations.GetValueOrDefault("align-items"), $"The {column} cell must start its lines at the label's edge");
+ }
+
+ #endregion // Methods
+
+ #region Helper methods
+
+ ///
+ /// Merge the declarations of the top-level rules whose selector entry matches
+ ///
+ /// Selector entry predicate
+ /// Property name to value, later rules winning
+ private static Dictionary GetTopLevelDeclarations(Func match)
+ {
+ var merged = new Dictionary();
+
+ foreach (var rule in GetEntries().Where(rule => rule.Context.Length == 0 && match(rule.Entry)))
+ {
+ foreach (var (name, value) in StylesheetReader.GetDeclarationList(rule.Body))
+ {
+ merged[name] = value;
+ }
+ }
+
+ return merged;
+ }
+
+ ///
+ /// Read every selector of every rule of the stylesheet, in every media context
+ ///
+ /// Selector, rule body and media context
+ private static List<(string Entry, string Body, string Context)> GetEntries()
+ {
+ return [.. StylesheetReader.GetRules(StylesheetReader.ReadHostFile(StylesheetPath)).SelectMany(rule => StylesheetReader.SplitTopLevel(rule.Selector, ',').Select(entry => (entry, rule.Body, rule.Context)))];
+ }
+
+ #endregion // Helper methods
+}
\ No newline at end of file
diff --git a/src/Tests/DockerUpdateGuard.Tests/RuntimeContainerListFormatterTests.cs b/src/Tests/DockerUpdateGuard.Tests/RuntimeContainerListFormatterTests.cs
new file mode 100644
index 00000000..f7754ce2
--- /dev/null
+++ b/src/Tests/DockerUpdateGuard.Tests/RuntimeContainerListFormatterTests.cs
@@ -0,0 +1,104 @@
+using DockerUpdateGuard.UI;
+
+namespace DockerUpdateGuard.Tests;
+
+///
+/// Tests for
+///
+[TestClass]
+public class RuntimeContainerListFormatterTests
+{
+ #region Methods
+
+ ///
+ /// Verify the inventory meta text counts containers and distinct Docker instances with singular and plural nouns
+ ///
+ /// Number of listed containers
+ /// Number of distinct Docker instances
+ /// Expected meta text
+ [TestMethod]
+ [TestCategory("AC1")]
+ [DataRow(1, 1, "1 container on 1 Docker instance")]
+ [DataRow(2, 1, "2 containers on 1 Docker instance")]
+ [DataRow(23, 2, "23 containers on 2 Docker instances")]
+ public void RuntimeContainerListFormatterFormatInventoryMetaUsesSingularAndPlural(int containerCount, int instanceCount, string expected)
+ {
+ var instanceIds = Enumerable.Range(0, instanceCount).Select(_ => Guid.NewGuid()).ToList();
+ var containers = Enumerable.Range(0, containerCount)
+ .Select(index => new RuntimeContainerListItemData
+ {
+ DockerInstanceId = instanceIds[index % instanceCount],
+ ContainerName = $"container-{index}"
+ })
+ .ToList();
+
+ var meta = RuntimeContainerListFormatter.FormatInventoryMeta(containers);
+
+ Assert.AreEqual(expected, meta, "The meta text must count containers and distinct Docker instances");
+ }
+
+ ///
+ /// Verify the count line lists the counts above zero in the order critical, high, medium, low, unknown
+ ///
+ /// Critical count
+ /// High count
+ /// Medium count
+ /// Low count
+ /// Unknown count
+ /// Expected count line
+ [TestMethod]
+ [TestCategory("AC5")]
+ [DataRow(1, 2, 0, 0, 0, "3 active · 1 critical, 2 high")]
+ [DataRow(1, 2, 3, 4, 5, "15 active · 1 critical, 2 high, 3 medium, 4 low, 5 unknown")]
+ [DataRow(0, 0, 0, 0, 4, "4 active · 4 unknown")]
+ [DataRow(0, 0, 0, 0, 0, "")]
+ public void RuntimeContainerListFormatterFormatActiveFindingsListsCountsInSeverityOrder(int critical, int high, int medium, int low, int other, string expected)
+ {
+ var summary = new VulnerabilitySeveritySummaryViewData
+ {
+ CriticalCount = critical,
+ HighCount = high,
+ MediumCount = medium,
+ LowCount = low,
+ OtherCount = other,
+ };
+
+ var line = RuntimeContainerListFormatter.FormatActiveFindings(summary);
+
+ Assert.AreEqual(expected, line, "The count line must list the counts above zero in severity order");
+ }
+
+ ///
+ /// Verify the status chip stands beside the severity chip only with active findings and a status other than Findings detected
+ ///
+ /// Active high findings
+ /// Vulnerability status
+ /// Expected decision
+ [TestMethod]
+ [TestCategory("AC5")]
+ [DataRow(2, "Failed", true)]
+ [DataRow(2, "Unavailable", true)]
+ [DataRow(2, "No findings", true)]
+ [DataRow(2, "Findings detected", false)]
+ [DataRow(2, "findings detected", false)]
+ [DataRow(0, "Failed", false)]
+ [DataRow(0, "Findings detected", false)]
+ public void RuntimeContainerListFormatterIsStatusShownBesideSeverityOnlyForOtherStatuses(int highCount, string status, bool expected)
+ {
+ var container = new RuntimeContainerListItemData
+ {
+ VulnerabilityStatus = status,
+ ActiveVulnerabilityFindingCount = highCount,
+ VulnerabilitySeveritySummary = new VulnerabilitySeveritySummaryViewData
+ {
+ HighCount = highCount
+ },
+ };
+
+ var shown = RuntimeContainerListFormatter.IsStatusShownBesideSeverity(container);
+
+ Assert.AreEqual(expected, shown, $"The status '{status}' with {highCount} active findings must decide the status chip as expected");
+ }
+
+ #endregion // Methods
+}
\ No newline at end of file
diff --git a/src/Tests/DockerUpdateGuard.Tests/RuntimeContainersRenderTests.cs b/src/Tests/DockerUpdateGuard.Tests/RuntimeContainersRenderTests.cs
new file mode 100644
index 00000000..63389a08
--- /dev/null
+++ b/src/Tests/DockerUpdateGuard.Tests/RuntimeContainersRenderTests.cs
@@ -0,0 +1,765 @@
+using Bunit;
+
+using DockerUpdateGuard.Components.Pages;
+using DockerUpdateGuard.Images.Interfaces;
+using DockerUpdateGuard.Tests.Data;
+using DockerUpdateGuard.Tests.Helper;
+using DockerUpdateGuard.UI;
+
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+
+using NSubstitute;
+
+namespace DockerUpdateGuard.Tests;
+
+///
+/// Render tests for the list of
+///
+[TestClass]
+public class RuntimeContainersRenderTests
+{
+ #region Constants
+
+ ///
+ /// Selector of the Vulnerabilities cell
+ ///
+ private const string VulnerabilitiesCell = "td.runtime-containers-table__vulnerabilities";
+
+ ///
+ /// Selector of the details part of the rescan control
+ ///
+ private const string DetailsPart = "div.vulnerability-rescan-control__details";
+
+ #endregion // Constants
+
+ #region Fields
+
+ ///
+ /// Column heads in order
+ ///
+ private static readonly string[] _columnHeads = ["Container", "Instance", "CPU", "Memory", "Network", "Update", "Vulnerabilities"];
+
+ ///
+ /// Class suffixes of the resource columns
+ ///
+ private static readonly string[] _resourceColumns = ["cpu", "memory", "network"];
+
+ ///
+ /// Lines of the details part in their expected order
+ ///
+ private static readonly string[] _detailLines = [">High<", "3 active · 3 high", "Checked 2026-11-23 21:27 UTC", "Base images affected", "4 active finding(s) across 1 base image"];
+
+ #endregion // Fields
+
+ #region Methods
+
+ ///
+ /// Verify the page shows one header with its action and the inventory panel with the meta text and no old header parts
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC1")]
+ public async Task RuntimeContainersRenderShowsHeaderWithActionAndInventoryPanel()
+ {
+ var instanceId = Guid.NewGuid();
+ var testContext = CreateContext([CreateContainer(instanceId, "web"), CreateContainer(instanceId, "db")]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+
+ Assert.AreEqual("Runtime Containers", page.Find("h1.dug-page-header__title").TextContent.Trim(), "The header must carry the page title");
+ Assert.AreEqual("Active containers with their images, update state, vulnerabilities and live resource usage.", page.Find("p.dug-page-header__description").TextContent.Trim(), "The header must carry the description");
+ Assert.AreEqual("Check image updates", page.Find("div.dug-page-header__actions button").TextContent.Trim(), "The action must stand in the header");
+ Assert.AreEqual("Container inventory", page.Find("h2.dug-panel__title").TextContent.Trim(), "The list must sit in the inventory panel");
+ Assert.AreEqual("2 containers on 1 Docker instance", page.Find("span.dug-panel__meta").TextContent.Trim(), "The panel must show the inventory meta text");
+ Assert.IsEmpty(page.FindAll(".page-eyebrow"), "The eyebrow label must be gone");
+ Assert.IsEmpty(page.FindAll(".section-description"), "The section description must be gone");
+ }
+ }
+
+ ///
+ /// Verify the table has the seven column heads in order and no Update State head
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC2")]
+ public async Task RuntimeContainersRenderShowsSevenColumnHeadsInOrder()
+ {
+ var testContext = CreateContext([CreateContainer(Guid.NewGuid(), "web")]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var heads = page.FindAll("th").Select(head => head.TextContent.Trim()).ToList();
+
+ Assert.AreSequenceEqual(_columnHeads, heads, "The heads must be the seven columns in order");
+ Assert.DoesNotContain("Update State", page.Markup, "The Update State head must no longer exist");
+ }
+ }
+
+ ///
+ /// Verify the Container cell shows the name link, the tag with the resolved version and the own image link
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC3")]
+ public async Task RuntimeContainersRenderContainerCellWithAliasAndOwnImageShowsOwnImageLink()
+ {
+ var instanceId = Guid.NewGuid();
+ var imageId = Guid.NewGuid();
+ var container = CreateContainer(instanceId, "web");
+
+ container.ContainerId = "abc123";
+ container.CurrentTag = "16";
+ container.ResolvedVersionTag = "16.3";
+ container.LinkedObservedImageId = imageId;
+ container.LinkedObservedImageName = "my/web";
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var cell = page.Find("td.runtime-containers-table__container");
+ var nameLink = cell.QuerySelector($"a[href='/runtime-containers/{instanceId}/abc123']");
+ var imageLink = cell.QuerySelector($"a[href='/observed-images/{imageId}']");
+
+ Assert.IsNotNull(nameLink, "The name must link to the detail route");
+ Assert.AreEqual("web", nameLink.TextContent.Trim(), "The link text must be the container name");
+ Assert.IsNotNull(imageLink, "An own image must be linked");
+ Assert.AreEqual("Own image · my/web", imageLink.TextContent.Trim(), "The own image line must read 'Own image · {name}'");
+ Assert.Contains("16 (16.3)", cell.TextContent, "The tag must show the resolved version in parentheses");
+ }
+ }
+
+ ///
+ /// Verify a container without an own image shows only name and tag: no own image line, no snapshot time, no icon link
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC3")]
+ public async Task RuntimeContainersRenderContainerCellWithoutOwnImageShowsNameAndTagOnly()
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+
+ container.CurrentTag = "16";
+ container.RecordedAtUtc = new DateTimeOffset(2026, 11, 23, 21, 27, 0, TimeSpan.Zero);
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var cell = page.Find("td.runtime-containers-table__container");
+
+ Assert.DoesNotContain("Own image", cell.TextContent, "Without an own image there must be no own image line");
+ Assert.DoesNotContain("2026-11-23", cell.TextContent, "The snapshot time must no longer be shown");
+ Assert.IsEmpty(cell.QuerySelectorAll("a[href^='/observed-images/']"), "There must be no link to an observed image");
+ Assert.IsEmpty(cell.QuerySelectorAll("svg"), "There must be no icon link");
+ Assert.Contains("16", cell.TextContent, "The tag must be shown");
+ }
+ }
+
+ ///
+ /// Verify the update state chip carries the tone of the shared mapping
+ ///
+ /// Update state
+ /// Expected tone CSS name
+ /// Task
+ [TestMethod]
+ [TestCategory("AC4")]
+ [DataRow("Update available", "warning")]
+ [DataRow("Up to date", "success")]
+ [DataRow("Manual review required", "info")]
+ [DataRow("Failed", "danger")]
+ [DataRow("No tag data", "neutral")]
+ [DataRow("Not evaluated", "neutral")]
+ [DataRow("Unsupported", "neutral")]
+ public async Task RuntimeContainersRenderUpdateCellShowsStateChipInItsTone(string state, string tone)
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+
+ container.UpdateState = state;
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var chip = page.Find("td.runtime-containers-table__update span.dug-chip");
+
+ Assert.AreEqual(state, chip.TextContent.Trim(), "The chip must show the update state");
+ Assert.IsTrue(chip.ClassList.Contains($"dug-chip--{tone}"), $"The state '{state}' must be shown in the {tone} tone");
+ }
+ }
+
+ ///
+ /// Verify the available version shows whatever the state, and only when one is known
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC4")]
+ public async Task RuntimeContainersRenderUpdateCellShowsAvailableVersionOnlyWhenKnown()
+ {
+ var known = CreateContainer(Guid.NewGuid(), "known");
+ var unknown = CreateContainer(Guid.NewGuid(), "unknown");
+
+ known.UpdateState = "Failed";
+ known.AvailableUpdateVersionTag = "17.1";
+ unknown.AvailableUpdateVersionTag = null;
+
+ var testContext = CreateContext([known, unknown]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var cells = page.FindAll("td.runtime-containers-table__update");
+
+ Assert.AreEqual("17.1", cells[0].QuerySelector("span.runtime-containers-table__version")?.TextContent.Trim(), "A known version must be shown below the chip");
+ Assert.IsNull(cells[1].QuerySelector("span.runtime-containers-table__version"), "Without a known version nothing must be shown");
+ }
+ }
+
+ ///
+ /// Verify findings show the highest severity chip and the count line, without the old chips
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC5")]
+ public async Task RuntimeContainersRenderFindingsShowHighestSeverityChipAndCountLine()
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+
+ SetFindings(container, "Findings detected", 1, 2, 0, 0, 0);
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var cell = page.Find(VulnerabilitiesCell);
+ var chips = cell.QuerySelectorAll("span.dug-chip").ToList();
+
+ Assert.HasCount(1, chips, "Findings with the status Findings detected must show one chip");
+ Assert.AreEqual("Critical", chips[0].TextContent.Trim(), "The chip must name the highest severity");
+ Assert.IsTrue(chips[0].ClassList.Contains("dug-chip--critical"), "The chip must be in the severity's tone");
+ Assert.Contains("3 active · 1 critical, 2 high", cell.TextContent, "The count line must list the breakdown");
+ Assert.DoesNotContain("Runtime vulnerabilities", page.Markup, "The Runtime vulnerabilities chip must be gone");
+ Assert.IsEmpty(page.FindAll(".mud-chip"), "The compact severity chips must be gone");
+ }
+ }
+
+ ///
+ /// Verify findings of unknown severity only show an Unknown chip in the low tone
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC5")]
+ public async Task RuntimeContainersRenderUnknownSeverityFindingsShowUnknownChipInLowTone()
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+
+ SetFindings(container, "Findings detected", 0, 0, 0, 0, 4);
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var cell = page.Find(VulnerabilitiesCell);
+ var chip = cell.QuerySelector("span.dug-chip");
+
+ Assert.IsNotNull(chip, "A chip must be shown");
+ Assert.AreEqual("Unknown", chip.TextContent.Trim(), "The chip must read Unknown");
+ Assert.IsTrue(chip.ClassList.Contains("dug-chip--low"), "The chip must be in the low tone");
+ Assert.Contains("4 active · 4 unknown", cell.TextContent, "The count line must list the unknown findings");
+ }
+ }
+
+ ///
+ /// Verify a failed check with earlier findings shows the status chip beside the severity chip
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC5")]
+ public async Task RuntimeContainersRenderFailedCheckWithFindingsShowsStatusChipBesideSeverity()
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+
+ SetFindings(container, "Failed", 0, 2, 0, 0, 0);
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var cell = page.Find(VulnerabilitiesCell);
+ var chips = cell.QuerySelectorAll("span.dug-chip").ToList();
+
+ Assert.HasCount(2, chips, "The severity chip and the status chip must both be shown");
+ Assert.AreEqual("High", chips[0].TextContent.Trim(), "The severity chip must come first");
+ Assert.AreEqual("Failed", chips[1].TextContent.Trim(), "The status chip must stand beside it");
+ Assert.IsTrue(chips[1].ClassList.Contains("dug-chip--danger"), "The failed status must be in the danger tone");
+ Assert.Contains("2 active · 2 high", cell.TextContent, "The count line must still be shown");
+ }
+ }
+
+ ///
+ /// Verify without active findings the status chip shows in its tone and no count line follows
+ ///
+ /// Vulnerability status
+ /// Expected tone CSS name
+ /// Task
+ [TestMethod]
+ [TestCategory("AC5")]
+ [DataRow("No findings", "success")]
+ [DataRow("Failed", "danger")]
+ [DataRow("Not scanned", "neutral")]
+ [DataRow("Not configured", "neutral")]
+ [DataRow("Unsupported", "neutral")]
+ [DataRow("Unavailable", "neutral")]
+ [DataRow("Findings detected", "low")]
+ public async Task RuntimeContainersRenderWithoutFindingsShowsStatusChipInItsTone(string status, string tone)
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+
+ container.VulnerabilityStatus = status;
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var cell = page.Find(VulnerabilitiesCell);
+ var chips = cell.QuerySelectorAll("span.dug-chip").ToList();
+
+ Assert.HasCount(1, chips, "Without findings only the status chip must be shown");
+ Assert.AreEqual(status, chips[0].TextContent.Trim(), "The chip must show the status");
+ Assert.IsTrue(chips[0].ClassList.Contains($"dug-chip--{tone}"), $"The status '{status}' must be shown in the {tone} tone");
+ Assert.DoesNotContain(" active", cell.TextContent, "Without findings there must be no count line");
+ }
+ }
+
+ ///
+ /// Verify the lines of the Vulnerabilities cell come in the specified order and the button stays outside the details part
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC6")]
+ public async Task RuntimeContainersRenderVulnerabilityCellOrdersItsLines()
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+
+ SetFindings(container, "Findings detected", 0, 3, 0, 0, 0);
+ container.VulnerabilityCheckedAtUtc = new DateTimeOffset(2026, 11, 23, 21, 27, 0, TimeSpan.Zero);
+ container.ActiveBaseImageVulnerabilityFindingCount = 4;
+ container.BaseImageVulnerabilitySummary = "4 active finding(s) across 1 base image";
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var cell = page.Find(VulnerabilitiesCell);
+ var details = cell.QuerySelector(DetailsPart);
+
+ Assert.IsNotNull(details, "The left part must be the details part of the split rescan control");
+ Assert.IsNull(details.QuerySelector("button"), "The rescan button must be outside the details part");
+ Assert.IsNotNull(cell.QuerySelector("button[aria-label='Rescan vulnerabilities']"), "The rescan button must stay in the cell");
+
+ var markup = details.InnerHtml;
+ var positions = _detailLines.Select(text => markup.IndexOf(text, StringComparison.Ordinal))
+ .ToList();
+
+ Assert.DoesNotContain(-1, positions, "Every line must be inside the details part");
+ Assert.AreSequenceEqual(positions.Order().ToList(), positions, "The lines must come in the order chip, count, check time, base image chip, base image summary");
+ }
+ }
+
+ ///
+ /// Verify the base image warning shows only when base images have active findings
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC6")]
+ public async Task RuntimeContainersRenderBaseImageWarningOnlyWithAffectedBaseImages()
+ {
+ var affected = CreateContainer(Guid.NewGuid(), "affected");
+ var clean = CreateContainer(Guid.NewGuid(), "clean");
+
+ affected.ActiveBaseImageVulnerabilityFindingCount = 1;
+ affected.BaseImageVulnerabilitySummary = "1 active finding(s) across 1 base image";
+ clean.BaseImageVulnerabilitySummary = "must not be shown";
+
+ var testContext = CreateContext([affected, clean]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var cells = page.FindAll(VulnerabilitiesCell);
+ var affectedDetails = cells[0].QuerySelector(DetailsPart);
+ var cleanDetails = cells[1].QuerySelector(DetailsPart);
+
+ Assert.IsNotNull(affectedDetails, "The affected row must use the split layout");
+ Assert.IsNotNull(cleanDetails, "The clean row must use the split layout");
+ Assert.Contains("Base images affected", affectedDetails.TextContent, "The warning must show in the details part");
+ Assert.Contains("1 active finding(s) across 1 base image", affectedDetails.TextContent, "The base image summary must show");
+ Assert.DoesNotContain("Base images affected", cleanDetails.TextContent, "Without affected base images there must be no warning");
+ Assert.DoesNotContain("must not be shown", cells[1].TextContent, "Without affected base images there must be no summary");
+ }
+ }
+
+ ///
+ /// Verify an image that was never scanned shows Never scanned in the details part
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC6")]
+ public async Task RuntimeContainersRenderNeverScannedImageShowsNeverScanned()
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+
+ container.VulnerabilityCheckedAtUtc = null;
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var details = page.Find($"{VulnerabilitiesCell} {DetailsPart}");
+
+ Assert.Contains("Never scanned", details.TextContent, "An image never checked must show Never scanned");
+ }
+ }
+
+ ///
+ /// Verify the resource cells show n/a without a current usage and no sparkline
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC7")]
+ public async Task RuntimeContainersRenderResourceCellsShowNotAvailableWithoutUsage()
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+
+ container.CurrentResourceUsage = null;
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+
+ foreach (var column in _resourceColumns)
+ {
+ var cell = page.Find($"td.runtime-containers-table__{column}");
+
+ Assert.AreEqual("n/a", cell.TextContent.Trim(), $"The {column} cell must show n/a");
+ Assert.IsEmpty(cell.QuerySelectorAll("svg"), $"The {column} cell must show no sparkline");
+ }
+ }
+ }
+
+ ///
+ /// Verify a sparkline needs two samples and the network cell draws two lines
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC7")]
+ public async Task RuntimeContainersRenderSparklinesNeedTwoSamples()
+ {
+ var single = CreateContainer(Guid.NewGuid(), "single");
+ var pair = CreateContainer(Guid.NewGuid(), "double");
+
+ single.ResourceUsageHistory = [CreateUsage(0)];
+ pair.ResourceUsageHistory = [CreateUsage(0), CreateUsage(1)];
+
+ var testContext = CreateContext([single, pair]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var rows = page.FindAll("tbody tr");
+
+ foreach (var column in _resourceColumns)
+ {
+ Assert.IsEmpty(rows[0].QuerySelectorAll($"td.runtime-containers-table__{column} svg"), $"One sample must not draw a {column} sparkline");
+ }
+
+ Assert.HasCount(1, rows[1].QuerySelectorAll("td.runtime-containers-table__cpu svg path"), "Two samples must draw one CPU line");
+ Assert.HasCount(1, rows[1].QuerySelectorAll("td.runtime-containers-table__memory svg path"), "Two samples must draw one memory line");
+ Assert.HasCount(2, rows[1].QuerySelectorAll("td.runtime-containers-table__network svg path"), "Two samples must draw a received and a sent line");
+ }
+ }
+
+ ///
+ /// Verify the network value is a single element so that it can stay on one line
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC7")]
+ public async Task RuntimeContainersRenderNetworkValueIsOneElement()
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+ var usage = container.CurrentResourceUsage!;
+ var expected = $"{ResourceUsageFormatter.FormatBytesPerSecond(usage.NetworkRxBytesPerSecond)} ↓ / {ResourceUsageFormatter.FormatBytesPerSecond(usage.NetworkTxBytesPerSecond)} ↑";
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var cell = page.Find("td.runtime-containers-table__network");
+ var valueElements = cell.QuerySelectorAll("*").Where(element => element.ChildElementCount == 0 && element.TextContent.Trim() == expected).ToList();
+
+ Assert.HasCount(1, valueElements, "The whole network value must be the text of one element");
+ }
+ }
+
+ ///
+ /// Verify the table switches to cards below 960 px, which is the small-screen breakpoint of MudBlazor, and every cell carries its label
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC9")]
+ public async Task RuntimeContainersRenderTableSwitchesToCardsBelow960Px()
+ {
+ var testContext = CreateContext([CreateContainer(Guid.NewGuid(), "web")]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var cells = page.FindAll("tbody td");
+ var labels = cells.Select(cell => cell.GetAttribute("data-label")).ToList();
+
+ Assert.IsNotEmpty(page.FindAll(".mud-sm-table"), "The table must use the small-screen card breakpoint (class mud-sm-table)");
+ Assert.IsEmpty(page.FindAll(".mud-md-table"), "The table must not use the medium breakpoint");
+ Assert.AreSequenceEqual(_columnHeads, labels, "Every cell must carry the label of its head");
+ }
+ }
+
+ #endregion // Methods
+
+ #region Helper methods
+
+ ///
+ /// Verify a whitespace-only resolved version is not shown in parentheses
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC3")]
+ public async Task RuntimeContainersRenderWhitespaceResolvedVersionShowsTagOnly()
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+
+ container.CurrentTag = "16";
+ container.ResolvedVersionTag = " ";
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+
+ Assert.DoesNotContain("(", page.Find("td.runtime-containers-table__container").TextContent, "A blank resolved version must not be shown in parentheses");
+ }
+ }
+
+ ///
+ /// Verify an own image without a name falls back to the generic link text
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC3")]
+ public async Task RuntimeContainersRenderOwnImageWithoutNameShowsFallbackText()
+ {
+ var container = CreateContainer(Guid.NewGuid(), "web");
+
+ container.LinkedObservedImageId = Guid.NewGuid();
+ container.LinkedObservedImageName = null;
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+ var imageLink = page.Find("td.runtime-containers-table__container a[href^='/observed-images/']");
+
+ Assert.AreEqual("Own image · linked image", imageLink.TextContent.Trim(), "An own image without a name must read 'Own image · linked image'");
+ }
+ }
+
+ ///
+ /// Verify an empty list shows the empty state and neither the inventory panel nor the skeleton
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC8")]
+ public async Task RuntimeContainersRenderEmptyListShowsEmptyState()
+ {
+ var testContext = CreateContext([]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+
+ Assert.AreEqual("No runtime containers have been observed yet.", page.Find(".empty-state-panel").TextContent.Trim(), "The empty state text must be shown");
+ Assert.IsEmpty(page.FindAll("h2.dug-panel__title"), "The inventory panel must not be shown for an empty list");
+ Assert.IsEmpty(page.FindAll("table"), "The table must not be shown for an empty list");
+ Assert.IsEmpty(page.FindAll(".mud-skeleton"), "The skeleton must not be shown for a loaded list");
+ }
+ }
+
+ ///
+ /// Verify a pending load shows the table skeleton with its title placeholder and neither table nor empty state
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC8")]
+ public async Task RuntimeContainersRenderLoadingShowsTableSkeletonWithTitle()
+ {
+ var testContext = BlazorTestContextFactory.Create();
+
+ await using (testContext)
+ {
+ var viewService = Substitute.For();
+ var pending = new TaskCompletionSource>();
+
+ viewService.GetRuntimeContainersAsync(Arg.Any())
+ .Returns(pending.Task);
+
+ testContext.Services.AddSingleton(viewService);
+ testContext.Services.AddSingleton(Substitute.For());
+ testContext.Services.AddSingleton(new DashboardRefreshState());
+ testContext.Services.AddSingleton>(new TestLogger());
+
+ var page = testContext.Render();
+
+ Assert.IsNotEmpty(page.FindAll(".dug-panel__header .mud-skeleton"), "The skeleton must show a title placeholder");
+ Assert.IsNotEmpty(page.FindAll(".dug-panel__body .mud-skeleton"), "The skeleton must show row placeholders");
+ Assert.IsEmpty(page.FindAll("table"), "The table must not be shown while loading");
+ Assert.IsEmpty(page.FindAll(".empty-state-panel"), "The empty state must not be shown while loading");
+
+ pending.SetResult([]);
+ await page.WaitForAssertionAsync(() => Assert.IsEmpty(page.FindAll(".mud-skeleton"), "The skeleton must disappear after the load"), TimeSpan.FromSeconds(DetailPageAssert.WaitSeconds)).ConfigureAwait(false);
+ }
+ }
+
+ ///
+ /// Verify externally supplied texts are rendered as text, not as markup
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC3")]
+ public async Task RuntimeContainersRenderEncodesExternalTexts()
+ {
+ var container = CreateContainer(Guid.NewGuid(), "evil ");
+
+ container.DockerInstanceName = "host ";
+ container.LinkedObservedImageId = Guid.NewGuid();
+ container.LinkedObservedImageName = "img ";
+
+ var testContext = CreateContext([container]);
+
+ await using (testContext)
+ {
+ var page = testContext.Render();
+
+ Assert.IsEmpty(page.FindAll("td b, td i, td u"), "External texts must not create elements");
+ Assert.Contains("evil ", page.Find("td.runtime-containers-table__container a.table-link").TextContent, "The container name must be shown as text");
+ Assert.Contains("host ", page.Find("td.runtime-containers-table__instance").TextContent, "The instance name must be shown as text");
+ Assert.Contains("img ", page.Find("td.runtime-containers-table__container a[href^='/observed-images/']").TextContent, "The own image name must be shown as text");
+ }
+ }
+
+ ///
+ /// Create a test context with the page's services and a list the view service returns
+ ///
+ /// Listed containers
+ /// Test context
+ private static BunitContext CreateContext(IReadOnlyList containers)
+ {
+ var testContext = BlazorTestContextFactory.Create();
+ var viewService = Substitute.For();
+
+ viewService.GetRuntimeContainersAsync(Arg.Any())
+ .Returns(containers);
+
+ testContext.Services.AddSingleton(viewService);
+ testContext.Services.AddSingleton(Substitute.For());
+ testContext.Services.AddSingleton(new DashboardRefreshState());
+ testContext.Services.AddSingleton>(new TestLogger());
+
+ return testContext;
+ }
+
+ ///
+ /// Create a container with a status without findings and a current resource usage
+ ///
+ /// Docker instance identifier
+ /// Container name
+ /// Container
+ private static RuntimeContainerListItemData CreateContainer(Guid instanceId, string name)
+ {
+ return new RuntimeContainerListItemData
+ {
+ DockerInstanceId = instanceId,
+ ContainerId = $"id-{name}",
+ ContainerName = name,
+ DockerInstanceName = "Production",
+ ImageVersionId = Guid.NewGuid(),
+ CurrentTag = "latest",
+ UpdateState = "Up to date",
+ VulnerabilityStatus = "No findings",
+ VulnerabilityCheckedAtUtc = new DateTimeOffset(2026, 11, 23, 21, 27, 0, TimeSpan.Zero),
+ CurrentResourceUsage = CreateUsage(0),
+ };
+ }
+
+ ///
+ /// Set a vulnerability status and the active finding counts of a container
+ ///
+ /// Container
+ /// Vulnerability status
+ /// Critical count
+ /// High count
+ /// Medium count
+ /// Low count
+ /// Unknown count
+ private static void SetFindings(RuntimeContainerListItemData container, string status, int critical, int high, int medium, int low, int other)
+ {
+ var summary = new VulnerabilitySeveritySummaryViewData
+ {
+ CriticalCount = critical,
+ HighCount = high,
+ MediumCount = medium,
+ LowCount = low,
+ OtherCount = other,
+ };
+
+ container.VulnerabilityStatus = status;
+ container.VulnerabilitySeveritySummary = summary;
+ container.ActiveVulnerabilityFindingCount = summary.TotalCount;
+ }
+
+ ///
+ /// Create a resource usage sample
+ ///
+ /// Minutes after the base time
+ /// Sample
+ private static ResourceUsagePointViewData CreateUsage(int minutes)
+ {
+ return new ResourceUsagePointViewData
+ {
+ CpuPercent = 12.5m + minutes,
+ MemoryUsageBytes = 1048576L * (100 + minutes),
+ MemoryLimitBytes = 1048576L * 512,
+ NetworkRxBytesPerSecond = 2048m + minutes,
+ NetworkTxBytesPerSecond = 1024m + minutes,
+ RecordedAtUtc = new DateTimeOffset(2026, 11, 23, 21, 0, 0, TimeSpan.Zero).AddMinutes(minutes),
+ };
+ }
+
+ #endregion // Helper methods
+}
\ No newline at end of file
diff --git a/src/Tests/DockerUpdateGuard.Tests/RuntimeContainersTests.cs b/src/Tests/DockerUpdateGuard.Tests/RuntimeContainersTests.cs
index 7c1bda4b..b58f8304 100644
--- a/src/Tests/DockerUpdateGuard.Tests/RuntimeContainersTests.cs
+++ b/src/Tests/DockerUpdateGuard.Tests/RuntimeContainersTests.cs
@@ -83,6 +83,7 @@ public void RuntimeContainersBuildSparklinePathEmptyValuesReturnsEmptyString()
///
/// Task
[TestMethod]
+ [TestCategory("AC8")]
public async Task RuntimeContainersFailedUpdateCheckShowsFixedReasonAndLogsAsync()
{
var testContext = BlazorTestContextFactory.Create();
@@ -118,8 +119,7 @@ public async Task RuntimeContainersFailedUpdateCheckShowsFixedReasonAndLogsAsync
///
/// Task
[TestMethod]
- [TestCategory("AC1")]
- [TestCategory("AC2")]
+ [TestCategory("AC8")]
public async Task RuntimeContainersLoadFailureShowsFixedErrorAndLogs()
{
var exception = new InvalidOperationException("secret text");
@@ -150,7 +150,7 @@ public async Task RuntimeContainersLoadFailureShowsFixedErrorAndLogs()
///
/// Task
[TestMethod]
- [TestCategory("AC4")]
+ [TestCategory("AC8")]
public async Task RuntimeContainersSuccessfulUpdateCheckAfterLoadFailureShowsList()
{
var exception = new InvalidOperationException("secret text");
@@ -190,6 +190,120 @@ public async Task RuntimeContainersSuccessfulUpdateCheckAfterLoadFailureShowsLis
}
}
+ ///
+ /// Verify a running update check disables the header button and shows the progress text, and both revert afterwards
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC8")]
+ public async Task RuntimeContainersRunningUpdateCheckDisablesButtonWithProgress()
+ {
+ var testContext = BlazorTestContextFactory.Create();
+
+ await using (testContext)
+ {
+ var viewService = Substitute.For();
+ var orchestrator = Substitute.For();
+ var gate = new TaskCompletionSource();
+
+ viewService.GetRuntimeContainersAsync(Arg.Any())
+ .Returns([]);
+ orchestrator.ScanAllAsync(Arg.Any(), Arg.Any())
+ .Returns(gate.Task);
+
+ testContext.Services.AddSingleton(viewService);
+ testContext.Services.AddSingleton(orchestrator);
+ testContext.Services.AddSingleton(new DashboardRefreshState());
+ testContext.Services.AddSingleton>(new TestLogger());
+
+ var page = testContext.Render();
+ var click = page.Find("div.dug-page-header__actions button").ClickAsync();
+
+ await page.WaitForAssertionAsync(() =>
+ {
+ var button = page.Find("div.dug-page-header__actions button");
+
+ Assert.IsTrue(button.HasAttribute("disabled"), "The button must be disabled while the update check runs");
+ Assert.Contains("Checking image updates...", button.TextContent, "The button must show the progress text");
+ Assert.IsNotEmpty(button.QuerySelectorAll(".mud-progress-circular"), "The button must show the progress indicator");
+ },
+ TimeSpan.FromSeconds(DetailPageAssert.WaitSeconds)).ConfigureAwait(false);
+
+ gate.SetResult();
+ await click.ConfigureAwait(false);
+
+ await page.WaitForAssertionAsync(() =>
+ {
+ var button = page.Find("div.dug-page-header__actions button");
+
+ Assert.IsFalse(button.HasAttribute("disabled"), "The button must be enabled again after the update check");
+ Assert.AreEqual("Check image updates", button.TextContent.Trim(), "The button text must revert");
+ },
+ TimeSpan.FromSeconds(DetailPageAssert.WaitSeconds)).ConfigureAwait(false);
+ }
+ }
+
+ ///
+ /// Verify a manual vulnerability rescan in a row reloads the list and notifies the dashboard once
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC8")]
+ public async Task RuntimeContainersRescanReloadsListAndNotifiesDashboardAsync()
+ {
+ var testContext = BlazorTestContextFactory.Create();
+
+ await using (testContext)
+ {
+ var viewService = Substitute.For();
+ var refreshState = new DashboardRefreshState();
+ var notifications = 0;
+
+ refreshState.Changed += () => notifications++;
+ viewService.GetRuntimeContainersAsync(Arg.Any())
+ .Returns(CreateSingleContainerList("before-rescan"),
+ CreateSingleContainerList("after-rescan"));
+
+ testContext.Services.AddSingleton(viewService);
+ testContext.Services.AddSingleton(Substitute.For());
+ testContext.Services.AddSingleton(Substitute.For());
+ testContext.Services.AddSingleton(refreshState);
+ testContext.Services.AddSingleton>(new TestLogger());
+
+ var page = testContext.Render();
+
+ Assert.Contains("before-rescan", page.Markup, "The first load must show the initial container");
+
+ await page.Find("button[aria-label='Rescan vulnerabilities']").ClickAsync().ConfigureAwait(false);
+ await page.WaitForAssertionAsync(() => Assert.Contains("after-rescan", page.Markup, "The rescan must reload the list"), TimeSpan.FromSeconds(DetailPageAssert.WaitSeconds)).ConfigureAwait(false);
+
+ Assert.AreEqual(1, notifications, "The rescan must notify the dashboard exactly once");
+ Assert.DoesNotContain("before-rescan", page.Markup, "The reloaded list must replace the old one");
+ }
+ }
+
+ ///
+ /// Create a one-container list as the view service returns it
+ ///
+ /// Container name
+ /// Task with the list
+ private static Task> CreateSingleContainerList(string name)
+ {
+ IReadOnlyList list = [
+ new RuntimeContainerListItemData
+ {
+ DockerInstanceId = Guid.NewGuid(),
+ ContainerId = $"id-{name}",
+ ContainerName = name,
+ DockerInstanceName = "Production",
+ ImageVersionId = Guid.NewGuid(),
+ UpdateState = "Up to date",
+ },
+ ];
+
+ return Task.FromResult(list);
+ }
+
///
/// Invoke the non-public sparkline-path builder
///
diff --git a/src/Tests/DockerUpdateGuard.Tests/VulnerabilityRescanControlTests.cs b/src/Tests/DockerUpdateGuard.Tests/VulnerabilityRescanControlTests.cs
index 4b2ff4ff..2b973143 100644
--- a/src/Tests/DockerUpdateGuard.Tests/VulnerabilityRescanControlTests.cs
+++ b/src/Tests/DockerUpdateGuard.Tests/VulnerabilityRescanControlTests.cs
@@ -29,7 +29,7 @@ public class VulnerabilityRescanControlTests
///
/// Task
[TestMethod]
- [TestCategory("AC3")]
+ [TestCategory("AC6")]
public async Task VulnerabilityRescanControlWithCheckedAtShowsUtcTimestampAsync()
{
var testContext = BlazorTestContextFactory.Create();
@@ -156,7 +156,7 @@ public async Task VulnerabilityRescanControlWithoutCheckedAtShowsNeverScannedAsy
///
/// Task
[TestMethod]
- [TestCategory("AC10")]
+ [TestCategory("AC6")]
public async Task VulnerabilityRescanControlButtonHasAriaLabelAndTooltip()
{
var testContext = BlazorTestContextFactory.Create();
@@ -178,7 +178,7 @@ public async Task VulnerabilityRescanControlButtonHasAriaLabelAndTooltip()
///
/// Task
[TestMethod]
- [TestCategory("AC10")]
+ [TestCategory("AC8")]
public async Task VulnerabilityRescanControlRunningRescanDisablesButton()
{
var testContext = BlazorTestContextFactory.Create();
@@ -205,5 +205,155 @@ public async Task VulnerabilityRescanControlRunningRescanDisablesButton()
}
}
+ ///
+ /// Verify leading and trailing content render in the split layout: details part with the content around the time, then the button
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC6")]
+ public async Task VulnerabilityRescanControlWithLeadingAndTrailingContentRendersSplitLayout()
+ {
+ var testContext = BlazorTestContextFactory.Create();
+
+ await using (testContext)
+ {
+ testContext.Services.AddSingleton(Substitute.For());
+
+ var component = RenderSplit(testContext);
+ var root = component.Find("div.vulnerability-rescan-control.vulnerability-rescan-control--split");
+ var details = root.QuerySelector("div.vulnerability-rescan-control__details");
+ var markup = root.InnerHtml;
+
+ Assert.IsNotNull(details, "The split layout must wrap its lines in a details part");
+ Assert.IsNull(details.QuerySelector("button"), "The rescan button must stay outside the details part");
+ Assert.IsNotNull(root.QuerySelector("button"), "The split layout must still render the rescan button");
+ Assert.IsLessThan(markup.IndexOf("Checked 2026-11-23", StringComparison.Ordinal), markup.IndexOf("LEADING-LINE", StringComparison.Ordinal), "The leading content must come before the check time");
+ Assert.IsLessThan(markup.IndexOf("TRAILING-LINE", StringComparison.Ordinal), markup.IndexOf("Checked 2026-11-23", StringComparison.Ordinal), "The trailing content must come after the check time");
+ Assert.IsLessThan(markup.IndexOf("
+ /// Verify a failed rescan in the split layout shows its error inside the details part after the check time and before the trailing content
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC6")]
+ public async Task VulnerabilityRescanControlFailedRescanInSplitLayoutShowsErrorBeforeTrailingContentAsync()
+ {
+ var testContext = BlazorTestContextFactory.Create();
+
+ await using (testContext)
+ {
+ var enrichmentService = Substitute.For();
+
+ enrichmentService.RefreshImageVersionAsync(Arg.Any(), Arg.Any(), Arg.Any())
+ .Returns(Task.FromException(new ReportableException("provider is not configured")));
+
+ testContext.Services.AddSingleton(enrichmentService);
+ testContext.Services.AddSingleton>(new TestLogger());
+
+ var component = RenderSplit(testContext);
+
+ await component.Find("button").ClickAsync().ConfigureAwait(false);
+
+ var details = component.Find("div.vulnerability-rescan-control__details");
+ var markup = details.InnerHtml;
+ var errorIndex = markup.IndexOf("Vulnerability rescan failed: provider is not configured", StringComparison.Ordinal);
+
+ Assert.IsGreaterThanOrEqualTo(0, errorIndex, "The error must be shown inside the details part");
+ Assert.IsLessThan(errorIndex, markup.IndexOf("Checked 2026-11-23", StringComparison.Ordinal), "The error must come after the check time");
+ Assert.IsLessThan(markup.IndexOf("TRAILING-LINE", StringComparison.Ordinal), errorIndex, "The error must come before the trailing content");
+ }
+ }
+
+ ///
+ /// Verify without leading and trailing content the control keeps the inline markup: no split class and no details part
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC6")]
+ public async Task VulnerabilityRescanControlWithoutContentKeepsInlineLayout()
+ {
+ var testContext = BlazorTestContextFactory.Create();
+
+ await using (testContext)
+ {
+ testContext.Services.AddSingleton(Substitute.For());
+
+ var component = testContext.Render(parameters => parameters.Add(control => control.ImageVersionId, Guid.NewGuid())
+ .Add(control => control.CheckedAtUtc, new DateTimeOffset(2026, 11, 23, 23, 27, 0, TimeSpan.FromHours(2))));
+
+ Assert.IsNotNull(component.Find("div.vulnerability-rescan-control"), "The inline layout must keep the control root");
+ Assert.IsEmpty(component.FindAll("div.vulnerability-rescan-control--split"), "Without content the control must not render the split class");
+ Assert.IsEmpty(component.FindAll("div.vulnerability-rescan-control__details"), "Without content the control must not render a details part");
+ Assert.Contains("Checked 2026-11-23 21:27 UTC", component.Markup, "The inline layout must still show the check time");
+ }
+ }
+
+ ///
+ /// Verify the split layout with only trailing content and no check time shows the never-scanned hint inside the details part
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC6")]
+ public async Task VulnerabilityRescanControlWithOnlyTrailingContentShowsNeverScannedInSplitLayout()
+ {
+ var testContext = BlazorTestContextFactory.Create();
+
+ await using (testContext)
+ {
+ testContext.Services.AddSingleton(Substitute.For());
+
+ var component = testContext.Render(parameters => parameters.Add(control => control.ImageVersionId, Guid.NewGuid())
+ .Add(control => control.TrailingContent, builder => builder.AddMarkupContent(0, "TRAILING-LINE ")));
+ var details = component.Find("div.vulnerability-rescan-control--split div.vulnerability-rescan-control__details");
+
+ Assert.Contains("Never scanned", details.InnerHtml, "The split layout must show the never-scanned hint without a check time");
+ Assert.Contains("TRAILING-LINE", details.InnerHtml, "Trailing content alone must select the split layout");
+ }
+ }
+
+ ///
+ /// Verify the split layout with only leading content selects the split layout
+ ///
+ /// Task
+ [TestMethod]
+ [TestCategory("AC6")]
+ public async Task VulnerabilityRescanControlWithOnlyLeadingContentRendersSplitLayout()
+ {
+ var testContext = BlazorTestContextFactory.Create();
+
+ await using (testContext)
+ {
+ testContext.Services.AddSingleton(Substitute.For());
+
+ var component = testContext.Render(parameters => parameters.Add(control => control.ImageVersionId, Guid.NewGuid())
+ .Add(control => control.LeadingContent, builder => builder.AddMarkupContent(0, "LEADING-LINE ")));
+ var details = component.Find("div.vulnerability-rescan-control--split div.vulnerability-rescan-control__details");
+
+ Assert.Contains("LEADING-LINE", details.InnerHtml, "Leading content alone must select the split layout");
+ }
+ }
+
#endregion // Methods
+
+ #region Helper methods
+
+ ///
+ /// Render the control with marked leading and trailing content
+ ///
+ /// Test context
+ /// Rendered control
+ private static IRenderedComponent RenderSplit(BunitContext testContext)
+ {
+ return testContext.Render(parameters => parameters.Add(control => control.ImageVersionId, Guid.NewGuid())
+ .Add(control => control.CheckedAtUtc, new DateTimeOffset(2026, 11, 23, 23, 27, 0, TimeSpan.FromHours(2)))
+ .Add(control => control.LeadingContent, builder => builder.AddMarkupContent(0, "LEADING-LINE "))
+ .Add(control => control.TrailingContent, builder => builder.AddMarkupContent(0, "TRAILING-LINE ")));
+ }
+
+ #endregion // Helper methods
}
\ No newline at end of file