Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[frontend] Update demographic stixCoreRelationships from entity overview #9637

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions opencti-platform/opencti-front/lang/front/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@
"Add an organization": "Hinzufügen einer Organisation",
"Add and complete": "Hinzufügen und ausfüllen",
"Add attack patterns": "Angriffsmuster hinzufügen",
"Add citizenship": "Staatsbürgerschaft hinzufügen",
"Add components": "Komponenten hinzufügen",
"Add context": "Kontext hinzufügen",
"Add country": "Land hinzufügen",
"Add country of residence": "Land des Wohnsitzes hinzufügen",
"Add courses of action": "Hinzufügen von Handlungsabläufen",
"Add data components": "Hinzufügen von Datenkomponenten",
"Add data source": "Datenquelle hinzufügen",
Expand All @@ -93,6 +96,7 @@
"Add indicators": "Indikatoren hinzufügen",
"Add individual": "Einzelperson hinzufügen",
"Add locations": "Standorte hinzufügen",
"Add nationality": "Nationalität hinzufügen",
"Add new assignees": "Neue Referenten hinzufügen",
"Add new labels": "Neue Labels hinzufügen",
"Add new participants": "Neue Teilnehmer hinzufügen",
Expand Down
4 changes: 4 additions & 0 deletions opencti-platform/opencti-front/lang/front/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@
"Add an organization": "Add an organization",
"Add and complete": "Add and complete",
"Add attack patterns": "Add attack patterns",
"Add citizenship": "Add citizenship",
"Add components": "Add components",
"Add context": "Add context",
"Add country": "Add country",
"Add country of residence": "Add country of residence",
"Add courses of action": "Add courses of action",
"Add data components": "Add data components",
"Add data source": "Add data source",
Expand All @@ -93,6 +96,7 @@
"Add indicators": "Add indicators",
"Add individual": "Add individual",
"Add locations": "Add locations",
"Add nationality": "Add nationality",
"Add new assignees": "Add new assignees",
"Add new labels": "Add new labels",
"Add new participants": "Add new participants",
Expand Down
4 changes: 4 additions & 0 deletions opencti-platform/opencti-front/lang/front/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@
"Add an organization": "Agregar una organización",
"Add and complete": "Agregar y completar",
"Add attack patterns": "Añadir patrones de ataque",
"Add citizenship": "Añadir ciudadanía",
"Add components": "Añadir componentes",
"Add context": "Agregar contexto",
"Add country": "Añadir país",
"Add country of residence": "Añadir país de residencia",
"Add courses of action": "Añadir contramedidas",
"Add data components": "Añadir componentes de datos",
"Add data source": "Añadir fuente de datos",
Expand All @@ -93,6 +96,7 @@
"Add indicators": "Añadir indicadores",
"Add individual": "Agregar individuo",
"Add locations": "Añadir una localización",
"Add nationality": "Añadir nacionalidad",
"Add new assignees": "Agregar nuevos referentes",
"Add new labels": "Añadir nuevas etiquetas",
"Add new participants": "Agregar nuevos participantes",
Expand Down
4 changes: 4 additions & 0 deletions opencti-platform/opencti-front/lang/front/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@
"Add an organization": "Ajouter une organisation",
"Add and complete": "Ajouter et compléter",
"Add attack patterns": "Ajouter des motifs d'attaque",
"Add citizenship": "Ajouter la citoyenneté",
"Add components": "Ajouter des composants",
"Add context": "Ajouter du contexte",
"Add country": "Ajouter un pays",
"Add country of residence": "Ajouter le pays de résidence",
"Add courses of action": "Ajouter des conduites à suivre",
"Add data components": "Ajouter des composants de données",
"Add data source": "Ajouter une source de données",
Expand All @@ -93,6 +96,7 @@
"Add indicators": "Ajouter des indicateurs",
"Add individual": "Ajouter un individu",
"Add locations": "Ajouter une localisation",
"Add nationality": "Ajouter la nationalité",
"Add new assignees": "Ajouter de nouveaux référents",
"Add new labels": "Ajouter des labels",
"Add new participants": "Ajouter de nouveaux participants",
Expand Down
4 changes: 4 additions & 0 deletions opencti-platform/opencti-front/lang/front/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@
"Add an organization": "組織を追加する",
"Add and complete": "追加して完成",
"Add attack patterns": "攻撃パターンを追加",
"Add citizenship": "市民権の追加",
"Add components": "コンポーネントを追加する",
"Add context": "コンテキストを追加",
"Add country": "国を追加する",
"Add country of residence": "居住国を追加",
"Add courses of action": "行動指針を追加",
"Add data components": "データコンポーネントの追加",
"Add data source": "データソースの追加",
Expand All @@ -93,6 +96,7 @@
"Add indicators": "インジケータの追加",
"Add individual": "個人を追加",
"Add locations": "ロケーションの追加",
"Add nationality": "国籍を追加する",
"Add new assignees": "新しい担当者を追加",
"Add new labels": "新しいラベルを作成",
"Add new participants": "新しい参加者を追加",
Expand Down
4 changes: 4 additions & 0 deletions opencti-platform/opencti-front/lang/front/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@
"Add an organization": "조직 추가",
"Add and complete": "추가 및 완료",
"Add attack patterns": "공격 패턴 추가",
"Add citizenship": "시민권 추가",
"Add components": "구성 요소 추가",
"Add context": "컨텍스트 추가",
"Add country": "국가 추가",
"Add country of residence": "거주 국가 추가",
"Add courses of action": "조치 과정 추가",
"Add data components": "데이터 구성 요소 추가",
"Add data source": "데이터 소스 추가",
Expand All @@ -93,6 +96,7 @@
"Add indicators": "지표 추가",
"Add individual": "개인 추가",
"Add locations": "위치 추가",
"Add nationality": "국적 추가",
"Add new assignees": "새로운 담당자를 추가",
"Add new labels": "새 라벨 추가",
"Add new participants": "새로운 참가자를 추가",
Expand Down
4 changes: 4 additions & 0 deletions opencti-platform/opencti-front/lang/front/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@
"Add an organization": "添加组织",
"Add and complete": "添加并完成",
"Add attack patterns": "添加攻击模式",
"Add citizenship": "添加公民身份",
"Add components": "添加组件",
"Add context": "添加上下文",
"Add country": "添加国家",
"Add country of residence": "添加居住国",
"Add courses of action": "添加应对措施",
"Add data components": "添加数据组件",
"Add data source": "添加数据源",
Expand All @@ -93,6 +96,7 @@
"Add indicators": "添加指标",
"Add individual": "添加个人",
"Add locations": "添加位置",
"Add nationality": "添加国籍",
"Add new assignees": "添加新的负责人",
"Add new labels": "添加新的标签",
"Add new participants": "添加新的参与者",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React, { FunctionComponent, useState } from 'react';
import { ThreatActorIndividual_ThreatActorIndividual$data } from '@components/threats/threat_actors_individual/__generated__/ThreatActorIndividual_ThreatActorIndividual.graphql';
import IconButton from '@mui/material/IconButton';
import { Add } from '@mui/icons-material';
import Drawer from '@components/common/drawer/Drawer';
import CountryCreation from '@components/locations/countries/CountryCreation';
import { useLazyLoadQuery } from 'react-relay';
import AddThreatActorIndividualDemographicLines, {
addIndividualsThreatActorIndividualLinesQuery,
} from '@components/threats/threat_actors_individual/AddThreatActorIndividualDemographicLines';
import { AddThreatActorIndividualDemographicLinesQuery } from '@components/threats/threat_actors_individual/__generated__/AddThreatActorIndividualDemographicLinesQuery.graphql';
import { useFormatter } from '../../../../components/i18n';
import SearchInput from '../../../../components/SearchInput';

