@@ -180,7 +180,6 @@ const EditComponent = () => {
180180 // created a copy for access and submissin access
181181 const [ formAccessRoles , setFormAccessRoles ] = useState ( _cloneDeep ( formAccess ) ) ;
182182 const [ submissionAccessRoles , setSubmissionAccessRoles ] = useState ( _cloneDeep ( submissionAccess ) ) ;
183- const [ formHistoryLoading , setFormHistoryLoading ] = useState ( false ) ;
184183 const { path, display } = useSelector ( ( state ) => state . form . form ) ;
185184
186185 const { authorizationDetails : formAuthorization } = useSelector (
@@ -438,7 +437,7 @@ const EditComponent = () => {
438437 }
439438 }
440439 ) ;
441- const [ paginationModel , setPaginationModel ] = useState ( { page : 0 , pageSize : 10 } ) ;
440+ const [ paginationModel ] = useState ( { page : 0 , pageSize : 10 } ) ;
442441
443442 const UploadActionType = {
444443 IMPORT : "import" ,
@@ -657,7 +656,6 @@ const EditComponent = () => {
657656 } = useSelector ( ( state ) => state . formRestore ) ;
658657
659658 /* ------------------------- BPMN history variables ------------------------- */
660- const [ showBpmnHistoryModal , setShowBpmnHistoryModal ] = useState ( false ) ;
661659 const [ bpmnHistoryData , setBpmnHistoryData ] = useState ( { processHistory : [ ] , totalCount : 0 } ) ;
662660
663661 /* -------------------------- getting process data -------------------------- */
@@ -741,6 +739,9 @@ useEffect(() => {
741739 if ( activeTab . primary === "form" && activeTab . secondary === "history" ) {
742740 handleFormHistory ( ) ;
743741 }
742+ if ( activeTab . primary === "bpmn" && activeTab . secondary === "history" ) {
743+ handleBpmnHistory ( ) ;
744+ }
744745 } , [ activeTab . primary , activeTab . secondary , processListData ?. parentFormId ,
745746 paginationModel . pageSize ] ) ;
746747
@@ -1217,14 +1218,12 @@ const saveFormWithWorkflow = async () => {
12171218 // setShowHistoryModal(false);
12181219 // };
12191220 const fetchFormHistory = ( parentFormId , page , limit ) => {
1220- setFormHistoryLoading ( true ) ;
12211221 parentFormId = parentFormId && typeof parentFormId === 'string' ? parentFormId : processListData ?. parentFormId ;
12221222 page = page ? page : paginationModel . page + 1 ;
12231223 limit = limit ? limit : paginationModel . pageSize ;
12241224 getFormHistory ( parentFormId , page , limit )
12251225 . then ( ( res ) => {
12261226 dispatch ( setFormHistories ( res . data ) ) ;
1227- setFormHistoryLoading ( false ) ;
12281227 } )
12291228 . catch ( ( ) => {
12301229 setFormHistories ( [ ] ) ;
@@ -1233,7 +1232,6 @@ const saveFormWithWorkflow = async () => {
12331232
12341233 const handleFormHistory = ( ) => {
12351234 console . log ( "handleFormHistory" , processListData ) ;
1236- // setShowHistoryModal(true);
12371235 dispatch ( setFormHistories ( { formHistory : [ ] , totalCount : 0 } ) ) ;
12381236 if ( processListData ?. parentFormId ) {
12391237 fetchFormHistory ( processListData ?. parentFormId , 1 , paginationModel . pageSize ) ;
@@ -1246,7 +1244,6 @@ const saveFormWithWorkflow = async () => {
12461244
12471245 /* ------------------------- BPMN history handlers ------------------------- */
12481246 const handleBpmnHistory = ( ) => {
1249- setShowBpmnHistoryModal ( true ) ;
12501247 setBpmnHistoryData ( { processHistory : [ ] , totalCount : 0 } ) ;
12511248 if ( processData ?. parentProcessKey ) {
12521249 fetchBpmnHistory ( processData . parentProcessKey , 1 , 4 ) ;
@@ -1282,9 +1279,7 @@ const saveFormWithWorkflow = async () => {
12821279 }
12831280 } ;
12841281
1285- const closeBpmnHistoryModal = ( ) => {
1286- setShowBpmnHistoryModal ( false ) ;
1287- } ;
1282+
12881283
12891284 const revertFormBtnAction = ( cloneId ) => {
12901285 dispatch ( setRestoreFormId ( cloneId ) ) ;
@@ -1870,6 +1865,7 @@ const saveFormWithWorkflow = async () => {
18701865 const renderTabContent = ( ) => {
18711866 switch ( activeTab . primary ) {
18721867 case 'form' :
1868+ // Check if history sub-tab is active
18731869 if ( activeTab . secondary === 'history' ) {
18741870 return (
18751871 < HistoryPage
@@ -1879,28 +1875,26 @@ const saveFormWithWorkflow = async () => {
18791875 revertBtnAction = { revertFormBtnAction }
18801876 historyCount = { formHistoryData . totalCount }
18811877 disableAllRevertButton = { isPublished }
1882- loading = { formHistoryLoading }
1878+ loading = { false }
18831879 refreshBtnAction = { fetchFormHistory }
18841880 paginationModel = { paginationModel }
1885- handlePaginationModelChange = { setPaginationModel }
1881+ handlePaginationModelChange = { ( ) => { } }
18861882 />
18871883 ) ;
18881884 }
18891885 // Check if settings sub-tab is active
18901886 if ( activeTab . secondary === 'settings' ) {
18911887 return (
1892-
1893- < SettingsTab
1894- handleConfirm = { handleConfirmSettings }
1895- isCreateRoute = { isCreateRoute }
1896- rolesState = { rolesState }
1897- formDetails = { formDetails }
1898- isAnonymous = { isAnonymous }
1899- setIsAnonymous = { setIsAnonymous }
1900- setFormDetails = { setFormDetails }
1901- setRolesState = { setRolesState }
1902- />
1903-
1888+ < SettingsTab
1889+ handleConfirm = { handleConfirmSettings }
1890+ isCreateRoute = { isCreateRoute }
1891+ rolesState = { rolesState }
1892+ formDetails = { formDetails }
1893+ isAnonymous = { isAnonymous }
1894+ setIsAnonymous = { setIsAnonymous }
1895+ setFormDetails = { setFormDetails }
1896+ setRolesState = { setRolesState }
1897+ />
19041898 ) ;
19051899 }
19061900 return (
@@ -2024,8 +2018,8 @@ const saveFormWithWorkflow = async () => {
20242018 { /* Show variable content when on variables tab */ }
20252019 { variableContent && < div className = "variable-content" > { variableContent } </ div > }
20262020
2027- { /* Always keep FlowEdit mounted but hide when showing variables */ }
2028- < div className = "bpmn-editor" style = { { display : variableContent ? 'none' : 'block' } } >
2021+ { /* Always keep FlowEdit mounted but hide when showing variables or history */ }
2022+ < div className = "bpmn-editor" style = { { display : ( variableContent || activeTab . secondary === 'history' ) ? 'none' : 'block' } } >
20292023 { isProcessDetailsLoading ? (
20302024 < div className = "d-flex justify-content-center p-4" >
20312025 < div className = "spinner-grow" aria-live = "polite" >
@@ -2093,11 +2087,9 @@ const saveFormWithWorkflow = async () => {
20932087 handleTabClick ( 'form' , 'settings' ) ;
20942088 } else if ( key === 'history' ) {
20952089 if ( activeTab . primary === 'form' ) {
2096- activeTab . secondary = 'history' ;
20972090 handleTabClick ( 'form' , 'history' ) ;
2098- handleFormHistory ( ) ;
20992091 } else if ( activeTab . primary === 'bpmn' ) {
2100- handleBpmnHistory ( ) ;
2092+ handleTabClick ( 'bpmn' , 'history' ) ;
21012093 }
21022094 } else if ( key === 'preview' ) {
21032095 handlePreview ( ) ;
@@ -2194,12 +2186,14 @@ const saveFormWithWorkflow = async () => {
21942186 </ div >
21952187 { createDesigns && (
21962188 < >
2189+ { /* {
2190+ logic for save button disabled
2191+ isCreateRoute
2192+ ? !formDetails.title?.trim()
2193+ : !formChangeState.changed && !workflowIsChanged
2194+ } */ }
21972195 < V8CustomButton
2198- disabled = {
2199- isCreateRoute
2200- ? ! formDetails . title ?. trim ( )
2201- : ! formChangeState . changed && ! workflowIsChanged
2202- }
2196+ disabled = { true }
22032197 label = { t ( "Save" ) }
22042198 onClick = {
22052199 isPublished
@@ -2210,6 +2204,7 @@ const saveFormWithWorkflow = async () => {
22102204 ariaLabel = { t ( "Save Form Layout" ) }
22112205 />
22122206 < V8CustomButton
2207+ disabled = { true }
22132208 label = { t ( publishText ) }
22142209 onClick = { handlePublishClick }
22152210 dataTestId = "handle-publish-testid"
@@ -2235,13 +2230,26 @@ const saveFormWithWorkflow = async () => {
22352230 return (
22362231 < V8CustomButton
22372232 key = { key }
2238- onClick = { ( ) => handleTabClick ( key ) }
2233+ onClick = { ( ) => {
2234+ // When clicking a primary tab, always go to the main view
2235+ // Only skip navigation if already on the main view
2236+ const isOnMainView = activeTab . primary === key &&
2237+ ! activeTab . secondary &&
2238+ ! activeTab . tertiary ;
2239+
2240+ if ( isOnMainView ) {
2241+ // Already on this tab's main view, avoid navigation
2242+ return ;
2243+ }
2244+ // Switch to main view (clearing secondary and tertiary)
2245+ handleTabClick ( key , null , null ) ;
2246+ } }
22392247 data-testid = { `tab-${ key } ` }
22402248 aria-label = { t ( `${ config . label } Tab` ) }
22412249 role = "tab"
2242- aria-selected = { activeTab . primary === key }
2250+ aria-selected = { activeTab . primary === key && ! activeTab . secondary }
22432251 label = { t ( config . label ) }
2244- selected = { activeTab . primary === key }
2252+ selected = { activeTab . primary === key && ! activeTab . secondary }
22452253 //disabled={isDisabled}
22462254 />
22472255 ) ;
@@ -2289,9 +2297,27 @@ const saveFormWithWorkflow = async () => {
22892297 ) }
22902298
22912299 { /* Body Section - Main content */ }
2292- < div className = "body-section formedit-layout" >
2300+ < div className = "body-section formedit-layout" style = { { display : ( activeTab . primary === 'bpmn' && activeTab . secondary === 'history' ) ? 'none' : 'block' } } >
22932301 { renderTabContent ( ) }
22942302 </ div >
2303+
2304+ { /* BPMN History Section - Show when on BPMN history tab */ }
2305+ { ( activeTab . primary === 'bpmn' && activeTab . secondary === 'history' ) && (
2306+ < div className = "body-section" >
2307+ < HistoryPage
2308+ title = { t ( "BPMN History" ) }
2309+ loadMoreBtnText = { t ( "Load More" ) }
2310+ loadMoreBtndataTestId = "load-more-bpmn-history"
2311+ revertBtnText = { t ( "Revert To This" ) }
2312+ allHistory = { bpmnHistoryData . processHistory }
2313+ loadMoreBtnAction = { loadMoreBpmnHistory }
2314+ categoryType = { CategoryType . WORKFLOW }
2315+ revertBtnAction = { revertBpmnHistory }
2316+ historyCount = { bpmnHistoryData . totalCount }
2317+ disableAllRevertButton = { isPublished }
2318+ />
2319+ </ div >
2320+ ) }
22952321 </ div >
22962322 </ div >
22972323 </ LoadingOverlay >
@@ -2369,37 +2395,7 @@ const saveFormWithWorkflow = async () => {
23692395 />
23702396 ) }
23712397
2372- { /* <HistoryPage
2373- // show={showHistoryModal}
2374- // onClose={closeHistoryModal}
2375- title={t("History")}
2376- loadMoreBtnText={t("Load More")}
2377- loadMoreBtndataTestId="load-more-form-history"
2378- revertBtnText={t("Revert To This")}
2379- allHistory={formHistory}
2380- loadMoreBtnAction={loadMoreBtnAction}
2381- categoryType={CategoryType.FORM}
2382- revertBtnAction={revertFormBtnAction}
2383- historyCount={formHistoryData.totalCount}
2384- disableAllRevertButton={isPublished}
2385- /> */ }
2386-
2387- { showBpmnHistoryModal && (
2388- < HistoryPage
2389- show = { showBpmnHistoryModal }
2390- onClose = { closeBpmnHistoryModal }
2391- title = { t ( "BPMN History" ) }
2392- loadMoreBtnText = { t ( "Load More" ) }
2393- loadMoreBtndataTestId = "load-more-bpmn-history"
2394- revertBtnText = { t ( "Revert To This" ) }
2395- allHistory = { bpmnHistoryData . processHistory }
2396- loadMoreBtnAction = { loadMoreBpmnHistory }
2397- categoryType = { CategoryType . WORKFLOW }
2398- revertBtnAction = { revertBpmnHistory }
2399- historyCount = { bpmnHistoryData . totalCount }
2400- disableAllRevertButton = { isPublished }
2401- />
2402- ) }
2398+
24032399
24042400 < PromptModal
24052401 show = { showDeleteModal }
0 commit comments