From 6e6fd6966e2ce3f7e669cfb10e2a2eaf6de42fa4 Mon Sep 17 00:00:00 2001 From: Laurent Bonnet Date: Fri, 13 Sep 2024 15:05:12 +0200 Subject: [PATCH] [frontend] make TAI personas always visible to be able to add some --- .../src/components/FieldOrEmpty.tsx | 2 +- .../StixCyberObservableCreation.jsx | 2 + .../ThreatActorGroupLocation.jsx | 96 +++++++++---------- .../ThreatActorIndividualDetailsChips.tsx | 73 +++++++------- .../ThreatActorIndividualLocation.jsx | 2 +- 5 files changed, 89 insertions(+), 86 deletions(-) diff --git a/opencti-platform/opencti-front/src/components/FieldOrEmpty.tsx b/opencti-platform/opencti-front/src/components/FieldOrEmpty.tsx index 632009c9481ff..1dd899f96659d 100644 --- a/opencti-platform/opencti-front/src/components/FieldOrEmpty.tsx +++ b/opencti-platform/opencti-front/src/components/FieldOrEmpty.tsx @@ -6,7 +6,7 @@ interface FieldOrEmptyProps { children: React.ReactNode; } -const FieldOrEmpty = ({ source, children }: FieldOrEmptyProps) => { +const FieldOrEmpty = ({ source, children }: FieldOrEmptyProps) => { return <>{isNotEmptyField(source) ? children : '-'}; // render the children if source is defined }; export default FieldOrEmpty; diff --git a/opencti-platform/opencti-front/src/private/components/observations/stix_cyber_observables/StixCyberObservableCreation.jsx b/opencti-platform/opencti-front/src/private/components/observations/stix_cyber_observables/StixCyberObservableCreation.jsx index 0cd3e0f90e589..c4c84bbc9f9c5 100644 --- a/opencti-platform/opencti-front/src/private/components/observations/stix_cyber_observables/StixCyberObservableCreation.jsx +++ b/opencti-platform/opencti-front/src/private/components/observations/stix_cyber_observables/StixCyberObservableCreation.jsx @@ -270,6 +270,7 @@ const StixCyberObservableCreation = ({ inputValue, paginationKey, paginationOptions, + controlledDialStyles = {}, defaultCreatedBy = null, defaultMarkingDefinitions = null, isFromBulkRelation, @@ -901,6 +902,7 @@ const StixCyberObservableCreation = ({ entityType={type ?? 'Observable'} onOpen={handleOpen} onClose={() => {}} + style={controlledDialStyles} /> :
- - {threatActorGroup.locations.edges.length === 0 && ( - - - - )} - {threatActorGroup.locations.edges.map((locationEdge) => { - const { types } = locationEdge; - const location = locationEdge.node; - const link = resolveLink(location.entity_type); - const flag = location.entity_type === 'Country' + + + {threatActorGroup.locations.edges.map((locationEdge) => { + const { types } = locationEdge; + const location = locationEdge.node; + const link = resolveLink(location.entity_type); + const flag = location.entity_type === 'Country' && R.head( (location.x_opencti_aliases ?? []).filter( (n) => n?.length === 2, ), ); - return ( - - + return ( + - {flag ? ( - {location.name} - ) : ( - - )} + + {flag ? ( + {location.name} + ) : ( + + )} + - - - {types.includes('manual') ? ( - - - this.removeLocation(locationEdge)} - size="large" - > - - - - - ) : } - - ); - })} - + + {types.includes('manual') ? ( + + + this.removeLocation(locationEdge)} + size="large" + > + + + + + ) : } + + ); + })} + + ); } diff --git a/opencti-platform/opencti-front/src/private/components/threats/threat_actors_individual/ThreatActorIndividualDetailsChips.tsx b/opencti-platform/opencti-front/src/private/components/threats/threat_actors_individual/ThreatActorIndividualDetailsChips.tsx index 5e349d8956452..25e7f4edfc81c 100644 --- a/opencti-platform/opencti-front/src/private/components/threats/threat_actors_individual/ThreatActorIndividualDetailsChips.tsx +++ b/opencti-platform/opencti-front/src/private/components/threats/threat_actors_individual/ThreatActorIndividualDetailsChips.tsx @@ -5,6 +5,7 @@ import { KNOWLEDGE_KNUPDATE } from 'src/utils/hooks/useGranted'; import { ThreatActorIndividualDetails_ThreatActorIndividual$data } from './__generated__/ThreatActorIndividualDetails_ThreatActorIndividual.graphql'; import AddPersonaThreatActorIndividual from './AddPersonasThreatActorIndividual'; import AddIndividualsThreatActorIndividual from './AddIndividualsThreatActorIndividual'; +import FieldOrEmpty from '../../../../components/FieldOrEmpty'; type SupportedTypes = 'known-as' | 'impersonates'; type SupportedFields = 'persona_name' | 'name'; @@ -59,43 +60,45 @@ ThreatActorIndividualDetailsChipsProps setNodes(getRelationshipsOfType(relType)); }, [data]); - // Hide if there are no valid relations - - return (
-
- - +
- {title} - - } - > - - -
-
- { - nodes.map(({ id, to }) => ( - - )) - } -
); + {title} +
+ } + > + + +
+
+ + { + nodes.map(({ id, to }) => ( + + )) + } + +
+ ); }; export default ThreatActorIndividualDetailsChips; diff --git a/opencti-platform/opencti-front/src/private/components/threats/threat_actors_individual/ThreatActorIndividualLocation.jsx b/opencti-platform/opencti-front/src/private/components/threats/threat_actors_individual/ThreatActorIndividualLocation.jsx index 38841e9587a8f..563ef891864b9 100644 --- a/opencti-platform/opencti-front/src/private/components/threats/threat_actors_individual/ThreatActorIndividualLocation.jsx +++ b/opencti-platform/opencti-front/src/private/components/threats/threat_actors_individual/ThreatActorIndividualLocation.jsx @@ -63,7 +63,7 @@ class ThreatActorIndividualLocationsComponent extends Component { />
- + {threatActorIndividual.locations.edges.map((locationEdge) => { const { types } = locationEdge;