chore(scans): properly enable link to findings when scan is completed (#7368)

This commit is contained in:
Pablo Lara
2025-03-25 08:45:37 +01:00
committed by GitHub
parent d6862766d3
commit dd05ef7974
3 changed files with 17 additions and 5 deletions
+1 -1
View File
@@ -13,12 +13,12 @@ All notable changes to the **Prowler UI** are documented in this file.
- Accepted invitations can no longer be edited. [(#7198)](https://github.com/prowler-cloud/prowler/pull/7198)
- Added download column in scans table to download reports for completed scans. [(#7353)](https://github.com/prowler-cloud/prowler/pull/7353)
#### 🔄 Changed
- Tweak styles for compliance cards. [(#7148)](https://github.com/prowler-cloud/prowler/pull/7148).
- Upgrade Next.js to v14.2.25 to fix a middleware authorization vulnerability. [(#7339)](https://github.com/prowler-cloud/prowler/pull/7339)
- Apply default filter to show only failed items when coming from scan table. [(#7356)](https://github.com/prowler-cloud/prowler/pull/7356)
- Fix link behavior in scan cards: only disable "View Findings" when scan is not completed or executing. [(#7368)](https://github.com/prowler-cloud/prowler/pull/7368)
---
@@ -4,16 +4,22 @@ import { CustomButton } from "@/components/ui/custom";
interface LinkToFindingsProps {
scanId?: string;
isDisabled?: boolean;
}
export const LinkToFindingsFromScan = ({ scanId }: LinkToFindingsProps) => {
export const LinkToFindingsFromScan = ({
scanId,
isDisabled,
}: LinkToFindingsProps) => {
return (
<CustomButton
asLink={`/findings?filter[scan__in]=${scanId}&filter[status__in]=FAIL`}
ariaLabel="Go to Findings page"
variant="solid"
color="action"
variant="ghost"
className="text-xs font-medium text-default-500 hover:text-primary disabled:opacity-30"
// color="action"
size="sm"
isDisabled={isDisabled}
>
See Findings
</CustomButton>
@@ -107,7 +107,13 @@ export const ColumnGetScans: ColumnDef<ScanProps>[] = [
header: "Findings",
cell: ({ row }) => {
const { id } = getScanData(row);
return <LinkToFindingsFromScan scanId={id} />;
const scanState = row.original.attributes?.state;
return (
<LinkToFindingsFromScan
scanId={id}
isDisabled={!["completed", "executing"].includes(scanState)}
/>
);
},
},
{