Refactor the routing mechanisms to use Data API powered create*Router to support more flexible routing.
The usage of Data API routing also enables usages of usePrompt to prompt users for confirmation via [window.confirm] prior to navigating away from the current location if there is any editing in place.
The routing logic:
ThreatsOnly mode (?mode=ThreatsOnly) should stay on the same url without any routing when navigating between ThreatEditor and ThreatList. And last visited workspace is selected and presented or default workspace if there is not any last visited workspace.
EditorOnly mode(?mode=EditorOnly) should stay on the same url without any routing
Full mode
if a full url is provided: workspaces/<workspace_name>/<entity_type> (e.g., workspaces/EXAMPLE_ThreatComposer/dashboard), it should navigate to the relevant page (dashboard, threat list...) of the workspace
If only workspace name is provided in the url: workspaces/<workspace_name> , it should navigate to the dashboard of the workspace
If no workspace name is provided in the url, it should navigate to the last visit workspace that stored in the local storage. If there is not previous visited workspace, it should navigate to the default workspace
For print/preview, it should navigate to /print/<data_key> page.
The routing changes apply to with base_name (for instance, /threat-composer for Github deployment), without base_name (Self deployment), and IDE extension mode.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Issue #, if available:
Description of changes:
Refactor the routing mechanisms to use Data API powered create*Router to support more flexible routing.
The usage of Data API routing also enables usages of usePrompt to prompt users for confirmation via [window.confirm] prior to navigating away from the current location if there is any editing in place.
The routing logic:
ThreatsOnly mode (
?mode=ThreatsOnly
) should stay on the same url without any routing when navigating between ThreatEditor and ThreatList. And last visited workspace is selected and presented or default workspace if there is not any last visited workspace.EditorOnly mode(
?mode=EditorOnly
) should stay on the same url without any routingFull mode
if a full url is provided:
workspaces/<workspace_name>/<entity_type>
(e.g.,workspaces/EXAMPLE_ThreatComposer/dashboard
), it should navigate to the relevant page (dashboard, threat list...) of the workspaceIf only workspace name is provided in the url:
workspaces/<workspace_name>
, it should navigate to the dashboard of the workspaceIf no workspace name is provided in the url, it should navigate to the last visit workspace that stored in the local storage. If there is not previous visited workspace, it should navigate to the default workspace
For print/preview, it should navigate to
/print/<data_key>
page.The routing changes apply to with base_name (for instance,
/threat-composer
for Github deployment), without base_name (Self deployment), and IDE extension mode.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.