From a5d60919a7cc3197704e8a9be0d1ccf5962715ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Bosi?=
<71827178+bosiraphael@users.noreply.github.com>
Date: Mon, 3 Mar 2025 17:03:53 +0100
Subject: [PATCH] Create import csv action (#10624)
Closes https://github.com/twentyhq/core-team-issues/issues/63
This PR:
- Creates an **Import csv** action
- Allows the import of notes and tasks
- Removes the import action from the index option menu
- Adds export action when only one record is selected
- Adds see deleted record action to workflow objects
---
.../constants/DefaultActionsConfigV1.ts | 37 +++++++++++-
.../constants/DefaultActionsConfigV2.ts | 45 +++++++++++---
.../constants/WorkflowActionsConfig.ts | 58 +++++++++++++++++--
.../constants/WorkflowRunsActionsConfig.ts | 25 ++++++--
.../WorkflowVersionsActionsConfig.ts | 19 +++++-
...useImportRecordsNoSelectionRecordAction.ts | 17 ++++++
.../types/NoSelectionRecordActionsKey.ts | 7 ++-
.../types/SingleRecordActionsKey.ts | 1 +
.../ObjectOptionsDropdownMenuContent.tsx | 26 ---------
...jectRecordsSpreadsheetImportDialog.test.ts | 2 +-
...penObjectRecordsSpreadsheetImportDialog.ts | 4 +-
11 files changed, 186 insertions(+), 55 deletions(-)
create mode 100644 packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/hooks/useImportRecordsNoSelectionRecordAction.ts
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DefaultActionsConfigV1.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DefaultActionsConfigV1.ts
index 2b462e003..b052bdacc 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DefaultActionsConfigV1.ts
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DefaultActionsConfigV1.ts
@@ -1,6 +1,7 @@
import { useDeleteMultipleRecordsAction } from '@/action-menu/actions/record-actions/multiple-records/hooks/useDeleteMultipleRecordsAction';
import { useExportMultipleRecordsAction } from '@/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction';
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
+import { useImportRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useImportRecordsNoSelectionRecordAction';
import { useSeeDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useSeeDeletedRecordsNoSelectionRecordAction';
import { NoSelectionRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKey';
import { useAddToFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useAddToFavoritesSingleRecordAction';
@@ -17,6 +18,7 @@ import {
import { msg } from '@lingui/core/macro';
import {
IconDatabaseExport,
+ IconFileImport,
IconHeart,
IconHeartOff,
IconRotate2,
@@ -83,13 +85,29 @@ export const DEFAULT_ACTIONS_CONFIG_V1: Record<
availableOn: [ActionViewType.INDEX_PAGE_BULK_SELECTION],
useAction: useDeleteMultipleRecordsAction,
},
+ exportSingleRecord: {
+ type: ActionMenuEntryType.Standard,
+ scope: ActionMenuEntryScope.RecordSelection,
+ key: SingleRecordActionKeys.EXPORT,
+ label: msg`Export record`,
+ shortLabel: msg`Export`,
+ position: 4,
+ Icon: IconDatabaseExport,
+ accent: 'default',
+ isPinned: false,
+ availableOn: [
+ ActionViewType.SHOW_PAGE,
+ ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
+ ],
+ useAction: useExportMultipleRecordsAction,
+ },
exportMultipleRecords: {
type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection,
key: MultipleRecordsActionKeys.EXPORT,
label: msg`Export records`,
shortLabel: msg`Export`,
- position: 4,
+ position: 5,
Icon: IconDatabaseExport,
accent: 'default',
isPinned: false,
@@ -102,7 +120,7 @@ export const DEFAULT_ACTIONS_CONFIG_V1: Record<
key: NoSelectionRecordActionKeys.EXPORT_VIEW,
label: msg`Export view`,
shortLabel: msg`Export`,
- position: 5,
+ position: 6,
Icon: IconDatabaseExport,
accent: 'default',
isPinned: false,
@@ -115,11 +133,24 @@ export const DEFAULT_ACTIONS_CONFIG_V1: Record<
key: NoSelectionRecordActionKeys.SEE_DELETED_RECORDS,
label: msg`See deleted records`,
shortLabel: msg`Deleted records`,
- position: 6,
+ position: 7,
Icon: IconRotate2,
accent: 'default',
isPinned: false,
availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
useAction: useSeeDeletedRecordsNoSelectionRecordAction,
},
+ importRecords: {
+ type: ActionMenuEntryType.Standard,
+ scope: ActionMenuEntryScope.Object,
+ key: NoSelectionRecordActionKeys.IMPORT_RECORDS,
+ label: msg`Import records`,
+ shortLabel: msg`Import`,
+ position: 8,
+ Icon: IconFileImport,
+ accent: 'default',
+ isPinned: false,
+ availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
+ useAction: useImportRecordsNoSelectionRecordAction,
+ },
};
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DefaultActionsConfigV2.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DefaultActionsConfigV2.ts
index 5cc68a08f..dbf340d39 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DefaultActionsConfigV2.ts
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DefaultActionsConfigV2.ts
@@ -3,6 +3,7 @@ import { useDestroyMultipleRecordsAction } from '@/action-menu/actions/record-ac
import { useExportMultipleRecordsAction } from '@/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction';
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
import { useCreateNewTableRecordNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useCreateNewTableRecordNoSelectionRecordAction';
+import { useImportRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useImportRecordsNoSelectionRecordAction';
import { useSeeDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useSeeDeletedRecordsNoSelectionRecordAction';
import { NoSelectionRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKey';
import { useAddToFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useAddToFavoritesSingleRecordAction';
@@ -26,6 +27,7 @@ import {
IconChevronUp,
IconDatabaseExport,
IconFileExport,
+ IconFileImport,
IconHeart,
IconHeartOff,
IconPlus,
@@ -123,13 +125,29 @@ export const DEFAULT_ACTIONS_CONFIG_V2: Record<
availableOn: [ActionViewType.INDEX_PAGE_BULK_SELECTION],
useAction: useDeleteMultipleRecordsAction,
},
+ exportSingleRecord: {
+ type: ActionMenuEntryType.Standard,
+ scope: ActionMenuEntryScope.RecordSelection,
+ key: SingleRecordActionKeys.EXPORT,
+ label: msg`Export record`,
+ shortLabel: msg`Export`,
+ position: 6,
+ Icon: IconDatabaseExport,
+ accent: 'default',
+ isPinned: false,
+ availableOn: [
+ ActionViewType.SHOW_PAGE,
+ ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
+ ],
+ useAction: useExportMultipleRecordsAction,
+ },
exportMultipleRecords: {
type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection,
key: MultipleRecordsActionKeys.EXPORT,
label: msg`Export records`,
shortLabel: msg`Export`,
- position: 6,
+ position: 7,
Icon: IconDatabaseExport,
accent: 'default',
isPinned: false,
@@ -142,7 +160,7 @@ export const DEFAULT_ACTIONS_CONFIG_V2: Record<
key: NoSelectionRecordActionKeys.EXPORT_VIEW,
label: msg`Export view`,
shortLabel: msg`Export`,
- position: 7,
+ position: 8,
Icon: IconDatabaseExport,
accent: 'default',
isPinned: false,
@@ -155,20 +173,33 @@ export const DEFAULT_ACTIONS_CONFIG_V2: Record<
key: NoSelectionRecordActionKeys.SEE_DELETED_RECORDS,
label: msg`See deleted records`,
shortLabel: msg`Deleted records`,
- position: 8,
+ position: 9,
Icon: IconRotate2,
accent: 'default',
isPinned: false,
availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
useAction: useSeeDeletedRecordsNoSelectionRecordAction,
},
+ importRecords: {
+ type: ActionMenuEntryType.Standard,
+ scope: ActionMenuEntryScope.Object,
+ key: NoSelectionRecordActionKeys.IMPORT_RECORDS,
+ label: msg`Import records`,
+ shortLabel: msg`Import`,
+ position: 10,
+ Icon: IconFileImport,
+ accent: 'default',
+ isPinned: false,
+ availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
+ useAction: useImportRecordsNoSelectionRecordAction,
+ },
destroySingleRecord: {
type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection,
key: SingleRecordActionKeys.DESTROY,
label: msg`Permanently destroy record`,
shortLabel: msg`Destroy`,
- position: 9,
+ position: 11,
Icon: IconTrashX,
accent: 'danger',
isPinned: true,
@@ -183,7 +214,7 @@ export const DEFAULT_ACTIONS_CONFIG_V2: Record<
scope: ActionMenuEntryScope.RecordSelection,
key: SingleRecordActionKeys.NAVIGATE_TO_PREVIOUS_RECORD,
label: msg`Navigate to previous record`,
- position: 10,
+ position: 12,
isPinned: true,
Icon: IconChevronUp,
availableOn: [ActionViewType.SHOW_PAGE],
@@ -194,7 +225,7 @@ export const DEFAULT_ACTIONS_CONFIG_V2: Record<
scope: ActionMenuEntryScope.RecordSelection,
key: SingleRecordActionKeys.NAVIGATE_TO_NEXT_RECORD,
label: msg`Navigate to next record`,
- position: 11,
+ position: 13,
isPinned: true,
Icon: IconChevronDown,
availableOn: [ActionViewType.SHOW_PAGE],
@@ -206,7 +237,7 @@ export const DEFAULT_ACTIONS_CONFIG_V2: Record<
key: MultipleRecordsActionKeys.DESTROY,
label: msg`Permanently destroy records`,
shortLabel: msg`Destroy`,
- position: 12,
+ position: 14,
Icon: IconTrashX,
accent: 'danger',
isPinned: true,
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowActionsConfig.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowActionsConfig.ts
index db67f48ef..216b883e7 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowActionsConfig.ts
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowActionsConfig.ts
@@ -3,6 +3,8 @@ import { useDestroyMultipleRecordsAction } from '@/action-menu/actions/record-ac
import { useExportMultipleRecordsAction } from '@/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction';
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
import { useCreateNewTableRecordNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useCreateNewTableRecordNoSelectionRecordAction';
+import { useImportRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useImportRecordsNoSelectionRecordAction';
+import { useSeeDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useSeeDeletedRecordsNoSelectionRecordAction';
import { NoSelectionRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKey';
import { useAddToFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useAddToFavoritesSingleRecordAction';
import { useDeleteSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useDeleteSingleRecordAction';
@@ -31,6 +33,7 @@ import {
IconChevronDown,
IconChevronUp,
IconDatabaseExport,
+ IconFileImport,
IconHeart,
IconHeartOff,
IconHistory,
@@ -40,6 +43,7 @@ import {
IconPlayerPlay,
IconPlus,
IconPower,
+ IconRotate2,
IconTrash,
IconTrashX,
} from 'twenty-ui';
@@ -52,7 +56,7 @@ export const WORKFLOW_ACTIONS_CONFIG: Record<
> = {
createNewRecord: {
type: ActionMenuEntryType.Standard,
- scope: ActionMenuEntryScope.RecordSelection,
+ scope: ActionMenuEntryScope.Object,
key: NoSelectionRecordActionKeys.CREATE_NEW_RECORD,
label: msg`Create new record`,
shortLabel: msg`New record`,
@@ -262,13 +266,29 @@ export const WORKFLOW_ACTIONS_CONFIG: Record<
],
useAction: useDestroySingleRecordAction,
},
+ exportSingleRecord: {
+ type: ActionMenuEntryType.Standard,
+ scope: ActionMenuEntryScope.RecordSelection,
+ key: SingleRecordActionKeys.EXPORT,
+ label: msg`Export workflow`,
+ shortLabel: msg`Export`,
+ position: 15,
+ Icon: IconDatabaseExport,
+ accent: 'default',
+ isPinned: false,
+ availableOn: [
+ ActionViewType.SHOW_PAGE,
+ ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
+ ],
+ useAction: useExportMultipleRecordsAction,
+ },
exportMultipleRecords: {
type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection,
key: MultipleRecordsActionKeys.EXPORT,
- label: msg`Export Workflows`,
+ label: msg`Export workflows`,
shortLabel: msg`Export`,
- position: 15,
+ position: 16,
Icon: IconDatabaseExport,
accent: 'default',
isPinned: false,
@@ -277,11 +297,11 @@ export const WORKFLOW_ACTIONS_CONFIG: Record<
},
exportView: {
type: ActionMenuEntryType.Standard,
- scope: ActionMenuEntryScope.RecordSelection,
+ scope: ActionMenuEntryScope.Object,
key: NoSelectionRecordActionKeys.EXPORT_VIEW,
label: msg`Export view`,
shortLabel: msg`Export`,
- position: 16,
+ position: 17,
Icon: IconDatabaseExport,
accent: 'default',
isPinned: false,
@@ -294,11 +314,37 @@ export const WORKFLOW_ACTIONS_CONFIG: Record<
key: MultipleRecordsActionKeys.DESTROY,
label: msg`Permanently destroy workflows`,
shortLabel: msg`Destroy`,
- position: 17,
+ position: 18,
Icon: IconTrashX,
accent: 'danger',
isPinned: true,
availableOn: [ActionViewType.INDEX_PAGE_BULK_SELECTION],
useAction: useDestroyMultipleRecordsAction,
},
+ seeDeletedRecords: {
+ type: ActionMenuEntryType.Standard,
+ scope: ActionMenuEntryScope.Object,
+ key: NoSelectionRecordActionKeys.SEE_DELETED_RECORDS,
+ label: msg`See deleted workflows`,
+ shortLabel: msg`Deleted workflows`,
+ position: 19,
+ Icon: IconRotate2,
+ accent: 'default',
+ isPinned: false,
+ availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
+ useAction: useSeeDeletedRecordsNoSelectionRecordAction,
+ },
+ importRecords: {
+ type: ActionMenuEntryType.Standard,
+ scope: ActionMenuEntryScope.Object,
+ key: NoSelectionRecordActionKeys.IMPORT_RECORDS,
+ label: msg`Import workflows`,
+ shortLabel: msg`Import`,
+ position: 20,
+ Icon: IconFileImport,
+ accent: 'default',
+ isPinned: false,
+ availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
+ useAction: useImportRecordsNoSelectionRecordAction,
+ },
};
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowRunsActionsConfig.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowRunsActionsConfig.ts
index bfbbd6a98..782b5e594 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowRunsActionsConfig.ts
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowRunsActionsConfig.ts
@@ -1,5 +1,6 @@
import { useExportMultipleRecordsAction } from '@/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction';
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
+import { useSeeDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useSeeDeletedRecordsNoSelectionRecordAction';
import { NoSelectionRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKey';
import { useAddToFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useAddToFavoritesSingleRecordAction';
import { useNavigateToNextRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToNextRecordSingleRecordAction';
@@ -20,6 +21,7 @@ import {
IconDatabaseExport,
IconHeart,
IconHeartOff,
+ IconRotate2,
} from 'twenty-ui';
export const WORKFLOW_RUNS_ACTIONS_CONFIG: Record<
@@ -30,7 +32,7 @@ export const WORKFLOW_RUNS_ACTIONS_CONFIG: Record<
> = {
addToFavoritesSingleRecord: {
type: ActionMenuEntryType.Standard,
- scope: ActionMenuEntryScope.RecordSelection,
+ scope: ActionMenuEntryScope.Object,
key: SingleRecordActionKeys.ADD_TO_FAVORITES,
label: msg`Add to favorites`,
shortLabel: msg`Add to favorites`,
@@ -62,7 +64,7 @@ export const WORKFLOW_RUNS_ACTIONS_CONFIG: Record<
type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection,
key: SingleRecordActionKeys.NAVIGATE_TO_PREVIOUS_RECORD,
- label: msg`Navigate to previous record`,
+ label: msg`Navigate to previous run`,
position: 2,
isPinned: true,
Icon: IconChevronUp,
@@ -73,7 +75,7 @@ export const WORKFLOW_RUNS_ACTIONS_CONFIG: Record<
type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection,
key: SingleRecordActionKeys.NAVIGATE_TO_NEXT_RECORD,
- label: msg`Navigate to next record`,
+ label: msg`Navigate to next run`,
position: 3,
isPinned: true,
Icon: IconChevronDown,
@@ -84,7 +86,7 @@ export const WORKFLOW_RUNS_ACTIONS_CONFIG: Record<
type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection,
key: MultipleRecordsActionKeys.EXPORT,
- label: msg`Export records`,
+ label: msg`Export runs`,
shortLabel: msg`Export`,
position: 4,
Icon: IconDatabaseExport,
@@ -95,7 +97,7 @@ export const WORKFLOW_RUNS_ACTIONS_CONFIG: Record<
},
exportView: {
type: ActionMenuEntryType.Standard,
- scope: ActionMenuEntryScope.RecordSelection,
+ scope: ActionMenuEntryScope.Object,
key: NoSelectionRecordActionKeys.EXPORT_VIEW,
label: msg`Export view`,
shortLabel: msg`Export`,
@@ -106,4 +108,17 @@ export const WORKFLOW_RUNS_ACTIONS_CONFIG: Record<
availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
useAction: useExportMultipleRecordsAction,
},
+ seeDeletedRecords: {
+ type: ActionMenuEntryType.Standard,
+ scope: ActionMenuEntryScope.Object,
+ key: NoSelectionRecordActionKeys.SEE_DELETED_RECORDS,
+ label: msg`See deleted runs`,
+ shortLabel: msg`Deleted runs`,
+ position: 6,
+ Icon: IconRotate2,
+ accent: 'default',
+ isPinned: false,
+ availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
+ useAction: useSeeDeletedRecordsNoSelectionRecordAction,
+ },
};
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowVersionsActionsConfig.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowVersionsActionsConfig.ts
index 4fdedd68d..79ec73894 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowVersionsActionsConfig.ts
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowVersionsActionsConfig.ts
@@ -1,5 +1,6 @@
import { useExportMultipleRecordsAction } from '@/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction';
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
+import { useSeeDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useSeeDeletedRecordsNoSelectionRecordAction';
import { NoSelectionRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKey';
import { useAddToFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useAddToFavoritesSingleRecordAction';
import { useNavigateToNextRecordSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useNavigateToNextRecordSingleRecordAction';
@@ -27,6 +28,7 @@ import {
IconHistory,
IconHistoryToggle,
IconPencil,
+ IconRotate2,
} from 'twenty-ui';
export const WORKFLOW_VERSIONS_ACTIONS_CONFIG: Record<
@@ -132,7 +134,7 @@ export const WORKFLOW_VERSIONS_ACTIONS_CONFIG: Record<
type: ActionMenuEntryType.Standard,
scope: ActionMenuEntryScope.RecordSelection,
key: MultipleRecordsActionKeys.EXPORT,
- label: msg`Export records`,
+ label: msg`Export versions`,
shortLabel: msg`Export`,
position: 8,
Icon: IconDatabaseExport,
@@ -143,7 +145,7 @@ export const WORKFLOW_VERSIONS_ACTIONS_CONFIG: Record<
},
exportView: {
type: ActionMenuEntryType.Standard,
- scope: ActionMenuEntryScope.RecordSelection,
+ scope: ActionMenuEntryScope.Object,
key: NoSelectionRecordActionKeys.EXPORT_VIEW,
label: msg`Export view`,
shortLabel: msg`Export`,
@@ -154,4 +156,17 @@ export const WORKFLOW_VERSIONS_ACTIONS_CONFIG: Record<
availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
useAction: useExportMultipleRecordsAction,
},
+ seeDeletedRecords: {
+ type: ActionMenuEntryType.Standard,
+ scope: ActionMenuEntryScope.Object,
+ key: NoSelectionRecordActionKeys.SEE_DELETED_RECORDS,
+ label: msg`See deleted versions`,
+ shortLabel: msg`Deleted versions`,
+ position: 10,
+ Icon: IconRotate2,
+ accent: 'default',
+ isPinned: false,
+ availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
+ useAction: useSeeDeletedRecordsNoSelectionRecordAction,
+ },
};
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/hooks/useImportRecordsNoSelectionRecordAction.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/hooks/useImportRecordsNoSelectionRecordAction.ts
new file mode 100644
index 000000000..2e071827b
--- /dev/null
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/hooks/useImportRecordsNoSelectionRecordAction.ts
@@ -0,0 +1,17 @@
+import { ActionHookWithObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
+import { useOpenObjectRecordsSpreadsheetImportDialog } from '@/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog';
+
+export const useImportRecordsNoSelectionRecordAction: ActionHookWithObjectMetadataItem =
+ ({ objectMetadataItem }) => {
+ const { openObjectRecordsSpreadsheetImportDialog } =
+ useOpenObjectRecordsSpreadsheetImportDialog(
+ objectMetadataItem.nameSingular,
+ );
+
+ return {
+ shouldBeRegistered: true,
+ onClick: () => {
+ openObjectRecordsSpreadsheetImportDialog();
+ },
+ };
+ };
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
index 2db8b6587..56b034434 100644
--- 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
@@ -1,5 +1,6 @@
export enum NoSelectionRecordActionKeys {
- EXPORT_VIEW = 'export-view-no-selection',
- CREATE_NEW_RECORD = 'create-new-record-no-selection',
- SEE_DELETED_RECORDS = 'see-deleted-records-no-selection',
+ EXPORT_VIEW = 'export-view',
+ CREATE_NEW_RECORD = 'create-new-record',
+ SEE_DELETED_RECORDS = 'see-deleted-records',
+ IMPORT_RECORDS = 'import-records',
}
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
index 128faca60..bca5bb107 100644
--- 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
@@ -6,4 +6,5 @@ export enum SingleRecordActionKeys {
NAVIGATE_TO_NEXT_RECORD = 'navigate-to-next-record-single-record',
NAVIGATE_TO_PREVIOUS_RECORD = 'navigate-to-previous-record-single-record',
EXPORT_NOTE_TO_PDF = 'export-note-to-pdf-single-record',
+ EXPORT = 'export-single-record',
}
diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx
index eaca99c78..820e70c00 100644
--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx
@@ -1,7 +1,6 @@
import { Key } from 'ts-key-enum';
import {
AppTooltip,
- IconFileImport,
IconLayout,
IconLayoutList,
IconList,
@@ -10,12 +9,10 @@ import {
useIcons,
} from 'twenty-ui';
-import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useObjectOptionsForBoard } from '@/object-record/object-options-dropdown/hooks/useObjectOptionsForBoard';
import { useOptionsDropdown } from '@/object-record/object-options-dropdown/hooks/useOptionsDropdown';
import { recordGroupFieldMetadataComponentState } from '@/object-record/record-group/states/recordGroupFieldMetadataComponentState';
import { TableOptionsHotkeyScope } from '@/object-record/record-table/types/TableOptionsHotkeyScope';
-import { useOpenObjectRecordsSpreadsheetImportDialog } from '@/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog';
import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
@@ -66,16 +63,6 @@ export const ObjectOptionsDropdownMenuContent = () => {
viewBarId: recordIndexId,
});
- const { openObjectRecordsSpreasheetImportDialog } =
- useOpenObjectRecordsSpreadsheetImportDialog(
- objectMetadataItem.nameSingular,
- );
-
- // TODO: Remove this once we have implemented Rich Text v2 and removed the old rich text
- const canImportOrExport =
- objectMetadataItem.nameSingular !== CoreObjectNameSingular.Note &&
- objectMetadataItem.nameSingular !== CoreObjectNameSingular.Task;
-
const isCommandMenuV2Enabled = useIsFeatureEnabled(
FeatureFlagKey.IsCommandMenuV2Enabled,
);
@@ -137,19 +124,6 @@ export const ObjectOptionsDropdownMenuContent = () => {
/>
)}
-
-
- {canImportOrExport && (
-
>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/__tests__/useOpenObjectRecordsSpreadsheetImportDialog.test.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/__tests__/useOpenObjectRecordsSpreadsheetImportDialog.test.ts
index 4975b0f4f..dbdad7c09 100644
--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/__tests__/useOpenObjectRecordsSpreadsheetImportDialog.test.ts
+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/__tests__/useOpenObjectRecordsSpreadsheetImportDialog.test.ts
@@ -345,7 +345,7 @@ describe('useSpreadsheetCompanyImport', () => {
spreadsheetImportDialogState,
);
const {
- openObjectRecordsSpreasheetImportDialog: openRecordSpreadsheetImport,
+ openObjectRecordsSpreadsheetImportDialog: openRecordSpreadsheetImport,
} = useOpenObjectRecordsSpreadsheetImportDialog(
CoreObjectNameSingular.Company,
);
diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.ts
index 20d26d97a..3c6647433 100644
--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.ts
+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.ts
@@ -27,7 +27,7 @@ export const useOpenObjectRecordsSpreadsheetImportDialog = (
const { buildAvailableFieldsForImport } = useBuildAvailableFieldsForImport();
- const openObjectRecordsSpreasheetImportDialog = (
+ const openObjectRecordsSpreadsheetImportDialog = (
options?: Omit<
SpreadsheetImportDialogOptions,
'fields' | 'isOpen' | 'onClose'
@@ -78,6 +78,6 @@ export const useOpenObjectRecordsSpreadsheetImportDialog = (
};
return {
- openObjectRecordsSpreasheetImportDialog,
+ openObjectRecordsSpreadsheetImportDialog,
};
};