fix(ui): stop offering reports and compliance for partial scans (#12880)

This commit is contained in:
Alejandro Bailo authored and GitHub committed 2026-09-25 10:09:33 +02:00
1 parent e0fa23b9ee
commit ee59e35bc2
4 files changed
+232 -17

No files matched your search

@@ -387,6 +387,36 @@ describe("ScanJobsRowActions", () => {
expect(downloadScanZipMock).toHaveBeenCalledWith("scan-1", toastMock);
});
it("offers neither report download nor compliance for a partial scan", async () => {
// A partial scan re-checks a few resources: no report files, no compliance.
const user = userEvent.setup();
render(
<ScanJobsRowActions
scan={makeScan({
state: "completed",
completed_at: "2026-01-01T10:05:00Z",
is_partial: true,
})}
tab="completed"
/>,
);
await user.click(
screen.getByRole("button", { name: /open actions menu/i }),
);
expect(
screen.queryByRole("menuitem", { name: /download scan reports/i }),
).not.toBeInTheDocument();
expect(
screen.queryByRole("menuitem", { name: /view compliance/i }),
).not.toBeInTheDocument();
// The rest of the completed-scan actions stay available.
expect(
screen.getByRole("menuitem", { name: /view findings/i }),
).toBeInTheDocument();
});
it("opens the paid plan upgrade instead of downloading subscription-only reports", async () => {
// Given
const user = userEvent.setup();
@@ -83,6 +83,9 @@ export function ScanJobsRowActions({
const scanState = scan.attributes.state;
const isCompleted = scanState === "completed";
const isFailed = scanState === "failed";
// Prowler Cloud partial scans re-check a few resources: they compute no
// compliance and write no report files, so neither entry applies.
const isPartial = scan.attributes.is_partial === true;
const taskId = scan.relationships.task.data?.id;
// The findings page bounds the UTC day range with completed_at; without it the
// range collapses to the start day and can miss later findings.
@@ -210,18 +213,22 @@ export function ScanJobsRowActions({
onSelect={openFindings}
disabled={!isCompleted || !hasCompletedAt}
/>
<ActionDropdownItem
icon={<ShieldCheck />}
label="View Compliance"
onSelect={openCompliance}
/>
<ActionDropdownItem
icon={<Download />}
label="Download Scan Reports"
onSelect={() =>
runReportDownload(() => downloadScanZip(scan.id, toast))
}
/>
{!isPartial && (
<ActionDropdownItem
icon={<ShieldCheck />}
label="View Compliance"
onSelect={openCompliance}
/>
)}
{!isPartial && (
<ActionDropdownItem
icon={<Download />}
label="Download Scan Reports"
onSelect={() =>
runReportDownload(() => downloadScanZip(scan.id, toast))
}
/>
)}
</>
)}
{isFailed && (