2023-11-02 14:08:34 +00:00
|
|
|
import { Alert, Slider } from 'antd';
|
2023-07-07 06:35:22 +00:00
|
|
|
import React from 'react';
|
2023-10-27 03:34:08 +00:00
|
|
|
|
|
|
|
import { cx, css } from '@nocobase/client';
|
|
|
|
|
2023-05-16 01:45:45 +00:00
|
|
|
import { Branch } from './Branch';
|
2023-10-27 07:32:17 +00:00
|
|
|
import { useFlowContext } from './FlowContext';
|
2023-05-16 01:45:45 +00:00
|
|
|
import { lang } from './locale';
|
2023-07-16 04:46:25 +00:00
|
|
|
import useStyles from './style';
|
2023-05-16 01:45:45 +00:00
|
|
|
import { TriggerConfig } from './triggers';
|
|
|
|
|
|
|
|
export function CanvasContent({ entry }) {
|
2023-07-16 04:46:25 +00:00
|
|
|
const { styles } = useStyles();
|
2023-10-13 08:18:19 +00:00
|
|
|
const { workflow } = useFlowContext();
|
2023-11-02 14:08:34 +00:00
|
|
|
const [zoom, setZoom] = React.useState(100);
|
2023-07-16 04:46:25 +00:00
|
|
|
|
2023-05-16 01:45:45 +00:00
|
|
|
return (
|
2023-11-02 14:08:34 +00:00
|
|
|
<div className="workflow-canvas-wrapper">
|
|
|
|
<div className="workflow-canvas" style={{ zoom: zoom / 100 }}>
|
|
|
|
<div
|
|
|
|
className={cx(
|
|
|
|
styles.branchBlockClass,
|
|
|
|
css`
|
|
|
|
margin-top: 0 !important;
|
|
|
|
`,
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<div className={styles.branchClass}>
|
|
|
|
{workflow?.executed ? (
|
|
|
|
<Alert type="warning" message={lang('Executed workflow cannot be modified')} showIcon />
|
|
|
|
) : null}
|
|
|
|
<TriggerConfig />
|
|
|
|
<div
|
|
|
|
className={cx(
|
|
|
|
styles.branchBlockClass,
|
|
|
|
css`
|
|
|
|
margin-top: 0 !important;
|
|
|
|
`,
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<Branch entry={entry} />
|
|
|
|
</div>
|
|
|
|
<div className={styles.terminalClass}>{lang('End')}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="workflow-canvas-zoomer">
|
|
|
|
<Slider vertical reverse defaultValue={100} step={10} min={10} value={zoom} onChange={setZoom} />
|
2023-05-16 01:45:45 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|