diff --git a/opencti-platform/opencti-front/src/private/components/common/stix_domain_objects/StixDomainObjectAttackPatternsKillChainContainer.tsx b/opencti-platform/opencti-front/src/private/components/common/stix_domain_objects/StixDomainObjectAttackPatternsKillChainContainer.tsx index a7136b7866fbb..12c2c3d1f7b54 100644 --- a/opencti-platform/opencti-front/src/private/components/common/stix_domain_objects/StixDomainObjectAttackPatternsKillChainContainer.tsx +++ b/opencti-platform/opencti-front/src/private/components/common/stix_domain_objects/StixDomainObjectAttackPatternsKillChainContainer.tsx @@ -101,15 +101,12 @@ export const stixDomainObjectAttackPatternsKillChainContainerFragment = graphql` killChainPhases { id kill_chain_name - kill_chain_namephase_name + phase_name x_opencti_order } creators { id name - creators { - id - name } } } diff --git a/opencti-platform/opencti-front/src/private/components/techniques/attack_patterns/AttackPatternsMatrix.jsx b/opencti-platform/opencti-front/src/private/components/techniques/attack_patterns/AttackPatternsMatrix.jsx deleted file mode 100644 index f27976f56957e..0000000000000 --- a/opencti-platform/opencti-front/src/private/components/techniques/attack_patterns/AttackPatternsMatrix.jsx +++ /dev/null @@ -1,83 +0,0 @@ -import React, { Component } from 'react'; -import * as PropTypes from 'prop-types'; -import { compose } from 'ramda'; -import withStyles from '@mui/styles/withStyles'; -import withRouter from '../../../../utils/compat_router/withRouter'; -import { QueryRenderer } from '../../../../relay/environment'; -import inject18n from '../../../../components/i18n'; -import Loader from '../../../../components/Loader'; -import AttackPatternsMatrixColumns, { attackPatternsMatrixColumnsQuery } from './AttackPatternsMatrixColumns'; - -const styles = () => ({ - container: { - width: '100%', - height: '100%', - margin: 0, - padding: 0, - }, -}); - -class AttackPatternsMatrix extends Component { - render() { - const { - classes, - attackPatterns, - marginRight, - searchTerm, - handleToggleModeOnlyActive, - handleToggleColorsReversed, - currentColorsReversed, - currentModeOnlyActive, - hideBar, - handleAdd, - } = this.props; - return ( -
- { - if (props) { - return ( - - ); - } - return ; - }} - /> -
- ); - } -} - -AttackPatternsMatrix.propTypes = { - t: PropTypes.func, - marginRight: PropTypes.bool, - navigate: PropTypes.func, - location: PropTypes.object, - classes: PropTypes.object, - attackPatterns: PropTypes.array, - searchTerm: PropTypes.string, - handleToggleModeOnlyActive: PropTypes.func, - handleToggleColorsReversed: PropTypes.func, - currentColorsReversed: PropTypes.bool, - currentModeOnlyActive: PropTypes.bool, - hideBar: PropTypes.bool, - handleAdd: PropTypes.func, -}; - -export default compose( - inject18n, - withRouter, - withStyles(styles), -)(AttackPatternsMatrix); diff --git a/opencti-platform/opencti-front/src/private/components/techniques/attack_patterns/AttackPatternsMatrixLine.tsx b/opencti-platform/opencti-front/src/private/components/techniques/attack_patterns/AttackPatternsMatrixLine.tsx deleted file mode 100644 index 4e976ccbdb119..0000000000000 --- a/opencti-platform/opencti-front/src/private/components/techniques/attack_patterns/AttackPatternsMatrixLine.tsx +++ /dev/null @@ -1,274 +0,0 @@ -import React, { FunctionComponent } from 'react'; -import { graphql, useFragment } from 'react-relay'; -import { useTheme } from '@mui/material/styles'; -import { Link } from 'react-router-dom'; -import ListItem from '@mui/material/ListItem'; -import ListItemIcon from '@mui/material/ListItemIcon'; -import Checkbox from '@mui/material/Checkbox'; -import ListItemText from '@mui/material/ListItemText'; -import Tooltip from '@mui/material/Tooltip'; -import StixCoreObjectLabels from '@components/common/stix_core_objects/StixCoreObjectLabels'; -import { KeyboardArrowRightOutlined } from '@mui/icons-material'; -import { AttackPatternsMatrixLine_node$data, AttackPatternsMatrixLine_node$key } from '@components/techniques/attack_patterns/__generated__/AttackPatternsMatrixLine_node.graphql'; -import Skeleton from '@mui/material/Skeleton'; -import { emptyFilled, truncate } from '../../../../utils/String'; -import { DataColumns } from '../../../../components/list_lines'; -import ItemIcon from '../../../../components/ItemIcon'; -import { HandleAddFilter } from '../../../../utils/hooks/useLocalStorage'; -import ItemMarkings from '../../../../components/ItemMarkings'; - -interface AttackPatternsMatrixLineProps { - node: AttackPatternsMatrixLine_node$key - dataColumns: DataColumns; - onLabelClick: HandleAddFilter; - onToggleEntity: ( - entity: AttackPatternsMatrixLine_node$data, - event?: React.SyntheticEvent - ) => void; - onToggleShiftEntity: ( - index: number, - entity: AttackPatternsMatrixLine_node$data, - event?: React.SyntheticEvent - ) => void; - selectedElements: Record; - deSelectedElements: Record; - selectAll: boolean; - index: number; -} - -const attackPatternsMatrixLineFragment = graphql` -fragment AttackPatternsMatrixLine_node on AttackPattern { - id - entity_type - parent_types - name - description - isSubAttackPattern - x_mitre_id - x_mitre_platforms - x_mitre_permissions_required - x_mitre_detection - objectMarking { - id - definition_type - definition - x_opencti_order - x_opencti_color - } - created - modified - objectLabel { - id - value - color - } - subAttackPatterns { - edges { - node { - id - name - description - x_mitre_id - } - } - } - killChainPhases { - id - kill_chain_name - phase_name - x_opencti_order - } - creators { - id - name - } -} -`; - -const AttackPatternsMatrixLine: FunctionComponent = ({ - dataColumns, - node, - onLabelClick, - onToggleEntity, - onToggleShiftEntity, - selectedElements, - deSelectedElements, - selectAll, - index, -}) => { - const theme = useTheme(); - const data = useFragment(attackPatternsMatrixLineFragment, node); - const killChainNames = (data.killChainPhases || []).map((phase) => phase.kill_chain_name).join(', '); - const phaseName = (data.killChainPhases && data.killChainPhases.length > 0) ? data.killChainPhases[0].phase_name : ''; - - return ( -
- - (event.shiftKey - ? onToggleShiftEntity(index, data, event) - : onToggleEntity(data, event)) - } - > - - - - - - - -
- [{truncate(killChainNames, 15)}] {truncate(phaseName, 15)} -
-
-
- {emptyFilled(data.x_mitre_id)} -
-
- {data.name} -
-
- -
-
- {data.created} -
-
- -
-
- } - /> - - - - - - ); -}; - -export const AttackPatternsMatrixLineDummy = ({ - dataColumns, -}: { - dataColumns: DataColumns; -}) => { - const theme = useTheme(); - - return ( - - - - - -
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- - } - /> - - - -
- ); -}; - -export default AttackPatternsMatrixLine; diff --git a/opencti-platform/opencti-front/src/private/components/techniques/attack_patterns/AttackPatternsMatrixLines.tsx b/opencti-platform/opencti-front/src/private/components/techniques/attack_patterns/AttackPatternsMatrixLines.tsx deleted file mode 100644 index c572bbf37caa8..0000000000000 --- a/opencti-platform/opencti-front/src/private/components/techniques/attack_patterns/AttackPatternsMatrixLines.tsx +++ /dev/null @@ -1,131 +0,0 @@ -import React, { FunctionComponent } from 'react'; -import AttackPatternsMatrixLine, { AttackPatternsMatrixLineDummy } from '@components/techniques/attack_patterns/AttackPatternsMatrixLine'; -import { graphql, PreloadedQuery } from 'react-relay'; -import { - AttackPatternsMatrixLinesPaginationQuery, - AttackPatternsMatrixLinesPaginationQuery$variables, -} from '@components/techniques/attack_patterns/__generated__/AttackPatternsMatrixLinesPaginationQuery.graphql'; -import { AttackPatternsMatrixLines_data$key } from '@components/techniques/attack_patterns/__generated__/AttackPatternsMatrixLines_data.graphql'; -import { AttackPatternsMatrixLine_node$data } from '@components/techniques/attack_patterns/__generated__/AttackPatternsMatrixLine_node.graphql'; -import { DataColumns } from '../../../../components/list_lines'; -import { HandleAddFilter, UseLocalStorageHelpers } from '../../../../utils/hooks/useLocalStorage'; -import usePreloadedPaginationFragment from '../../../../utils/hooks/usePreloadedPaginationFragment'; -import ListLinesContent from '../../../../components/list_lines/ListLinesContent'; - -const nbOfRowsToLoad = 50; - -interface AttackPatternsMatrixLinesProps { - queryRef: PreloadedQuery; - dataColumns: DataColumns; - paginationOptions: AttackPatternsMatrixLinesPaginationQuery$variables; - setNumberOfElements: UseLocalStorageHelpers['handleSetNumberOfElements']; - selectedElements: Record; - deSelectedElements: Record; - onToggleEntity: ( - entity: AttackPatternsMatrixLine_node$data, - event: React.SyntheticEvent - ) => void; - selectAll: boolean; - onLabelClick: HandleAddFilter; - redirectionMode?: string; -} - -export const attackPatternsMatrixLinesQuery = graphql` - query AttackPatternsMatrixLinesPaginationQuery( - $search: String - $orderBy: AttackPatternsOrdering - $orderMode: OrderingMode - $count: Int! - $cursor: ID - $filters: FilterGroup - ) { - ...AttackPatternsMatrixLines_data - @arguments( - search: $search - orderBy: $orderBy - orderMode: $orderMode - count: $count - cursor: $cursor - filters: $filters - ) - } -`; - -const attackPatternsMatrixLinesFragment = graphql` - fragment AttackPatternsMatrixLines_data on Query - @argumentDefinitions( - search: { type: "String" } - orderBy: { type: "AttackPatternsOrdering", defaultValue: x_mitre_id } - orderMode: { type: "OrderingMode", defaultValue: asc } - count: { type: "Int", defaultValue: 25 } - cursor: { type: "ID" } - filters: { type: "FilterGroup" } - ) - @refetchable(queryName: "AttackPatternsMatrixLinesRefetchQuery") { - attackPatterns( - search: $search - orderBy: $orderBy - orderMode: $orderMode - first: $count - after: $cursor - filters: $filters - ) @connection(key: "Pagination_attackPatterns") { - edges { - node { - ...AttackPatternsMatrixLine_node - } - } - pageInfo { - endCursor - hasNextPage - globalCount - } - } - } -`; - -const AttackPatternsMatrixLines: FunctionComponent = ({ - queryRef, - setNumberOfElements, - dataColumns, - onToggleEntity, - selectedElements, - deSelectedElements, - selectAll, - paginationOptions, - onLabelClick, -}) => { - const { data, hasMore, loadMore, isLoadingMore } = usePreloadedPaginationFragment< - AttackPatternsMatrixLinesPaginationQuery, - AttackPatternsMatrixLines_data$key - >({ - linesQuery: attackPatternsMatrixLinesQuery, - linesFragment: attackPatternsMatrixLinesFragment, - queryRef, - nodePath: ['attackPatterns', 'pageInfo', 'globalCount'], - setNumberOfElements, - }); - - return ( - - ); -}; - -export default AttackPatternsMatrixLines;