Skip to content

Commit

Permalink
chore: Update the status as per PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jessieweiyi committed Aug 29, 2024
1 parent 9fc987d commit bebc2cb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
MITIGATION_STATUS_IDENTIFIED,
MITIGATION_STATUS_IN_PROGRESS,
MITIGATION_STATUS_RESOLVED,
MITIGATION_STATUS_RESOLVED_ABANDONED,
MITIGATION_STATUS_RESOLVED_WILLNOTACTION,
STATUS_NOT_SET,
} from '../../../../../configs';
import { useMitigationsContext } from '../../../../../contexts/MitigationsContext';
Expand Down Expand Up @@ -66,8 +66,8 @@ const MitigationStatus: FC<WorkspaceInsightsProps> = ({
[mitigationList],
);

const countAbandoned = useMemo(
() => mitigationList.filter(x => x.status === MITIGATION_STATUS_RESOLVED_ABANDONED).length,
const countWillNotAction = useMemo(
() => mitigationList.filter(x => x.status === MITIGATION_STATUS_RESOLVED_WILLNOTACTION).length,
[mitigationList],
);

Expand Down Expand Up @@ -100,8 +100,8 @@ const MitigationStatus: FC<WorkspaceInsightsProps> = ({
color: colorChartsStatusPositive,
},
{
title: mitigationStatus.find(x => x.value === MITIGATION_STATUS_RESOLVED_ABANDONED)?.label || 'Abandoned',
value: countAbandoned,
title: mitigationStatus.find(x => x.value === MITIGATION_STATUS_RESOLVED_WILLNOTACTION)?.label || 'Will not action',
value: countWillNotAction,
color: colorChartsStatusLow,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import ColumnLayout from '@cloudscape-design/components/column-layout';
import { LinkProps } from '@cloudscape-design/components/link';
import { css } from '@emotion/react';
import { useMemo, FC, ReactNode } from 'react';
import { LEVEL_HIGH, LEVEL_LOW, LEVEL_MEDIUM, LEVEL_NOT_SET, MITIGATION_STATUS_IDENTIFIED, MITIGATION_STATUS_IN_PROGRESS, MITIGATION_STATUS_RESOLVED, MITIGATION_STATUS_RESOLVED_ABANDONED, STATUS_NOT_SET, THREAT_STATUS_IDENTIFIED, THREAT_STATUS_NOT_USEFUL, THREAT_STATUS_RESOLVED } from '../../../../../configs';
import { LEVEL_HIGH, LEVEL_LOW, LEVEL_MEDIUM, LEVEL_NOT_SET, MITIGATION_STATUS_IDENTIFIED, MITIGATION_STATUS_IN_PROGRESS, MITIGATION_STATUS_RESOLVED, MITIGATION_STATUS_RESOLVED_WILLNOTACTION, STATUS_NOT_SET, THREAT_STATUS_IDENTIFIED, THREAT_STATUS_NOT_USEFUL, THREAT_STATUS_RESOLVED } from '../../../../../configs';
import { useAssumptionLinksContext, useMitigationsContext } from '../../../../../contexts';
import { useMitigationLinksContext } from '../../../../../contexts/MitigationLinksContext';
import { useThreatsContext } from '../../../../../contexts/ThreatsContext';
Expand Down Expand Up @@ -97,7 +97,7 @@ const Overview: FC<WorkspaceInsightsProps> = ({
const [completedMitigations, totalMitigations] = useMemo(() => {
return [
mitigationList.filter((m) => m.status === MITIGATION_STATUS_RESOLVED
|| m.status === MITIGATION_STATUS_RESOLVED_ABANDONED).length,
|| m.status === MITIGATION_STATUS_RESOLVED_WILLNOTACTION).length,
mitigationList.length,
];
}, [mitigationList]);
Expand Down
4 changes: 2 additions & 2 deletions packages/threat-composer/src/configs/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const DEFAULT_THREAT_STATUS = THREAT_STATUS_IDENTIFIED;
export const MITIGATION_STATUS_IDENTIFIED = 'mitigationIdentified';
export const MITIGATION_STATUS_IN_PROGRESS = 'mitigationInProgress';
export const MITIGATION_STATUS_RESOLVED = 'mitigationResolved';
export const MITIGATION_STATUS_RESOLVED_ABANDONED = 'mitigationResolvedAbandoned';
export const MITIGATION_STATUS_RESOLVED_WILLNOTACTION = 'mitigationResolvedWillNotAction';
export const DEFAULT_MITIGATION_STATUS = MITIGATION_STATUS_IDENTIFIED;

export const STATUS_NOT_SET = 'NoSet';
Expand All @@ -30,7 +30,7 @@ export const MITIGATION_STATUS_COLOR_MAPPING: any = {
mitigationIdentified: 'grey',
mitigationInProgress: 'blue',
mitigationResolved: 'green',
mitigationResolvedAbandoned: 'red',
mitigationResolvedWillNotAction: 'red',
NotSet: 'grey',
};

Expand Down
4 changes: 2 additions & 2 deletions packages/threat-composer/src/customTypes/mitigations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
******************************************************************************************************************** */
import { z } from 'zod';
import { ContentEntityBaseSchema, EntityLinkBaseSchema, StatusSchema } from './entities';
import { MITIGATION_STATUS_IDENTIFIED, MITIGATION_STATUS_IN_PROGRESS, MITIGATION_STATUS_RESOLVED, MITIGATION_STATUS_RESOLVED_ABANDONED, STATUS_NOT_SET } from '../configs';
import { MITIGATION_STATUS_IDENTIFIED, MITIGATION_STATUS_IN_PROGRESS, MITIGATION_STATUS_RESOLVED, MITIGATION_STATUS_RESOLVED_WILLNOTACTION, STATUS_NOT_SET } from '../configs';
import mitigationStatus from '../data/status/mitigationStatus.json';

export const MitigationSchema = ContentEntityBaseSchema.extend({
Expand Down Expand Up @@ -43,6 +43,6 @@ export interface MitigationListFilter {
status?: (typeof MITIGATION_STATUS_IDENTIFIED
| typeof MITIGATION_STATUS_IN_PROGRESS
| typeof MITIGATION_STATUS_RESOLVED
| typeof MITIGATION_STATUS_RESOLVED_ABANDONED
| typeof MITIGATION_STATUS_RESOLVED_WILLNOTACTION
| typeof STATUS_NOT_SET)[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"iconName": "status-positive"
},
{
"label": "Abandoned",
"value": "mitigationResolvedAbandoned",
"label": "Will not action",
"value": "mitigationResolvedWillNotAction",
"description": "Will not be implementing this mitigation",
"iconName": "flag"
}
Expand Down

0 comments on commit bebc2cb

Please sign in to comment.