From 22a33bc6903f78fbec5ebc9a4e19737241648e96 Mon Sep 17 00:00:00 2001 From: Samuel Hassine Date: Sat, 1 Oct 2022 11:27:04 +0200 Subject: [PATCH] [frontend] Enhance channels list --- .../private/components/arsenal/Channels.js | 10 +++++-- .../arsenal/channels/ChannelLine.js | 18 ++++++++++++ .../components/common/lists/Filters.js | 28 +++++++++++++++++++ .../opencti-front/src/utils/Localization.js | 4 +++ 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/opencti-platform/opencti-front/src/private/components/arsenal/Channels.js b/opencti-platform/opencti-front/src/private/components/arsenal/Channels.js index bd84406597fa..242f53a06f4f 100644 --- a/opencti-platform/opencti-front/src/private/components/arsenal/Channels.js +++ b/opencti-platform/opencti-front/src/private/components/arsenal/Channels.js @@ -106,12 +106,17 @@ class Channels extends Component { const dataColumns = { name: { label: 'Name', - width: '35%', + width: '30%', + isSortable: true, + }, + channel_types: { + label: 'Types', + width: '15%', isSortable: true, }, objectLabel: { label: 'Labels', - width: '25%', + width: '20%', isSortable: false, }, created: { @@ -142,6 +147,7 @@ class Channels extends Component { paginationOptions={paginationOptions} numberOfElements={numberOfElements} availableFilterKeys={[ + 'channel_types', 'labelledBy', 'markedBy', 'created_start_date', diff --git a/opencti-platform/opencti-front/src/private/components/arsenal/channels/ChannelLine.js b/opencti-platform/opencti-front/src/private/components/arsenal/channels/ChannelLine.js index 625a468a32ac..f29e3e983e07 100644 --- a/opencti-platform/opencti-front/src/private/components/arsenal/channels/ChannelLine.js +++ b/opencti-platform/opencti-front/src/private/components/arsenal/channels/ChannelLine.js @@ -66,6 +66,12 @@ class ChannelLineComponent extends Component { > {node.name} +
+ {node.channel_types.join(', ')} +
+
+ +
({ const directFilters = [ 'report_types', + 'channel_types', 'sightedBy', 'container_type', 'toSightingId', @@ -849,6 +850,33 @@ class Filters extends Component { }); }); break; + case 'channel_types': + fetchQuery(attributesSearchQuery, { + attributeName: 'channel_types', + search: event.target.value !== 0 ? event.target.value : '', + first: 10, + }) + .toPromise() + .then((data) => { + const channelTypesEntities = R.pipe( + R.pathOr([], ['runtimeAttributes', 'edges']), + R.map((n) => ({ + label: t(n.node.value), + value: n.node.value, + type: 'attribute', + })), + )(data); + this.setState({ + entities: { + ...this.state.entities, + channel_types: R.union( + channelTypesEntities, + this.state.entities.channel_types, + ), + }, + }); + }); + break; case 'entity_type': // eslint-disable-next-line no-case-declarations let entitiesTypes = []; diff --git a/opencti-platform/opencti-front/src/utils/Localization.js b/opencti-platform/opencti-front/src/utils/Localization.js index 7c0080f98c1f..1a83566d4a7a 100644 --- a/opencti-platform/opencti-front/src/utils/Localization.js +++ b/opencti-platform/opencti-front/src/utils/Localization.js @@ -1466,6 +1466,7 @@ const i18n = { filter_containedBy: 'Contenedor', filter_x_opencti_workflow_id: 'Estado', filter_report_types: 'Tipo de informe', + filter_channel_types: 'Tipo de canal', filter_confidence_gt: 'Confianza superior a', filter_published_start_date: 'Publicado después de', filter_published_end_date: 'Publicado antes de', @@ -2974,6 +2975,7 @@ const i18n = { filter_containedBy: 'Conteneur', filter_x_opencti_workflow_id: 'Statut', filter_report_types: 'Type de rapport', + filter_channel_types: 'Type de canal', filter_confidence_gt: 'Confiance supérieure à', filter_published_start_date: 'Publié après', filter_published_end_date: 'Publié avant', @@ -4378,6 +4380,7 @@ const i18n = { filter_containedBy: '包含', filter_x_opencti_workflow_id: '状态', filter_report_types: '报告类型', + filter_channel_types: '渠道类型', filter_confidence_gt: '置信度高于', filter_published_start_date: '发布开始日期', filter_published_end_date: '发布结束日期', @@ -4678,6 +4681,7 @@ const i18n = { filter_confidence_gt: 'Confidence greater than', filter_x_opencti_workflow_id: 'Status', filter_report_types: 'Report type', + filter_channel_types: 'Channel type', filter_published_start_date: 'Published after', filter_published_end_date: 'Published before', filter_created_start_date: 'Created after',