@@ -57,21 +57,22 @@ const ProcessCreateEdit = ({ type }) => {
5757 const { processKey, step } = useParams ( ) ;
5858 const isCreate = step === "create" ;
5959 const isBPMN = type === "BPMN" ;
60- const Process = isBPMN
61- ? {
60+ const Process = {
61+ BPMN : {
6262 name : "Subflow" ,
6363 type : "BPMN" ,
6464 route : "subflow" ,
6565 extension : ".bpmn" ,
6666 fileType : "text/bpmn" ,
67- }
68- : {
67+ } ,
68+ DMN : {
6969 name : "Decision Table" ,
7070 type : "DMN" ,
7171 route : "decision-table" ,
7272 extension : ".dmn" ,
7373 fileType : "text/dmn" ,
74- } ;
74+ }
75+ } [ isBPMN ? 'BPMN' : 'DMN' ] ;
7576
7677 const diagramType = Process . type ;
7778 const dispatch = useDispatch ( ) ;
@@ -188,7 +189,7 @@ const ProcessCreateEdit = ({ type }) => {
188189 {
189190 cacheTime : 0 , // Disable caching if not disabled the previous data will be cached
190191 staleTime : 0 , // Data is always treated as stale
191- enabled : ! ! processKey && ! isDataFetched . current , // Run only if processKey exists and data hasn't been fetched
192+ enabled : Boolean ( processKey ) && ! isDataFetched . current , // Run only if processKey exists and data hasn't been fetched
192193 onSuccess : ( { data } ) => {
193194 isDataFetched . current = true ;
194195 setIsPublished ( data . status === "Published" ) ;
@@ -224,9 +225,7 @@ const ProcessCreateEdit = ({ type }) => {
224225 } ,
225226 } ) ;
226227
227- const processDataXML = isReverted
228- ? historyData ?. processData
229- : processData ?. processData ;
228+ const processDataXML = isReverted ? historyData ?. processData : processData ?. processData ;
230229 // handle history modal
231230 // const handleToggleHistoryModal = () => setHistoryModalShow(!historyModalShow);
232231
@@ -529,7 +528,9 @@ const ProcessCreateEdit = ({ type }) => {
529528 } ;
530529 const handleCloseErrorModal = ( ) => setShowErrorModal ( false ) ;
531530
532- if ( isProcessDetailsLoading ) return < Loading /> ;
531+ if ( isProcessDetailsLoading ) {
532+ return < Loading /> ;
533+ }
533534
534535 const getModalContent = ( ) => {
535536 const getModalConfig = (
@@ -624,8 +625,11 @@ const ProcessCreateEdit = ({ type }) => {
624625
625626 < BreadCrumbs
626627 items = { [
627- { label : t ( "Build" ) , href : isBPMN ? `/${ Process . route } ` : `/${ Process . route } ` } ,
628- { label : isCreate ? t ( `Create New Flow` ) : t ( `Edit Flow` ) , href : location ?. pathname || "" } ,
628+ { label : t ( "Build" ) , href : `/${ Process . route } ` } ,
629+ {
630+ label : isCreate ? t ( "Create New Flow" ) : t ( "Edit Flow" ) ,
631+ href : location ?. pathname || ""
632+ } ,
629633 ] }
630634 variant = "minimized"
631635 underlined = { true }
@@ -660,9 +664,11 @@ const ProcessCreateEdit = ({ type }) => {
660664 />
661665 < V8CustomButton
662666 onClick = { ( ) => {
663- isPublished
664- ? openConfirmModal ( "unpublish" )
665- : openConfirmModal ( "publish" ) ;
667+ if ( isPublished ) {
668+ openConfirmModal ( "unpublish" ) ;
669+ } else {
670+ openConfirmModal ( "publish" ) ;
671+ }
666672 } }
667673 label = { t ( publishText ) }
668674 aria-label = { `${ t ( publishText ) } ${ t ( "Button" ) } ` }
@@ -723,26 +729,26 @@ const ProcessCreateEdit = ({ type }) => {
723729 />
724730 ) : (
725731 showEditor && (
726- < LoadingOverlay
727- active = { historyLoading }
728- spinner
729- text = { t ( "Loading..." ) }
730- >
731- { isBPMN ? (
732- < BpmnEditor
733- onChange = { enableWorkflowChange }
734- ref = { bpmnRef }
735- bpmnXml = { isCreate ? defaultProcessXmlData : processDataXML }
736- setLintErrors = { setLintErrors }
737- />
738- ) : (
739- < DmnEditor
740- onChange = { enableWorkflowChange }
741- ref = { dmnRef }
742- dmnXml = { isCreate ? defaultDmnXmlData : processDataXML }
743- />
744- ) }
745- </ LoadingOverlay >
732+ < LoadingOverlay
733+ active = { historyLoading }
734+ spinner
735+ text = { t ( "Loading..." ) }
736+ >
737+ { isBPMN ? (
738+ < BpmnEditor
739+ onChange = { enableWorkflowChange }
740+ ref = { bpmnRef }
741+ bpmnXml = { isCreate ? defaultProcessXmlData : processDataXML }
742+ setLintErrors = { setLintErrors }
743+ />
744+ ) : (
745+ < DmnEditor
746+ onChange = { enableWorkflowChange }
747+ ref = { dmnRef }
748+ dmnXml = { isCreate ? defaultDmnXmlData : processDataXML }
749+ />
750+ ) }
751+ </ LoadingOverlay >
746752 )
747753 ) }
748754 </ div >
0 commit comments