Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 30x 30x 30x 30x 30x 62x 62x 62x 62x 62x 62x 62x 30x 30x 30x 30x 30x 30x 30x 62x 62x 30x 30x 30x 2x 62x 62x 40x 19x 19x 19x 19x 19x 19x 19x 40x 40x 2x 40x 1x 40x 37x 40x 40x 40x 40x 62x 62x 40x 40x 19x 40x 19x 19x 19x 19x 19x 19x 21x 22x 40x 40x 21x 40x 40x 40x 40x 62x 62x 40x 40x 19x 19x 40x 40x 40x 40x 40x 40x 40x 40x 40x 40x 40x 40x 40x 40x 38x 62x 62x 62x 62x 62x 62x 62x 186x 186x 186x 186x 186x 186x 182x 186x 62x 30x 30x 30x 30x 30x 30x 30x 30x 30x 30x 30x 30x 30x 30x 30x 30x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 4x 62x 62x 62x 62x 30x 30x 30x 2x 62x 62x 30x 30x 30x 30x 28x 30x 2x 30x 30x 62x 62x 62x 30x 30x 30x 30x 30x 30x 30x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 248x 248x 248x 248x 62x 186x 248x 248x 248x 248x 248x 248x 248x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 2x 60x 60x 60x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 2x 60x 60x 56x 4x 2x 2x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 62x 1x | import React, { useMemo, useState } from "react"; import { WIDGET_ICONS, WIDGET_TITLES } from "../../../constants/appConstants"; import { SECURITY_SUMMARY_TEST_IDS } from "../../../constants/testIds"; import { useCIAContentService } from "../../../hooks/useCIAContentService"; import { useComplianceService } from "../../../hooks/useComplianceService"; import { useSecurityMetricsService } from "../../../hooks/useSecurityMetricsService"; import { SecurityLevel } from "../../../types/cia"; import { StatusType } from "../../../types/common/StatusTypes"; import { calculateROIEstimate } from "../../../utils/businessValueUtils"; import { calculateTotalSecurityCost } from "../../../utils/costCalculationUtils"; import { calculateOverallSecurityLevel, getRiskLevelFromSecurityLevel, getSecurityLevelDescription, getSecurityLevelValue, } from "../../../utils/securityLevelUtils"; import { isNullish } from "../../../utils/typeGuards"; import RadarChart from "../../charts/RadarChart"; import SecurityLevelIndicator from "../../common/SecurityLevelIndicator"; import StatusBadge from "../../common/StatusBadge"; import WidgetContainer from "../../common/WidgetContainer"; /** * Props for SecuritySummaryWidget component */ export interface SecuritySummaryWidgetProps { /** * Selected availability level */ availabilityLevel: SecurityLevel; /** * Selected integrity level */ integrityLevel: SecurityLevel; /** * Selected confidentiality level */ confidentialityLevel: SecurityLevel; /** * Optional overall security level */ securityLevel?: SecurityLevel; /** * Optional CSS class name */ className?: string; /** * Optional test ID */ testId?: string; } /** * Tab options for the summary widget */ type SecuritySummaryTab = | "overview" | "business" | "implementation" | "compliance"; // Interface for business impact content interface BusinessValueContent { description?: string; riskLevel?: string; value?: string; [key: string]: any; } // Interface for compliance status interface ComplianceStatusType { status?: string; complianceScore?: number; compliantFrameworks: string[]; partiallyCompliantFrameworks: string[]; nonCompliantFrameworks?: string[]; remediationSteps?: string[]; [key: string]: any; } // Interface for implementation details interface ImplementationDetails { complexity: string; timeToImplement: string; resources: string; personnelNeeds: string; technologies?: string[]; [key: string]: any; } /** * Displays a comprehensive executive summary of security posture with key metrics * * ## Business Perspective * * This widget serves as an executive dashboard that provides a comprehensive view of * security posture, business value, implementation requirements, and compliance status. * It consolidates critical metrics from specialized widgets to support executive * decision-making and communication. 📊 */ const SecuritySummaryWidget: React.FC<SecuritySummaryWidgetProps> = ({ availabilityLevel, integrityLevel, confidentialityLevel, className = "", testId = SECURITY_SUMMARY_TEST_IDS.WIDGET, }) => { // Active tab state const [activeTab, setActiveTab] = useState<SecuritySummaryTab>("overview"); // Get services for data const { ciaContentService, error: ciaError, isLoading: ciaLoading, } = useCIAContentService(); const { securityMetricsService, error: metricsError, isLoading: metricsLoading, } = useSecurityMetricsService(); const { complianceService, error: complianceError, isLoading: complianceLoading, } = useComplianceService(); // Determine if any service is loading or has errors const isLoading = ciaLoading || metricsLoading || complianceLoading; const error = ciaError || metricsError || complianceError; // Calculate overall security level const overallSecurityLevel = useMemo( () => calculateOverallSecurityLevel( availabilityLevel, integrityLevel, confidentialityLevel ), [availabilityLevel, integrityLevel, confidentialityLevel] ); // Get security level description const securityLevelDescription = useMemo( () => getSecurityLevelDescription(overallSecurityLevel), [overallSecurityLevel] ); // Calculate security score (0-100) const securityScore = useMemo(() => { const availabilityValue = getSecurityLevelValue(availabilityLevel); const integrityValue = getSecurityLevelValue(integrityLevel); const confidentialityValue = getSecurityLevelValue(confidentialityLevel); const totalValue = availabilityValue + integrityValue + confidentialityValue; const maxPossibleValue = 12; // 3 components x maximum value of 4 return Math.round((totalValue / maxPossibleValue) * 100); }, [availabilityLevel, integrityLevel, confidentialityLevel]); // Calculate risk level based on security score const riskLevel = useMemo(() => { if (securityScore >= 80) return "Low Risk"; if (securityScore >= 60) return "Medium Risk"; if (securityScore >= 40) return "High Risk"; return "Critical Risk"; }, [securityScore]); // Get security classification const securityClassification = useMemo(() => { if (!isNullish(ciaContentService)) { try { if ( typeof (ciaContentService as any).getSecurityClassification === "function" ) { const classification = ( ciaContentService as any ).getSecurityClassification(overallSecurityLevel); if (!isNullish(classification)) return classification; } } catch (err) { console.error("Error fetching security classification:", err); } } // Fallback classification switch (overallSecurityLevel) { case "None": return "Minimal Security"; case "Low": return "Basic Security"; case "Moderate": return "Standard Security"; case "High": return "Enhanced Security"; case "Very High": return "Maximum Security"; default: return "Unknown Security Level"; } }, [ciaContentService, overallSecurityLevel]); // Get data classification const dataClassification = useMemo(() => { if ( !isNullish(ciaContentService) && typeof ciaContentService.getInformationSensitivity === "function" ) { try { const sensitivity = ciaContentService.getInformationSensitivity(confidentialityLevel); if (!isNullish(sensitivity)) return sensitivity; } catch (err) { console.error("Error fetching information sensitivity:", err); } } // Fallback classification switch (confidentialityLevel) { case "None": return "Public Data"; case "Low": return "Internal Data"; case "Moderate": return "Confidential Data"; case "High": return "Restricted Data"; case "Very High": return "Classified Data"; default: return "Unclassified Data"; } }, [ciaContentService, confidentialityLevel]); // Get implementation complexity const implementationComplexity = useMemo(() => { if ( !isNullish(ciaContentService) && typeof (ciaContentService as any).getImplementationComplexity === "function" ) { try { const complexity = ( ciaContentService as any ).getImplementationComplexity( availabilityLevel, integrityLevel, confidentialityLevel ); if (!isNullish(complexity)) return complexity; } catch (err) { console.error("Error fetching implementation complexity:", err); } } // Fallback calculation const levelValues: Record<SecurityLevel, number> = { None: 0, Low: 1, Moderate: 2, High: 3, "Very High": 4, }; const availabilityValue = levelValues[availabilityLevel] || 0; const integrityValue = levelValues[integrityLevel] || 0; const confidentialityValue = levelValues[confidentialityLevel] || 0; const totalValue = availabilityValue + integrityValue + confidentialityValue; if (totalValue <= 3) return "Low"; if (totalValue <= 6) return "Moderate"; if (totalValue <= 9) return "High"; return "Very High"; }, [ ciaContentService, availabilityLevel, integrityLevel, confidentialityLevel, ]); // Helper function for status badge variant const getStatusVariant = (level: string): StatusType => { const normalizedLevel = level.toLowerCase(); if (normalizedLevel === "none") return "error"; if (normalizedLevel === "low") return "warning"; if (normalizedLevel === "moderate") return "info"; if (normalizedLevel === "high") return "success"; if (normalizedLevel === "very high") return "purple"; return "neutral"; }; // Get compliance status const complianceStatus = useMemo((): ComplianceStatusType | null => { try { if (isNullish(complianceService)) return null; const status = complianceService.getComplianceStatus?.( availabilityLevel, integrityLevel, confidentialityLevel ); // Ensure we have proper arrays if (status) { return { ...status, compliantFrameworks: status.compliantFrameworks || [], partiallyCompliantFrameworks: status.partiallyCompliantFrameworks || [], nonCompliantFrameworks: status.nonCompliantFrameworks || [], }; } return null; } catch (err) { console.error("Error fetching compliance status:", err); return null; } }, [ complianceService, availabilityLevel, integrityLevel, confidentialityLevel, ]); // Get appropriate risk color class const getRiskColorClass = (risk: string): string => { if (risk.includes("Low")) return "text-green-600 dark:text-green-400"; if (risk.includes("Medium")) return "text-yellow-600 dark:text-yellow-400"; if (risk.includes("High")) return "text-orange-600 dark:text-orange-400"; if (risk.includes("Critical")) return "text-red-600 dark:text-red-400"; return "text-gray-600 dark:text-gray-400"; }; // Get implementation time const getImplementationTime = (): string => { try { if ( !isNullish(ciaContentService) && typeof (ciaContentService as any).getImplementationTime === "function" ) { const time = (ciaContentService as any).getImplementationTime( availabilityLevel, integrityLevel, confidentialityLevel ); if (!isNullish(time)) return time; } } catch (err) { console.error("Error fetching implementation time:", err); } // Fallback based on security score if (securityScore >= 80) return "3-6 months"; if (securityScore >= 60) return "2-4 months"; if (securityScore >= 40) return "1-2 months"; return "2-4 weeks"; }; // Get resource requirements const getRequiredResources = (): string => { try { if ( !isNullish(ciaContentService) && typeof (ciaContentService as any).getRequiredResources === "function" ) { const resources = (ciaContentService as any).getRequiredResources( availabilityLevel, integrityLevel, confidentialityLevel ); if (!isNullish(resources)) return resources; } } catch (err) { console.error("Error fetching resource requirements:", err); } // Fallback based on security score if (securityScore >= 80) return "Specialized Team"; if (securityScore >= 60) return "Dedicated Team"; if (securityScore >= 40) return "Small Team"; return "Individual Effort"; }; // Calculate business maturity level based on security score const businessMaturityLevel = useMemo(() => { if (securityScore >= 80) return "Strategic"; if (securityScore >= 60) return "Advanced"; if (securityScore >= 40) return "Standard"; return "Basic"; }, [securityScore]); // Get business maturity description const getBusinessMaturityDescription = useMemo(() => { switch (businessMaturityLevel) { case "Strategic": return "Enables competitive advantage and innovation"; case "Advanced": return "Supports business growth and trusted partnerships"; case "Standard": return "Maintains core business operations securely"; case "Basic": return "Enables fundamental business activities"; default: return "Unknown business maturity level"; } }, [businessMaturityLevel]); // Get ROI estimate based on security score const getROIEstimate = (): string => { try { // Use the centralized utility function for consistent ROI calculation const roiEstimate = calculateROIEstimate( availabilityLevel, integrityLevel, confidentialityLevel ); return roiEstimate.value ?? "N/A"; // Add nullish coalescing operator to handle undefined } catch (err) { console.error("Error calculating ROI estimate:", err); return "N/A"; } }; // Get cost details using standardized cost calculation utility const costDetails = useMemo(() => { // Use the standard cost calculation with consistent defaults return calculateTotalSecurityCost( availabilityLevel, integrityLevel, confidentialityLevel, "medium", // Ensure consistent org size "general" // Ensure consistent industry ); }, [availabilityLevel, integrityLevel, confidentialityLevel]); const { totalCapex, totalOpex } = calculateTotalSecurityCost( availabilityLevel, integrityLevel, confidentialityLevel, "medium", // Ensure consistent org size "general" // Ensure consistent industry ); const implementationCost = totalCapex; return ( <WidgetContainer title={WIDGET_TITLES.SECURITY_SUMMARY} icon={WIDGET_ICONS.SECURITY_SUMMARY} className={className} testId={testId} isLoading={isLoading} error={error} > <div className="p-4"> {/* Security Classification Banner */} <div className="mb-4 p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg border-l-4 border-blue-500 dark:border-blue-400 shadow-sm"> <div className="flex justify-between items-center"> <div> <h2 className="text-lg font-semibold flex items-center gap-2"> <span className="inline-block w-3 h-3 rounded-full bg-blue-500 dark:bg-blue-400 pulse-dot"></span> {securityClassification} </h2> <p className="text-sm text-gray-600 dark:text-gray-300"> {securityLevelDescription} </p> </div> <div className="text-right"> <div className="text-xs text-gray-500 dark:text-gray-400"> Security Score </div> <div className="font-bold text-xl text-blue-600 dark:text-blue-400"> {securityScore}% </div> <div className={`text-sm font-medium ${getRiskColorClass( riskLevel )}`} data-testid={`${testId}-risk-level`} > {riskLevel} </div> </div> </div> </div> {/* Tab Navigation */} <div className="border-b border-gray-200 dark:border-gray-700 mb-4"> <nav className="flex flex-wrap -mb-px gap-2" aria-label="Security Summary Tabs" > {[ { id: "overview", label: "Overview" }, { id: "business", label: "Business Value" }, { id: "implementation", label: "Implementation" }, { id: "compliance", label: "Compliance" }, ].map((tab) => ( <button key={tab.id} className={`py-2 px-4 text-sm font-medium border-b-2 transition-colors duration-200 ${ activeTab === tab.id ? "border-blue-500 text-blue-600 dark:text-blue-400 dark:border-blue-400" : "border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 hover:border-gray-300" }`} onClick={() => setActiveTab(tab.id as SecuritySummaryTab)} data-testid={`${testId}-tab-${tab.id}`} aria-selected={activeTab === tab.id} role="tab" > {tab.label} </button> ))} </nav> </div> {/* Tab Content */} <div className="tab-content"> {/* Overview Tab - Simplified and focused on key metrics */} {activeTab === "overview" && ( <div data-testid={`${testId}-content-overview`} className="space-y-4" > {/* Security Radar Chart */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Security Profile </h3> <div className="h-[300px]"> <RadarChart availabilityLevel={availabilityLevel} integrityLevel={integrityLevel} confidentialityLevel={confidentialityLevel} testId={`${testId}-radar-chart`} /> </div> </div> {/* Security Level Summary */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Security Components </h3> <div className="grid grid-cols-1 sm:grid-cols-3 gap-4"> {/* Confidentiality Card */} <div className="p-3 bg-purple-50 dark:bg-purple-900 dark:bg-opacity-20 rounded-lg border border-purple-100 dark:border-purple-800" data-testid={SECURITY_SUMMARY_TEST_IDS.CONFIDENTIALITY_CARD} > <div className="flex items-center mb-2"> <span className="text-xl mr-2 text-purple-500 dark:text-purple-400"> 🔒 </span> <h4 className="font-medium text-purple-700 dark:text-purple-300"> Confidentiality </h4> </div> <div className="flex items-center justify-between mb-1"> <SecurityLevelIndicator level={confidentialityLevel} /> <StatusBadge status={getStatusVariant( getRiskLevelFromSecurityLevel(confidentialityLevel) )} size="sm" > {getRiskLevelFromSecurityLevel(confidentialityLevel)} </StatusBadge> </div> <div className="mt-2 text-xs text-gray-600 dark:text-gray-400"> Classification:{" "} <span className="font-medium">{dataClassification}</span> </div> </div> {/* Integrity Card */} <div className="p-3 bg-green-50 dark:bg-green-900 dark:bg-opacity-20 rounded-lg border border-green-100 dark:border-green-800" data-testid={SECURITY_SUMMARY_TEST_IDS.INTEGRITY_CARD} > <div className="flex items-center mb-2"> <span className="text-xl mr-2 text-green-500 dark:text-green-400"> ✓ </span> <h4 className="font-medium text-green-700 dark:text-green-300"> Integrity </h4> </div> <div className="flex items-center justify-between mb-1"> <SecurityLevelIndicator level={integrityLevel} /> <StatusBadge status={getStatusVariant( getRiskLevelFromSecurityLevel(integrityLevel) )} size="sm" > {getRiskLevelFromSecurityLevel(integrityLevel)} </StatusBadge> </div> <div className="mt-2 text-xs text-gray-600 dark:text-gray-400"> Validation Level:{" "} <span className="font-medium"> {integrityLevel === "None" ? "Unverified" : integrityLevel === "Low" ? "Basic Validation" : integrityLevel === "Moderate" ? "Validated" : integrityLevel === "High" ? "Strongly Validated" : "Formally Verified"} </span> </div> </div> {/* Availability Card */} <div className="p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg border border-blue-100 dark:border-blue-800" data-testid={SECURITY_SUMMARY_TEST_IDS.AVAILABILITY_CARD} > <div className="flex items-center mb-2"> <span className="text-xl mr-2 text-blue-500 dark:text-blue-400"> ⏱️ </span> <h4 className="font-medium text-blue-700 dark:text-blue-300"> Availability </h4> </div> <div className="flex items-center justify-between mb-1"> <SecurityLevelIndicator level={availabilityLevel} /> <StatusBadge status={getStatusVariant( getRiskLevelFromSecurityLevel(availabilityLevel) )} size="sm" > {getRiskLevelFromSecurityLevel(availabilityLevel)} </StatusBadge> </div> <div className="mt-2 text-xs text-gray-600 dark:text-gray-400"> Uptime Target:{" "} <span className="font-medium"> {availabilityLevel === "None" ? "No guarantee" : availabilityLevel === "Low" ? "95%" : availabilityLevel === "Moderate" ? "99%" : availabilityLevel === "High" ? "99.9%" : "99.999%"} </span> </div> </div> </div> </div> {/* Key Metrics Dashboard */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Key Security Metrics </h3> <div className="grid grid-cols-1 sm:grid-cols-3 gap-4"> <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg"> <div className="text-sm font-medium mb-1"> Implementation Complexity </div> <div className="text-lg font-bold"> {implementationComplexity} </div> <div className="text-xs text-gray-600 dark:text-gray-400"> Based on combined security levels </div> </div> <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg"> <div className="text-sm font-medium mb-1"> Business Maturity </div> <div className="text-lg font-bold"> {businessMaturityLevel} </div> <div className="text-xs text-gray-600 dark:text-gray-400"> {getBusinessMaturityDescription} </div> </div> <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg"> <div className="text-sm font-medium mb-1"> Compliance Status </div> <div className="text-lg font-bold"> {complianceStatus?.complianceScore || securityScore}% </div> <div className="text-xs text-gray-600 dark:text-gray-400"> Overall compliance alignment </div> </div> </div> </div> </div> )} {/* Business Value Tab */} {activeTab === "business" && ( <div data-testid={`${testId}-content-business`} className="space-y-4" > {/* Business Value content */} <div className="p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg mb-4"> <p className="text-sm"> This section summarizes the business value and financial impact of your selected security levels, helping justify security investments to stakeholders. </p> </div> {/* Business Impact Summary */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Business Value Summary </h3> <div className="grid grid-cols-1 md:grid-cols-2 gap-4"> {/* Business Maturity */} <div className="p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg"> <h4 className="font-medium text-blue-700 dark:text-blue-300"> Business Maturity Level </h4> <div className="text-xl font-bold text-blue-600 dark:text-blue-400 mt-2"> {businessMaturityLevel} </div> <p className="text-sm text-blue-600 dark:text-blue-400 mt-1"> {getBusinessMaturityDescription} </p> </div> {/* ROI Estimation */} <div className="p-3 bg-green-50 dark:bg-green-900 dark:bg-opacity-20 rounded-lg"> <h4 className="font-medium text-green-700 dark:text-green-300"> Estimated ROI </h4> <div className="text-xl font-bold text-green-600 dark:text-green-400 mt-2"> {getROIEstimate()} </div> <p className="text-sm text-green-600 dark:text-green-400 mt-1"> {securityScore >= 80 ? "Strong return from security investments" : securityScore >= 60 ? "Good return from security investments" : securityScore >= 40 ? "Basic return, primarily risk avoidance" : "Minimal return on investment"} </p> </div> </div> </div> {/* Cost Summary */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Cost Summary </h3> <div className="grid grid-cols-1 md:grid-cols-3 gap-4"> {/* Implementation Cost */} <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg"> <div className="text-sm font-medium mb-1"> Implementation Cost </div> <div className="text-xl font-bold text-blue-600 dark:text-blue-400"> {costDetails.totalCapex} </div> <div className="text-xs text-gray-600 dark:text-gray-400"> One-time investment </div> </div> {/* Operational Cost */} <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg"> <div className="text-sm font-medium mb-1"> Operational Cost </div> <div className="text-xl font-bold text-green-600 dark:text-green-400"> {costDetails.totalOpex} </div> <div className="text-xs text-gray-600 dark:text-gray-400"> Annual expense </div> </div> {/* Total Cost */} <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg"> <div className="text-sm font-medium mb-1"> Total First-Year Cost </div> <div className="text-xl font-bold text-purple-600 dark:text-purple-400"> {costDetails.totalCost} </div> <div className="text-xs text-gray-600 dark:text-gray-400"> Combined implementation and operational costs </div> </div> </div> </div> {/* Business Enablement */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Business Enablement </h3> <div className="space-y-3"> <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg"> <h4 className="text-sm font-medium mb-2"> Business Capabilities </h4> <ul className="list-disc pl-5 space-y-1 text-sm"> {securityScore >= 80 ? ( <> <li>Enables digital transformation initiatives</li> <li>Supports secure cloud adoption</li> <li>Facilitates secure partner integrations</li> <li> Provides competitive advantage through security as a value </li> </> ) : securityScore >= 60 ? ( <> <li>Supports most digital business initiatives</li> <li>Enables secure customer data handling</li> <li>Allows controlled partner access</li> <li>Meets most customer security requirements</li> </> ) : securityScore >= 40 ? ( <> <li>Supports basic business operations</li> <li>Enables limited partner interactions</li> <li>Meets minimum customer expectations</li> </> ) : ( <> <li>Limited security capabilities</li> <li>May restrict business opportunities</li> <li>Potential compliance limitations</li> </> )} </ul> </div> </div> </div> </div> )} {/* Implementation Tab */} {activeTab === "implementation" && ( <div data-testid={`${testId}-content-implementation`} className="space-y-4" > {/* Implementation introduction */} <div className="p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg mb-4"> <p className="text-sm"> This section summarizes implementation requirements for your selected security levels, helping plan resources, timelines, and technical approaches. </p> </div> {/* Implementation Overview */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Implementation Overview </h3> <div className="mb-4"> <div className="flex items-center justify-between mb-2"> <div className="text-md font-medium"> Implementation Complexity: </div> <div className="font-medium"> {implementationComplexity} </div> </div> <div className="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2.5"> <div className={`h-2.5 rounded-full ${ implementationComplexity === "Low" ? "w-1/4 bg-green-500" : implementationComplexity === "Moderate" ? "w-2/4 bg-yellow-500" : implementationComplexity === "High" ? "w-3/4 bg-orange-500" : "w-full bg-red-500" }`} ></div> </div> <p className="text-sm text-gray-600 dark:text-gray-400 mt-2"> {implementationComplexity === "Low" ? "Basic security controls with straightforward implementation" : implementationComplexity === "Moderate" ? "Standard security measures with moderate implementation effort" : implementationComplexity === "High" ? "Advanced security controls requiring significant implementation effort" : "Comprehensive security framework requiring extensive resources"} </p> </div> <div className="grid grid-cols-1 md:grid-cols-2 gap-4"> {/* Implementation Timeline */} <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg"> <div className="text-sm font-medium mb-1"> Estimated Implementation Time </div> <div className="text-lg font-bold"> {getImplementationTime()} </div> <div className="text-xs text-gray-600 dark:text-gray-400"> Typical project timeline </div> </div> {/* Required Resources */} <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg"> <div className="text-sm font-medium mb-1"> Required Resources </div> <div className="text-lg font-bold"> {getRequiredResources()} </div> <div className="text-xs text-gray-600 dark:text-gray-400"> Resource allocation recommendation </div> </div> </div> </div> {/* Component Implementation Summary */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Component Implementation Summary </h3> <div className="grid grid-cols-1 md:grid-cols-3 gap-4"> {/* Confidentiality Implementation */} <div className="p-3 bg-purple-50 dark:bg-purple-900 dark:bg-opacity-20 rounded-lg border border-purple-100 dark:border-purple-800"> <h4 className="font-medium text-purple-700 dark:text-purple-300 mb-2"> Confidentiality Implementation </h4> <p className="text-sm text-gray-600 dark:text-gray-400"> {confidentialityLevel === "None" ? "No data protection controls needed" : confidentialityLevel === "Low" ? "Basic access controls and authentication" : confidentialityLevel === "Moderate" ? "Role-based access and encryption for sensitive data" : confidentialityLevel === "High" ? "Comprehensive encryption and access controls" : "Maximum protection with advanced encryption and zero-trust"} </p> <div className="mt-2 text-xs font-medium text-purple-700 dark:text-purple-300"> Level: {confidentialityLevel} </div> </div> {/* Integrity Implementation */} <div className="p-3 bg-green-50 dark:bg-green-900 dark:bg-opacity-20 rounded-lg border border-green-100 dark:border-green-800"> <h4 className="font-medium text-green-700 dark:text-green-300 mb-2"> Integrity Implementation </h4> <p className="text-sm text-gray-600 dark:text-gray-400"> {integrityLevel === "None" ? "No data validation controls needed" : integrityLevel === "Low" ? "Basic input validation and error checking" : integrityLevel === "Moderate" ? "Data validation and cryptographic checksums" : integrityLevel === "High" ? "Digital signatures and strong validation" : "Formal verification and immutable audit trails"} </p> <div className="mt-2 text-xs font-medium text-green-700 dark:text-green-300"> Level: {integrityLevel} </div> </div> {/* Availability Implementation */} <div className="p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg border border-blue-100 dark:border-blue-800"> <h4 className="font-medium text-blue-700 dark:text-blue-300 mb-2"> Availability Implementation </h4> <p className="text-sm text-gray-600 dark:text-gray-400"> {availabilityLevel === "None" ? "No uptime guarantees or redundancy" : availabilityLevel === "Low" ? "Basic backup and recovery procedures" : availabilityLevel === "Moderate" ? "Redundant components and standard backups" : availabilityLevel === "High" ? "High availability clustering and failover" : "Multi-site redundancy and continuous availability"} </p> <div className="mt-2 text-xs font-medium text-blue-700 dark:text-blue-300"> Level: {availabilityLevel} </div> </div> </div> </div> {/* Implementation Considerations */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Implementation Considerations </h3> <div className="grid grid-cols-1 sm:grid-cols-2 gap-4"> <div className="p-3 bg-yellow-50 dark:bg-yellow-900 dark:bg-opacity-20 rounded-lg"> <h4 className="font-medium text-yellow-700 dark:text-yellow-300"> Success Factors </h4> <ul className="mt-2 space-y-1 list-disc list-inside text-sm"> <li>Executive sponsorship and support</li> <li>Clear security requirements definition</li> <li>Adequate resource allocation</li> <li>Proper testing and validation</li> <li>Staff training and awareness</li> </ul> </div> <div className="p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg"> <h4 className="font-medium text-blue-700 dark:text-blue-300"> Key Challenges </h4> <ul className="mt-2 space-y-1 list-disc list-inside text-sm"> <li>Balancing security with usability</li> <li>Integration with existing systems</li> <li>Managing scope and expectations</li> <li>Maintaining consistent controls</li> <li>Securing necessary expertise</li> </ul> </div> </div> </div> </div> )} {/* Compliance Tab */} {activeTab === "compliance" && ( <div data-testid={`${testId}-content-compliance`} className="space-y-4" > {/* Compliance introduction */} <div className="p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg mb-4"> <p className="text-sm"> This section summarizes your compliance status based on selected security levels, highlighting alignment with regulatory frameworks and standards. </p> </div> {/* Compliance Status */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Compliance Status Overview </h3> {!complianceStatus ? ( <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg"> <div className="flex justify-between items-center mb-2"> <span className="font-medium">Compliance Score</span> <span className="text-xl font-bold"> {securityScore}% </span> </div> <div className="w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2.5 mb-2"> <div className={`h-2.5 rounded-full ${ securityScore >= 80 ? "bg-green-500" : securityScore >= 50 ? "bg-yellow-500" : "bg-red-500" }`} style={{ width: `${securityScore}%` }} ></div> </div> <p className="text-sm text-gray-600 dark:text-gray-400"> {securityScore >= 80 ? "Strong compliance position" : securityScore >= 50 ? "Moderate compliance position" : "Compliance gaps detected"} </p> </div> ) : ( <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg"> <div className="flex justify-between items-center mb-2"> <span className="font-medium">Compliance Score</span> <span className="text-xl font-bold"> {complianceStatus.complianceScore}% </span> </div> <div className="w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2.5 mb-2"> <div className={`h-2.5 rounded-full ${ (complianceStatus.complianceScore || 0) >= 80 ? "bg-green-500" : (complianceStatus.complianceScore || 0) >= 50 ? "bg-yellow-500" : "bg-red-500" }`} style={{ width: `${complianceStatus.complianceScore || 0}%`, }} ></div> </div> <p className="text-sm text-gray-600 dark:text-gray-400"> {complianceStatus.status || ((complianceStatus.complianceScore || 0) >= 80 ? "Strong compliance position" : (complianceStatus.complianceScore || 0) >= 50 ? "Moderate compliance position" : "Compliance gaps detected")} </p> </div> )} </div> {/* Framework Status */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Framework Compliance Status </h3> {!complianceStatus ? ( <p className="text-sm text-gray-600 dark:text-gray-400 italic"> Detailed compliance information is not available. </p> ) : ( <div className="grid grid-cols-1 md:grid-cols-2 gap-4"> <div className="p-3 bg-green-50 dark:bg-green-900 dark:bg-opacity-20 rounded-lg"> <h4 className="font-medium text-green-700 dark:text-green-300 flex items-center justify-between"> <span>Compliant</span> <span className="text-sm bg-green-100 dark:bg-green-800 px-2 py-0.5 rounded-full"> {complianceStatus.compliantFrameworks.length} </span> </h4> {complianceStatus.compliantFrameworks.length > 0 ? ( <ul className="mt-2 space-y-1 list-disc list-inside text-sm text-gray-600 dark:text-gray-400"> {complianceStatus.compliantFrameworks.map( (framework, idx) => ( <li key={`compliant-${idx}`}>{framework}</li> ) )} </ul> ) : ( <p className="mt-2 text-sm text-gray-600 dark:text-gray-400 italic"> No fully compliant frameworks </p> )} </div> <div className="p-3 bg-yellow-50 dark:bg-yellow-900 dark:bg-opacity-20 rounded-lg"> <h4 className="font-medium text-yellow-700 dark:text-yellow-300 flex items-center justify-between"> <span>Partially Compliant</span> <span className="text-sm bg-yellow-100 dark:bg-yellow-800 px-2 py-0.5 rounded-full"> {complianceStatus.partiallyCompliantFrameworks.length} </span> </h4> {complianceStatus.partiallyCompliantFrameworks.length > 0 ? ( <ul className="mt-2 space-y-1 list-disc list-inside text-sm text-gray-600 dark:text-gray-400"> {complianceStatus.partiallyCompliantFrameworks.map( (framework, idx) => ( <li key={`partial-${idx}`}>{framework}</li> ) )} </ul> ) : ( <p className="mt-2 text-sm text-gray-600 dark:text-gray-400 italic"> No partially compliant frameworks </p> )} </div> </div> )} </div> {/* Component Requirements */} <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700"> <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100"> Component Compliance Requirements </h3> <div className="grid grid-cols-1 md:grid-cols-3 gap-4"> {/* Confidentiality compliance */} <div className="p-3 bg-purple-50 dark:bg-purple-900 dark:bg-opacity-20 rounded"> <h5 className="text-sm font-medium mb-1 text-purple-700 dark:text-purple-300"> Confidentiality </h5> <p className="text-xs"> <span className="font-medium">Level:</span>{" "} {confidentialityLevel} </p> <p className="text-xs text-gray-600 dark:text-gray-400 mt-1"> {confidentialityLevel === "None" ? "Not sufficient for most compliance frameworks" : confidentialityLevel === "Low" ? "Meets basic compliance requirements" : confidentialityLevel === "Moderate" ? "Satisfies most regulatory requirements" : confidentialityLevel === "High" ? "Meets stringent compliance standards" : "Exceeds most compliance requirements"} </p> </div> {/* Integrity compliance */} <div className="p-3 bg-green-50 dark:bg-green-900 dark:bg-opacity-20 rounded"> <h5 className="text-sm font-medium mb-1 text-green-700 dark:text-green-300"> Integrity </h5> <p className="text-xs"> <span className="font-medium">Level:</span>{" "} {integrityLevel} </p> <p className="text-xs text-gray-600 dark:text-gray-400 mt-1"> {integrityLevel === "None" ? "Not sufficient for most compliance frameworks" : integrityLevel === "Low" ? "Meets basic compliance requirements" : integrityLevel === "Moderate" ? "Satisfies most regulatory requirements" : integrityLevel === "High" ? "Meets stringent compliance standards" : "Exceeds most compliance requirements"} </p> </div> {/* Availability compliance */} <div className="p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded"> <h5 className="text-sm font-medium mb-1 text-blue-700 dark:text-blue-300"> Availability </h5> <p className="text-xs"> <span className="font-medium">Level:</span>{" "} {availabilityLevel} </p> <p className="text-xs text-gray-600 dark:text-gray-400 mt-1"> {availabilityLevel === "None" ? "Not sufficient for most compliance frameworks" : availabilityLevel === "Low" ? "Meets basic compliance requirements" : availabilityLevel === "Moderate" ? "Satisfies most regulatory requirements" : availabilityLevel === "High" ? "Meets stringent compliance standards" : "Exceeds most compliance requirements"} </p> </div> </div> </div> </div> )} </div> </div> </WidgetContainer> ); }; export default SecuritySummaryWidget; |