interface AddThreatActorIndividualDemographicProps {
threatActorIndividual: ThreatActorIndividual_ThreatActorIndividual$data,
relType: string,
title:string,
}

const AddThreatActorIndividualDemographic: FunctionComponent<
AddThreatActorIndividualDemographicProps
> = ({
threatActorIndividual,
relType,
title,
}) => {
const { t_i18n } = useFormatter();
const [open, setOpen] = useState<boolean>(false);
const [search, setSearch] = useState<string>('');
const paginationOptions = { search };

const handleOpen = () => setOpen(true);
const handleClose = () => setOpen(false);
const handleSearch = (term: string) => setSearch(term);

const data = useLazyLoadQuery<AddThreatActorIndividualDemographicLinesQuery>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why using useLazyLoadQuery instead of usePreloadedQuery?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to use usePreloadedQuery.

First you need to prepare the query Ref in a parent componant using useQueryLoading and then replace useLazyLoadQuery with usePreloadedQuery.

addIndividualsThreatActorIndividualLinesQuery,
{
...paginationOptions,
count: 50,
},
);

return (<div>
<IconButton
color='primary'
style={{ marginTop: '-11px' }}
onClick={handleOpen}
>
<Add fontSize="small" />
</IconButton>
<Drawer
open={open}
onClose={handleClose}
title={t_i18n(title)}
header={
<div
style={{
marginLeft: 'auto',
marginRight: '20px',
display: 'flex',
flexWrap: 'wrap',
justifyContent: 'flex-end',
alignItems: 'flex-end',
}}
>
<SearchInput
variant='inDrawer'
onSubmit={handleSearch}
/>
<div style={{ height: 5 }} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of that div?

<CountryCreation
paginationOptions={{
search,
count: 50,
}}
/>
</div>
}
>
<AddThreatActorIndividualDemographicLines
threatActorIndividual={threatActorIndividual}
fragmentKey={data}
relType={relType}
/>
</Drawer>
</div>);
};

export default AddThreatActorIndividualDemographic;
Loading
Loading