Create workflow version show page (#7466)
In this PR: - Refactored components to clarify their behavior. For example, I renamed the `Workflow` component to `WorkflowVisualizer`. This moved forward the issue #7010. - Create two variants of several workflow-related components: one version for editing and another for viewing. For instance, there is `WorkflowDiagramCanvasEditable.tsx` and `WorkflowDiagramCanvasReadonly.tsx` - Implement the show page for workflow versions. On this page, we display a readonly workflow visualizer. Users can click on nodes and it will expand the right drawer. - I added buttons in the header of the RecordShowPage for workflow versions: users can activate, deactivate or use the currently viewed version as the next draft. **There are many cache desynchronisation and I'll fix them really soon.** ## Demo (Turn sound on) https://github.com/user-attachments/assets/97fafa48-8902-4dab-8b39-f40848bf041e
This commit is contained in:
committed by
GitHub
parent
d5bd320b8d
commit
1863636003
@ -11,6 +11,7 @@ import { RightDrawerTopBar } from '@/ui/layout/right-drawer/components/RightDraw
|
||||
import { ComponentByRightDrawerPage } from '@/ui/layout/right-drawer/types/ComponentByRightDrawerPage';
|
||||
import { RightDrawerWorkflowEditStep } from '@/workflow/components/RightDrawerWorkflowEditStep';
|
||||
import { RightDrawerWorkflowSelectAction } from '@/workflow/components/RightDrawerWorkflowSelectAction';
|
||||
import { RightDrawerWorkflowViewStep } from '@/workflow/components/RightDrawerWorkflowViewStep';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { rightDrawerPageState } from '../states/rightDrawerPageState';
|
||||
import { RightDrawerPages } from '../types/RightDrawerPages';
|
||||
@ -41,6 +42,7 @@ const RIGHT_DRAWER_PAGES_CONFIG: ComponentByRightDrawerPage = {
|
||||
<RightDrawerWorkflowSelectAction />
|
||||
),
|
||||
[RightDrawerPages.WorkflowStepEdit]: <RightDrawerWorkflowEditStep />,
|
||||
[RightDrawerPages.WorkflowStepView]: <RightDrawerWorkflowViewStep />,
|
||||
};
|
||||
|
||||
export const RightDrawerRouter = () => {
|
||||
|
||||
@ -7,4 +7,5 @@ export const RIGHT_DRAWER_PAGE_ICONS = {
|
||||
[RightDrawerPages.Copilot]: 'IconSparkles',
|
||||
[RightDrawerPages.WorkflowStepEdit]: 'IconSparkles',
|
||||
[RightDrawerPages.WorkflowStepSelectAction]: 'IconSparkles',
|
||||
[RightDrawerPages.WorkflowStepView]: 'IconSparkles',
|
||||
};
|
||||
|
||||
@ -7,4 +7,5 @@ export const RIGHT_DRAWER_PAGE_TITLES = {
|
||||
[RightDrawerPages.Copilot]: 'Copilot',
|
||||
[RightDrawerPages.WorkflowStepEdit]: 'Workflow',
|
||||
[RightDrawerPages.WorkflowStepSelectAction]: 'Workflow',
|
||||
[RightDrawerPages.WorkflowStepView]: 'Workflow',
|
||||
};
|
||||
|
||||
@ -4,5 +4,6 @@ export enum RightDrawerPages {
|
||||
ViewRecord = 'view-record',
|
||||
Copilot = 'copilot',
|
||||
WorkflowStepSelectAction = 'workflow-step-select-action',
|
||||
WorkflowStepView = 'workflow-step-view',
|
||||
WorkflowStepEdit = 'workflow-step-edit',
|
||||
}
|
||||
|
||||
@ -15,7 +15,10 @@ import { ShowPageActivityContainer } from '@/ui/layout/show-page/components/Show
|
||||
import { TabList } from '@/ui/layout/tab/components/TabList';
|
||||
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||
import { Workflow } from '@/workflow/components/Workflow';
|
||||
import { WorkflowVersionVisualizer } from '@/workflow/components/WorkflowVersionVisualizer';
|
||||
import { WorkflowVersionVisualizerEffect } from '@/workflow/components/WorkflowVersionVisualizerEffect';
|
||||
import { WorkflowVisualizer } from '@/workflow/components/WorkflowVisualizer';
|
||||
import { WorkflowVisualizerEffect } from '@/workflow/components/WorkflowVisualizerEffect';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import styled from '@emotion/styled';
|
||||
import { useState } from 'react';
|
||||
@ -130,6 +133,10 @@ export const ShowPageRightContainer = ({
|
||||
isWorkflowEnabled &&
|
||||
targetableObject.targetObjectNameSingular ===
|
||||
CoreObjectNameSingular.Workflow;
|
||||
const isWorkflowVersion =
|
||||
isWorkflowEnabled &&
|
||||
targetableObject.targetObjectNameSingular ===
|
||||
CoreObjectNameSingular.WorkflowVersion;
|
||||
|
||||
const shouldDisplayCalendarTab = isCompanyOrPerson;
|
||||
const shouldDisplayEmailsTab = emails && isCompanyOrPerson;
|
||||
@ -162,7 +169,7 @@ export const ShowPageRightContainer = ({
|
||||
id: 'timeline',
|
||||
title: 'Timeline',
|
||||
Icon: IconTimelineEvent,
|
||||
hide: !timeline || isInRightDrawer || isWorkflow,
|
||||
hide: !timeline || isInRightDrawer || isWorkflow || isWorkflowVersion,
|
||||
},
|
||||
{
|
||||
id: 'tasks',
|
||||
@ -174,7 +181,8 @@ export const ShowPageRightContainer = ({
|
||||
CoreObjectNameSingular.Note ||
|
||||
targetableObject.targetObjectNameSingular ===
|
||||
CoreObjectNameSingular.Task ||
|
||||
isWorkflow,
|
||||
isWorkflow ||
|
||||
isWorkflowVersion,
|
||||
},
|
||||
{
|
||||
id: 'notes',
|
||||
@ -186,13 +194,14 @@ export const ShowPageRightContainer = ({
|
||||
CoreObjectNameSingular.Note ||
|
||||
targetableObject.targetObjectNameSingular ===
|
||||
CoreObjectNameSingular.Task ||
|
||||
isWorkflow,
|
||||
isWorkflow ||
|
||||
isWorkflowVersion,
|
||||
},
|
||||
{
|
||||
id: 'files',
|
||||
title: 'Files',
|
||||
Icon: IconPaperclip,
|
||||
hide: !notes || isWorkflow,
|
||||
hide: !notes || isWorkflow || isWorkflowVersion,
|
||||
},
|
||||
{
|
||||
id: 'emails',
|
||||
@ -212,6 +221,12 @@ export const ShowPageRightContainer = ({
|
||||
Icon: IconSettings,
|
||||
hide: !isWorkflow,
|
||||
},
|
||||
{
|
||||
id: 'workflowVersion',
|
||||
title: 'Workflow Version',
|
||||
Icon: IconSettings,
|
||||
hide: !isWorkflowVersion,
|
||||
},
|
||||
];
|
||||
const renderActiveTabContent = () => {
|
||||
switch (activeTabId) {
|
||||
@ -251,7 +266,25 @@ export const ShowPageRightContainer = ({
|
||||
case 'calendar':
|
||||
return <Calendar targetableObject={targetableObject} />;
|
||||
case 'workflow':
|
||||
return <Workflow targetableObject={targetableObject} />;
|
||||
return (
|
||||
<>
|
||||
<WorkflowVisualizerEffect workflowId={targetableObject.id} />
|
||||
|
||||
<WorkflowVisualizer targetableObject={targetableObject} />
|
||||
</>
|
||||
);
|
||||
case 'workflowVersion':
|
||||
return (
|
||||
<>
|
||||
<WorkflowVersionVisualizerEffect
|
||||
workflowVersionId={targetableObject.id}
|
||||
/>
|
||||
|
||||
<WorkflowVersionVisualizer
|
||||
workflowVersionId={targetableObject.id}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
default:
|
||||
return <></>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user