diff --git a/apps/console/src/pages/organizations/vendors/VendorView.tsx b/apps/console/src/pages/organizations/vendors/VendorView.tsx index 19f159d81..3b404f791 100644 --- a/apps/console/src/pages/organizations/vendors/VendorView.tsx +++ b/apps/console/src/pages/organizations/vendors/VendorView.tsx @@ -20,6 +20,7 @@ import type { VendorViewDeleteComplianceReportMutation as DeleteComplianceReport import type { VendorViewUploadComplianceReportMutation as UploadComplianceReportMutationType } from "./__generated__/VendorViewUploadComplianceReportMutation.graphql"; import type { VendorViewUpdateVendorMutation } from "./__generated__/VendorViewUpdateVendorMutation.graphql"; import type { VendorViewCreateRiskAssessmentMutation } from "./__generated__/VendorViewCreateRiskAssessmentMutation.graphql"; +import type { BusinessImpact, DataSensitivity } from "./__generated__/VendorViewCreateRiskAssessmentMutation.graphql"; import { useParams } from "react-router"; import { cn } from "@/lib/utils"; import { PageTemplate } from "@/components/PageTemplate"; @@ -818,6 +819,160 @@ function RiskAssessmentsTable({ ); } +function RiskAssessmentModal({ + isOpen, + onClose, + onSubmit, + businessOwnerId, +}: { + isOpen: boolean; + onClose: () => void; + onSubmit: (data: { + dataSensitivity: DataSensitivity; + businessImpact: BusinessImpact; + notes: string; + }) => void; + businessOwnerId: string | null; +}) { + const [dataSensitivity, setDataSensitivity] = useState("LOW"); + const [businessImpact, setBusinessImpact] = useState("LOW"); + const [notes, setNotes] = useState(""); + const [showError, setShowError] = useState(false); + + if (!isOpen) return null; + + const handleSubmit = () => { + if (!businessOwnerId) { + setShowError(true); + return; + } + + onSubmit({ + dataSensitivity, + businessImpact, + notes, + }); + }; + + // Data sensitivity descriptions from vendor_risk_assessment.go + const dataSensitivityOptions = [ + { value: "NONE", label: "None", description: "No sensitive data" }, + { value: "LOW", label: "Low", description: "Public or non-sensitive data" }, + { value: "MEDIUM", label: "Medium", description: "Internal/restricted data" }, + { value: "HIGH", label: "High", description: "Confidential data" }, + { value: "CRITICAL", label: "Critical", description: "Regulated/PII/financial data" }, + ]; + + // Business impact descriptions from vendor_risk_assessment.go + const businessImpactOptions = [ + { value: "LOW", label: "Low", description: "Minimal impact on business" }, + { value: "MEDIUM", label: "Medium", description: "Moderate impact on business" }, + { value: "HIGH", label: "High", description: "Significant business impact" }, + { value: "CRITICAL", label: "Critical", description: "Critical to business operations" }, + ]; + + return ( +
+
+

Create Risk Assessment

+ + {showError && !businessOwnerId && ( +
+

Business Owner Required

+

Please assign a Business Owner to this vendor before creating a risk assessment.

+
+ )} + +
+
+ + +
+

+ {dataSensitivityOptions.find(o => o.value === dataSensitivity)?.label}: +

+

+ {dataSensitivityOptions.find(o => o.value === dataSensitivity)?.description} +

+

+ Select the level of sensitivity for the data this vendor processes or stores. +

+
+
+ +
+ + +
+

+ {businessImpactOptions.find(o => o.value === businessImpact)?.label}: +

+

+ {businessImpactOptions.find(o => o.value === businessImpact)?.description} +

+

+ Select the impact on your business if this vendor experiences an outage or data breach. +

+
+
+ +
+ +