-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn user when leaving bpmn editor with unsaved changes (#11715)
* Upgrade react-router-dom from 6.18.0 to 6.20.0 * Refactor routes * Create new hook to block navigation * Implement new hook * Move App code into RouterProvider * Add tests for useConfirmationNavigation hook * Fix unit tests * Fix Canvas unit tests * Rename hook to useConfirmationDialogOnPageLeave * Rename AppShell and Layout * Fix missing type * Add missing changes * Fixes after cr
- Loading branch information
Showing
23 changed files
with
329 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,40 @@ | ||
import React from 'react'; | ||
import classes from './PageRoutes.module.css'; | ||
import { Navigate, Route, Routes } from 'react-router-dom'; | ||
import { AppShell } from 'app-development/layout/AppShell'; | ||
import { | ||
RouterProvider, | ||
createBrowserRouter, | ||
createRoutesFromElements, | ||
Navigate, | ||
Route, | ||
} from 'react-router-dom'; | ||
import { App } from 'app-development/layout/App'; | ||
import { PageLayout } from 'app-development/layout/PageLayout'; | ||
import { RoutePaths } from 'app-development/enums/RoutePaths'; | ||
import { routerRoutes } from 'app-development/router/routes'; | ||
import { StudioNotFoundPage } from '@studio/components'; | ||
import { APP_DEVELOPMENT_BASENAME } from 'app-shared/constants'; | ||
|
||
const BASE_PATH = '/:org/:app'; | ||
|
||
const router = createBrowserRouter( | ||
createRoutesFromElements( | ||
<Route path='/' element={<App />}> | ||
<Route path={BASE_PATH} element={<PageLayout />}> | ||
{/* Redirects from /:org/:app to child route /overview */} | ||
<Route path={RoutePaths.Root} element={<Navigate to={RoutePaths.Overview} />} /> | ||
{routerRoutes.map((route) => ( | ||
<Route key={route.path} path={route.path} element={<route.subapp {...route.props} />} /> | ||
))} | ||
<Route path='*' element={<StudioNotFoundPage />} /> | ||
</Route> | ||
<Route path='*' element={<StudioNotFoundPage />} /> | ||
</Route>, | ||
), | ||
{ | ||
basename: APP_DEVELOPMENT_BASENAME, | ||
}, | ||
); | ||
|
||
/** | ||
* Displays the routes for app development pages | ||
*/ | ||
export const PageRoutes = () => { | ||
return ( | ||
<div className={classes.root}> | ||
<Routes> | ||
<Route path={BASE_PATH} element={<AppShell />}> | ||
{/* Redirects from /:org/:app to child route /overview */} | ||
<Route path={RoutePaths.Root} element={<Navigate to={RoutePaths.Overview} />} /> | ||
{routerRoutes.map((route) => ( | ||
<Route key={route.path} path={route.path} element={<route.subapp {...route.props} />} /> | ||
))} | ||
<Route path='*' element={<StudioNotFoundPage />} /> | ||
</Route> | ||
<Route path='*' element={<StudioNotFoundPage />} /> | ||
</Routes> | ||
</div> | ||
); | ||
}; | ||
export const PageRoutes = () => <RouterProvider router={router} />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.