diff --git a/opencti-platform/opencti-front/src/private/components/common/stix_core_relationships/StixCoreRelationshipCreationFromControlledDial.tsx b/opencti-platform/opencti-front/src/private/components/common/stix_core_relationships/StixCoreRelationshipCreationFromControlledDial.tsx index 7b9055404285..47c9e9241a9d 100644 --- a/opencti-platform/opencti-front/src/private/components/common/stix_core_relationships/StixCoreRelationshipCreationFromControlledDial.tsx +++ b/opencti-platform/opencti-front/src/private/components/common/stix_core_relationships/StixCoreRelationshipCreationFromControlledDial.tsx @@ -1,6 +1,6 @@ import React, { FunctionComponent, useContext, useEffect, useState } from 'react'; import { Button, CircularProgress, Fab, Typography } from '@mui/material'; -import { Add, ChevronRightOutlined } from '@mui/icons-material'; +import { ChevronRightOutlined } from '@mui/icons-material'; import { v4 as uuid } from 'uuid'; import { ConnectionHandler, RecordSourceSelectorProxy } from 'relay-runtime'; import { FormikConfig } from 'formik'; @@ -19,7 +19,7 @@ import { commitMutation, handleErrorInForm, QueryRenderer } from '../../../../re import { StixCoreRelationshipCreationFromEntityQuery$data } from './__generated__/StixCoreRelationshipCreationFromEntityQuery.graphql'; import StixCyberObservableCreation from '../../observations/stix_cyber_observables/StixCyberObservableCreation'; import StixDomainObjectCreation from '../stix_domain_objects/StixDomainObjectCreation'; -import { emptyFilterGroup, useBuildEntityTypeBasedFilterContext, useRemoveIdAndIncorrectKeysFromFilterGroupObject } from '../../../../utils/filters/filtersUtils'; +import { emptyFilterGroup, useBuildEntityTypeBasedFilterContext } from '../../../../utils/filters/filtersUtils'; import { useFormatter } from '../../../../components/i18n'; import { CreateRelationshipContext } from '../menus/CreateRelationshipContextProvider'; import { computeTargetStixCyberObservableTypes, computeTargetStixDomainObjectTypes } from '../../../../utils/stixTypeUtils'; @@ -59,7 +59,7 @@ export const CreateRelationshipControlledDial = ({ onOpen }: { fontSize: 'small', }} > - {t_i18n('Create Relationship')} + {t_i18n('Create Relationship')} ); }; @@ -105,7 +105,8 @@ export const Header: FunctionComponent = ({ }; const searchPaginationOptions = { search: '', - filters: useRemoveIdAndIncorrectKeysFromFilterGroupObject(filters, entityTypes), + // filters: useRemoveIdAndIncorrectKeysFromFilterGroupObject(filters, entityTypes), + filters: useBuildEntityTypeBasedFilterContext(entityTypes, filters), orderBy: '_score', orderMode: 'desc', }; @@ -125,7 +126,7 @@ export const Header: FunctionComponent = ({ {showSDOCreation && ( )} {showSCOCreation && ( )} = ({ defaultMarkingDefinitions={undefined} stixDomainObjectTypes={entityTypes} onCompleted={undefined} - isFromBulkRelation={false} + isFromBulkRelation={undefined} /> = ({ open={openCreateObservable} handleClose={handleCloseCreateObservable} type={undefined} - isFromBulkRelation={false} + isFromBulkRelation={undefined} onCompleted={undefined} /> @@ -253,7 +254,10 @@ const SelectEntity = ({ }], } : emptyFilterGroup; - const virtualEntityTypes = stixCoreObjectTypes ?? ['Stix-Domain-Object', 'Stix-Cyber-Observable']; + let virtualEntityTypes = stixCoreObjectTypes; + if (virtualEntityTypes === undefined || virtualEntityTypes.length < 1) { + virtualEntityTypes = ['Stix-Domain-Object', 'Stix-Cyber-Observable']; + } const getLocalStorageKey = (entityId: string) => `${entityId}_stixCoreRelationshipCreationFromEntity`; const [sortBy, setSortBy] = useState('_score'); @@ -335,6 +339,14 @@ const SelectEntity = ({ const [tableRootRef, setTableRootRef] = useState(null); + const initialValues = { + searchTerm: '', + sortBy: 'created', + orderAsc: false, + openExports: false, + filters: emptyFilterGroup, + }; + return (
data.stixCoreObjects?.edges?.map((n) => n?.node)} storageKey={getLocalStorageKey(entity_id)} lineFragment={stixCoreRelationshipCreationFromEntityStixCoreObjectsLineFragment} - initialValues={{}} + initialValues={initialValues} toolbarFilters={contextFilters} preloadedPaginationProps={preloadedPaginationProps} entityTypes={virtualEntityTypes} @@ -598,45 +612,50 @@ const StixCoreRelationshipCreationFromControlledDial: FunctionComponent - { - if (props?.stixCoreObject) { - const { name, entity_type, observable_value } = props.stixCoreObject; - return
- {step === 0 && ( - setStep(1)} - /> - )} - {step === 1 && ( - - )} -
; - } - return renderLoader(); - }} - /> + {({ onClose }) => ( + { + if (props?.stixCoreObject) { + const { name, entity_type, observable_value } = props.stixCoreObject; + return
+ {step === 0 && ( + setStep(1)} + /> + )} + {step === 1 && ( + { + reset(); + onClose(); + }} + allowedRelationshipTypes={allowedRelationshipTypes} + isReversable={isReversable} + defaultStartTime={defaultStartTime} + defaultStopTime={defaultStopTime} + /> + )} +
; + } + return renderLoader(); + }} + /> + )} ); }; diff --git a/opencti-platform/opencti-front/src/private/components/common/stix_core_relationships/views/indicators/EntityStixCoreRelationshipsIndicatorsEntitiesView.tsx b/opencti-platform/opencti-front/src/private/components/common/stix_core_relationships/views/indicators/EntityStixCoreRelationshipsIndicatorsEntitiesView.tsx index 9d7371bb9695..c7d4c2990d71 100644 --- a/opencti-platform/opencti-front/src/private/components/common/stix_core_relationships/views/indicators/EntityStixCoreRelationshipsIndicatorsEntitiesView.tsx +++ b/opencti-platform/opencti-front/src/private/components/common/stix_core_relationships/views/indicators/EntityStixCoreRelationshipsIndicatorsEntitiesView.tsx @@ -218,7 +218,7 @@ const EntityStixCoreRelationshipsIndicatorsEntitiesView: FunctionComponent - {isFABReplaced && ( + {!isFABReplaced && (