mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-11-02 01:15:31 +00:00
feat: 50X errors handler (#8621)
This commit is contained in:
1 parent
d4eb4bdca7
commit
136eb4facd
21 files changed
+227
-508
No files matched your search
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { Snippet } from "@nextui-org/react";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
|
||||
import { CodeSnippet } from "@/components/ui/code-snippet/code-snippet";
|
||||
import { CustomSection } from "@/components/ui/custom";
|
||||
@@ -14,14 +13,6 @@ import { FindingProps, ProviderType } from "@/types";
|
||||
import { Muted } from "../muted";
|
||||
import { DeltaIndicator } from "./delta-indicator";
|
||||
|
||||
const MarkdownContainer = ({ children }: { children: string }) => {
|
||||
return (
|
||||
<div className="prose prose-sm max-w-none whitespace-normal break-words dark:prose-invert">
|
||||
<ReactMarkdown>{children}</ReactMarkdown>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const renderValue = (value: string | null | undefined) => {
|
||||
return value && value.trim() !== "" ? value : "-";
|
||||
};
|
||||
@@ -131,17 +122,15 @@ export const FindingDetail = ({
|
||||
hideCopyButton
|
||||
hideSymbol
|
||||
>
|
||||
<MarkdownContainer>
|
||||
<p className="whitespace-pre-line">
|
||||
{attributes.check_metadata.risk}
|
||||
</MarkdownContainer>
|
||||
</p>
|
||||
</Snippet>
|
||||
</InfoField>
|
||||
)}
|
||||
|
||||
<InfoField label="Description">
|
||||
<MarkdownContainer>
|
||||
{attributes.check_metadata.description}
|
||||
</MarkdownContainer>
|
||||
{renderValue(attributes.check_metadata.description)}
|
||||
</InfoField>
|
||||
|
||||
<InfoField label="Status Extended">
|
||||
@@ -158,9 +147,9 @@ export const FindingDetail = ({
|
||||
{attributes.check_metadata.remediation.recommendation.text && (
|
||||
<InfoField label="Recommendation">
|
||||
<div className="flex flex-col gap-2">
|
||||
<MarkdownContainer>
|
||||
<p>
|
||||
{attributes.check_metadata.remediation.recommendation.text}
|
||||
</MarkdownContainer>
|
||||
</p>
|
||||
{attributes.check_metadata.remediation.recommendation.url && (
|
||||
<CustomLink
|
||||
href={
|
||||
@@ -186,12 +175,15 @@ export const FindingDetail = ({
|
||||
</InfoField>
|
||||
)}
|
||||
|
||||
{/* Remediation Steps section */}
|
||||
{/* Additional Resources section */}
|
||||
{attributes.check_metadata.remediation.code.other && (
|
||||
<InfoField label="Remediation Steps">
|
||||
<MarkdownContainer>
|
||||
{attributes.check_metadata.remediation.code.other}
|
||||
</MarkdownContainer>
|
||||
<InfoField label="Additional Resources">
|
||||
<CustomLink
|
||||
href={attributes.check_metadata.remediation.code.other}
|
||||
size="sm"
|
||||
>
|
||||
View documentation
|
||||
</CustomLink>
|
||||
</InfoField>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -21,17 +21,17 @@ export const EditTenantForm = ({
|
||||
const { toast } = useToast();
|
||||
|
||||
useEffect(() => {
|
||||
if (state?.success) {
|
||||
if (state && "success" in state) {
|
||||
toast({
|
||||
title: "Changed successfully",
|
||||
description: state.success,
|
||||
});
|
||||
setIsOpen(false);
|
||||
} else if (state?.errors?.general) {
|
||||
} else if (state && "error" in state) {
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Oops! Something went wrong",
|
||||
description: state.errors.general,
|
||||
description: state.error,
|
||||
});
|
||||
}
|
||||
}, [state, toast, setIsOpen]);
|
||||
@@ -49,8 +49,8 @@ export const EditTenantForm = ({
|
||||
labelPlacement="outside"
|
||||
variant="bordered"
|
||||
isRequired={true}
|
||||
isInvalid={!!state?.errors?.name}
|
||||
errorMessage={state?.errors?.name}
|
||||
isInvalid={!!(state && "error" in state)}
|
||||
errorMessage={state && "error" in state ? state.error : undefined}
|
||||
/>
|
||||
|
||||
{/* Hidden inputs for Server Action */}
|
||||
|
||||
Reference in new issue
Block a user