{label}
@@ -62,8 +65,10 @@ const LabelValuePair: FC<{
const Overview: FC
= ({
onThreatListView,
+ onMitigationListView,
}) => {
const { statementList } = useThreatsContext();
+ const { mitigationList } = useMitigationsContext();
const { mitigationLinkList } = useMitigationLinksContext();
const { assumptionLinkList } = useAssumptionLinksContext();
@@ -75,7 +80,9 @@ const Overview: FC = ({
).length;
}, [statementList, mitigationLinkList, assumptionLinkList]);
- const handleLinkClicked = useLinkClicked(onThreatListView);
+ const handleThreatListLinkClicked = useThreatListLinkClicked(onThreatListView);
+
+ const handleMitigationListLinkClicked = useMitigationListLinkClicked(onMitigationListView);
const missingMitigation = useMemo(() => {
return statementList.filter(
@@ -87,6 +94,22 @@ const Overview: FC = ({
return filterThreatsByMetadata(statementList, 'Priority').length;
}, [statementList]);
+ const [completedMitigations, totalMitigations] = useMemo(() => {
+ return [
+ mitigationList.filter((m) => m.status === MITIGATION_STATUS_RESOLVED
+ || m.status === MITIGATION_STATUS_RESOLVED_WILLNOTACTION).length,
+ mitigationList.length,
+ ];
+ }, [mitigationList]);
+
+ const [completedThreats, totalThreats] = useMemo(() => {
+ return [
+ statementList.filter((st) => st.status === THREAT_STATUS_NOT_USEFUL
+ || st.status === THREAT_STATUS_RESOLVED).length,
+ statementList.length,
+ ];
+ }, [mitigationList]);
+
const countHigh = useMemo(() => {
return filterThreatsByMetadata(statementList, 'Priority', LEVEL_HIGH)
.length;
@@ -101,42 +124,56 @@ const Overview: FC = ({
}, [statementList]);
return (
-
-
+
+
High}
value={countHigh}
- onLinkFollow={handleLinkClicked({
+ onLinkFollow={handleThreatListLinkClicked({
priority: LEVEL_HIGH,
})} />
Med}
value={countMed}
- onLinkFollow={handleLinkClicked({
+ onLinkFollow={handleThreatListLinkClicked({
priority: LEVEL_MEDIUM,
})} />
Low}
value={countLow}
- onLinkFollow={handleLinkClicked({
+ onLinkFollow={handleThreatListLinkClicked({
priority: LEVEL_LOW,
})} />
+
+
);
};
diff --git a/packages/threat-composer/src/components/workspaces/WorkspaceInsights/components/STRIDEAllocation/index.tsx b/packages/threat-composer/src/components/workspaces/WorkspaceInsights/components/STRIDEAllocation/index.tsx
index ea7f32e0..d55edab1 100644
--- a/packages/threat-composer/src/components/workspaces/WorkspaceInsights/components/STRIDEAllocation/index.tsx
+++ b/packages/threat-composer/src/components/workspaces/WorkspaceInsights/components/STRIDEAllocation/index.tsx
@@ -32,7 +32,7 @@ import {
import { useThreatsContext } from '../../../../../contexts/ThreatsContext';
import filterThreatsByMetadata from '../../../../../utils/filterThreatsByMetadata';
import DashboardNumber from '../../../../generic/DashboardNumber';
-import useLinkClicked from '../../hooks/useLinkClicked';
+import useThreatListLinkClicked from '../../hooks/useThreatListLinkClicked';
import { WorkspaceInsightsProps } from '../../types';
const STRIDEAllocation: FC = ({
@@ -83,7 +83,7 @@ const STRIDEAllocation: FC = ({
[filteredStatementList],
);
- const handleLinkClicked = useLinkClicked(onThreatListView);
+ const handleLinkClicked = useThreatListLinkClicked(onThreatListView);
const barSeries: BarChartProps['series'] = [
{
@@ -187,7 +187,7 @@ const STRIDEAllocation: FC = ({
Missing STRIDE
= ({
Not using grammar
) : null}
diff --git a/packages/threat-composer/src/components/workspaces/WorkspaceInsights/components/ThreatPrioritization/index.tsx b/packages/threat-composer/src/components/workspaces/WorkspaceInsights/components/ThreatPrioritization/index.tsx
index d4b43b46..ab1550ae 100644
--- a/packages/threat-composer/src/components/workspaces/WorkspaceInsights/components/ThreatPrioritization/index.tsx
+++ b/packages/threat-composer/src/components/workspaces/WorkspaceInsights/components/ThreatPrioritization/index.tsx
@@ -36,7 +36,7 @@ import {
import { useThreatsContext } from '../../../../../contexts/ThreatsContext';
import filterThreatsByMetadata from '../../../../../utils/filterThreatsByMetadata';
import DashboardNumber from '../../../../generic/DashboardNumber';
-import useLinkClicked from '../../hooks/useLinkClicked';
+import useThreatListLinkClicked from '../../hooks/useThreatListLinkClicked';
import { WorkspaceInsightsProps } from '../../types';
const ThreatPrioritization: FC