diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/hooks/useDeleteMultipleRecordsAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/hooks/useDeleteMultipleRecordsAction.tsx index d240e761c..4499caacd 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/hooks/useDeleteMultipleRecordsAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/hooks/useDeleteMultipleRecordsAction.tsx @@ -1,3 +1,4 @@ +import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys'; import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { useActionMenuEntries } from '@/action-menu/hooks/useActionMenuEntries'; import { @@ -94,7 +95,7 @@ export const useDeleteMultipleRecordsAction = ({ addActionMenuEntry({ type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'delete-multiple-records', + key: MultipleRecordsActionKeys.DELETE, label: 'Delete records', shortLabel: 'Delete', position, diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction.tsx index 935c34db1..67d6482db 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction.tsx @@ -2,6 +2,7 @@ import { useActionMenuEntries } from '@/action-menu/hooks/useActionMenuEntries'; import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { IconDatabaseExport } from 'twenty-ui'; +import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys'; import { ActionMenuEntryScope, ActionMenuEntryType, @@ -33,7 +34,7 @@ export const useExportMultipleRecordsAction = ({ addActionMenuEntry({ type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'export-multiple-records', + key: MultipleRecordsActionKeys.EXPORT, position, label: displayedExportProgress(progress), shortLabel: 'Export', diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys.ts new file mode 100644 index 000000000..9ecbb5b23 --- /dev/null +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys.ts @@ -0,0 +1,4 @@ +export enum MultipleRecordsActionKeys { + DELETE = 'delete-multiple-records', + EXPORT = 'export-multiple-records', +} diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/hooks/useExportViewNoSelectionRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/hooks/useExportViewNoSelectionRecordAction.tsx index 3bb7cebbb..e3ace2ee6 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/hooks/useExportViewNoSelectionRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/hooks/useExportViewNoSelectionRecordAction.tsx @@ -2,6 +2,7 @@ import { useActionMenuEntries } from '@/action-menu/hooks/useActionMenuEntries'; import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { IconDatabaseExport } from 'twenty-ui'; +import { NoSelectionRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKey'; import { ActionMenuEntryScope, ActionMenuEntryType, @@ -33,7 +34,7 @@ export const useExportViewNoSelectionRecordAction = ({ addActionMenuEntry({ type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.Global, - key: 'export-view-no-selection', + key: NoSelectionRecordActionKeys.EXPORT_VIEW, position, label: displayedExportProgress(progress), Icon: IconDatabaseExport, diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKey.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKey.ts new file mode 100644 index 000000000..1b56de13e --- /dev/null +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKey.ts @@ -0,0 +1,3 @@ +export enum NoSelectionRecordActionKeys { + EXPORT_VIEW = 'export-view-no-selection', +} diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/constants/DefaultSingleRecordActionsConfigV1.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/constants/DefaultSingleRecordActionsConfigV1.ts index db6512154..727ff0255 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/constants/DefaultSingleRecordActionsConfigV1.ts +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/constants/DefaultSingleRecordActionsConfigV1.ts @@ -1,6 +1,7 @@ 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 { 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 { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook'; import { @@ -19,7 +20,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V1: Record< addToFavoritesSingleRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'add-to-favorites-single-record', + key: SingleRecordActionKeys.ADD_TO_FAVORITES, label: 'Add to favorites', position: 0, Icon: IconHeart, @@ -32,7 +33,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V1: Record< removeFromFavoritesSingleRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'remove-from-favorites-single-record', + key: SingleRecordActionKeys.REMOVE_FROM_FAVORITES, label: 'Remove from favorites', position: 1, Icon: IconHeartOff, @@ -45,7 +46,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V1: Record< deleteSingleRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'delete-single-record', + key: SingleRecordActionKeys.DELETE, label: 'Delete', position: 2, Icon: IconTrash, diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/constants/DefaultSingleRecordActionsConfigV2.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/constants/DefaultSingleRecordActionsConfigV2.ts index b22f7e14f..d55a4b1e7 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/constants/DefaultSingleRecordActionsConfigV2.ts +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/constants/DefaultSingleRecordActionsConfigV2.ts @@ -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 { useNavigateToPreviousRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToPreviousRecordSingleRecordAction'; 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 { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook'; import { @@ -29,7 +30,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record< addToFavoritesSingleRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'add-to-favorites-single-record', + key: SingleRecordActionKeys.ADD_TO_FAVORITES, label: 'Add to favorites', shortLabel: 'Add to favorites', position: 0, @@ -44,7 +45,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record< removeFromFavoritesSingleRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'remove-from-favorites-single-record', + key: SingleRecordActionKeys.REMOVE_FROM_FAVORITES, label: 'Remove from favorites', shortLabel: 'Remove from favorites', isPinned: true, @@ -59,7 +60,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record< deleteSingleRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'delete-single-record', + key: SingleRecordActionKeys.DELETE, label: 'Delete record', shortLabel: 'Delete', position: 2, @@ -75,7 +76,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record< destroySingleRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'destroy-single-record', + key: SingleRecordActionKeys.DESTROY, label: 'Permanently destroy record', shortLabel: 'Destroy', position: 3, @@ -91,7 +92,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record< navigateToPreviousRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'navigate-to-previous-record', + key: SingleRecordActionKeys.NAVIGATE_TO_PREVIOUS_RECORD, label: 'Navigate to previous record', shortLabel: '', position: 4, @@ -103,7 +104,7 @@ export const DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: Record< navigateToNextRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'navigate-to-next-record', + key: SingleRecordActionKeys.NAVIGATE_TO_NEXT_RECORD, label: 'Navigate to next record', shortLabel: '', position: 5, diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey.ts new file mode 100644 index 000000000..536480576 --- /dev/null +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey.ts @@ -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', +} diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/constants/WorkflowSingleRecordActionsConfig.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/constants/WorkflowSingleRecordActionsConfig.ts index c168ffe54..da1176161 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/constants/WorkflowSingleRecordActionsConfig.ts +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/constants/WorkflowSingleRecordActionsConfig.ts @@ -1,5 +1,6 @@ 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 { 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 { 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'; @@ -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 { 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 { WorkflowSingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/workflow-actions/types/WorkflowSingleRecordActionsKeys'; import { ActionAvailableOn } from '@/action-menu/actions/types/actionAvailableOn'; import { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook'; import { @@ -33,7 +35,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record< } > = { activateWorkflowDraftSingleRecord: { - key: 'activate-workflow-draft-single-record', + key: WorkflowSingleRecordActionKeys.ACTIVATE_DRAFT, label: 'Activate Draft', shortLabel: 'Activate Draft', isPinned: true, @@ -48,7 +50,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record< actionHook: useActivateDraftWorkflowSingleRecordAction, }, activateWorkflowLastPublishedVersionSingleRecord: { - key: 'activate-workflow-last-published-version-single-record', + key: WorkflowSingleRecordActionKeys.ACTIVATE_LAST_PUBLISHED, label: 'Activate last published version', shortLabel: 'Activate last version', isPinned: true, @@ -63,7 +65,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record< actionHook: useActivateLastPublishedVersionWorkflowSingleRecordAction, }, deactivateWorkflowSingleRecord: { - key: 'deactivate-workflow-single-record', + key: WorkflowSingleRecordActionKeys.DEACTIVATE, label: 'Deactivate Workflow', shortLabel: 'Deactivate', isPinned: true, @@ -78,7 +80,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record< actionHook: useDeactivateWorkflowSingleRecordAction, }, discardWorkflowDraftSingleRecord: { - key: 'discard-workflow-draft-single-record', + key: WorkflowSingleRecordActionKeys.DISCARD_DRAFT, label: 'Discard Draft', shortLabel: 'Discard Draft', isPinned: true, @@ -93,7 +95,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record< actionHook: useDiscardDraftWorkflowSingleRecordAction, }, seeWorkflowActiveVersionSingleRecord: { - key: 'see-workflow-active-version-single-record', + key: WorkflowSingleRecordActionKeys.SEE_ACTIVE_VERSION, label: 'See active version', shortLabel: 'See active version', isPinned: false, @@ -108,7 +110,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record< actionHook: useSeeActiveVersionWorkflowSingleRecordAction, }, seeWorkflowRunsSingleRecord: { - key: 'see-workflow-runs-single-record', + key: WorkflowSingleRecordActionKeys.SEE_RUNS, label: 'See runs', shortLabel: 'See runs', isPinned: false, @@ -123,7 +125,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record< actionHook: useSeeRunsWorkflowSingleRecordAction, }, seeWorkflowVersionsHistorySingleRecord: { - key: 'see-workflow-versions-history-single-record', + key: WorkflowSingleRecordActionKeys.SEE_VERSIONS, label: 'See versions history', shortLabel: 'See versions', isPinned: false, @@ -138,7 +140,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record< actionHook: useSeeVersionsWorkflowSingleRecordAction, }, testWorkflowSingleRecord: { - key: 'test-workflow-single-record', + key: WorkflowSingleRecordActionKeys.TEST, label: 'Test Workflow', shortLabel: 'Test', isPinned: true, @@ -155,7 +157,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record< navigateToPreviousRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'navigate-to-previous-record', + key: SingleRecordActionKeys.NAVIGATE_TO_PREVIOUS_RECORD, label: 'Navigate to previous workflow', shortLabel: '', position: 9, @@ -166,7 +168,7 @@ export const WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG: Record< navigateToNextRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'navigate-to-next-record', + key: SingleRecordActionKeys.NAVIGATE_TO_NEXT_RECORD, label: 'Navigate to next workflow', shortLabel: '', position: 10, diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/types/WorkflowSingleRecordActionsKeys.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/types/WorkflowSingleRecordActionsKeys.ts new file mode 100644 index 000000000..f40dc9f96 --- /dev/null +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/types/WorkflowSingleRecordActionsKeys.ts @@ -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', +} diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/constants/WorkflowVersionsSingleRecordActionsConfig.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/constants/WorkflowVersionsSingleRecordActionsConfig.ts index 659d0e166..c12d9ea6a 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/constants/WorkflowVersionsSingleRecordActionsConfig.ts +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/constants/WorkflowVersionsSingleRecordActionsConfig.ts @@ -1,8 +1,10 @@ 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 { 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 { 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 { SingleRecordActionHook } from '@/action-menu/actions/types/singleRecordActionHook'; import { @@ -25,7 +27,7 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record< } > = { useAsDraftWorkflowVersionSingleRecord: { - key: 'use-as-draft-workflow-version-single-record', + key: WorkflowVersionSingleRecordActionKeys.USE_AS_DRAFT, label: 'Use as draft', position: 1, isPinned: true, @@ -38,9 +40,9 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record< ], actionHook: useUseAsDraftWorkflowVersionSingleRecordAction, }, - seeWorkflowExecutionsSingleRecord: { - key: 'see-workflow-executions-single-record', - label: 'See executions', + seeWorkflowRunsSingleRecord: { + key: WorkflowVersionSingleRecordActionKeys.SEE_RUNS, + label: 'See runs', position: 2, type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, @@ -49,10 +51,10 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record< ActionAvailableOn.SHOW_PAGE, ActionAvailableOn.INDEX_PAGE_SINGLE_RECORD_SELECTION, ], - actionHook: useSeeExecutionsWorkflowVersionSingleRecordAction, + actionHook: useSeeRunsWorkflowVersionSingleRecordAction, }, seeWorkflowVersionsHistorySingleRecord: { - key: 'see-workflow-versions-history-single-record', + key: WorkflowVersionSingleRecordActionKeys.SEE_VERSIONS, label: 'See versions history', position: 3, type: ActionMenuEntryType.Standard, @@ -67,7 +69,7 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record< navigateToPreviousRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'navigate-to-previous-record', + key: SingleRecordActionKeys.NAVIGATE_TO_PREVIOUS_RECORD, label: 'Navigate to previous version', shortLabel: '', position: 9, @@ -78,7 +80,7 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record< navigateToNextRecord: { type: ActionMenuEntryType.Standard, scope: ActionMenuEntryScope.RecordSelection, - key: 'navigate-to-next-record', + key: SingleRecordActionKeys.NAVIGATE_TO_NEXT_RECORD, label: 'Navigate to next version', shortLabel: '', position: 10, diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useSeeExecutionsWorkflowVersionSingleRecordAction.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useSeeRunsWorkflowVersionSingleRecordAction.ts similarity index 93% rename from packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useSeeExecutionsWorkflowVersionSingleRecordAction.ts rename to packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useSeeRunsWorkflowVersionSingleRecordAction.ts index 241a1e9fe..a4359d929 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useSeeExecutionsWorkflowVersionSingleRecordAction.ts +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useSeeRunsWorkflowVersionSingleRecordAction.ts @@ -9,7 +9,7 @@ import { useNavigate } from 'react-router-dom'; import { useRecoilValue } from 'recoil'; import { isDefined } from 'twenty-ui'; -export const useSeeExecutionsWorkflowVersionSingleRecordAction: SingleRecordActionHookWithoutObjectMetadataItem = +export const useSeeRunsWorkflowVersionSingleRecordAction: SingleRecordActionHookWithoutObjectMetadataItem = ({ recordId }) => { const workflowVersion = useRecoilValue(recordStoreFamilyState(recordId)); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/types/WorkflowVersionSingleRecordActionsKeys.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/types/WorkflowVersionSingleRecordActionsKeys.ts new file mode 100644 index 000000000..d6515b28e --- /dev/null +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/types/WorkflowVersionSingleRecordActionsKeys.ts @@ -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', +} diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx index 1e3789a9e..603bc34bd 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx @@ -1,4 +1,5 @@ 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 { ActionMenuConfirmationModals } from '@/action-menu/components/ActionMenuConfirmationModals'; import { RecordIndexActionMenuBar } from '@/action-menu/components/RecordIndexActionMenuBar'; @@ -39,12 +40,12 @@ export const RecordIndexActionMenu = ({ indexId }: { indexId: string }) => { value={{ isInRightDrawer: false, onActionStartedCallback: (action) => { - if (action.key === 'delete-multiple-records') { + if (action.key === MultipleRecordsActionKeys.DELETE) { setIsLoadMoreLocked(true); } }, onActionExecutedCallback: (action) => { - if (action.key === 'delete-multiple-records') { + if (action.key === MultipleRecordsActionKeys.DELETE) { setIsLoadMoreLocked(false); } }, diff --git a/packages/twenty-front/src/modules/object-record/hooks/useDeleteManyRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useDeleteManyRecords.ts index 4de099eb2..f9b5ee597 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useDeleteManyRecords.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useDeleteManyRecords.ts @@ -1,6 +1,5 @@ import { useApolloClient } from '@apollo/client'; -import { triggerUpdateRecordOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerUpdateRecordOptimisticEffect'; import { triggerUpdateRecordOptimisticEffectByBatch } from '@/apollo/optimistic-effect/utils/triggerUpdateRecordOptimisticEffectByBatch'; import { apiConfigState } from '@/client-config/states/apiConfigState'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; @@ -145,6 +144,9 @@ export const useDeleteManyRecords = ({ }, }) .catch((error: Error) => { + const cachedRecordsWithConnection: RecordGqlNode[] = []; + const optimisticRecordsWithConnection: RecordGqlNode[] = []; + cachedRecords.forEach((cachedRecord) => { if (isUndefinedOrNull(cachedRecord?.id)) { return; @@ -183,16 +185,21 @@ export const useDeleteManyRecords = ({ !optimisticRecordWithConnection || !cachedRecordWithConnection ) { - return null; + return; } - triggerUpdateRecordOptimisticEffect({ - cache: apolloClient.cache, - objectMetadataItem, - currentRecord: optimisticRecordWithConnection, - updatedRecord: cachedRecordWithConnection, - objectMetadataItems, - }); + cachedRecordsWithConnection.push(cachedRecordWithConnection); + optimisticRecordsWithConnection.push( + optimisticRecordWithConnection, + ); + }); + + triggerUpdateRecordOptimisticEffectByBatch({ + cache: apolloClient.cache, + objectMetadataItem, + currentRecords: optimisticRecordsWithConnection, + updatedRecords: cachedRecordsWithConnection, + objectMetadataItems, }); throw error; diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx index 6a9ad6eb7..532c9a9f2 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx @@ -230,7 +230,6 @@ export const RecordIndexContainer = () => { objectNamePlural={objectNamePlural} viewBarId={recordIndexId} /> - {recordIndexViewType === ViewType.Table && ( diff --git a/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.constants.ts b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.constants.ts index 31804805d..e6f0f11a4 100644 --- a/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.constants.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.constants.ts @@ -18,5 +18,5 @@ export enum MessageQueue { testQueue = 'test-queue', workflowQueue = 'workflow-queue', serverlessFunctionQueue = 'serverless-function-queue', - favoriteQueue = 'favorite-queue', + deleteCascadeQueue = 'delete-cascade-queue', } diff --git a/packages/twenty-server/src/modules/favorite/jobs/favorite-deletion.job.ts b/packages/twenty-server/src/modules/favorite/jobs/favorite-deletion.job.ts index 140466c2f..c3215e4fa 100644 --- a/packages/twenty-server/src/modules/favorite/jobs/favorite-deletion.job.ts +++ b/packages/twenty-server/src/modules/favorite/jobs/favorite-deletion.job.ts @@ -11,7 +11,7 @@ export type FavoriteDeletionJobData = { }; @Processor({ - queueName: MessageQueue.favoriteQueue, + queueName: MessageQueue.deleteCascadeQueue, scope: Scope.REQUEST, }) export class FavoriteDeletionJob { diff --git a/packages/twenty-server/src/modules/favorite/listeners/favorite-deletion.listener.ts b/packages/twenty-server/src/modules/favorite/listeners/favorite-deletion.listener.ts index 2a41cdc76..4de7fa58c 100644 --- a/packages/twenty-server/src/modules/favorite/listeners/favorite-deletion.listener.ts +++ b/packages/twenty-server/src/modules/favorite/listeners/favorite-deletion.listener.ts @@ -15,7 +15,7 @@ import { @Injectable() export class FavoriteDeletionListener { constructor( - @InjectMessageQueue(MessageQueue.favoriteQueue) + @InjectMessageQueue(MessageQueue.deleteCascadeQueue) private readonly messageQueueService: MessageQueueService, ) {}