diff --git a/ui/.eslintrc.cjs b/ui/.eslintrc.cjs index 6f1426da12..8c32ae0804 100644 --- a/ui/.eslintrc.cjs +++ b/ui/.eslintrc.cjs @@ -12,6 +12,7 @@ module.exports = { "plugin:jsx-a11y/recommended", "eslint-config-prettier", "prettier", + "next/core-web-vitals", ], parserOptions: { ecmaVersion: "latest", @@ -37,7 +38,14 @@ module.exports = { "eol-last": ["error", "always"], "simple-import-sort/imports": "error", "simple-import-sort/exports": "error", - "jsx-a11y/anchor-is-valid": "error", + "jsx-a11y/anchor-is-valid": [ + "error", + { + components: ["Link"], + specialLink: ["hrefLeft", "hrefRight"], + aspects: ["invalidHref", "preferButton"], + }, + ], "jsx-a11y/alt-text": "error", "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }], }, diff --git a/ui/actions/providers/providers.ts b/ui/actions/providers/providers.ts index cd9e021696..3b2ea126d3 100644 --- a/ui/actions/providers/providers.ts +++ b/ui/actions/providers/providers.ts @@ -42,6 +42,7 @@ export const getProviders = async ({ revalidatePath("/providers"); return parsedData; } catch (error) { + // eslint-disable-next-line no-console console.error("Error fetching providers:", error); return undefined; } diff --git a/ui/actions/services/services.ts b/ui/actions/services/services.ts index c4ab342f01..cfd295e1cb 100644 --- a/ui/actions/services/services.ts +++ b/ui/actions/services/services.ts @@ -1,13 +1,10 @@ "use server"; import { revalidatePath } from "next/cache"; -import { redirect } from "next/navigation"; -import { parse } from "path"; import { auth } from "@/auth.config"; -import { getErrorMessage, parseStringify } from "@/lib"; -export const getServices = async ({}) => { +export const getServices = async () => { const session = await auth(); const keyServer = process.env.API_BASE_URL; @@ -90,6 +87,7 @@ export const getServices = async ({}) => { fail_findings: failFindings, }); } catch (error) { + // eslint-disable-next-line no-console console.error(`Error fetching data for service ${service.id}:`, error); } } diff --git a/ui/actions/users/users.ts b/ui/actions/users/users.ts index 3d06ccc801..ce80221da3 100644 --- a/ui/actions/users/users.ts +++ b/ui/actions/users/users.ts @@ -42,6 +42,7 @@ export const getUsers = async ({ revalidatePath("/users"); return parsedData; } catch (error) { + // eslint-disable-next-line no-console console.error("Error fetching users:", error); return undefined; } @@ -200,6 +201,7 @@ export const getProfileInfo = async () => { revalidatePath("/profile"); return parsedData; } catch (error) { + // eslint-disable-next-line no-console console.error("Error fetching profile:", error); return undefined; } diff --git a/ui/app/(prowler)/compliance/page.tsx b/ui/app/(prowler)/compliance/page.tsx index 108433a7c7..ce5fe18e5d 100644 --- a/ui/app/(prowler)/compliance/page.tsx +++ b/ui/app/(prowler)/compliance/page.tsx @@ -1,3 +1,5 @@ +export const dynamic = "force-dynamic"; + import { Spacer } from "@nextui-org/react"; import { Suspense } from "react"; diff --git a/ui/app/(prowler)/error.tsx b/ui/app/(prowler)/error.tsx index 980e681220..d5083d9d33 100644 --- a/ui/app/(prowler)/error.tsx +++ b/ui/app/(prowler)/error.tsx @@ -24,11 +24,10 @@ export default function Error({ An unexpected error occurred - We're sorry for the inconvenience. Please try again or contact support - if the problem persists. + We're sorry for the inconvenience. Please try again or contact + support if the problem persists. - - {" "} + Go to the homepage diff --git a/ui/app/(prowler)/providers/page.tsx b/ui/app/(prowler)/providers/page.tsx index b41c049202..3851c75f0d 100644 --- a/ui/app/(prowler)/providers/page.tsx +++ b/ui/app/(prowler)/providers/page.tsx @@ -72,15 +72,15 @@ const SSRDataTable = async ({ return acc; }, {}) || {}; - const enrichedProviders = providersData?.data.map( - (provider: ProviderProps) => { - const groupNames = provider.relationships.provider_groups.data.map( - (group: { id: string }) => - providerGroupDict[group.id] || "Unknown Group", - ); + const enrichedProviders = + providersData?.data?.map((provider: ProviderProps) => { + const groupNames = + provider.relationships?.provider_groups?.data?.map( + (group: { id: string }) => + providerGroupDict[group.id] || "Unknown Group", + ) || []; return { ...provider, groupNames }; - }, - ); + }) || []; return ( }> - + ); } -const SSRServiceGrid = async ({ - searchParams, -}: { - searchParams: SearchParamsProps; -}) => { - const servicesData = await getServices(searchParams); - const [services] = await Promise.all([servicesData]); +const SSRServiceGrid = async () => { + const services = await getServices(); return (
diff --git a/ui/components/compliance/data-compliance/select-scan-compliance-data.tsx b/ui/components/compliance/data-compliance/select-scan-compliance-data.tsx index 5ebc36515d..6bbfd3d4e0 100644 --- a/ui/components/compliance/data-compliance/select-scan-compliance-data.tsx +++ b/ui/components/compliance/data-compliance/select-scan-compliance-data.tsx @@ -15,6 +15,9 @@ export const SelectScanComplianceData = ({