Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(scans): add new component - alert bar #6391

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ui/app/(prowler)/compliance/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default async function Compliance({
progress: scan.attributes.progress,
})) || [];
} catch (error) {
// eslint-disable-next-line no-console
console.error("Error fetching scans data:", error);
}

Expand Down Expand Up @@ -72,6 +73,7 @@ export default async function Compliance({
)
: [];
} catch (error) {
// eslint-disable-next-line no-console
console.error("Error fetching compliance data:", error);
}

Expand Down Expand Up @@ -104,6 +106,7 @@ const SSRComplianceGrid = async ({
region: regionFilter,
});
} catch (error) {
// eslint-disable-next-line no-console
console.error("Error fetching compliances overview:", error);
return (
<div className="flex h-full items-center justify-center">
Expand Down
4 changes: 3 additions & 1 deletion ui/app/(prowler)/scans/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ButtonRefreshData,
NoProvidersAdded,
NoProvidersConnected,
ScanWarningBar,
} from "@/components/scans";
import { LaunchScanWorkflow } from "@/components/scans/launch-workflow";
import { SkeletonTableScans } from "@/components/scans/table";
Expand Down Expand Up @@ -72,9 +73,10 @@ export default async function Scans({
<Spacer y={8} />
</>
)}
<Spacer y={8} />
<div className="grid grid-cols-12 items-start gap-4">
<div className="col-span-12">
<ScanWarningBar />
<Spacer y={4} />
<div className="flex flex-row items-center justify-between">
<DataTableFilterCustom filters={filterScans || []} />
<ButtonRefreshData
Expand Down
4 changes: 3 additions & 1 deletion ui/components/filters/custom-region-selection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export const CustomRegionSelection: React.FC = () => {
className="w-full"
size="sm"
selectedKeys={selectedKeys}
onSelectionChange={(keys) => applyRegionFilter(Array.from(keys))}
onSelectionChange={(keys) =>
applyRegionFilter(Array.from(keys) as string[])
}
>
{regions.map((region) => (
<SelectItem key={region.key}>{region.label}</SelectItem>
Expand Down
1 change: 1 addition & 0 deletions ui/components/scans/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from "./button-refresh-data";
export * from "./link-to-findings-from-scan";
export * from "./no-providers-added";
export * from "./no-providers-connected";
export * from "./scan-warning-bar";
19 changes: 19 additions & 0 deletions ui/components/scans/scan-warning-bar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Alert, cn } from "@nextui-org/react";

export const ScanWarningBar = () => {
return (
<Alert
color="warning"
title="Waiting for Your Scan to Show Up?"
description="Your scan is being processed and may take a few minutes to appear on the table. It will show up shortly."
variant="faded"
isClosable
classNames={{
base: cn([
"border-1 border-default-200 dark:border-default-100",
"gap-x-4",
]),
}}
/>
);
};
6 changes: 3 additions & 3 deletions ui/components/ui/custom/custom-radio.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { UseRadioProps } from "@nextui-org/radio/dist/use-radio";
import { cn, useRadio, VisuallyHidden } from "@nextui-org/react";
import React from "react";

interface CustomRadioProps extends UseRadioProps {
interface CustomRadioProps {
description?: string;
value?: string;
children?: React.ReactNode;
}

Expand All @@ -18,7 +18,7 @@ export const CustomRadio: React.FC<CustomRadioProps> = (props) => {
getLabelProps,
getLabelWrapperProps,
getControlProps,
} = useRadio(props);
} = useRadio({ ...props, value: props.value || "" });

return (
<Component
Expand Down
2 changes: 1 addition & 1 deletion ui/components/ui/custom/custom-textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { Textarea } from "@nextui-org/input";
import { Textarea } from "@nextui-org/react";
import React from "react";
import { Control, FieldPath, FieldValues } from "react-hook-form";

Expand Down
Loading
Loading