Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backend] add action to remove entity from draft (#6728) #9684

Merged
merged 32 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7495399
[frontend] reenable background tasks
JeremyCloarec Jan 22, 2025
9ab0ad3
[frontend] reenable background tasks
JeremyCloarec Jan 22, 2025
4d4a183
[backend] clean up works draft_context when deleting a draft
JeremyCloarec Jan 22, 2025
6d783fa
[backend] silent fail buildDraftVersion
JeremyCloarec Jan 22, 2025
a340457
[frontend] add relationship draft color
JeremyCloarec Jan 22, 2025
a9308e1
[frontend] add draft chip to relationship page
JeremyCloarec Jan 22, 2025
70c4bc7
[backend] remove from draft WIP
JeremyCloarec Jan 23, 2025
79443a5
[frontend] add draft color to relationship line (latests)
SouadHadjiat Jan 23, 2025
a0452cd
[frontend] change relationship color in draft
JeremyCloarec Jan 23, 2025
147a4d0
[backend] wip remove from draft
JeremyCloarec Jan 23, 2025
53bda17
[backend] wip remove from draft
JeremyCloarec Jan 23, 2025
c6ba258
[backend] wip remove from draft
JeremyCloarec Jan 24, 2025
003cd7a
[backend] wip remove from draft
JeremyCloarec Jan 24, 2025
bc30a56
[frontend] fix relationships table size & add confirm dialog title
SouadHadjiat Jan 24, 2025
c71512d
[backend] wip remove from draft
JeremyCloarec Jan 24, 2025
609eca7
[backend] wip remove from draft
JeremyCloarec Jan 24, 2025
3e68f08
[backend] first version remove from draft
JeremyCloarec Jan 27, 2025
2ac519b
[backend] first version remove from draft
JeremyCloarec Jan 27, 2025
a6bd899
[backend] first version remove from draft
JeremyCloarec Jan 27, 2025
9912cee
[backend] first version remove from draft
JeremyCloarec Jan 27, 2025
b2cbabe
[backend] first version remove from draft
JeremyCloarec Jan 27, 2025
69f197c
[backend] first version remove from draft
JeremyCloarec Jan 28, 2025
d8aeb27
[backend] first version remove from draft
JeremyCloarec Jan 31, 2025
25dfb3a
[backend] force no draft context during draft validation
JeremyCloarec Feb 3, 2025
f9dd282
[backend/frontend] add remove from draft to background tasks
JeremyCloarec Feb 3, 2025
cc78a96
[backend] added test for draft removal
JeremyCloarec Feb 4, 2025
69a7d29
[backend] added test for draft removal
JeremyCloarec Feb 4, 2025
5e269c3
[backend] fix removeFromDraft delete
JeremyCloarec Feb 6, 2025
e40064c
[backend] code refactor
JeremyCloarec Feb 6, 2025
ff2e2e7
[backend] code refactor
JeremyCloarec Feb 6, 2025
fe8df6a
[frontend] Fix remove from draft in toolbar
SouadHadjiat Feb 6, 2025
0e10e6d
[backend] fix remove from draft
JeremyCloarec Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2511,6 +2511,7 @@
"Remove": "Entfernen",
"Remove attribute": "Attribut entfernen",
"Remove Filigran logos": "Filigran-Logos entfernen",
"Remove from draft": "Aus dem Entwurf entfernen",
"Remove from the container": "Aus dem Container entfernen",
"Remove from this entity": "Aus dieser Entität entfernen",
"Remove from this object": "Aus diesem Objekt entfernen",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2513,6 +2513,7 @@
"Remove": "Remove",
"Remove attribute": "Remove attribute",
"Remove Filigran logos": "Remove Filigran logos",
"Remove from draft": "Remove from draft",
"Remove from the container": "Remove from the container",
"Remove from this entity": "Remove from this entity",
"Remove from this object": "Remove from this object",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -2511,6 +2511,7 @@
"Remove": "Borrar",
"Remove attribute": "Quitar atributo",
"Remove Filigran logos": "Quitar logos Filigran",
"Remove from draft": "Eliminar del borrador",
"Remove from the container": "Borrar del contenedor",
"Remove from this entity": "Quitar esta entidad",
"Remove from this object": "Quitar este objeto",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2511,6 +2511,7 @@
"Remove": "Retirer",
"Remove attribute": "Supprimer un attribut",
"Remove Filigran logos": "Supprimer les logos Filigran",
"Remove from draft": "Retirer du projet",
"Remove from the container": "Retirer de ce conteneur",
"Remove from this entity": "Retirer de cette entité",
"Remove from this object": "Retirer de cet objet",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -2511,6 +2511,7 @@
"Remove": "解除",
"Remove attribute": "属性の削除",
"Remove Filigran logos": "フィリグランロゴの削除",
"Remove from draft": "ドラフトから削除",
"Remove from the container": "コンテナから削除する",
"Remove from this entity": "このエンティティから削除する",
"Remove from this object": "このオブジェクトから削除する",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -2511,6 +2511,7 @@
"Remove": "제거",
"Remove attribute": "속성 제거",
"Remove Filigran logos": "Filigran 로고 제거",
"Remove from draft": "초안에서 제거",
"Remove from the container": "컨테이너에서 제거",
"Remove from this entity": "이 엔터티에서 제거",
"Remove from this object": "이 객체에서 제거",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -2511,6 +2511,7 @@
"Remove": "移除",
"Remove attribute": "删除属性",
"Remove Filigran logos": "移除 Filigran 标识",
"Remove from draft": "从草案中删除",
"Remove from the container": "从容器中取出",
"Remove from this entity": "从该实体中移除",
"Remove from this object": "从该对象中移除",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ type DataTableInternalToolbarProps = Pick<DataTableProps,
| 'toolbarFilters'
| 'handleCopy'
| 'removeAuthMembersEnabled'
| 'removeFromDraftEnabled'
> & {
taskScope?: string
globalSearch?: string;
Expand All @@ -115,6 +116,7 @@ const DataTableInternalToolbar = ({
toolbarFilters,
globalSearch,
removeAuthMembersEnabled,
removeFromDraftEnabled,
}: DataTableInternalToolbarProps) => {
const theme = useTheme<Theme>();

Expand Down Expand Up @@ -150,6 +152,7 @@ const DataTableInternalToolbar = ({
taskScope={taskScope}
handleCopy={handleCopy}
removeAuthMembersEnabled={removeAuthMembersEnabled}
removeFromDraftEnabled={removeFromDraftEnabled}
/>
</div>
);
Expand Down Expand Up @@ -205,6 +208,7 @@ const DataTable = (props: OCTIDataTableProps) => {
hideFilters,
taskScope,
removeAuthMembersEnabled,
removeFromDraftEnabled,
} = props;

const settingsMessagesBannerHeight = useSettingsMessagesBannerHeight();
Expand Down Expand Up @@ -257,6 +261,7 @@ const DataTable = (props: OCTIDataTableProps) => {
toolbarFilters={toolbarFilters}
globalSearch={globalSearch}
removeAuthMembersEnabled={removeAuthMembersEnabled}
removeFromDraftEnabled={removeFromDraftEnabled}
/>
)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export interface DataTableProps {
disableToolBar?: boolean
disableSelectAll?: boolean
removeAuthMembersEnabled?: boolean
removeFromDraftEnabled?: boolean
selectOnLineClick?: boolean
onLineClick?: (line: any) => void
hideHeaders?: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ const defaultColumns: DataTableProps['dataColumns'] = {
isSortable: false,
render: ({ draftVersion }) => (
<ItemOperations
draftOperation={draftVersion.draft_operation}
draftOperation={draftVersion?.draft_operation}
/>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import Skeleton from '@mui/material/Skeleton';
import { AutoFix } from 'mdi-material-ui';
import Tooltip from '@mui/material/Tooltip';
import Checkbox from '@mui/material/Checkbox';
import withTheme from '@mui/styles/withTheme';
import inject18n from '../../../../components/i18n';
import ItemIcon from '../../../../components/ItemIcon';
import ItemConfidence from '../../../../components/ItemConfidence';
import StixCoreRelationshipPopover from './StixCoreRelationshipPopover';
import { getMainRepresentative } from '../../../../utils/defaultRepresentatives';
import ItemMarkings from '../../../../components/ItemMarkings';
import ItemEntityType from '../../../../components/ItemEntityType';
import { DraftChip } from '../draft/DraftChip';
import { DraftChip, getDraftModeColor } from '../draft/DraftChip';

const styles = (theme) => ({
item: {
Expand Down Expand Up @@ -55,6 +56,7 @@ class EntityStixCoreRelationshipLineAllComponent extends Component {
entityId,
fsd,
t,
theme,
classes,
dataColumns,
node,
Expand Down Expand Up @@ -97,7 +99,7 @@ class EntityStixCoreRelationshipLineAllComponent extends Component {
/>
</ListItemIcon>
<ListItemIcon classes={{ root: classes.itemIcon }}>
<ItemIcon type={node.entity_type} />
<ItemIcon type={node.entity_type} color={node.draftVersion ? getDraftModeColor(theme) : null } />
</ListItemIcon>
<ListItemText
primary={
Expand Down Expand Up @@ -221,6 +223,10 @@ const EntityStixCoreRelationshipLineAllFragment = createFragmentContainer(
node: graphql`
fragment EntityStixCoreRelationshipLineAll_node on StixCoreRelationship {
id
draftVersion {
draft_id
draft_operation
}
entity_type
parent_types
relationship_type
Expand Down Expand Up @@ -538,6 +544,7 @@ const EntityStixCoreRelationshipLineAllFragment = createFragmentContainer(
export const EntityStixCoreRelationshipLineAll = R.compose(
inject18n,
withStyles(styles),
withTheme,
)(EntityStixCoreRelationshipLineAllFragment);

class EntityStixCoreRelationshipLineAllDummyComponent extends Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import Skeleton from '@mui/material/Skeleton';
import { AutoFix } from 'mdi-material-ui';
import Tooltip from '@mui/material/Tooltip';
import Checkbox from '@mui/material/Checkbox';
import withTheme from '@mui/styles/withTheme';
import inject18n from '../../../../components/i18n';
import ItemIcon from '../../../../components/ItemIcon';
import ItemConfidence from '../../../../components/ItemConfidence';
import StixCoreRelationshipPopover from './StixCoreRelationshipPopover';
import { getMainRepresentative } from '../../../../utils/defaultRepresentatives';
import ItemMarkings from '../../../../components/ItemMarkings';
import ItemEntityType from '../../../../components/ItemEntityType';
import { DraftChip } from '../draft/DraftChip';
import { DraftChip, getDraftModeColor } from '../draft/DraftChip';

const styles = (theme) => ({
item: {
Expand Down Expand Up @@ -58,6 +59,7 @@ class EntityStixCoreRelationshipLineFromComponent extends Component {
const {
fsd,
t,
theme,
classes,
dataColumns,
node,
Expand Down Expand Up @@ -99,7 +101,7 @@ class EntityStixCoreRelationshipLineFromComponent extends Component {
/>
</ListItemIcon>
<ListItemIcon classes={{ root: classes.itemIcon }}>
<ItemIcon type={node.entity_type} />
<ItemIcon type={node.entity_type} color={node.draftVersion ? getDraftModeColor(theme) : null } />
</ListItemIcon>
<ListItemText
primary={
Expand Down Expand Up @@ -222,6 +224,10 @@ const EntityStixCoreRelationshipLineFromFragment = createFragmentContainer(
node: graphql`
fragment EntityStixCoreRelationshipLineFrom_node on StixCoreRelationship {
id
draftVersion {
draft_id
draft_operation
}
entity_type
parent_types
relationship_type
Expand Down Expand Up @@ -571,6 +577,7 @@ const EntityStixCoreRelationshipLineFromFragment = createFragmentContainer(
export const EntityStixCoreRelationshipLineFrom = R.compose(
inject18n,
withStyles(styles),
withTheme,
)(EntityStixCoreRelationshipLineFromFragment);

class EntityStixCoreRelationshipLineFromDummyComponent extends Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import { AutoFix } from 'mdi-material-ui';
import Skeleton from '@mui/material/Skeleton';
import Tooltip from '@mui/material/Tooltip';
import Checkbox from '@mui/material/Checkbox';
import withTheme from '@mui/styles/withTheme';
import inject18n from '../../../../components/i18n';
import ItemIcon from '../../../../components/ItemIcon';
import ItemConfidence from '../../../../components/ItemConfidence';
import StixCoreRelationshipPopover from './StixCoreRelationshipPopover';
import { getMainRepresentative } from '../../../../utils/defaultRepresentatives';
import ItemMarkings from '../../../../components/ItemMarkings';
import ItemEntityType from '../../../../components/ItemEntityType';
import { DraftChip } from '../draft/DraftChip';
import { DraftChip, getDraftModeColor } from '../draft/DraftChip';

const styles = (theme) => ({
item: {
Expand Down Expand Up @@ -54,6 +55,7 @@ class EntityStixCoreRelationshipLineToComponent extends Component {
const {
fsd,
t,
theme,
classes,
dataColumns,
node,
Expand Down Expand Up @@ -94,7 +96,7 @@ class EntityStixCoreRelationshipLineToComponent extends Component {
/>
</ListItemIcon>
<ListItemIcon classes={{ root: classes.itemIcon }}>
<ItemIcon type={node.entity_type} />
<ItemIcon type={node.entity_type} color={node.draftVersion ? getDraftModeColor(theme) : null } />
</ListItemIcon>
<ListItemText
primary={
Expand Down Expand Up @@ -216,6 +218,10 @@ const EntityStixCoreRelationshipLineToFragment = createFragmentContainer(
node: graphql`
fragment EntityStixCoreRelationshipLineTo_node on StixCoreRelationship {
id
draftVersion {
draft_id
draft_operation
}
entity_type
parent_types
relationship_type
Expand Down Expand Up @@ -569,6 +575,7 @@ const EntityStixCoreRelationshipLineToFragment = createFragmentContainer(
export const EntityStixCoreRelationshipLineTo = R.compose(
inject18n,
withStyles(styles),
withTheme,
)(EntityStixCoreRelationshipLineToFragment);

class EntityStixCoreRelationshipLineToDummyComponent extends Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { compose } from 'ramda';
import { Link } from 'react-router-dom';
import { graphql, createFragmentContainer } from 'react-relay';
import withStyles from '@mui/styles/withStyles';
import withTheme from '@mui/styles/withTheme';
import ListItem from '@mui/material/ListItem';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
Expand All @@ -13,7 +14,7 @@ import { AutoFix } from 'mdi-material-ui';
import Skeleton from '@mui/material/Skeleton';
import Tooltip from '@mui/material/Tooltip';
import * as R from 'ramda';
import { DraftChip } from '../draft/DraftChip';
import { DraftChip, getDraftModeColor } from '../draft/DraftChip';
import inject18n from '../../../../components/i18n';
import ItemConfidence from '../../../../components/ItemConfidence';
import StixCoreRelationshipPopover from './StixCoreRelationshipPopover';
Expand Down Expand Up @@ -56,6 +57,7 @@ class SimpleStixObjectOrStixRelationshipStixCoreRelationshipLineComponent extend
fsd,
t,
classes,
theme,
dataColumns,
node,
paginationOptions,
Expand All @@ -72,6 +74,7 @@ class SimpleStixObjectOrStixRelationshipStixCoreRelationshipLineComponent extend
name: 'Restricted',
restricted: true,
};
const draftColor = getDraftModeColor(theme);
return (
<ListItem
classes={{ root: classes.item }}
Expand All @@ -81,7 +84,7 @@ class SimpleStixObjectOrStixRelationshipStixCoreRelationshipLineComponent extend
to={link}
>
<ListItemIcon classes={{ root: classes.itemIcon }}>
<ItemIcon type={node.entity_type} isReversed={isReversed} />
<ItemIcon type={node.entity_type} isReversed={isReversed} color={node.draftVersion ? draftColor : null} />
</ListItemIcon>
<ListItemText
primary={
Expand Down Expand Up @@ -183,6 +186,10 @@ const SimpleStixObjectOrStixRelationshipStixCoreRelationshipLineFragment = creat
node: graphql`
fragment SimpleStixObjectOrStixRelationshipStixCoreRelationshipLine_node on StixCoreRelationship {
id
draftVersion {
draft_id
draft_operation
}
entity_type
parent_types
relationship_type
Expand Down Expand Up @@ -684,6 +691,7 @@ const SimpleStixObjectOrStixRelationshipStixCoreRelationshipLineFragment = creat
export const SimpleStixObjectOrStixRelationshipStixCoreRelationshipLine = compose(
inject18n,
withStyles(styles),
withTheme,
)(SimpleStixObjectOrStixRelationshipStixCoreRelationshipLineFragment);

class SimpleStixObjectOrStixRelationshipStixCoreRelationshipLineDummyComponent extends Component {
Expand Down
Loading