diff --git a/packages/threat-composer/src/components/generic/Table/index.tsx b/packages/threat-composer/src/components/generic/Table/index.tsx index 52f5450e..35461f84 100644 --- a/packages/threat-composer/src/components/generic/Table/index.tsx +++ b/packages/threat-composer/src/components/generic/Table/index.tsx @@ -35,6 +35,8 @@ const Table: FC = ({ disableSettings, preferences: collectionPrefere const [preferences, setPreferences] = useState({ pageSize: props.defaultPageSize, visibleContent: props.columnDefinitions.map((cd) => cd.id || ''), + wrapLines: true, + stripedRows: true, }); const visibleContentOptions = useMemo(() => { diff --git a/packages/threat-composer/src/components/threats/MitigationCandidates/index.tsx b/packages/threat-composer/src/components/threats/MitigationCandidates/index.tsx index 0fc48074..e6af23b2 100644 --- a/packages/threat-composer/src/components/threats/MitigationCandidates/index.tsx +++ b/packages/threat-composer/src/components/threats/MitigationCandidates/index.tsx @@ -67,7 +67,20 @@ const MitigationCandidates: FC = ({ setupMitigations().catch(err => console.log('Error', err)); }, [threatPackId, threatPackThreatId, getMitigationCandidates]); - const colDef: ColumnDefinition[] = useMemo(() => [ + const items = useMemo(() => { + return mitigations.map(x => { + const metadata = getMetadata(x.metadata); + return { + ...x, + comments: metadata.Comments || '', + }; + }); + }, [mitigations]); + + const colDef: ColumnDefinition<{ + content: string; + comments: string; + }>[] = useMemo(() => [ { id: 'content', header: 'Mitigation', @@ -75,17 +88,14 @@ const MitigationCandidates: FC = ({ sortingField: 'content', }, { - id: 'description', - header: 'Description', - cell: (data) => { - const metadata = getMetadata(data.metadata); - return metadata.Description || ''; - }, - sortingField: 'content', + id: 'comments', + header: 'Comments', + cell: (data) => data.comments, + sortingField: 'comments', }, ], []); - if (mitigations.length === 0) { + if (items.length === 0) { return (<>); } @@ -103,8 +113,7 @@ const MitigationCandidates: FC = ({ header="Mitigation Candidates" headerVariant='h3' variant='embedded' - items={mitigations || []} - wrapLines={true} + items={items || []} selectedItems={selectedItems} onSelectionChange={({ detail }) => setSelectedItems([...detail.selectedItems])} isItemDisabled={(item) => linkedMitigationsFromThreakpack.includes(item.id)} diff --git a/packages/threat-composer/src/components/workspaces/MitigationPack/index.tsx b/packages/threat-composer/src/components/workspaces/MitigationPack/index.tsx index 6bf02f2b..0ceba1d8 100644 --- a/packages/threat-composer/src/components/workspaces/MitigationPack/index.tsx +++ b/packages/threat-composer/src/components/workspaces/MitigationPack/index.tsx @@ -44,7 +44,20 @@ const MitigationPack: FC = ({ setSelectedItems([]); }, [mitigationPackId, selectedItems]); - const colDef: ColumnDefinition[] = useMemo(() => [ + const items = useMemo(() => { + return mitigationPack?.mitigations?.map(x => { + const metadata = getMetadata(x.metadata); + return { + ...x, + comments: metadata.Comments || '', + }; + }) || []; + }, [mitigationPack?.mitigations]); + + const colDef: ColumnDefinition<{ + content: string; + comments: string; + }>[] = useMemo(() => [ { id: 'content', header: 'Mitigation', @@ -52,13 +65,10 @@ const MitigationPack: FC = ({ sortingField: 'content', }, { - id: 'description', - header: 'Description', - cell: (data) => { - const metadata = getMetadata(data.metadata); - return metadata.Description || ''; - }, - sortingField: 'content', + id: 'comments', + header: 'Comments', + cell: (data) => data.comments, + sortingField: 'comments', }, ], []); @@ -106,8 +116,7 @@ const MitigationPack: FC = ({ columnDefinitions={colDef} actions={actions} header="Mitigations" - items={mitigationPack.mitigations || []} - wrapLines={true} + items={items} isItemDisabled={isItemDisabled} selectedItems={totalSelectedItems} onSelectionChange={({ detail }) => setSelectedItems([...detail.selectedItems])} diff --git a/packages/threat-composer/src/components/workspaces/MitigationPacks/index.tsx b/packages/threat-composer/src/components/workspaces/MitigationPacks/index.tsx index 53eac7c2..c4707c28 100644 --- a/packages/threat-composer/src/components/workspaces/MitigationPacks/index.tsx +++ b/packages/threat-composer/src/components/workspaces/MitigationPacks/index.tsx @@ -82,7 +82,6 @@ const MitigationPacks: FC = ({ columnDefinitions={colDef} items={mitigationPacks} disableRowSelect={true} - wrapLines={true} /> ); }; diff --git a/packages/threat-composer/src/components/workspaces/ThreatPack/index.tsx b/packages/threat-composer/src/components/workspaces/ThreatPack/index.tsx index 108941a2..8e461867 100644 --- a/packages/threat-composer/src/components/workspaces/ThreatPack/index.tsx +++ b/packages/threat-composer/src/components/workspaces/ThreatPack/index.tsx @@ -156,7 +156,6 @@ const ThreatPack: FC = ({ actions={actions} header="Threats" items={threatPack.threats || []} - wrapLines={true} isItemDisabled={isItemDisabled} selectedItems={totalSelectedItems} onSelectionChange={({ detail }) => setSelectedItems([...detail.selectedItems])} diff --git a/packages/threat-composer/src/components/workspaces/ThreatPacks/index.tsx b/packages/threat-composer/src/components/workspaces/ThreatPacks/index.tsx index d60663e7..c503b4fd 100644 --- a/packages/threat-composer/src/components/workspaces/ThreatPacks/index.tsx +++ b/packages/threat-composer/src/components/workspaces/ThreatPacks/index.tsx @@ -81,8 +81,6 @@ const ThreatPacks: FC = ({ columnDefinitions={colDef} items={threatPacks} disableRowSelect={true} - wrapLines={true} - /> ); };