@@ -18,6 +18,7 @@ import {
1818 Skeleton ,
1919 Breadcrumb ,
2020} from 'antd' ;
21+ import { FolderOutlined } from '@ant-design/icons' ;
2122import { MdArrowBackIos , MdArrowForwardIos } from 'react-icons/md' ;
2223import { UserError } from '@/lib/user-error' ;
2324import { useAddControlCallback } from '@/lib/controls-store' ;
@@ -31,14 +32,15 @@ import dynamic from 'next/dynamic';
3132
3233import '@toast-ui/editor/dist/toastui-editor.css' ;
3334import type { Editor as EditorClass } from '@toast-ui/react-editor' ;
35+ import { isDummyFolderProcess } from '@/lib/process-export/export-preparation' ;
3436const TextEditor = dynamic ( ( ) => import ( '@/components/text-editor' ) , {
3537 ssr : false ,
3638 loading : ( ) => < Skeleton . Input size = "large" /> ,
3739} ) ;
3840
3941export type ProcessModalMode = 'create' | 'edit' | 'copy' | 'import' ;
4042
41- type ProcessModalProps < T extends { name : string ; description : string } > = {
43+ type ProcessModalProps < T extends { id ?: string ; name : string ; description : string } > = {
4244 open : boolean ;
4345 title : string ;
4446 okText ?: string ;
@@ -52,6 +54,7 @@ type ProcessModalProps<T extends { name: string; description: string }> = {
5254
5355const ProcessModal = <
5456 T extends {
57+ id ?: string ;
5558 name : string ;
5659 description : string ;
5760 userDefinedId ?: string ;
@@ -214,6 +217,8 @@ const ProcessModal = <
214217 { level : 2 , blocking : open , dependencies : [ open ] } ,
215218 ) ;
216219
220+ const [ fullyOpen , setFullyOpen ] = useState ( false ) ;
221+
217222 const renderFormContent = ( ) => {
218223 if ( ! initialData ) {
219224 return < ProcessInputs index = { 0 } readonly = { readonly } /> ;
@@ -255,13 +260,38 @@ const ProcessModal = <
255260 >
256261 { initialData . map ( ( process , index ) => (
257262 < Card key = { index } >
258- { process . bpmn && (
259- < >
260- < LazyBPMNViewer previewBpmn = { process . bpmn } reduceLogo = { true } fitOnResize />
261- < Divider style = { { width : '100%' , marginLeft : '-20%' } } />
262- </ >
263- ) }
264- < ProcessInputsImport key = { index } index = { index } readonly = { readonly } />
263+ < >
264+ { process . bpmn && (
265+ < >
266+ { isDummyFolderProcess ( process ) ? (
267+ < div
268+ style = { {
269+ height : '150px' ,
270+ width : '100%' ,
271+ display : 'flex' ,
272+ justifyContent : 'center' ,
273+ } }
274+ >
275+ < FolderOutlined style = { { fontSize : '100px' } } />
276+ </ div >
277+ ) : (
278+ < LazyBPMNViewer
279+ previewBpmn = { process . bpmn }
280+ reduceLogo = { true }
281+ fitOnResize
282+ visible = { fullyOpen }
283+ />
284+ ) }
285+ < Divider style = { { width : '100%' , marginLeft : '-20%' } } />
286+ </ >
287+ ) }
288+ </ >
289+ < ProcessInputsImport
290+ key = { index }
291+ index = { index }
292+ readonly = { readonly }
293+ isFolder = { isDummyFolderProcess ( process ) }
294+ />
265295 </ Card >
266296 ) ) }
267297 </ Carousel >
@@ -309,6 +339,7 @@ const ProcessModal = <
309339 flexDirection : 'column' ,
310340 } ,
311341 } }
342+ afterOpenChange = { ( open ) => setFullyOpen ( open ) }
312343 >
313344 < div style = { { overflowY : 'auto' , flex : 1 } } className = "Hide-Scroll-Bar" >
314345 { nameCollisions . length > 0 && showCollisions && (
@@ -395,6 +426,7 @@ type ProcessInputsProps = {
395426 index : number ;
396427 initialName ?: string ;
397428 readonly ?: boolean ;
429+ isFolder ?: boolean ;
398430} ;
399431
400432const ProcessInputs = ( { index, initialName, readonly = false } : ProcessInputsProps ) => {
@@ -486,7 +518,7 @@ const ProcessInputs = ({ index, initialName, readonly = false }: ProcessInputsPr
486518 ) ;
487519} ;
488520
489- const ProcessInputsImport = ( { index, readonly = false } : ProcessInputsProps ) => {
521+ const ProcessInputsImport = ( { index, readonly = false , isFolder } : ProcessInputsProps ) => {
490522 const instance = Form . useFormInstance ( ) ;
491523 const data = instance . getFieldsValue ( ) [ index ] ;
492524
@@ -497,6 +529,13 @@ const ProcessInputsImport = ({ index, readonly = false }: ProcessInputsProps) =>
497529 < Form . Item hidden name = { [ index , 'folderPath' ] } >
498530 < Input disabled />
499531 </ Form . Item >
532+ { isFolder && (
533+ < Alert
534+ style = { { marginBottom : '10px' } }
535+ type = "warning"
536+ title = "This imports an empty folder without any processes."
537+ />
538+ ) }
500539 { ! ! data ?. folderPath && (
501540 < Form . Item label = "Import Path" >
502541 < Card size = "small" >
@@ -509,24 +548,32 @@ const ProcessInputsImport = ({ index, readonly = false }: ProcessInputsProps) =>
509548 </ Card >
510549 </ Form . Item >
511550 ) }
512- < ProcessInputs index = { index } readonly = { readonly } />
513- < Form . Item name = { [ index , 'creator' ] } label = "Original Creator" rules = { [ { required : false } ] } >
514- < Input disabled />
515- </ Form . Item >
516- < Form . Item
517- name = { [ index , 'creatorUsername' ] }
518- label = "Original Creator Username"
519- rules = { [ { required : false } ] }
520- >
521- < Input disabled />
522- </ Form . Item >
523- < Form . Item
524- name = { [ index , 'createdOn' ] }
525- label = "Original Creation Date"
526- rules = { [ { required : false } ] }
527- >
528- < Input disabled />
529- </ Form . Item >
551+ { ! isFolder && (
552+ < >
553+ < ProcessInputs index = { index } readonly = { readonly } />
554+ < Form . Item
555+ name = { [ index , 'creator' ] }
556+ label = "Original Creator"
557+ rules = { [ { required : false } ] }
558+ >
559+ < Input disabled />
560+ </ Form . Item >
561+ < Form . Item
562+ name = { [ index , 'creatorUsername' ] }
563+ label = "Original Creator Username"
564+ rules = { [ { required : false } ] }
565+ >
566+ < Input disabled />
567+ </ Form . Item >
568+ < Form . Item
569+ name = { [ index , 'createdOn' ] }
570+ label = "Original Creation Date"
571+ rules = { [ { required : false } ] }
572+ >
573+ < Input disabled />
574+ </ Form . Item >
575+ </ >
576+ ) }
530577 </ >
531578 ) ;
532579} ;
0 commit comments