@ -326,6 +326,7 @@ export type ClientConfig = {
|
||||
api: ApiConfig;
|
||||
authProviders: AuthProviders;
|
||||
billing: Billing;
|
||||
calendarBookingPageId?: Maybe<Scalars['String']['output']>;
|
||||
canManageFeatureFlags: Scalars['Boolean']['output'];
|
||||
captcha: Captcha;
|
||||
chromeExtensionId?: Maybe<Scalars['String']['output']>;
|
||||
@ -658,8 +659,7 @@ export enum FeatureFlagKey {
|
||||
IS_PERMISSIONS_V2_ENABLED = 'IS_PERMISSIONS_V2_ENABLED',
|
||||
IS_POSTGRESQL_INTEGRATION_ENABLED = 'IS_POSTGRESQL_INTEGRATION_ENABLED',
|
||||
IS_STRIPE_INTEGRATION_ENABLED = 'IS_STRIPE_INTEGRATION_ENABLED',
|
||||
IS_UNIQUE_INDEXES_ENABLED = 'IS_UNIQUE_INDEXES_ENABLED',
|
||||
IS_WORKFLOW_ENABLED = 'IS_WORKFLOW_ENABLED'
|
||||
IS_UNIQUE_INDEXES_ENABLED = 'IS_UNIQUE_INDEXES_ENABLED'
|
||||
}
|
||||
|
||||
export type Field = {
|
||||
@ -1001,6 +1001,7 @@ export type Mutation = {
|
||||
signUp: AvailableWorkspacesAndAccessTokensOutput;
|
||||
signUpInNewWorkspace: SignUpOutput;
|
||||
signUpInWorkspace: SignUpOutput;
|
||||
skipBookOnboardingStep: OnboardingStepSuccess;
|
||||
skipSyncEmailOnboardingStep: OnboardingStepSuccess;
|
||||
submitFormStep: Scalars['Boolean']['output'];
|
||||
switchToEnterprisePlan: BillingUpdateOutput;
|
||||
@ -1574,6 +1575,7 @@ export type OnDbEventInput = {
|
||||
|
||||
/** Onboarding status */
|
||||
export enum OnboardingStatus {
|
||||
BOOK_ONBOARDING = 'BOOK_ONBOARDING',
|
||||
COMPLETED = 'COMPLETED',
|
||||
INVITE_TEAM = 'INVITE_TEAM',
|
||||
PLAN_REQUIRED = 'PLAN_REQUIRED',
|
||||
@ -1945,6 +1947,8 @@ export type Role = {
|
||||
export type RunWorkflowVersionInput = {
|
||||
/** Execution result in JSON format */
|
||||
payload?: InputMaybe<Scalars['JSON']['input']>;
|
||||
/** Workflow run ID */
|
||||
workflowRunId?: InputMaybe<Scalars['String']['input']>;
|
||||
/** Workflow version ID */
|
||||
workflowVersionId: Scalars['String']['input'];
|
||||
};
|
||||
|
||||
@ -615,8 +615,7 @@ export enum FeatureFlagKey {
|
||||
IS_PERMISSIONS_V2_ENABLED = 'IS_PERMISSIONS_V2_ENABLED',
|
||||
IS_POSTGRESQL_INTEGRATION_ENABLED = 'IS_POSTGRESQL_INTEGRATION_ENABLED',
|
||||
IS_STRIPE_INTEGRATION_ENABLED = 'IS_STRIPE_INTEGRATION_ENABLED',
|
||||
IS_UNIQUE_INDEXES_ENABLED = 'IS_UNIQUE_INDEXES_ENABLED',
|
||||
IS_WORKFLOW_ENABLED = 'IS_WORKFLOW_ENABLED'
|
||||
IS_UNIQUE_INDEXES_ENABLED = 'IS_UNIQUE_INDEXES_ENABLED'
|
||||
}
|
||||
|
||||
export type Field = {
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -1,43 +1,22 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
import { isWorkflowRelatedObjectMetadata } from '@/object-metadata/utils/isWorkflowRelatedObjectMetadata';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export const useFilteredObjectMetadataItems = () => {
|
||||
const objectMetadataItems = useRecoilValue(objectMetadataItemsState);
|
||||
|
||||
const isWorkflowEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IS_WORKFLOW_ENABLED,
|
||||
);
|
||||
|
||||
const isWorkflowToBeFiltered = useCallback(
|
||||
(nameSingular: string) => {
|
||||
return (
|
||||
!isWorkflowEnabled && isWorkflowRelatedObjectMetadata(nameSingular)
|
||||
);
|
||||
},
|
||||
[isWorkflowEnabled],
|
||||
);
|
||||
|
||||
const activeNonSystemObjectMetadataItems = useMemo(
|
||||
() =>
|
||||
objectMetadataItems.filter(
|
||||
({ isActive, isSystem, nameSingular }) =>
|
||||
isActive && !isSystem && !isWorkflowToBeFiltered(nameSingular),
|
||||
({ isActive, isSystem }) => isActive && !isSystem,
|
||||
),
|
||||
[isWorkflowToBeFiltered, objectMetadataItems],
|
||||
[objectMetadataItems],
|
||||
);
|
||||
|
||||
const activeObjectMetadataItems = useMemo(
|
||||
() =>
|
||||
objectMetadataItems.filter(
|
||||
({ isActive, nameSingular }) =>
|
||||
isActive && !isWorkflowToBeFiltered(nameSingular),
|
||||
),
|
||||
[isWorkflowToBeFiltered, objectMetadataItems],
|
||||
() => objectMetadataItems.filter(({ isActive }) => isActive),
|
||||
[objectMetadataItems],
|
||||
);
|
||||
|
||||
const alphaSortedActiveNonSystemObjectMetadataItems =
|
||||
|
||||
@ -4,10 +4,7 @@ import { ObjectMetadataItemNotFoundError } from '@/object-metadata/errors/Object
|
||||
import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector';
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
|
||||
import { isWorkflowRelatedObjectMetadata } from '@/object-metadata/utils/isWorkflowRelatedObjectMetadata';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
import { ObjectMetadataItemIdentifier } from '../types/ObjectMetadataItemIdentifier';
|
||||
|
||||
export const useObjectMetadataItem = ({
|
||||
@ -20,21 +17,8 @@ export const useObjectMetadataItem = ({
|
||||
}),
|
||||
);
|
||||
|
||||
const isWorkflowEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IS_WORKFLOW_ENABLED,
|
||||
);
|
||||
|
||||
const isWorkflowToBeFiltered =
|
||||
!isWorkflowEnabled && isWorkflowRelatedObjectMetadata(objectNameSingular);
|
||||
|
||||
const objectMetadataItems = useRecoilValue(objectMetadataItemsState);
|
||||
|
||||
if (isWorkflowToBeFiltered) {
|
||||
throw new Error(
|
||||
'Workflow is not enabled. If you want to use it, please enable it in the lab.',
|
||||
);
|
||||
}
|
||||
|
||||
if (!isDefined(objectMetadataItem)) {
|
||||
throw new ObjectMetadataItemNotFoundError(
|
||||
objectNameSingular,
|
||||
|
||||
@ -20,7 +20,6 @@ import {
|
||||
IconSettings,
|
||||
} from 'twenty-ui/display';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
import { FeatureFlagKey } from '~/generated/graphql';
|
||||
|
||||
export const useRecordShowContainerTabs = (
|
||||
loading: boolean,
|
||||
@ -155,7 +154,7 @@ export const useRecordShowContainerTabs = (
|
||||
ifMobile: false,
|
||||
ifDesktop: false,
|
||||
ifInRightDrawer: false,
|
||||
ifFeaturesDisabled: [FeatureFlagKey.IS_WORKFLOW_ENABLED],
|
||||
ifFeaturesDisabled: [],
|
||||
ifRequiredObjectsInactive: [],
|
||||
ifRelationsMissing: [],
|
||||
},
|
||||
@ -178,7 +177,7 @@ export const useRecordShowContainerTabs = (
|
||||
ifMobile: false,
|
||||
ifDesktop: false,
|
||||
ifInRightDrawer: false,
|
||||
ifFeaturesDisabled: [FeatureFlagKey.IS_WORKFLOW_ENABLED],
|
||||
ifFeaturesDisabled: [],
|
||||
ifRequiredObjectsInactive: [],
|
||||
ifRelationsMissing: [],
|
||||
},
|
||||
@ -200,7 +199,7 @@ export const useRecordShowContainerTabs = (
|
||||
ifMobile: false,
|
||||
ifDesktop: false,
|
||||
ifInRightDrawer: false,
|
||||
ifFeaturesDisabled: [FeatureFlagKey.IS_WORKFLOW_ENABLED],
|
||||
ifFeaturesDisabled: [],
|
||||
ifRequiredObjectsInactive: [],
|
||||
ifRelationsMissing: [],
|
||||
},
|
||||
|
||||
@ -4,7 +4,6 @@ import { ObjectMetadataItemsQuery } from '~/generated-metadata/graphql';
|
||||
// This file is not designed to be manually edited.
|
||||
// It's an extract from the dev seeded environment metadata call
|
||||
// TODO: automate the generation of this file
|
||||
// ⚠️ WARNING ⚠️: Be sure to activate the workflow feature flag (IsWorkflowEnabled) before updating that mock.
|
||||
|
||||
// prettier-ignore
|
||||
export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
|
||||
@ -68,10 +68,6 @@ export const mockCurrentWorkspace: Workspace = {
|
||||
key: FeatureFlagKey.IS_POSTGRESQL_INTEGRATION_ENABLED,
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
key: FeatureFlagKey.IS_WORKFLOW_ENABLED,
|
||||
value: true,
|
||||
},
|
||||
],
|
||||
createdAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
|
||||
Reference in New Issue
Block a user