diff --git a/opencti-platform/opencti-front/src/private/components/common/stix_core_objects/StixCoreObjectHistory.jsx b/opencti-platform/opencti-front/src/private/components/common/stix_core_objects/StixCoreObjectHistory.jsx index 1af35c8aaa5f..162c15cb2ce9 100644 --- a/opencti-platform/opencti-front/src/private/components/common/stix_core_objects/StixCoreObjectHistory.jsx +++ b/opencti-platform/opencti-front/src/private/components/common/stix_core_objects/StixCoreObjectHistory.jsx @@ -118,11 +118,6 @@ class StixCoreObjectHistory extends Component { filters: { mode: 'and', filters: [ - { - key: 'context_data.id', - values: [stixCoreObjectId], - operator: 'wildcard', - }, { key: 'event_type', values: ['create', 'delete', 'mutation'], // retro-compatibility @@ -142,6 +137,20 @@ class StixCoreObjectHistory extends Component { }, ], filterGroups: [], + }, + { + mode: 'or', + filters: [ + { + key: 'context_data.from_id', + values: [stixCoreObjectId], + }, + { + key: 'context_data.to_id', + values: [stixCoreObjectId], + }, + ], + filterGroups: [], }], }, first: 20, diff --git a/opencti-platform/opencti-graphql/src/schema/attribute-definition.ts b/opencti-platform/opencti-graphql/src/schema/attribute-definition.ts index c44ac75a07c8..14905f7d1566 100644 --- a/opencti-platform/opencti-graphql/src/schema/attribute-definition.ts +++ b/opencti-platform/opencti-graphql/src/schema/attribute-definition.ts @@ -1,5 +1,5 @@ import { ENTITY_TYPE_USER } from './internalObject'; -import { ABSTRACT_STIX_CORE_OBJECT } from './general'; +import { ABSTRACT_BASIC_OBJECT, ABSTRACT_BASIC_RELATIONSHIP } from './general'; export const shortMapping = { type: 'text', @@ -70,13 +70,14 @@ export const id: AttributeDefinition = { name: 'id', label: 'Id', type: 'string', - format: 'short', + format: 'id', update: false, mandatoryType: 'no', multiple: false, editDefault: false, upsert: false, isFilterable: false, + entityTypes: [ABSTRACT_BASIC_OBJECT, ABSTRACT_BASIC_RELATIONSHIP] }; export const internalId: AttributeDefinition = { @@ -90,7 +91,7 @@ export const internalId: AttributeDefinition = { multiple: false, upsert: false, isFilterable: false, - entityTypes: [ABSTRACT_STIX_CORE_OBJECT] + entityTypes: [ABSTRACT_BASIC_OBJECT, ABSTRACT_BASIC_RELATIONSHIP] }; export const creators: AttributeDefinition = { diff --git a/opencti-platform/opencti-graphql/tests/01-unit/domain/filterKeysSchema-test.ts b/opencti-platform/opencti-graphql/tests/01-unit/domain/filterKeysSchema-test.ts index cbcc77657ce3..5e47a8e94adf 100644 --- a/opencti-platform/opencti-graphql/tests/01-unit/domain/filterKeysSchema-test.ts +++ b/opencti-platform/opencti-graphql/tests/01-unit/domain/filterKeysSchema-test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest'; import { generateFilterKeysSchema } from '../../../src/domain/filterKeysSchema'; import { + ABSTRACT_BASIC_OBJECT, ABSTRACT_STIX_CORE_OBJECT, ABSTRACT_STIX_CORE_RELATIONSHIP, ABSTRACT_STIX_CYBER_OBSERVABLE, @@ -133,8 +134,8 @@ describe('Filter keys schema generation testing', async () => { expect(filterDefinition?.filterKey).toEqual('fromId'); expect(filterDefinition?.type).toEqual('id'); expect(filterDefinition?.label).toEqual('Source entity'); - expect(filterDefinition?.elementsForFilterValuesSearch.length).toEqual(1); - expect(filterDefinition?.elementsForFilterValuesSearch[0]).toEqual(ABSTRACT_STIX_CORE_OBJECT); + expect(filterDefinition?.elementsForFilterValuesSearch.length).toEqual(2); + expect(filterDefinition?.elementsForFilterValuesSearch[0]).toEqual(ABSTRACT_BASIC_OBJECT); // 'toTypes' for relationships filterDefinition = filterKeysSchema.get(ABSTRACT_STIX_CORE_RELATIONSHIP)?.get('toTypes'); expect(filterDefinition?.filterKey).toEqual('toTypes');