Skip to content

Commit

Permalink
[frontend] make TAI personas always visible to be able to add some
Browse files Browse the repository at this point in the history
  • Loading branch information
labo-flg committed Sep 13, 2024
1 parent 324ba62 commit 93242a7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,15 @@ AddIndividualsThreatActorIndividualProps
count: 50,
},
);
const getRelationships = () => {
const relations = [];
for (const { node } of threatActorIndividual.stixCoreRelationships?.edges ?? []) {
const { relationship_type } = node ?? {};
if (relationship_type === 'impersonates') relations.push(node);
}
return relations;
};

return (<div>
{(getRelationships().length > 0) && (
<IconButton
color='primary'
style={{ marginTop: '-11px' }}
onClick={handleOpen}
>
<Add fontSize="small" />
</IconButton>
)}
<IconButton
color='primary'
style={{ marginTop: '-11px' }}
onClick={handleOpen}
>
<Add fontSize="small" />
</IconButton>
<Drawer
open={open}
onClose={handleClose}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,14 @@ AddPersonaThreatActorIndividualProps
},
);

const getRelationships = () => {
const relations = [];
for (const { node } of threatActorIndividual.stixCoreRelationships?.edges ?? []) {
const { relationship_type } = node ?? {};
if (relationship_type === 'known-as') relations.push(node);
}
return relations;
};

return (<div>
{(getRelationships().length > 0) && (
<IconButton
color='primary'
style={{ marginTop: '-11px' }}
onClick={handleOpen}
>
<Add fontSize="small" />
</IconButton>
)}
<IconButton
color='primary'
style={{ marginTop: '-11px' }}
onClick={handleOpen}
>
<Add fontSize="small" />
</IconButton>
<Drawer
open={open}
onClose={handleClose}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ ThreatActorIndividualDetailsChipsProps

// Hide if there are no valid relations

return (<div style={nodes.length > 0 ? { marginBottom: '20px' } : {}}>
return (<div style={{ marginBottom: '20px' }}>
<div style={{
display: 'flex',
flexDirection: 'row',
}}
>
{(nodes.length > 0) && (

<Typography
variant="h3"
gutterBottom={true}
>
{title}
</Typography>)}
</Typography>
<Security
needs={[KNOWLEDGE_KNUPDATE]}
placeholder={<div style={{ height: 29 }} />}
Expand All @@ -82,7 +82,7 @@ ThreatActorIndividualDetailsChipsProps
</Security>
</div>
<div className='clearfix' />
{(nodes.length > 0) && (
{
nodes.map(({ id, to }) => (
<Button
key={id}
Expand All @@ -94,7 +94,7 @@ ThreatActorIndividualDetailsChipsProps
{to?.[field]}
</Button>
))
)}
}
</div>);
};

Expand Down

0 comments on commit 93242a7

Please sign in to comment.