2023-11-02 22:08:34 +08:00
|
|
|
import { Alert, Slider } from 'antd';
|
2023-07-07 14:35:22 +08:00
|
|
|
import React from 'react';
|
2023-10-27 11:34:08 +08:00
|
|
|
|
|
|
|
import { cx, css } from '@nocobase/client';
|
|
|
|
|
2023-05-16 09:45:45 +08:00
|
|
|
import { Branch } from './Branch';
|
2023-10-27 15:32:17 +08:00
|
|
|
import { useFlowContext } from './FlowContext';
|
2023-05-16 09:45:45 +08:00
|
|
|
import { lang } from './locale';
|
2023-07-16 12:46:25 +08:00
|
|
|
import useStyles from './style';
|
2023-05-16 09:45:45 +08:00
|
|
|
import { TriggerConfig } from './triggers';
|
|
|
|
|
|
|
|
export function CanvasContent({ entry }) {
|
2023-07-16 12:46:25 +08:00
|
|
|
const { styles } = useStyles();
|
2023-10-13 16:18:19 +08:00
|
|
|
const { workflow } = useFlowContext();
|
2023-11-02 22:08:34 +08:00
|
|
|
const [zoom, setZoom] = React.useState(100);
|
2023-07-16 12:46:25 +08:00
|
|
|
|
2023-05-16 09:45:45 +08:00
|
|
|
return (
|
2023-11-02 22:08:34 +08: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 09:45:45 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|