Skip to content

The open alternative to Salesforce, designed for AI.

chore(workflow): match the core workflow show page header to the workspace one (#26552)

Thomas Trompettecb1813008e8d
diff --git a/packages/twenty-front/src/generated/graphql.ts b/packages/twenty-front/src/generated/graphql.ts
index 5db87be6c06..db72f0e2b7e 100644
--- a/packages/twenty-front/src/generated/graphql.ts
+++ b/packages/twenty-front/src/generated/graphql.ts
@@ -458,7 +458,6 @@ export type Mutation = {
updateWorkflowVersionPositions: Scalars['Boolean']['output'];
updateWorkflowVersionStep: WorkflowAction;
updateWorkflowVersionTrigger: WorkflowVersionTrigger;
- validateCoreWorkflowVersion: Scalars['Boolean']['output'];
validateWorkflowVersion: Scalars['Boolean']['output'];
};
@@ -658,11 +657,6 @@ export type MutationUpdateWorkflowVersionTriggerArgs = {
};
-export type MutationValidateCoreWorkflowVersionArgs = {
- coreWorkflowVersionId: Scalars['UUID']['input'];
-};
-
-
export type MutationValidateWorkflowVersionArgs = {
workflowVersionId: Scalars['UUID']['input'];
};
@@ -1335,20 +1329,6 @@ export type UpdateCoreWorkflowVersionTriggerMutationVariables = Exact<{
export type UpdateCoreWorkflowVersionTriggerMutation = { __typename?: 'Mutation', updateWorkflowVersionTrigger: { __typename?: 'WorkflowVersionTrigger', trigger?: any | null } };
-export type UpdateCoreWorkflowVisibilityMutationVariables = Exact<{
- input: UpdateCoreWorkflowVisibilityInput;
-}>;
-
-
-export type UpdateCoreWorkflowVisibilityMutation = { __typename?: 'Mutation', updateCoreWorkflowVisibility?: { __typename?: 'CoreWorkflowDTO', id: any, visibility: WorkflowVisibility, canChangeVisibility: boolean, updatedAt: string } | null };
-
-export type ValidateCoreWorkflowVersionMutationVariables = Exact<{
- coreWorkflowVersionId: Scalars['UUID']['input'];
-}>;
-
-
-export type ValidateCoreWorkflowVersionMutation = { __typename?: 'Mutation', validateCoreWorkflowVersion: boolean };
-
export type GetCoreWorkflowQueryVariables = Exact<{
coreWorkflowId: Scalars['UUID']['input'];
}>;
@@ -1579,8 +1559,6 @@ export const UpdateCoreWorkflowDocument = {"kind":"Document","definitions":[{"ki
export const UpdateCoreWorkflowVersionPositionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCoreWorkflowVersionPositions"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCoreWorkflowVersionPositionsInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"updateWorkflowVersionPositions"},"name":{"kind":"Name","value":"updateCoreWorkflowVersionPositions"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}]}]}}]} as unknown as DocumentNode<UpdateCoreWorkflowVersionPositionsMutation, UpdateCoreWorkflowVersionPositionsMutationVariables>;
export const UpdateCoreWorkflowVersionStepDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCoreWorkflowVersionStep"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCoreWorkflowVersionStepInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"updateWorkflowVersionStep"},"name":{"kind":"Name","value":"updateCoreWorkflowVersionStep"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"settings"}},{"kind":"Field","name":{"kind":"Name","value":"valid"}},{"kind":"Field","name":{"kind":"Name","value":"nextStepIds"}},{"kind":"Field","name":{"kind":"Name","value":"position"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"x"}},{"kind":"Field","name":{"kind":"Name","value":"y"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateCoreWorkflowVersionStepMutation, UpdateCoreWorkflowVersionStepMutationVariables>;
export const UpdateCoreWorkflowVersionTriggerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCoreWorkflowVersionTrigger"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCoreWorkflowVersionTriggerInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"updateWorkflowVersionTrigger"},"name":{"kind":"Name","value":"updateCoreWorkflowVersionTrigger"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"trigger"}}]}}]}}]} as unknown as DocumentNode<UpdateCoreWorkflowVersionTriggerMutation, UpdateCoreWorkflowVersionTriggerMutationVariables>;
-export const UpdateCoreWorkflowVisibilityDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCoreWorkflowVisibility"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCoreWorkflowVisibilityInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCoreWorkflowVisibility"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"canChangeVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<UpdateCoreWorkflowVisibilityMutation, UpdateCoreWorkflowVisibilityMutationVariables>;
-export const ValidateCoreWorkflowVersionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ValidateCoreWorkflowVersion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"coreWorkflowVersionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"validateCoreWorkflowVersion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"coreWorkflowVersionId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"coreWorkflowVersionId"}}}]}]}}]} as unknown as DocumentNode<ValidateCoreWorkflowVersionMutation, ValidateCoreWorkflowVersionMutationVariables>;
export const GetCoreWorkflowDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCoreWorkflow"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"coreWorkflowId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"coreWorkflow"},"name":{"kind":"Name","value":"coreWorkflowById"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"coreWorkflowId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"coreWorkflowId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"statuses"}},{"kind":"Field","name":{"kind":"Name","value":"lastPublishedCoreWorkflowVersionId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceWorkflowId"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"canChangeVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<GetCoreWorkflowQuery, GetCoreWorkflowQueryVariables>;
export const GetCoreWorkflowLegacyMappingDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCoreWorkflowLegacyMapping"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceWorkflowId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"coreWorkflow"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"workspaceWorkflowId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceWorkflowId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<GetCoreWorkflowLegacyMappingQuery, GetCoreWorkflowLegacyMappingQueryVariables>;
export const GetCoreWorkflowVersionLegacyMappingDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCoreWorkflowVersionLegacyMapping"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceWorkflowVersionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"coreWorkflowVersion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"workspaceWorkflowVersionId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceWorkflowVersionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"coreWorkflowId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceWorkflowVersionId"}}]}}]}}]} as unknown as DocumentNode<GetCoreWorkflowVersionLegacyMappingQuery, GetCoreWorkflowVersionLegacyMappingQueryVariables>;
diff --git a/packages/twenty-front/src/modules/object-core/components/CoreObjectIdentifierBar.tsx b/packages/twenty-front/src/modules/object-core/components/CoreObjectIdentifierBar.tsx
new file mode 100644
index 00000000000..b6e9beea82c
--- /dev/null
+++ b/packages/twenty-front/src/modules/object-core/components/CoreObjectIdentifierBar.tsx
@@ -0,0 +1,94 @@
+import { styled } from '@linaria/react';
+import { useState } from 'react';
+import { isDefined } from 'twenty-shared/utils';
+import { themeCssVariables } from 'twenty-ui/theme';
+
+import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons';
+import { RecordIdentifierBarCreatedAt } from '@/object-record/record-show/components/RecordIdentifierBarCreatedAt';
+import { recordStoreIdentifierFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreIdentifierFamilySelector';
+import { PAGE_LAYOUT_RECORD_IDENTIFIER_BAR_HEIGHT } from '@/page-layout/constants/PageLayoutRecordIdentifierBarHeight';
+import { TitleInput } from '@/ui/input/components/TitleInput';
+import { HeaderIdentifier } from '@/ui/layout/page/components/HeaderIdentifier';
+import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
+import { getAbsoluteImageUrl } from '~/utils/image/getAbsoluteImageUrl';
+
+const StyledBar = styled.div`
+ align-items: center;
+ background: ${themeCssVariables.background.secondary};
+ box-shadow: inset 0 -1px 0 ${themeCssVariables.border.color.light};
+ box-sizing: border-box;
+ display: flex;
+ flex-shrink: 0;
+ gap: ${themeCssVariables.spacing[2]};
+ height: ${PAGE_LAYOUT_RECORD_IDENTIFIER_BAR_HEIGHT}px;
+ justify-content: space-between;
+ padding: 0 ${themeCssVariables.spacing[3]};
+ width: 100%;
+`;
+
+type CoreObjectIdentifierBarProps = {
+ recordId: string;
+ name: string | null | undefined;
+ namePlaceholder: string;
+ onRename: (name: string) => Promise<boolean>;
+};
+
+export const CoreObjectIdentifierBar = ({
+ recordId,
+ name,
+ namePlaceholder,
+ onRename,
+}: CoreObjectIdentifierBarProps) => {
+ const [editedName, setEditedName] = useState<string>();
+ const allowRequestsToTwentyIcons = useAtomStateValue(
+ allowRequestsToTwentyIconsState,
+ );
+ const recordIdentifier = useAtomFamilySelectorValue(
+ recordStoreIdentifierFamilySelector,
+ { recordId, allowRequestsToTwentyIcons },
+ );
+
+ const saveName = async () => {
+ if (!isDefined(editedName)) {
+ return;
+ }
+
+ const didSave = await onRename(editedName);
+
+ if (didSave) {
+ setEditedName((currentName) =>
+ currentName === editedName ? undefined : currentName,
+ );
+ }
+ };
+
+ return (
+ <StyledBar>
+ <HeaderIdentifier
+ fontSize="lg"
+ avatar={{
+ src: getAbsoluteImageUrl(recordIdentifier?.avatarUrl ?? ''),
+ colorSeed: recordId,
+ name: recordIdentifier?.name ?? '',
+ shape: recordIdentifier?.avatarShape ?? 'circle',
+ }}
+ title={
+ <TitleInput
+ instanceId={`core-object-name-${recordId}`}
+ sizeVariant="sm"
+ value={editedName ?? name ?? ''}
+ placeholder={namePlaceholder}
+ onChange={setEditedName}
+ onEnter={saveName}
+ onEscape={() => setEditedName(undefined)}
+ onClickOutside={saveName}
+ onTab={saveName}
+ onShiftTab={saveName}
+ />
+ }
+ />
+ <RecordIdentifierBarCreatedAt objectRecordId={recordId} />
+ </StyledBar>
+ );
+};
diff --git a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowShowToolbar.tsx b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowShowToolbar.tsx
deleted file mode 100644
index 2625dbfac59..00000000000
--- a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowShowToolbar.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-import { styled } from '@linaria/react';
-import { t } from '@lingui/core/macro';
-import { isDefined } from 'twenty-shared/utils';
-import { IconRefresh } from 'twenty-ui/icon';
-import { Button } from 'twenty-ui/primitives/input';
-import { themeCssVariables } from 'twenty-ui/theme';
-
-import { Select } from '@/ui/input/components/Select';
-import { CoreWorkflowVisibilitySelect } from '@/object-core/workflows/components/CoreWorkflowVisibilitySelect';
-import { CoreWorkflowVersionRestoreButton } from '@/object-core/workflows/versions/components/CoreWorkflowVersionRestoreButton';
-import { CORE_WORKFLOW_VERSION_STATUS_TAG_PROPS } from '@/object-core/workflows/versions/constants/CoreWorkflowVersionStatusTagProps';
-import {
- type GetCoreWorkflowVersionsQuery,
- type WorkflowVisibility,
-} from '~/generated/graphql';
-
-const StyledToolbar = styled.div`
- align-items: center;
- border-bottom: 1px solid ${themeCssVariables.border.color.light};
- display: flex;
- gap: ${themeCssVariables.spacing[2]};
- padding: ${themeCssVariables.spacing[2]} ${themeCssVariables.spacing[3]};
-`;
-
-type CoreWorkflowShowToolbarProps = {
- coreWorkflowId: string;
- versions: GetCoreWorkflowVersionsQuery['coreWorkflowVersions'];
- selectedVersionId: string | undefined;
- visibility: WorkflowVisibility;
- canChangeVisibility: boolean;
- isHistoricalVersion: boolean;
- isValidating: boolean;
- onVersionChange: (versionId: string) => void;
- onValidate: () => Promise<void>;
- onRefresh: () => Promise<void>;
-};
-
-export const CoreWorkflowShowToolbar = ({
- coreWorkflowId,
- versions,
- selectedVersionId,
- visibility,
- canChangeVisibility,
- isHistoricalVersion,
- isValidating,
- onVersionChange,
- onValidate,
- onRefresh,
-}: CoreWorkflowShowToolbarProps) => (
- <StyledToolbar>
- <Select
- dropdownId={`core-workflow-version-${coreWorkflowId}`}
- aria-label={t`Version`}
- value={selectedVersionId ?? ''}
- options={versions.map((version) => ({
- value: version.id,
- label: `${version.label} · ${t(CORE_WORKFLOW_VERSION_STATUS_TAG_PROPS[version.status].label)}`,
- }))}
- onChange={onVersionChange}
- />
- {isHistoricalVersion && isDefined(selectedVersionId) && (
- <CoreWorkflowVersionRestoreButton
- workflowId={coreWorkflowId}
- coreWorkflowVersionId={selectedVersionId}
- />
- )}
- <Button
- size="sm"
- disabled={!isDefined(selectedVersionId) || isValidating}
- onClick={onValidate}
- >
- {t`Validate`}
- </Button>
- <Button size="sm" startIcon={<IconRefresh />} onClick={onRefresh}>
- {t`Refresh`}
- </Button>
- <CoreWorkflowVisibilitySelect
- coreWorkflowId={coreWorkflowId}
- visibility={visibility}
- disabled={!canChangeVisibility}
- />
- </StyledToolbar>
-);
diff --git a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowVisibilitySelect.tsx b/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowVisibilitySelect.tsx
deleted file mode 100644
index 762826981e4..00000000000
--- a/packages/twenty-front/src/modules/object-core/workflows/components/CoreWorkflowVisibilitySelect.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import { t } from '@lingui/core/macro';
-
-import { type WorkflowVisibility } from '~/generated/graphql';
-import { CORE_WORKFLOW_VISIBILITY_OPTIONS } from '@/object-core/workflows/constants/CoreWorkflowVisibilityOptions';
-import { useUpdateCoreWorkflowVisibility } from '@/object-core/workflows/hooks/useUpdateCoreWorkflowVisibility';
-import { Select } from '@/ui/input/components/Select';
-
-type CoreWorkflowVisibilitySelectProps = {
- coreWorkflowId: string;
- visibility: WorkflowVisibility;
- disabled?: boolean;
-};
-
-export const CoreWorkflowVisibilitySelect = ({
- coreWorkflowId,
- visibility,
- disabled = false,
-}: CoreWorkflowVisibilitySelectProps) => {
- const { updateVisibility, isUpdatingVisibility } =
- useUpdateCoreWorkflowVisibility({ coreWorkflowId });
-
- return (
- <Select
- dropdownId={`core-workflow-visibility-${coreWorkflowId}`}
- aria-label={t`Visibility`}
- value={visibility}
- disabled={disabled || isUpdatingVisibility}
- showIconInControl
- showContextualTextInControl
- options={CORE_WORKFLOW_VISIBILITY_OPTIONS.map((option) => ({
- value: option.value,
- label: t(option.label),
- contextualText: t(option.contextualText),
- Icon: option.Icon,
- }))}
- onChange={updateVisibility}
- />
- );
-};
diff --git a/packages/twenty-front/src/modules/object-core/workflows/docs/rollout.md b/packages/twenty-front/src/modules/object-core/workflows/docs/rollout.md
index 07121b38f28..64f786bf38d 100644
--- a/packages/twenty-front/src/modules/object-core/workflows/docs/rollout.md
+++ b/packages/twenty-front/src/modules/object-core/workflows/docs/rollout.md
@@ -23,7 +23,7 @@ Before rollout, the SSE dependency must provide:
- An ordering/revision mechanism and reconnect resynchronization, including missed deletions and draft replacement.
- Lifecycle coverage for every writer: core mutations, legacy mirror writes, activation/deactivation, draft creation/discard, duplication and deletion.
-Deliver the backend contract and frontend consumer together in a separate follow-up PR, which may be stacked on this frontend PR. The consumer must invalidate `coreWorkflows`, `coreWorkflowById`, `coreWorkflowVersionsByCoreWorkflowId` and `coreWorkflowVersionById`, reconcile removed selections and update open diagrams. It must not subscribe using workspace definition IDs. Local mutation refetches and the explicit Refresh action are implemented; remote live updates are not complete. Keep general rollout blocked until that contract and consumer land and multi-session/reconnect tests pass.
+Deliver the backend contract and frontend consumer together in a separate follow-up PR, which may be stacked on this frontend PR. The consumer must invalidate `coreWorkflows`, `coreWorkflowById`, `coreWorkflowVersionsByCoreWorkflowId` and `coreWorkflowVersionById`, reconcile removed selections and update open diagrams. It must not subscribe using workspace definition IDs. Local mutation refetches are implemented; remote live updates are not complete. Keep general rollout blocked until that contract and consumer land and multi-session/reconnect tests pass.
## Execution integration
diff --git a/packages/twenty-front/src/modules/object-core/workflows/graphql/mutations/updateCoreWorkflowVisibility.ts b/packages/twenty-front/src/modules/object-core/workflows/graphql/mutations/updateCoreWorkflowVisibility.ts
deleted file mode 100644
index fe385073630..00000000000
--- a/packages/twenty-front/src/modules/object-core/workflows/graphql/mutations/updateCoreWorkflowVisibility.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { gql } from '@apollo/client';
-
-export const UPDATE_CORE_WORKFLOW_VISIBILITY = gql`
- mutation UpdateCoreWorkflowVisibility(
- $input: UpdateCoreWorkflowVisibilityInput!
- ) {
- updateCoreWorkflowVisibility(input: $input) {
- id
- visibility
- canChangeVisibility
- updatedAt
- }
- }
-`;
diff --git a/packages/twenty-front/src/modules/object-core/workflows/graphql/mutations/validateCoreWorkflowVersion.ts b/packages/twenty-front/src/modules/object-core/workflows/graphql/mutations/validateCoreWorkflowVersion.ts
deleted file mode 100644
index a63930d2502..00000000000
--- a/packages/twenty-front/src/modules/object-core/workflows/graphql/mutations/validateCoreWorkflowVersion.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { gql } from '@apollo/client';
-
-export const VALIDATE_CORE_WORKFLOW_VERSION = gql`
- mutation ValidateCoreWorkflowVersion($coreWorkflowVersionId: UUID!) {
- validateCoreWorkflowVersion(coreWorkflowVersionId: $coreWorkflowVersionId)
- }
-`;
diff --git a/packages/twenty-front/src/modules/object-core/workflows/hooks/useUpdateCoreWorkflowVisibility.ts b/packages/twenty-front/src/modules/object-core/workflows/hooks/useUpdateCoreWorkflowVisibility.ts
deleted file mode 100644
index 7c1671bead7..00000000000
--- a/packages/twenty-front/src/modules/object-core/workflows/hooks/useUpdateCoreWorkflowVisibility.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import { useMutation } from '@apollo/client/react';
-import { t } from '@lingui/core/macro';
-import { useToast } from 'twenty-ui/components';
-
-import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
-import {
- UpdateCoreWorkflowVisibilityDocument,
- type WorkflowVisibility,
-} from '~/generated/graphql';
-import { logError } from '~/utils/logError';
-
-export const useUpdateCoreWorkflowVisibility = ({
- coreWorkflowId,
-}: {
- coreWorkflowId: string;
-}) => {
- const client = useApolloCoreClient();
- const [updateVisibilityMutation, { loading: isUpdatingVisibility }] =
- useMutation(UpdateCoreWorkflowVisibilityDocument, { client });
- const { enqueueToast } = useToast();
-
- const updateVisibility = async (visibility: WorkflowVisibility) => {
- try {
- await updateVisibilityMutation({
- variables: { input: { coreWorkflowId, visibility } },
- });
- } catch (mutationError) {
- logError(mutationError);
- enqueueToast({
- variant: 'error',
- children:
- mutationError instanceof Error
- ? mutationError.message
- : t`Could not change who can see this workflow`,
- });
- }
- };
-
- return { updateVisibility, isUpdatingVisibility };
-};
diff --git a/packages/twenty-front/src/modules/object-core/workflows/hooks/useValidateCoreWorkflowVersion.ts b/packages/twenty-front/src/modules/object-core/workflows/hooks/useValidateCoreWorkflowVersion.ts
deleted file mode 100644
index 01d0c8b18b1..00000000000
--- a/packages/twenty-front/src/modules/object-core/workflows/hooks/useValidateCoreWorkflowVersion.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { useMutation } from '@apollo/client/react';
-import { t } from '@lingui/core/macro';
-import { isDefined } from 'twenty-shared/utils';
-import { useToast } from 'twenty-ui/components';
-
-import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
-import { ValidateCoreWorkflowVersionDocument } from '~/generated/graphql';
-
-export const useValidateCoreWorkflowVersion = (
- coreWorkflowVersionId: string | undefined,
-) => {
- const client = useApolloCoreClient();
- const [validateVersion, { loading: isValidating }] = useMutation(
- ValidateCoreWorkflowVersionDocument,
- { client },
- );
- const { enqueueToast } = useToast();
-
- const validate = async () => {
- if (!isDefined(coreWorkflowVersionId)) {
- return;
- }
-
- try {
- await validateVersion({ variables: { coreWorkflowVersionId } });
- enqueueToast({ variant: 'success', children: t`Workflow is valid` });
- } catch (mutationError) {
- enqueueToast({
- variant: 'error',
- children:
- mutationError instanceof Error
- ? mutationError.message
- : t`Could not save workflow`,
- });
- }
- };
-
- return { validate, isValidating };
-};
diff --git a/packages/twenty-front/src/pages/object-core/WorkflowCoreShowPage.tsx b/packages/twenty-front/src/pages/object-core/WorkflowCoreShowPage.tsx
index 2b4db6b6441..1fd425d8bc0 100644
--- a/packages/twenty-front/src/pages/object-core/WorkflowCoreShowPage.tsx
+++ b/packages/twenty-front/src/pages/object-core/WorkflowCoreShowPage.tsx
@@ -1,16 +1,14 @@
import { CoreWorkflowEditor } from '@/object-core/workflows/components/CoreWorkflowEditor';
-import { CoreWorkflowShowToolbar } from '@/object-core/workflows/components/CoreWorkflowShowToolbar';
+import { CoreObjectIdentifierBar } from '@/object-core/components/CoreObjectIdentifierBar';
import { CoreWorkflowToWorkspaceRedirect } from '@/object-core/workflows/components/CoreWorkflowToWorkspaceRedirect';
import { useRenameCoreWorkflow } from '@/object-core/workflows/hooks/useRenameCoreWorkflow';
-import { useValidateCoreWorkflowVersion } from '@/object-core/workflows/hooks/useValidateCoreWorkflowVersion';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-import { useCallback, useState } from 'react';
+import { useCallback } from 'react';
import { useParams, useSearchParams } from 'react-router-dom';
-import { CoreObjectNameSingular } from 'twenty-shared/types';
+import { AppPath, CoreObjectNameSingular } from 'twenty-shared/types';
import { PermissionFlagType } from 'twenty-shared/constants';
-import { isDefined } from 'twenty-shared/utils';
-import { IconSettingsAutomation } from 'twenty-ui/icon';
+import { getAppPath, isDefined } from 'twenty-shared/utils';
import { Loader } from 'twenty-ui/primitives/feedback';
import { Button } from 'twenty-ui/primitives/input';
@@ -27,14 +25,11 @@ import { useObjectPermissionsForObject } from '@/object-record/hooks/useObjectPe
import { RecordShowPageResourceEffect } from '@/object-record/record-show/components/RecordShowPageResourceEffect';
import { RecordShowContainerContextStoreTargetedRecordsEffect } from '@/object-record/record-show/components/RecordShowContainerContextStoreTargetedRecordsEffect';
import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';
-import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';
import { SidePanelToggleButton } from '@/side-panel/components/SidePanelToggleButton';
-import { TextInput } from '@/ui/input/components/TextInput';
import { PageCardHeader } from '@/ui/layout/page/components/PageCardHeader';
import { PageCardLayout } from '@/ui/layout/page/components/PageCardLayout';
import { PageTitle } from '@/ui/utilities/page-title/components/PageTitle';
import { useIsWorkflowCoreEnabled } from '@/workflow/hooks/useIsWorkflowCoreEnabled';
-import { WorkflowVisibility } from '~/generated/graphql';
import { getWorkflowCurrentVersion } from '@/workflow/utils/getWorkflowCurrentVersion';
const StyledContainer = styled.div`
@@ -50,7 +45,6 @@ const CoreWorkflowShowContent = ({
coreWorkflowId: string;
}) => {
const client = useApolloCoreClient();
- const { closeSidePanelMenu } = useSidePanelMenu();
const { record, coreWorkflow, loading, error, refetch } =
useCoreWorkflowShowPageResource({
coreWorkflowId,
@@ -68,8 +62,7 @@ const CoreWorkflowShowContent = ({
refetch: refetchCoreWorkflowAndVersions,
});
- const [searchParams, setSearchParams] = useSearchParams();
- const [editedName, setEditedName] = useState<string>();
+ const [searchParams] = useSearchParams();
const requestedVersionId = searchParams.get('version');
const currentVersion = getWorkflowCurrentVersion({
versions: versions.coreWorkflowVersions,
@@ -79,15 +72,10 @@ const CoreWorkflowShowContent = ({
? versions.coreWorkflowVersions.find(({ id }) => id === requestedVersionId)
: currentVersion;
const isReadOnlyVersion = isDefined(requestedVersionId);
- const isHistoricalVersion =
- isDefined(requestedVersionId) && selectedVersion?.id !== currentVersion?.id;
const { renameWorkflow } = useRenameCoreWorkflow({
coreWorkflowId,
currentName: record?.name,
});
- const { validate, isValidating } = useValidateCoreWorkflowVersion(
- selectedVersion?.id,
- );
const resource = (
<RecordShowPageResourceEffect
@@ -143,23 +131,13 @@ const CoreWorkflowShowContent = ({
<PageCardLayout
header={
<PageCardHeader
- icon={<IconSettingsAutomation />}
- title={
- <TextInput
- placeholder={t`Workflow name`}
- value={editedName ?? record.name ?? ''}
- onChange={setEditedName}
- onBlur={async (event) => {
- const name = event.target.value;
- const didSave = await renameWorkflow(name);
- if (didSave) {
- setEditedName((currentName) =>
- currentName === name ? undefined : currentName,
- );
- }
- }}
- />
- }
+ links={[
+ {
+ children: t`Workflows`,
+ href: getAppPath(AppPath.WorkflowCoreIndexPage),
+ },
+ { children: record.name ?? '' },
+ ]}
actionButton={
<>
{!isReadOnlyVersion && <RecordShowCommandMenu />}
@@ -170,24 +148,11 @@ const CoreWorkflowShowContent = ({
}
>
<StyledContainer>
- <CoreWorkflowShowToolbar
- coreWorkflowId={coreWorkflowId}
- versions={versions.coreWorkflowVersions}
- selectedVersionId={selectedVersion?.id}
- visibility={
- coreWorkflow?.visibility ?? WorkflowVisibility.WORKSPACE
- }
- canChangeVisibility={coreWorkflow?.canChangeVisibility ?? false}
- isHistoricalVersion={isHistoricalVersion}
- isValidating={isValidating}
- onVersionChange={(versionId) => {
- closeSidePanelMenu();
- setSearchParams(
- versionId === currentVersion?.id ? {} : { version: versionId },
- );
- }}
- onValidate={validate}
- onRefresh={() => invalidateCoreWorkflowVersions(client)}
+ <CoreObjectIdentifierBar
+ recordId={coreWorkflowId}
+ name={record.name}
+ namePlaceholder={t`Workflow name`}
+ onRename={renameWorkflow}
/>
{isDefined(selectedVersion) ? (
<CoreWorkflowEditor
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/core-workflow-version-mutation.resolver.ts b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/core-workflow-version-mutation.resolver.ts
index 4c01fbef5e6..46027315d75 100644
--- a/packages/twenty-server/src/engine/core-modules/workflow/resolvers/core-workflow-version-mutation.resolver.ts
+++ b/packages/twenty-server/src/engine/core-modules/workflow/resolvers/core-workflow-version-mutation.resolver.ts
@@ -71,24 +71,6 @@ export class CoreWorkflowVersionMutationResolver {
private readonly workspaceOrmManager: WorkspaceOrmManager,
) {}
- @Mutation(() => Boolean)
- async validateCoreWorkflowVersion(
- @AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
- @AuthUserWorkspaceId({ allowUndefined: true })
- userWorkspaceId: string | undefined,
- @Args('coreWorkflowVersionId', { type: () => UUIDScalarType })
- coreWorkflowVersionId: string,
- ): Promise<boolean> {
- return this.coreWorkflowLifecycleWorkspaceService.validateCoreWorkflowVersion(
- {
- workspaceId,
-
- userWorkspaceId,
- coreWorkflowVersionId,
- },
- );
- }
-
@Mutation(() => Boolean)
async activateCoreWorkflowVersion(
@AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
diff --git a/packages/twenty-server/test/integration/graphql/suites/workflow/core-workflow-id-mutations.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/workflow/core-workflow-id-mutations.integration-spec.ts
index 76f8c69dd18..fd765dde660 100644
--- a/packages/twenty-server/test/integration/graphql/suites/workflow/core-workflow-id-mutations.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/workflow/core-workflow-id-mutations.integration-spec.ts
@@ -217,20 +217,6 @@ describe('core workflow id mutations (e2e)', () => {
});
it('activates, runs and deactivates by core ids', async () => {
- const validateResponse = await workflowGraphqlRequest(
- `
- mutation ValidateCoreWorkflowVersion($coreWorkflowVersionId: UUID!) {
- validateCoreWorkflowVersion(
- coreWorkflowVersionId: $coreWorkflowVersionId
- )
- }
- `,
- { coreWorkflowVersionId },
- );
-
- expect(validateResponse.body.errors).toBeUndefined();
- expect(validateResponse.body.data.validateCoreWorkflowVersion).toBe(true);
-
const activateResponse = await workflowGraphqlRequest(
`
mutation ActivateCoreWorkflowVersion($coreWorkflowVersionId: UUID!) {