@ -413,13 +413,11 @@ export const DEFAULT_RECORD_ACTIONS_CONFIG: Record<
|
||||
shouldBeRegistered: ({
|
||||
objectMetadataItem,
|
||||
viewType,
|
||||
isWorkflowEnabled,
|
||||
getTargetObjectReadPermission,
|
||||
}) =>
|
||||
getTargetObjectReadPermission(CoreObjectNameSingular.Workflow) === true &&
|
||||
(objectMetadataItem?.nameSingular !== CoreObjectNameSingular.Workflow ||
|
||||
viewType === ActionViewType.SHOW_PAGE) &&
|
||||
isWorkflowEnabled,
|
||||
viewType === ActionViewType.SHOW_PAGE),
|
||||
availableOn: [
|
||||
ActionViewType.INDEX_PAGE_NO_SELECTION,
|
||||
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
|
||||
|
||||
@ -4,18 +4,12 @@ import { ActionType } from '@/action-menu/actions/types/ActionType';
|
||||
import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
|
||||
import { useActiveWorkflowVersionsWithManualTrigger } from '@/workflow/hooks/useActiveWorkflowVersionsWithManualTrigger';
|
||||
import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { useContext } from 'react';
|
||||
import { capitalize, isDefined } from 'twenty-shared/utils';
|
||||
import { IconSettingsAutomation } from 'twenty-ui/display';
|
||||
import { FeatureFlagKey } from '~/generated/graphql';
|
||||
|
||||
export const useRunWorkflowRecordAgnosticActions = () => {
|
||||
const isWorkflowEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IS_WORKFLOW_ENABLED,
|
||||
);
|
||||
|
||||
const { actionMenuType } = useContext(ActionMenuContext);
|
||||
|
||||
const { records: activeWorkflowVersions } =
|
||||
@ -27,10 +21,6 @@ export const useRunWorkflowRecordAgnosticActions = () => {
|
||||
|
||||
const { runWorkflowVersion } = useRunWorkflowVersion();
|
||||
|
||||
if (!isWorkflowEnabled) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return activeWorkflowVersions
|
||||
.map((activeWorkflowVersion, index) => {
|
||||
if (!isDefined(activeWorkflowVersion.workflow)) {
|
||||
|
||||
@ -8,7 +8,6 @@ import { WorkflowWithCurrentVersion } from '@/workflow/types/Workflow';
|
||||
export type ShouldBeRegisteredFunctionParams = {
|
||||
objectMetadataItem?: ObjectMetadataItem;
|
||||
objectPermissions: ObjectPermissions;
|
||||
isWorkflowEnabled: boolean;
|
||||
recordFilters?: RecordFilter[];
|
||||
isShowPage?: boolean;
|
||||
isSoftDeleteFilterActive?: boolean;
|
||||
|
||||
@ -6,10 +6,8 @@ import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
|
||||
export const ActionMenuContextProvider = ({
|
||||
children,
|
||||
@ -19,10 +17,6 @@ export const ActionMenuContextProvider = ({
|
||||
}: Omit<ActionMenuContextType, 'actions'> & {
|
||||
children: React.ReactNode;
|
||||
}) => {
|
||||
const isWorkflowEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IS_WORKFLOW_ENABLED,
|
||||
);
|
||||
|
||||
const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2(
|
||||
contextStoreCurrentObjectMetadataItemIdComponentState,
|
||||
);
|
||||
@ -39,7 +33,7 @@ export const ActionMenuContextProvider = ({
|
||||
objectMetadataItem?.nameSingular === CoreObjectNameSingular.WorkflowRun ||
|
||||
objectMetadataItem?.nameSingular === CoreObjectNameSingular.WorkflowVersion;
|
||||
|
||||
if (isWorkflowEnabled && isDefined(objectMetadataItem) && isWorkflowObject) {
|
||||
if (isDefined(objectMetadataItem) && isWorkflowObject) {
|
||||
return (
|
||||
<ActionMenuContextProviderWorkflowObjects
|
||||
isInRightDrawer={isInRightDrawer}
|
||||
@ -53,7 +47,6 @@ export const ActionMenuContextProvider = ({
|
||||
}
|
||||
|
||||
if (
|
||||
isWorkflowEnabled &&
|
||||
isDefined(objectMetadataItem) &&
|
||||
(actionMenuType === 'command-menu' ||
|
||||
actionMenuType === 'command-menu-show-page-action-menu-dropdown')
|
||||
|
||||
@ -13,10 +13,8 @@ import { useObjectPermissionsForObject } from '@/object-record/hooks/useObjectPe
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { isSoftDeleteFilterActiveComponentState } from '@/object-record/record-table/states/isSoftDeleteFilterActiveComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { useContext } from 'react';
|
||||
import { useRecoilCallback, useRecoilValue } from 'recoil';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
|
||||
export const useShouldActionBeRegisteredParams = ({
|
||||
objectMetadataItem,
|
||||
@ -61,10 +59,6 @@ export const useShouldActionBeRegisteredParams = ({
|
||||
useRecoilComponentValueV2(contextStoreCurrentViewTypeComponentState) ===
|
||||
ContextStoreViewType.ShowPage;
|
||||
|
||||
const isWorkflowEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IS_WORKFLOW_ENABLED,
|
||||
);
|
||||
|
||||
const numberOfSelectedRecords = useRecoilComponentValueV2(
|
||||
contextStoreNumberOfSelectedRecordsComponentState,
|
||||
);
|
||||
@ -101,7 +95,6 @@ export const useShouldActionBeRegisteredParams = ({
|
||||
isSoftDeleteFilterActive,
|
||||
isShowPage,
|
||||
selectedRecord,
|
||||
isWorkflowEnabled,
|
||||
numberOfSelectedRecords,
|
||||
viewType: viewType ?? undefined,
|
||||
getTargetObjectReadPermission: getObjectReadPermission,
|
||||
|
||||
Reference in New Issue
Block a user