The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Remove delete action from workflow versions and runs (#9261)
Raphaël Bosi522b51581df6
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/utils/getActionConfig.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/utils/getActionConfig.tsindex 4fcaf415be2..6c567e0c515 100644--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/utils/getActionConfig.ts+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/utils/getActionConfig.ts@@ -1,6 +1,7 @@import { DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V1 } from '@/action-menu/actions/record-actions/single-record/constants/DefaultSingleRecordActionsConfigV1';import { DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2 } from '@/action-menu/actions/record-actions/single-record/constants/DefaultSingleRecordActionsConfigV2';import { WORKFLOW_SINGLE_RECORD_ACTIONS_CONFIG } from '@/action-menu/actions/record-actions/single-record/workflow-actions/constants/WorkflowSingleRecordActionsConfig';+import { WORKFLOW_RUNS_SINGLE_RECORD_ACTIONS_CONFIG } from '@/action-menu/actions/record-actions/single-record/workflow-run-actions/constants/WorkflowRunsSingleRecordActionsConfig';import { WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG } from '@/action-menu/actions/record-actions/single-record/workflow-version-actions/constants/WorkflowVersionsSingleRecordActionsConfig';import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';@@ -17,6 +18,9 @@ export const getActionConfig = () {return WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG;}+ if (objectMetadataItem.nameSingular === CoreObjectNameSingular.WorkflowRun) {+ return WORKFLOW_RUNS_SINGLE_RECORD_ACTIONS_CONFIG;+ }return isPageHeaderV2Enabled? DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V2: DEFAULT_SINGLE_RECORD_ACTIONS_CONFIG_V1;diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/constants/WorkflowRunsSingleRecordActionsConfig.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/constants/WorkflowRunsSingleRecordActionsConfig.tsnew file mode 100644index 00000000000..65b97bf750b--- /dev/null+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/constants/WorkflowRunsSingleRecordActionsConfig.ts@@ -0,0 +1,80 @@+import { useAddToFavoritesSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useAddToFavoritesSingleRecordAction';+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 {+ ActionMenuEntry,+ ActionMenuEntryScope,+ ActionMenuEntryType,+} from '@/action-menu/types/ActionMenuEntry';+import {+ IconChevronDown,+ IconChevronUp,+ IconHeart,+ IconHeartOff,+} from 'twenty-ui';++export const WORKFLOW_RUNS_SINGLE_RECORD_ACTIONS_CONFIG: Record<+ string,+ ActionMenuEntry & {+ actionHook: SingleRecordActionHook;+ }+> = {+ addToFavoritesSingleRecord: {+ type: ActionMenuEntryType.Standard,+ scope: ActionMenuEntryScope.RecordSelection,+ key: SingleRecordActionKeys.ADD_TO_FAVORITES,+ label: 'Add to favorites',+ shortLabel: 'Add to favorites',+ position: 0,+ isPinned: true,+ Icon: IconHeart,+ availableOn: [+ ActionAvailableOn.INDEX_PAGE_SINGLE_RECORD_SELECTION,+ ActionAvailableOn.SHOW_PAGE,+ ],+ actionHook: useAddToFavoritesSingleRecordAction,+ },+ removeFromFavoritesSingleRecord: {+ type: ActionMenuEntryType.Standard,+ scope: ActionMenuEntryScope.RecordSelection,+ key: SingleRecordActionKeys.REMOVE_FROM_FAVORITES,+ label: 'Remove from favorites',+ shortLabel: 'Remove from favorites',+ isPinned: true,+ position: 1,+ Icon: IconHeartOff,+ availableOn: [+ ActionAvailableOn.INDEX_PAGE_SINGLE_RECORD_SELECTION,+ ActionAvailableOn.SHOW_PAGE,+ ],+ actionHook: useRemoveFromFavoritesSingleRecordAction,+ },+ navigateToPreviousRecord: {+ type: ActionMenuEntryType.Standard,+ scope: ActionMenuEntryScope.RecordSelection,+ key: SingleRecordActionKeys.NAVIGATE_TO_PREVIOUS_RECORD,+ label: 'Navigate to previous record',+ shortLabel: '',+ position: 2,+ isPinned: true,+ Icon: IconChevronUp,+ availableOn: [ActionAvailableOn.SHOW_PAGE],+ actionHook: useNavigateToPreviousRecordSingleRecordAction,+ },+ navigateToNextRecord: {+ type: ActionMenuEntryType.Standard,+ scope: ActionMenuEntryScope.RecordSelection,+ key: SingleRecordActionKeys.NAVIGATE_TO_NEXT_RECORD,+ label: 'Navigate to next record',+ shortLabel: '',+ position: 3,+ isPinned: true,+ Icon: IconChevronDown,+ availableOn: [ActionAvailableOn.SHOW_PAGE],+ actionHook: useNavigateToNextRecordSingleRecordAction,+ },+};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.tsindex fa6174ed387..10065a3bb4d 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,6 +1,4 @@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 { useDestroySingleRecordAction } from '@/action-menu/actions/record-actions/single-record/hooks/useDestroySingleRecordAction';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';@@ -24,8 +22,6 @@ import {IconHistory,IconHistoryToggle,IconPencil,- IconTrash,- IconTrashX,} from 'twenty-ui';export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record<@@ -37,6 +33,7 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record<useAsDraftWorkflowVersionSingleRecord: {key: WorkflowVersionSingleRecordActionKeys.USE_AS_DRAFT,label: 'Use as draft',+ shortLabel: 'Use as draft',position: 1,isPinned: true,type: ActionMenuEntryType.Standard,@@ -51,6 +48,7 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record<seeWorkflowRunsSingleRecord: {key: WorkflowVersionSingleRecordActionKeys.SEE_RUNS,label: 'See runs',+ shortLabel: 'See runs',position: 2,type: ActionMenuEntryType.Standard,scope: ActionMenuEntryScope.RecordSelection,@@ -64,6 +62,7 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record<seeWorkflowVersionsHistorySingleRecord: {key: WorkflowVersionSingleRecordActionKeys.SEE_VERSIONS,label: 'See versions history',+ shortLabel: 'See versions',position: 3,type: ActionMenuEntryType.Standard,scope: ActionMenuEntryScope.RecordSelection,@@ -126,36 +125,4 @@ export const WORKFLOW_VERSIONS_SINGLE_RECORD_ACTIONS_CONFIG: Record<],actionHook: useRemoveFromFavoritesSingleRecordAction,},- deleteSingleRecord: {- type: ActionMenuEntryType.Standard,- scope: ActionMenuEntryScope.RecordSelection,- key: SingleRecordActionKeys.DELETE,- label: 'Delete record',- shortLabel: 'Delete',- position: 8,- Icon: IconTrash,- accent: 'danger',- isPinned: false,- availableOn: [- ActionAvailableOn.INDEX_PAGE_SINGLE_RECORD_SELECTION,- ActionAvailableOn.SHOW_PAGE,- ],- actionHook: useDeleteSingleRecordAction,- },- destroySingleRecord: {- type: ActionMenuEntryType.Standard,- scope: ActionMenuEntryScope.RecordSelection,- key: SingleRecordActionKeys.DESTROY,- label: 'Permanently destroy record',- shortLabel: 'Destroy',- position: 9,- Icon: IconTrashX,- accent: 'danger',- isPinned: false,- availableOn: [- ActionAvailableOn.INDEX_PAGE_SINGLE_RECORD_SELECTION,- ActionAvailableOn.SHOW_PAGE,- ],- actionHook: useDestroySingleRecordAction,- },};