9018 fix batch delete follow ups (#9166)

Follow ups on #9018
This commit is contained in:
Raphaël Bosi
2024-12-20 11:41:09 +01:00
committed by GitHub
parent 2437572a5c
commit 1acf845101
19 changed files with 93 additions and 47 deletions

View File

@ -1,3 +1,4 @@
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
import { useActionMenuEntries } from '@/action-menu/hooks/useActionMenuEntries'; import { useActionMenuEntries } from '@/action-menu/hooks/useActionMenuEntries';
import { import {
@ -94,7 +95,7 @@ export const useDeleteMultipleRecordsAction = ({
addActionMenuEntry({ addActionMenuEntry({
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'delete-multiple-records', key: MultipleRecordsActionKeys.DELETE,
label: 'Delete records', label: 'Delete records',
shortLabel: 'Delete', shortLabel: 'Delete',
position, position,

View File

@ -2,6 +2,7 @@ import { useActionMenuEntries } from '@/action-menu/hooks/useActionMenuEntries';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { IconDatabaseExport } from 'twenty-ui'; import { IconDatabaseExport } from 'twenty-ui';
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
import { import {
ActionMenuEntryScope, ActionMenuEntryScope,
ActionMenuEntryType, ActionMenuEntryType,
@ -33,7 +34,7 @@ export const useExportMultipleRecordsAction = ({
addActionMenuEntry({ addActionMenuEntry({
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'export-multiple-records', key: MultipleRecordsActionKeys.EXPORT,
position, position,
label: displayedExportProgress(progress), label: displayedExportProgress(progress),
shortLabel: 'Export', shortLabel: 'Export',

View File

@ -0,0 +1,4 @@
export enum MultipleRecordsActionKeys {
DELETE = 'delete-multiple-records',
EXPORT = 'export-multiple-records',
}

View File

@ -2,6 +2,7 @@ import { useActionMenuEntries } from '@/action-menu/hooks/useActionMenuEntries';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { IconDatabaseExport } from 'twenty-ui'; import { IconDatabaseExport } from 'twenty-ui';
import { NoSelectionRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKey';
import { import {
ActionMenuEntryScope, ActionMenuEntryScope,
ActionMenuEntryType, ActionMenuEntryType,
@ -33,7 +34,7 @@ export const useExportViewNoSelectionRecordAction = ({
addActionMenuEntry({ addActionMenuEntry({
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.Global, scope: ActionMenuEntryScope.Global,
key: 'export-view-no-selection', key: NoSelectionRecordActionKeys.EXPORT_VIEW,
position, position,
label: displayedExportProgress(progress), label: displayedExportProgress(progress),
Icon: IconDatabaseExport, Icon: IconDatabaseExport,

View File

@ -0,0 +1,3 @@
export enum NoSelectionRecordActionKeys {
EXPORT_VIEW = 'export-view-no-selection',
}

View File

@ -1,6 +1,7 @@
import { useAddToFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useAddToFavoritesSingleRecordAction'; import { useAddToFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useAddToFavoritesSingleRecordAction';
import { useDeleteSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useDeleteSingleRecordAction'; import { useDeleteSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useDeleteSingleRecordAction';
import { useRemoveFromFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useRemoveFromFavoritesSingleRecordAction'; import { useRemoveFromFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useRemoveFromFavoritesSingleRecordAction';
import { SingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey';
import { ActionAvailableOn } from '@/action-menu/actions/types/actionAvailableOn'; import { ActionAvailableOn } from '@/action-menu/actions/types/actionAvailableOn';
import { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook'; import { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook';
import { import {
@ -19,7 +20,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V1: Record<
addToFavoritesSingleRecord: { addToFavoritesSingleRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'add-to-favorites-single-record', key: SingleRecordActionKeys.ADD_TO_FAVORITES,
label: 'Add to favorites', label: 'Add to favorites',
position: 0, position: 0,
Icon: IconHeart, Icon: IconHeart,
@ -32,7 +33,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V1: Record<
removeFromFavoritesSingleRecord: { removeFromFavoritesSingleRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'remove-from-favorites-single-record', key: SingleRecordActionKeys.REMOVE_FROM_FAVORITES,
label: 'Remove from favorites', label: 'Remove from favorites',
position: 1, position: 1,
Icon: IconHeartOff, Icon: IconHeartOff,
@ -45,7 +46,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V1: Record<
deleteSingleRecord: { deleteSingleRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'delete-single-record', key: SingleRecordActionKeys.DELETE,
label: 'Delete', label: 'Delete',
position: 2, position: 2,
Icon: IconTrash, Icon: IconTrash,

View File

@ -4,6 +4,7 @@ import { useDestroySingleRecordAction } from '@/action-menu/actions/record-actio
import { useNavigateToNextRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToNextRecordSingleRecordAction'; import { useNavigateToNextRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToNextRecordSingleRecordAction';
import { useNavigateToPreviousRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToPreviousRecordSingleRecordAction'; import { useNavigateToPreviousRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToPreviousRecordSingleRecordAction';
import { useRemoveFromFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useRemoveFromFavoritesSingleRecordAction'; import { useRemoveFromFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useRemoveFromFavoritesSingleRecordAction';
import { SingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey';
import { ActionAvailableOn } from '@/action-menu/actions/types/actionAvailableOn'; import { ActionAvailableOn } from '@/action-menu/actions/types/actionAvailableOn';
import { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook'; import { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook';
import { import {
@ -29,7 +30,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record<
addToFavoritesSingleRecord: { addToFavoritesSingleRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'add-to-favorites-single-record', key: SingleRecordActionKeys.ADD_TO_FAVORITES,
label: 'Add to favorites', label: 'Add to favorites',
shortLabel: 'Add to favorites', shortLabel: 'Add to favorites',
position: 0, position: 0,
@ -44,7 +45,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record<
removeFromFavoritesSingleRecord: { removeFromFavoritesSingleRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'remove-from-favorites-single-record', key: SingleRecordActionKeys.REMOVE_FROM_FAVORITES,
label: 'Remove from favorites', label: 'Remove from favorites',
shortLabel: 'Remove from favorites', shortLabel: 'Remove from favorites',
isPinned: true, isPinned: true,
@ -59,7 +60,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record<
deleteSingleRecord: { deleteSingleRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'delete-single-record', key: SingleRecordActionKeys.DELETE,
label: 'Delete record', label: 'Delete record',
shortLabel: 'Delete', shortLabel: 'Delete',
position: 2, position: 2,
@ -75,7 +76,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record<
destroySingleRecord: { destroySingleRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'destroy-single-record', key: SingleRecordActionKeys.DESTROY,
label: 'Permanently destroy record', label: 'Permanently destroy record',
shortLabel: 'Destroy', shortLabel: 'Destroy',
position: 3, position: 3,
@ -91,7 +92,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record<
navigateToPreviousRecord: { navigateToPreviousRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'navigate-to-previous-record', key: SingleRecordActionKeys.NAVIGATE_TO_PREVIOUS_RECORD,
label: 'Navigate to previous record', label: 'Navigate to previous record',
shortLabel: '', shortLabel: '',
position: 4, position: 4,
@ -103,7 +104,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record<
navigateToNextRecord: { navigateToNextRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'navigate-to-next-record', key: SingleRecordActionKeys.NAVIGATE_TO_NEXT_RECORD,
label: 'Navigate to next record', label: 'Navigate to next record',
shortLabel: '', shortLabel: '',
position: 5, position: 5,

View File

@ -0,0 +1,8 @@
export enum SingleRecordActionKeys {
DELETE = 'delete-single-record',
DESTROY = 'destroy-single-record',
ADD_TO_FAVORITES = 'add-to-favorites-single-record',
REMOVE_FROM_FAVORITES = 'remove-from-favorites-single-record',
NAVIGATE_TO_NEXT_RECORD = 'navigate-to-next-record-single-record',
NAVIGATE_TO_PREVIOUS_RECORD = 'navigate-to-previous-record-single-record',
}

View File

@ -1,5 +1,6 @@
import { useNavigateToNextRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToNextRecordSingleRecordAction'; import { useNavigateToNextRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToNextRecordSingleRecordAction';
import { useNavigateToPreviousRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToPreviousRecordSingleRecordAction'; import { useNavigateToPreviousRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToPreviousRecordSingleRecordAction';
import { SingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey';
import { useActivateDraftWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useActivateDraftWorkflowSingleRecordAction'; import { useActivateDraftWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useActivateDraftWorkflowSingleRecordAction';
import { useActivateLastPublishedVersionWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useActivateLastPublishedVersionWorkflowSingleRecordAction'; import { useActivateLastPublishedVersionWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useActivateLastPublishedVersionWorkflowSingleRecordAction';
import { useDeactivateWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useDeactivateWorkflowSingleRecordAction'; import { useDeactivateWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useDeactivateWorkflowSingleRecordAction';
@ -8,6 +9,7 @@ import { useSeeActiveVersionWorkflowSingleRecordAction } from '@/action-menu/act
import { useSeeRunsWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useSeeRunsWorkflowSingleRecordAction'; import { useSeeRunsWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useSeeRunsWorkflowSingleRecordAction';
import { useSeeVersionsWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useSeeVersionsWorkflowSingleRecordAction'; import { useSeeVersionsWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useSeeVersionsWorkflowSingleRecordAction';
import { useTestWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useTestWorkflowSingleRecordAction'; import { useTestWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useTestWorkflowSingleRecordAction';
import { WorkflowSingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/workflow-actions/types/WorkflowSingleRecordActionsKeys';
import { ActionAvailableOn } from '@/action-menu/actions/types/actionAvailableOn'; import { ActionAvailableOn } from '@/action-menu/actions/types/actionAvailableOn';
import { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook'; import { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook';
import { import {
@ -33,7 +35,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record<
} }
> = { > = {
activateWorkflowDraftSingleRecord: { activateWorkflowDraftSingleRecord: {
key: 'activate-workflow-draft-single-record', key: WorkflowSingleRecordActionKeys.ACTIVATE_DRAFT,
label: 'Activate Draft', label: 'Activate Draft',
shortLabel: 'Activate Draft', shortLabel: 'Activate Draft',
isPinned: true, isPinned: true,
@ -48,7 +50,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record<
actionHook: useActivateDraftWorkflowSingleRecordAction, actionHook: useActivateDraftWorkflowSingleRecordAction,
}, },
activateWorkflowLastPublishedVersionSingleRecord: { activateWorkflowLastPublishedVersionSingleRecord: {
key: 'activate-workflow-last-published-version-single-record', key: WorkflowSingleRecordActionKeys.ACTIVATE_LAST_PUBLISHED,
label: 'Activate last published version', label: 'Activate last published version',
shortLabel: 'Activate last version', shortLabel: 'Activate last version',
isPinned: true, isPinned: true,
@ -63,7 +65,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record<
actionHook: useActivateLastPublishedVersionWorkflowSingleRecordAction, actionHook: useActivateLastPublishedVersionWorkflowSingleRecordAction,
}, },
deactivateWorkflowSingleRecord: { deactivateWorkflowSingleRecord: {
key: 'deactivate-workflow-single-record', key: WorkflowSingleRecordActionKeys.DEACTIVATE,
label: 'Deactivate Workflow', label: 'Deactivate Workflow',
shortLabel: 'Deactivate', shortLabel: 'Deactivate',
isPinned: true, isPinned: true,
@ -78,7 +80,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record<
actionHook: useDeactivateWorkflowSingleRecordAction, actionHook: useDeactivateWorkflowSingleRecordAction,
}, },
discardWorkflowDraftSingleRecord: { discardWorkflowDraftSingleRecord: {
key: 'discard-workflow-draft-single-record', key: WorkflowSingleRecordActionKeys.DISCARD_DRAFT,
label: 'Discard Draft', label: 'Discard Draft',
shortLabel: 'Discard Draft', shortLabel: 'Discard Draft',
isPinned: true, isPinned: true,
@ -93,7 +95,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record<
actionHook: useDiscardDraftWorkflowSingleRecordAction, actionHook: useDiscardDraftWorkflowSingleRecordAction,
}, },
seeWorkflowActiveVersionSingleRecord: { seeWorkflowActiveVersionSingleRecord: {
key: 'see-workflow-active-version-single-record', key: WorkflowSingleRecordActionKeys.SEE_ACTIVE_VERSION,
label: 'See active version', label: 'See active version',
shortLabel: 'See active version', shortLabel: 'See active version',
isPinned: false, isPinned: false,
@ -108,7 +110,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record<
actionHook: useSeeActiveVersionWorkflowSingleRecordAction, actionHook: useSeeActiveVersionWorkflowSingleRecordAction,
}, },
seeWorkflowRunsSingleRecord: { seeWorkflowRunsSingleRecord: {
key: 'see-workflow-runs-single-record', key: WorkflowSingleRecordActionKeys.SEE_RUNS,
label: 'See runs', label: 'See runs',
shortLabel: 'See runs', shortLabel: 'See runs',
isPinned: false, isPinned: false,
@ -123,7 +125,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record<
actionHook: useSeeRunsWorkflowSingleRecordAction, actionHook: useSeeRunsWorkflowSingleRecordAction,
}, },
seeWorkflowVersionsHistorySingleRecord: { seeWorkflowVersionsHistorySingleRecord: {
key: 'see-workflow-versions-history-single-record', key: WorkflowSingleRecordActionKeys.SEE_VERSIONS,
label: 'See versions history', label: 'See versions history',
shortLabel: 'See versions', shortLabel: 'See versions',
isPinned: false, isPinned: false,
@ -138,7 +140,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record<
actionHook: useSeeVersionsWorkflowSingleRecordAction, actionHook: useSeeVersionsWorkflowSingleRecordAction,
}, },
testWorkflowSingleRecord: { testWorkflowSingleRecord: {
key: 'test-workflow-single-record', key: WorkflowSingleRecordActionKeys.TEST,
label: 'Test Workflow', label: 'Test Workflow',
shortLabel: 'Test', shortLabel: 'Test',
isPinned: true, isPinned: true,
@ -155,7 +157,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record<
navigateToPreviousRecord: { navigateToPreviousRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'navigate-to-previous-record', key: SingleRecordActionKeys.NAVIGATE_TO_PREVIOUS_RECORD,
label: 'Navigate to previous workflow', label: 'Navigate to previous workflow',
shortLabel: '', shortLabel: '',
position: 9, position: 9,
@ -166,7 +168,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record<
navigateToNextRecord: { navigateToNextRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'navigate-to-next-record', key: SingleRecordActionKeys.NAVIGATE_TO_NEXT_RECORD,
label: 'Navigate to next workflow', label: 'Navigate to next workflow',
shortLabel: '', shortLabel: '',
position: 10, position: 10,

View File

@ -0,0 +1,10 @@
export enum WorkflowSingleRecordActionKeys {
ACTIVATE_DRAFT = 'activate-draft-workflow-single-record',
ACTIVATE_LAST_PUBLISHED = 'activate-last-published-workflow-single-record',
DEACTIVATE = 'deactivate-workflow-single-record',
DISCARD_DRAFT = 'discard-draft-workflow-single-record',
SEE_ACTIVE_VERSION = 'see-active-version-workflow-single-record',
SEE_RUNS = 'see-runs-workflow-single-record',
SEE_VERSIONS = 'see-versions-workflow-single-record',
TEST = 'test-workflow-single-record',
}

View File

@ -1,8 +1,10 @@
import { useNavigateToNextRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToNextRecordSingleRecordAction'; import { useNavigateToNextRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToNextRecordSingleRecordAction';
import { useNavigateToPreviousRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToPreviousRecordSingleRecordAction'; import { useNavigateToPreviousRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToPreviousRecordSingleRecordAction';
import { useSeeExecutionsWorkflowVersionSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useSeeExecutionsWorkflowVersionSingleRecordAction'; import { SingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey';
import { useSeeRunsWorkflowVersionSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useSeeRunsWorkflowVersionSingleRecordAction';
import { useSeeVersionsWorkflowVersionSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useSeeVersionsWorkflowVersionSingleRecordAction'; import { useSeeVersionsWorkflowVersionSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useSeeVersionsWorkflowVersionSingleRecordAction';
import { useUseAsDraftWorkflowVersionSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useUseAsDraftWorkflowVersionSingleRecordAction'; import { useUseAsDraftWorkflowVersionSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useUseAsDraftWorkflowVersionSingleRecordAction';
import { WorkflowVersionSingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/workflow-version-actions/types/WorkflowVersionSingleRecordActionsKeys';
import { ActionAvailableOn } from '@/action-menu/actions/types/actionAvailableOn'; import { ActionAvailableOn } from '@/action-menu/actions/types/actionAvailableOn';
import { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook'; import { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook';
import { import {
@ -25,7 +27,7 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record<
} }
> = { > = {
useAsDraftWorkflowVersionSingleRecord: { useAsDraftWorkflowVersionSingleRecord: {
key: 'use-as-draft-workflow-version-single-record', key: WorkflowVersionSingleRecordActionKeys.USE_AS_DRAFT,
label: 'Use as draft', label: 'Use as draft',
position: 1, position: 1,
isPinned: true, isPinned: true,
@ -38,9 +40,9 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record<
], ],
actionHook: useUseAsDraftWorkflowVersionSingleRecordAction, actionHook: useUseAsDraftWorkflowVersionSingleRecordAction,
}, },
seeWorkflowExecutionsSingleRecord: { seeWorkflowRunsSingleRecord: {
key: 'see-workflow-executions-single-record', key: WorkflowVersionSingleRecordActionKeys.SEE_RUNS,
label: 'See executions', label: 'See runs',
position: 2, position: 2,
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
@ -49,10 +51,10 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record<
ActionAvailableOn.SHOW_PAGE, ActionAvailableOn.SHOW_PAGE,
ActionAvailableOn.INDEX_PAGE_SINGLE_RECORD_SELECTION, ActionAvailableOn.INDEX_PAGE_SINGLE_RECORD_SELECTION,
], ],
actionHook: useSeeExecutionsWorkflowVersionSingleRecordAction, actionHook: useSeeRunsWorkflowVersionSingleRecordAction,
}, },
seeWorkflowVersionsHistorySingleRecord: { seeWorkflowVersionsHistorySingleRecord: {
key: 'see-workflow-versions-history-single-record', key: WorkflowVersionSingleRecordActionKeys.SEE_VERSIONS,
label: 'See versions history', label: 'See versions history',
position: 3, position: 3,
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
@ -67,7 +69,7 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record<
navigateToPreviousRecord: { navigateToPreviousRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'navigate-to-previous-record', key: SingleRecordActionKeys.NAVIGATE_TO_PREVIOUS_RECORD,
label: 'Navigate to previous version', label: 'Navigate to previous version',
shortLabel: '', shortLabel: '',
position: 9, position: 9,
@ -78,7 +80,7 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record<
navigateToNextRecord: { navigateToNextRecord: {
type: ActionMenuEntryType.Standard, type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection, scope: ActionMenuEntryScope.RecordSelection,
key: 'navigate-to-next-record', key: SingleRecordActionKeys.NAVIGATE_TO_NEXT_RECORD,
label: 'Navigate to next version', label: 'Navigate to next version',
shortLabel: '', shortLabel: '',
position: 10, position: 10,

View File

@ -9,7 +9,7 @@ import { useNavigate } from 'react-router-dom';
import { useRecoilValue } from 'recoil'; import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-ui'; import { isDefined } from 'twenty-ui';
export const useSeeExecutionsWorkflowVersionSingleRecordAction: SingleRecordActionHookWithoutObjectMetadataItem = export const useSeeRunsWorkflowVersionSingleRecordAction: SingleRecordActionHookWithoutObjectMetadataItem =
({ recordId }) => { ({ recordId }) => {
const workflowVersion = useRecoilValue(recordStoreFamilyState(recordId)); const workflowVersion = useRecoilValue(recordStoreFamilyState(recordId));

View File

@ -0,0 +1,5 @@
export enum WorkflowVersionSingleRecordActionKeys {
SEE_RUNS = 'see-runs-workflow-version-single-record',
SEE_VERSIONS = 'see-versions-workflow-version-single-record',
USE_AS_DRAFT = 'use-as-draft-workflow-version-single-record',
}

View File

@ -1,4 +1,5 @@
import { RecordActionMenuEntriesSetter } from '@/action-menu/actions/record-actions/components/RecordActionMenuEntriesSetter'; import { RecordActionMenuEntriesSetter } from '@/action-menu/actions/record-actions/components/RecordActionMenuEntriesSetter';
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
import { RecordAgnosticActionsSetterEffect } from '@/action-menu/actions/record-agnostic-actions/components/RecordAgnosticActionsSetterEffect'; import { RecordAgnosticActionsSetterEffect } from '@/action-menu/actions/record-agnostic-actions/components/RecordAgnosticActionsSetterEffect';
import { ActionMenuConfirmationModals } from '@/action-menu/components/ActionMenuConfirmationModals'; import { ActionMenuConfirmationModals } from '@/action-menu/components/ActionMenuConfirmationModals';
import { RecordIndexActionMenuBar } from '@/action-menu/components/RecordIndexActionMenuBar'; import { RecordIndexActionMenuBar } from '@/action-menu/components/RecordIndexActionMenuBar';
@ -39,12 +40,12 @@ export const RecordIndexActionMenu = ({ indexId }: { indexId: string }) => {
value={{ value={{
isInRightDrawer: false, isInRightDrawer: false,
onActionStartedCallback: (action) => { onActionStartedCallback: (action) => {
if (action.key === 'delete-multiple-records') { if (action.key === MultipleRecordsActionKeys.DELETE) {
setIsLoadMoreLocked(true); setIsLoadMoreLocked(true);
} }
}, },
onActionExecutedCallback: (action) => { onActionExecutedCallback: (action) => {
if (action.key === 'delete-multiple-records') { if (action.key === MultipleRecordsActionKeys.DELETE) {
setIsLoadMoreLocked(false); setIsLoadMoreLocked(false);
} }
}, },

View File

@ -1,6 +1,5 @@
import { useApolloClient } from '@apollo/client'; import { useApolloClient } from '@apollo/client';
import { triggerUpdateRecordOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerUpdateRecordOptimisticEffect';
import { triggerUpdateRecordOptimisticEffectByBatch } from '@/apollo/optimistic-effect/utils/triggerUpdateRecordOptimisticEffectByBatch'; import { triggerUpdateRecordOptimisticEffectByBatch } from '@/apollo/optimistic-effect/utils/triggerUpdateRecordOptimisticEffectByBatch';
import { apiConfigState } from '@/client-config/states/apiConfigState'; import { apiConfigState } from '@/client-config/states/apiConfigState';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
@ -145,6 +144,9 @@ export const useDeleteManyRecords = ({
}, },
}) })
.catch((error: Error) => { .catch((error: Error) => {
const cachedRecordsWithConnection: RecordGqlNode[] = [];
const optimisticRecordsWithConnection: RecordGqlNode[] = [];
cachedRecords.forEach((cachedRecord) => { cachedRecords.forEach((cachedRecord) => {
if (isUndefinedOrNull(cachedRecord?.id)) { if (isUndefinedOrNull(cachedRecord?.id)) {
return; return;
@ -183,16 +185,21 @@ export const useDeleteManyRecords = ({
!optimisticRecordWithConnection || !optimisticRecordWithConnection ||
!cachedRecordWithConnection !cachedRecordWithConnection
) { ) {
return null; return;
} }
triggerUpdateRecordOptimisticEffect({ cachedRecordsWithConnection.push(cachedRecordWithConnection);
cache: apolloClient.cache, optimisticRecordsWithConnection.push(
objectMetadataItem, optimisticRecordWithConnection,
currentRecord: optimisticRecordWithConnection, );
updatedRecord: cachedRecordWithConnection, });
objectMetadataItems,
}); triggerUpdateRecordOptimisticEffectByBatch({
cache: apolloClient.cache,
objectMetadataItem,
currentRecords: optimisticRecordsWithConnection,
updatedRecords: cachedRecordsWithConnection,
objectMetadataItems,
}); });
throw error; throw error;

View File

@ -230,7 +230,6 @@ export const RecordIndexContainer = () => {
objectNamePlural={objectNamePlural} objectNamePlural={objectNamePlural}
viewBarId={recordIndexId} viewBarId={recordIndexId}
/> />
<RecordIndexTableContainerEffect />
</SpreadsheetImportProvider> </SpreadsheetImportProvider>
<RecordIndexFiltersToContextStoreEffect /> <RecordIndexFiltersToContextStoreEffect />
{recordIndexViewType === ViewType.Table && ( {recordIndexViewType === ViewType.Table && (

View File

@ -18,5 +18,5 @@ export enum MessageQueue {
testQueue = 'test-queue', testQueue = 'test-queue',
workflowQueue = 'workflow-queue', workflowQueue = 'workflow-queue',
serverlessFunctionQueue = 'serverless-function-queue', serverlessFunctionQueue = 'serverless-function-queue',
favoriteQueue = 'favorite-queue', deleteCascadeQueue = 'delete-cascade-queue',
} }

View File

@ -11,7 +11,7 @@ export type FavoriteDeletionJobData = {
}; };
@Processor({ @Processor({
queueName: MessageQueue.favoriteQueue, queueName: MessageQueue.deleteCascadeQueue,
scope: Scope.REQUEST, scope: Scope.REQUEST,
}) })
export class FavoriteDeletionJob { export class FavoriteDeletionJob {

View File

@ -15,7 +15,7 @@ import {
@Injectable() @Injectable()
export class FavoriteDeletionListener { export class FavoriteDeletionListener {
constructor( constructor(
@InjectMessageQueue(MessageQueue.favoriteQueue) @InjectMessageQueue(MessageQueue.deleteCascadeQueue)
private readonly messageQueueService: MessageQueueService, private readonly messageQueueService: MessageQueueService,
) {} ) {}