From c99f202e743275cd6873cbf84a83e75f6ea1a6d6 Mon Sep 17 00:00:00 2001 From: Chandrapal Badshah <12944530+Chan9390@users.noreply.github.com> Date: Thu, 1 May 2025 12:19:12 +0530 Subject: [PATCH] Fix NextJS reviews --- ui/actions/lighthouse/compliances.ts | 8 ++++---- ui/app/(prowler)/lighthouse/config/layout.tsx | 19 ------------------- ui/app/(prowler)/lighthouse/page.tsx | 8 +++----- ui/lib/lighthouse/tools/checks.ts | 4 ++-- ui/lib/lighthouse/tools/compliances.ts | 8 ++++---- ui/types/lighthouse/checks.ts | 2 +- ui/types/lighthouse/compliances.ts | 6 +++--- ui/types/lighthouse/findings.ts | 18 ------------------ ui/types/lighthouse/overviews.ts | 18 ------------------ ui/types/lighthouse/providers.ts | 13 ------------- 10 files changed, 17 insertions(+), 87 deletions(-) delete mode 100644 ui/app/(prowler)/lighthouse/config/layout.tsx diff --git a/ui/actions/lighthouse/compliances.ts b/ui/actions/lighthouse/compliances.ts index 782156d977..7bbaddcaa7 100644 --- a/ui/actions/lighthouse/compliances.ts +++ b/ui/actions/lighthouse/compliances.ts @@ -5,14 +5,14 @@ export const getLighthouseCompliancesOverview = async ({ fields, filters, page, - page_size, + pageSize, sort, }: { scanId: string; fields?: string[]; filters?: Record; page?: number; - page_size?: number; + pageSize?: number; sort?: string; }) => { const headers = await getAuthHeaders({ contentType: false }); @@ -39,8 +39,8 @@ export const getLighthouseCompliancesOverview = async ({ if (page) { url.searchParams.append("page[number]", page.toString()); } - if (page_size) { - url.searchParams.append("page[size]", page_size.toString()); + if (pageSize) { + url.searchParams.append("page[size]", pageSize.toString()); } // Handle sorting diff --git a/ui/app/(prowler)/lighthouse/config/layout.tsx b/ui/app/(prowler)/lighthouse/config/layout.tsx deleted file mode 100644 index d7c1351b71..0000000000 --- a/ui/app/(prowler)/lighthouse/config/layout.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import "@/styles/globals.css"; - -import React from "react"; - -import { ContentLayout } from "@/components/ui"; - -interface ChatbotConfigLayoutProps { - children: React.ReactNode; -} - -export default function ChatbotConfigLayout({ - children, -}: ChatbotConfigLayoutProps) { - return ( - - {children} - - ); -} diff --git a/ui/app/(prowler)/lighthouse/page.tsx b/ui/app/(prowler)/lighthouse/page.tsx index 190e6a038c..8c27686aef 100644 --- a/ui/app/(prowler)/lighthouse/page.tsx +++ b/ui/app/(prowler)/lighthouse/page.tsx @@ -4,10 +4,8 @@ import Chat from "./chat"; export default function AIChatbot() { return ( -
- - - -
+ + + ); } diff --git a/ui/lib/lighthouse/tools/checks.ts b/ui/lib/lighthouse/tools/checks.ts index aa43b268d0..9d96325333 100644 --- a/ui/lib/lighthouse/tools/checks.ts +++ b/ui/lib/lighthouse/tools/checks.ts @@ -4,8 +4,8 @@ import { getLighthouseProviderChecks } from "@/lib/lighthouse/helpers/checks"; import { checkSchema } from "@/types/lighthouse"; export const getProviderChecksTool = tool( - async ({ provider_type }) => { - const checks = await getLighthouseProviderChecks(provider_type); + async ({ providerType }) => { + const checks = await getLighthouseProviderChecks(providerType); return checks; }, { diff --git a/ui/lib/lighthouse/tools/compliances.ts b/ui/lib/lighthouse/tools/compliances.ts index d5f5b36d6e..397afa27c3 100644 --- a/ui/lib/lighthouse/tools/compliances.ts +++ b/ui/lib/lighthouse/tools/compliances.ts @@ -12,13 +12,13 @@ import { } from "@/types/lighthouse"; export const getCompliancesOverviewTool = tool( - async ({ scanId, fields, filters, page, page_size, sort }) => { + async ({ scanId, fields, filters, page, pageSize, sort }) => { return await getLighthouseCompliancesOverview({ scanId, fields, filters, page, - page_size, + pageSize, sort, }); }, @@ -31,8 +31,8 @@ export const getCompliancesOverviewTool = tool( ); export const getComplianceFrameworksTool = tool( - async ({ provider }) => { - return await getLighthouseComplianceFrameworks(provider); + async ({ providerType }) => { + return await getLighthouseComplianceFrameworks(providerType); }, { name: "getComplianceFrameworks", diff --git a/ui/types/lighthouse/checks.ts b/ui/types/lighthouse/checks.ts index 39233c93e7..fa359766b1 100644 --- a/ui/types/lighthouse/checks.ts +++ b/ui/types/lighthouse/checks.ts @@ -1,5 +1,5 @@ import { z } from "zod"; export const checkSchema = z.object({ - provider_type: z.enum(["aws", "gcp", "azure", "kubernetes", "m365"]), + providerType: z.enum(["aws", "gcp", "azure", "kubernetes", "m365"]), }); diff --git a/ui/types/lighthouse/compliances.ts b/ui/types/lighthouse/compliances.ts index 59521f043b..e8983e5626 100644 --- a/ui/types/lighthouse/compliances.ts +++ b/ui/types/lighthouse/compliances.ts @@ -81,15 +81,15 @@ export const getCompliancesOverviewSchema = z.object({ "The filters to get the compliances overview for. If not provided, all regions will be returned by default.", ), page: z.number().optional().describe("Page number. Default is 1."), - page_size: z.number().optional().describe("Page size. Default is 10."), + pageSize: z.number().optional().describe("Page size. Default is 10."), sort: getCompliancesOverviewSort .optional() .describe("Sort by field. Default is inserted_at."), }); export const getComplianceFrameworksSchema = z.object({ - provider: z - .enum(["aws", "azure", "gcp", "kubernetes"]) + providerType: z + .enum(["aws", "azure", "gcp", "kubernetes", "m365"]) .describe("The provider type to get the compliance frameworks for."), }); diff --git a/ui/types/lighthouse/findings.ts b/ui/types/lighthouse/findings.ts index 6fc141d691..feca1ab9de 100644 --- a/ui/types/lighthouse/findings.ts +++ b/ui/types/lighthouse/findings.ts @@ -2,24 +2,6 @@ import { z } from "zod"; // Get Findings Schema -// const findingFieldsEnum = z.enum([ -// "", -// "uid", -// "delta", -// "status", -// "status_extended", -// "severity", -// "check_id", -// "check_metadata", -// "raw_result", -// "inserted_at", -// "updated_at", -// "first_seen_at", -// "url", -// "scan", -// "resources", -// ]); - const deltaEnum = z.enum(["", "new", "changed"]); const impactEnum = z.enum([ diff --git a/ui/types/lighthouse/overviews.ts b/ui/types/lighthouse/overviews.ts index 8a2d541350..e4591397e6 100644 --- a/ui/types/lighthouse/overviews.ts +++ b/ui/types/lighthouse/overviews.ts @@ -18,24 +18,6 @@ export const getProvidersOverviewSchema = z.object({ // Get Findings By Status -// const findingsOverviewFieldsEnum = z.enum([ -// "", -// "id", -// "new", -// "changed", -// "unchanged", -// "fail_new", -// "fail_changed", -// "pass_new", -// "pass_changed", -// "muted_new", -// "muted_changed", -// "total", -// "fail", -// "muted", -// "pass", -// ]); - const providerTypeEnum = z.enum(["", "aws", "azure", "gcp", "kubernetes"]); const sortFieldsEnum = z.enum([ diff --git a/ui/types/lighthouse/providers.ts b/ui/types/lighthouse/providers.ts index 160a2ff86a..c4ffcd07a4 100644 --- a/ui/types/lighthouse/providers.ts +++ b/ui/types/lighthouse/providers.ts @@ -2,19 +2,6 @@ import { z } from "zod"; // Get Providers Schema -// const providerFieldsEnum = z.enum([ -// "", -// "inserted_at", -// "updated_at", -// "provider", -// "uid", -// "alias", -// "connection", -// "secret", -// "provider_groups", -// "url", -// ]); - const providerEnum = z.enum(["", "aws", "azure", "gcp", "kubernetes"]); const sortFieldsEnum = z.enum([