Skip to content

Commit

Permalink
[frontend] Enhance channels list
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelHassine committed Oct 1, 2022
1 parent b02996d commit 22a33bc
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -142,6 +147,7 @@ class Channels extends Component {
paginationOptions={paginationOptions}
numberOfElements={numberOfElements}
availableFilterKeys={[
'channel_types',
'labelledBy',
'markedBy',
'created_start_date',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ class ChannelLineComponent extends Component {
>
{node.name}
</div>
<div
className={classes.bodyItem}
style={{ width: dataColumns.channel_types.width }}
>
{node.channel_types.join(', ')}
</div>
<div
className={classes.bodyItem}
style={{ width: dataColumns.objectLabel.width }}
Expand Down Expand Up @@ -112,6 +118,7 @@ const ChannelLineFragment = createFragmentContainer(ChannelLineComponent, {
fragment ChannelLine_node on Channel {
id
name
channel_types
created
modified
objectLabel {
Expand Down Expand Up @@ -159,6 +166,17 @@ class ChannelLineDummyComponent extends Component {
height="100%"
/>
</div>
<div
className={classes.bodyItem}
style={{ width: dataColumns.channel_types.width }}
>
<Skeleton
animation="wave"
variant="rectangular"
width="90%"
height="100%"
/>
</div>
<div
className={classes.bodyItem}
style={{ width: dataColumns.objectLabel.width }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const styles = (theme) => ({

const directFilters = [
'report_types',
'channel_types',
'sightedBy',
'container_type',
'toSightingId',
Expand Down Expand Up @@ -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 = [];
Expand Down
4 changes: 4 additions & 0 deletions opencti-platform/opencti-front/src/utils/Localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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: '发布结束日期',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 22a33bc

Please sign in to comment.