mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-23 20:42:02 +00:00
fix: move ProviderType to shared types and update usages (#7710)
This commit is contained in:
+6
-2
@@ -2,13 +2,18 @@
|
||||
|
||||
All notable changes to the **Prowler UI** are documented in this file.
|
||||
|
||||
## [v1.7.0] (Prowler v5.7.0)
|
||||
## [v1.7.0] (Prowler v5.7.0) – Not released
|
||||
|
||||
### 🚀 Added
|
||||
|
||||
- Add a new chart to show the split between passed and failed findings. [(#7680)](https://github.com/prowler-cloud/prowler/pull/7680)
|
||||
- Added `Accordion` component. [(#7700)](https://github.com/prowler-cloud/prowler/pull/7700)
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
- Fix form validation in launch scan workflow. [(#7693)](https://github.com/prowler-cloud/prowler/pull/7693)
|
||||
- Moved ProviderType to a shared types file and replaced all occurrences across the codebase. [(#7710)](https://github.com/prowler-cloud/prowler/pull/7710)
|
||||
|
||||
---
|
||||
|
||||
## [v1.6.0] (Prowler v5.6.0)
|
||||
@@ -22,7 +27,6 @@ All notable changes to the **Prowler UI** are documented in this file.
|
||||
- Add a button to download the CSV report in compliance card. [(#7665)](https://github.com/prowler-cloud/prowler/pull/7665)
|
||||
- Show loading state while checking provider connection. [(#7669)](https://github.com/prowler-cloud/prowler/pull/7669)
|
||||
|
||||
|
||||
### 🔄 Changed
|
||||
|
||||
- Finding URLs now include the ID, allowing them to be shared within the organization. [(#7654)](https://github.com/prowler-cloud/prowler/pull/7654)
|
||||
|
||||
@@ -14,12 +14,8 @@ import {
|
||||
import { ContentLayout } from "@/components/ui";
|
||||
import { DataTable, DataTableFilterCustom } from "@/components/ui/table";
|
||||
import { createDict } from "@/lib";
|
||||
import {
|
||||
FindingProps,
|
||||
ProviderProps,
|
||||
ScanProps,
|
||||
SearchParamsProps,
|
||||
} from "@/types/components";
|
||||
import { ProviderProps } from "@/types";
|
||||
import { FindingProps, ScanProps, SearchParamsProps } from "@/types/components";
|
||||
|
||||
export default async function Findings({
|
||||
searchParams,
|
||||
|
||||
@@ -2,11 +2,11 @@ import { Divider } from "@nextui-org/react";
|
||||
import React from "react";
|
||||
|
||||
import { DateWithTime, EntityInfoShort } from "@/components/ui/entities";
|
||||
|
||||
import { ProviderType } from "@/types";
|
||||
interface ComplianceScanInfoProps {
|
||||
scan: {
|
||||
providerInfo: {
|
||||
provider: "aws" | "azure" | "gcp" | "kubernetes";
|
||||
provider: ProviderType;
|
||||
alias?: string;
|
||||
uid?: string;
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
SeverityBadge,
|
||||
StatusFindingBadge,
|
||||
} from "@/components/ui/table";
|
||||
import { FindingProps } from "@/types";
|
||||
import { FindingProps, ProviderType } from "@/types";
|
||||
|
||||
import { Muted } from "../muted";
|
||||
import { DeltaIndicator } from "./delta-indicator";
|
||||
@@ -215,7 +215,7 @@ export const ColumnFindings: ColumnDef<FindingProps>[] = [
|
||||
return (
|
||||
<>
|
||||
<EntityInfoShort
|
||||
cloudProvider={provider as "aws" | "azure" | "gcp" | "kubernetes"}
|
||||
cloudProvider={provider as ProviderType}
|
||||
entityAlias={alias as string}
|
||||
entityId={uid as string}
|
||||
/>
|
||||
|
||||
@@ -6,12 +6,9 @@ import Link from "next/link";
|
||||
import { CodeSnippet } from "@/components/ui/code-snippet/code-snippet";
|
||||
import { InfoField } from "@/components/ui/entities";
|
||||
import { DateWithTime } from "@/components/ui/entities/date-with-time";
|
||||
import {
|
||||
getProviderLogo,
|
||||
type ProviderType,
|
||||
} from "@/components/ui/entities/get-provider-logo";
|
||||
import { getProviderLogo } from "@/components/ui/entities/get-provider-logo";
|
||||
import { SeverityBadge } from "@/components/ui/table/severity-badge";
|
||||
import { FindingProps } from "@/types";
|
||||
import { FindingProps, ProviderType } from "@/types";
|
||||
|
||||
import { Muted } from "../muted";
|
||||
import { DeltaIndicator } from "./delta-indicator";
|
||||
|
||||
@@ -9,7 +9,7 @@ import { InfoIcon } from "@/components/icons";
|
||||
import { DateWithTime, EntityInfoShort } from "@/components/ui/entities";
|
||||
import { TriggerSheet } from "@/components/ui/sheet";
|
||||
import { SeverityBadge, StatusFindingBadge } from "@/components/ui/table";
|
||||
import { FindingProps } from "@/types";
|
||||
import { FindingProps, ProviderType } from "@/types";
|
||||
|
||||
import { Muted } from "../../../findings/muted";
|
||||
|
||||
@@ -162,7 +162,7 @@ export const ColumnNewFindingsToDate: ColumnDef<FindingProps>[] = [
|
||||
return (
|
||||
<>
|
||||
<EntityInfoShort
|
||||
cloudProvider={provider as "aws" | "azure" | "gcp" | "kubernetes"}
|
||||
cloudProvider={provider as ProviderType}
|
||||
entityAlias={alias as string}
|
||||
entityId={uid as string}
|
||||
/>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Tooltip } from "@nextui-org/react";
|
||||
import React from "react";
|
||||
|
||||
import { ConnectionFalse, ConnectionPending, ConnectionTrue } from "../icons";
|
||||
import { getProviderLogo, ProviderType } from "../ui/entities";
|
||||
import { ProviderType } from "@/types";
|
||||
|
||||
import { ConnectionFalse, ConnectionPending, ConnectionTrue } from "../icons";
|
||||
import { getProviderLogo } from "../ui/entities";
|
||||
interface ProviderInfoProps {
|
||||
connected: boolean | null;
|
||||
provider: ProviderType;
|
||||
|
||||
@@ -9,8 +9,8 @@ import * as z from "zod";
|
||||
|
||||
import { useToast } from "@/components/ui";
|
||||
import { CustomButton, CustomInput } from "@/components/ui/custom";
|
||||
import { ProviderType } from "@/components/ui/entities";
|
||||
import { Form } from "@/components/ui/form";
|
||||
import { ProviderType } from "@/types";
|
||||
|
||||
import { addProvider } from "../../../../actions/providers/providers";
|
||||
import { addProviderFormSchema, ApiError } from "../../../../types";
|
||||
|
||||
@@ -18,9 +18,9 @@ import { getTask } from "@/actions/task/tasks";
|
||||
import { CheckIcon, RocketIcon } from "@/components/icons";
|
||||
import { useToast } from "@/components/ui";
|
||||
import { CustomButton } from "@/components/ui/custom";
|
||||
import { ProviderType } from "@/components/ui/entities";
|
||||
import { Form } from "@/components/ui/form";
|
||||
import { checkTaskStatus } from "@/lib/helper";
|
||||
import { ProviderType } from "@/types";
|
||||
import { ApiError, testConnectionFormSchema } from "@/types";
|
||||
|
||||
import { ProviderInfo } from "../..";
|
||||
|
||||
@@ -10,8 +10,8 @@ import * as z from "zod";
|
||||
import { updateCredentialsProvider } from "@/actions/providers/providers";
|
||||
import { useToast } from "@/components/ui";
|
||||
import { CustomButton } from "@/components/ui/custom";
|
||||
import { ProviderType } from "@/components/ui/entities";
|
||||
import { Form } from "@/components/ui/form";
|
||||
import { ProviderType } from "@/types";
|
||||
import {
|
||||
addCredentialsFormSchema,
|
||||
ApiError,
|
||||
|
||||
@@ -10,8 +10,8 @@ import * as z from "zod";
|
||||
import { addCredentialsProvider } from "@/actions/providers/providers";
|
||||
import { useToast } from "@/components/ui";
|
||||
import { CustomButton } from "@/components/ui/custom";
|
||||
import { ProviderType } from "@/components/ui/entities";
|
||||
import { Form } from "@/components/ui/form";
|
||||
import { ProviderType } from "@/types";
|
||||
import {
|
||||
addCredentialsFormSchema,
|
||||
ApiError,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Link from "next/link";
|
||||
|
||||
import { getProviderName } from "@/components/ui/entities/get-provider-logo";
|
||||
import { ProviderType } from "@/components/ui/entities/get-provider-logo";
|
||||
import { getProviderLogo } from "@/components/ui/entities/get-provider-logo";
|
||||
import { ProviderType } from "@/types";
|
||||
|
||||
export const ProviderTitleDocs = ({
|
||||
providerType,
|
||||
|
||||
@@ -10,7 +10,7 @@ import { DateWithTime, EntityInfoShort } from "@/components/ui/entities";
|
||||
import { TriggerSheet } from "@/components/ui/sheet";
|
||||
import { DataTableColumnHeader, StatusBadge } from "@/components/ui/table";
|
||||
import { downloadScanZip } from "@/lib/helper";
|
||||
import { ScanProps } from "@/types";
|
||||
import { ProviderType, ScanProps } from "@/types";
|
||||
|
||||
import { LinkToFindingsFromScan } from "../../link-to-findings-from-scan";
|
||||
import { TriggerIcon } from "../../trigger-icon";
|
||||
@@ -60,7 +60,7 @@ export const ColumnGetScans: ColumnDef<ScanProps>[] = [
|
||||
|
||||
return (
|
||||
<EntityInfoShort
|
||||
cloudProvider={provider as "aws" | "azure" | "gcp" | "kubernetes"}
|
||||
cloudProvider={provider as ProviderType}
|
||||
entityAlias={alias}
|
||||
entityId={uid}
|
||||
/>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import React from "react";
|
||||
|
||||
import { ProviderType } from "@/types";
|
||||
|
||||
import { getProviderLogo } from "./get-provider-logo";
|
||||
import { SnippetId } from "./snippet-id";
|
||||
|
||||
interface EntityInfoProps {
|
||||
cloudProvider: "aws" | "azure" | "gcp" | "kubernetes";
|
||||
cloudProvider: ProviderType;
|
||||
entityAlias?: string;
|
||||
entityId?: string;
|
||||
hideCopyButton?: boolean;
|
||||
|
||||
@@ -7,8 +7,7 @@ import {
|
||||
KS8ProviderBadge,
|
||||
M365ProviderBadge,
|
||||
} from "@/components/icons/providers-badge";
|
||||
|
||||
export type ProviderType = "aws" | "azure" | "gcp" | "kubernetes" | "m365";
|
||||
import { ProviderType } from "@/types";
|
||||
|
||||
export const getProviderLogo = (provider: ProviderType) => {
|
||||
switch (provider) {
|
||||
|
||||
+4
-68
@@ -1,6 +1,8 @@
|
||||
import { LucideIcon } from "lucide-react";
|
||||
import { SVGProps } from "react";
|
||||
|
||||
import { ProviderType } from "./providers";
|
||||
|
||||
export type IconSvgProps = SVGProps<SVGSVGElement> & {
|
||||
size?: number;
|
||||
};
|
||||
@@ -45,7 +47,7 @@ export interface CollapseMenuButtonProps {
|
||||
export interface SelectScanComplianceDataProps {
|
||||
scans: (ScanProps & {
|
||||
providerInfo: {
|
||||
provider: "aws" | "azure" | "gcp" | "kubernetes";
|
||||
provider: ProviderType;
|
||||
uid: string;
|
||||
alias: string;
|
||||
};
|
||||
@@ -174,27 +176,6 @@ export interface FindingsSeverityOverview {
|
||||
};
|
||||
}
|
||||
|
||||
export interface ProviderOverviewProps {
|
||||
data: {
|
||||
type: "provider-overviews";
|
||||
id: "aws" | "gcp" | "azure" | "kubernetes";
|
||||
attributes: {
|
||||
findings: {
|
||||
pass: number;
|
||||
fail: number;
|
||||
manual: number;
|
||||
total: number;
|
||||
};
|
||||
resources: {
|
||||
total: number;
|
||||
};
|
||||
};
|
||||
}[];
|
||||
meta: {
|
||||
version: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface TaskDetails {
|
||||
attributes: {
|
||||
state: string;
|
||||
@@ -509,51 +490,6 @@ export interface UserProps {
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface ProviderProps {
|
||||
id: string;
|
||||
type: "providers";
|
||||
attributes: {
|
||||
provider: "aws" | "azure" | "m365" | "gcp" | "kubernetes";
|
||||
uid: string;
|
||||
alias: string;
|
||||
status: "completed" | "pending" | "cancelled";
|
||||
resources: number;
|
||||
connection: {
|
||||
connected: boolean;
|
||||
last_checked_at: string;
|
||||
};
|
||||
scanner_args: {
|
||||
only_logs: boolean;
|
||||
excluded_checks: string[];
|
||||
aws_retries_max_attempts: number;
|
||||
};
|
||||
inserted_at: string;
|
||||
updated_at: string;
|
||||
created_by: {
|
||||
object: string;
|
||||
id: string;
|
||||
};
|
||||
};
|
||||
relationships: {
|
||||
secret: {
|
||||
data: {
|
||||
type: string;
|
||||
id: string;
|
||||
} | null;
|
||||
};
|
||||
provider_groups: {
|
||||
meta: {
|
||||
count: number;
|
||||
};
|
||||
data: Array<{
|
||||
type: string;
|
||||
id: string;
|
||||
}>;
|
||||
};
|
||||
};
|
||||
groupNames?: string[];
|
||||
}
|
||||
|
||||
export interface ScanProps {
|
||||
type: "scans";
|
||||
id: string;
|
||||
@@ -596,7 +532,7 @@ export interface ScanProps {
|
||||
};
|
||||
};
|
||||
providerInfo?: {
|
||||
provider: "aws" | "azure" | "gcp" | "kubernetes";
|
||||
provider: ProviderType;
|
||||
uid: string;
|
||||
alias: string;
|
||||
};
|
||||
|
||||
@@ -2,3 +2,4 @@ export * from "./authFormSchema";
|
||||
export * from "./components";
|
||||
export * from "./filters";
|
||||
export * from "./formSchemas";
|
||||
export * from "./providers";
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
export type ProviderType = "aws" | "azure" | "m365" | "gcp" | "kubernetes";
|
||||
|
||||
export interface ProviderProps {
|
||||
id: string;
|
||||
type: "providers";
|
||||
attributes: {
|
||||
provider: ProviderType;
|
||||
uid: string;
|
||||
alias: string;
|
||||
status: "completed" | "pending" | "cancelled";
|
||||
resources: number;
|
||||
connection: {
|
||||
connected: boolean;
|
||||
last_checked_at: string;
|
||||
};
|
||||
scanner_args: {
|
||||
only_logs: boolean;
|
||||
excluded_checks: string[];
|
||||
aws_retries_max_attempts: number;
|
||||
};
|
||||
inserted_at: string;
|
||||
updated_at: string;
|
||||
created_by: {
|
||||
object: string;
|
||||
id: string;
|
||||
};
|
||||
};
|
||||
relationships: {
|
||||
secret: {
|
||||
data: {
|
||||
type: string;
|
||||
id: string;
|
||||
} | null;
|
||||
};
|
||||
provider_groups: {
|
||||
meta: {
|
||||
count: number;
|
||||
};
|
||||
data: Array<{
|
||||
type: string;
|
||||
id: string;
|
||||
}>;
|
||||
};
|
||||
};
|
||||
groupNames?: string[];
|
||||
}
|
||||
|
||||
export interface ProviderOverviewProps {
|
||||
data: {
|
||||
type: "provider-overviews";
|
||||
id: ProviderType;
|
||||
attributes: {
|
||||
findings: {
|
||||
pass: number;
|
||||
fail: number;
|
||||
manual: number;
|
||||
total: number;
|
||||
};
|
||||
resources: {
|
||||
total: number;
|
||||
};
|
||||
};
|
||||
}[];
|
||||
meta: {
|
||||
version: string;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user