+
+type MatchRoute<Params> = (route: string) => match<Params> | null;
+type ActionCreator<Params> = (params: Params) => void;
+
+const handle = <Params>(matchRoute: MatchRoute<Params>, actionCreator: ActionCreator<Params>) =>
+ (dispatch: Dispatch, route: string) => {
+ const match = matchRoute(route);
+ return match
+ ? (
+ dispatch<any>(actionCreator(match.params)),
+ true
+ )
+ : false;
+ };
+
+const locationChangeHandlers = [
+
+ handle(
+ R.matchApiClientAuthorizationsRoute,
+ () => WA.loadApiClientAuthorizations
+ ),
+
+ handle(
+ R.matchCollectionRoute,
+ ({ id }) => WA.loadCollection(id)
+ ),
+
+ handle(
+ R.matchComputeNodesRoute,
+ () => WA.loadComputeNodes
+ ),
+
+ handle(
+ R.matchFavoritesRoute,
+ () => WA.loadFavorites
+ ),
+
+ handle(
+ R.matchGroupDetailsRoute,
+ ({ id }) => WA.loadGroupDetailsPanel(id)
+ ),
+
+ handle(
+ R.matchGroupsRoute,
+ () => WA.loadGroupsPanel
+ ),
+
+ handle(
+ R.matchKeepServicesRoute,
+ () => WA.loadKeepServices
+ ),
+
+ handle(
+ R.matchLinksRoute,
+ () => WA.loadLinks
+ ),
+
+ handle(
+ R.matchMyAccountRoute,
+ () => WA.loadMyAccount
+ ),
+
+ handle(
+ R.matchProcessLogRoute,
+ ({ id }) => WA.loadProcessLog(id)
+ ),
+
+ handle(
+ R.matchProcessRoute,
+ ({ id }) => WA.loadProcess(id)
+ ),
+
+ handle(
+ R.matchProjectRoute,
+ ({ id }) => WA.loadProject(id)
+ ),
+
+ handle(
+ R.matchRepositoriesRoute,
+ () => WA.loadRepositories
+ ),
+
+ handle(
+ R.matchRootRoute,
+ () => navigateToRootProject
+ ),
+
+ handle(
+ R.matchRunProcessRoute,
+ () => WA.loadRunProcess
+ ),
+
+ handle(
+ R.matchSearchResultsRoute,
+ () => WA.loadSearchResults
+ ),
+
+ handle(
+ R.matchSharedWithMeRoute,
+ () => WA.loadSharedWithMe
+ ),
+
+ handle(
+ R.matchSiteManagerRoute,
+ () => WA.loadSiteManager
+ ),
+
+ handle(
+ R.matchSshKeysAdminRoute,
+ () => WA.loadSshKeys
+ ),
+
+ handle(
+ R.matchSshKeysUserRoute,
+ () => WA.loadSshKeys
+ ),
+
+ handle(
+ R.matchTrashRoute,
+ () => WA.loadTrash
+ ),
+
+ handle(
+ R.matchUsersRoute,
+ () => WA.loadUsers
+ ),
+
+ handle(
+ R.matchAdminVirtualMachineRoute,
+ () => WA.loadVirtualMachines
+ ),
+
+ handle(
+ R.matchUserVirtualMachineRoute,
+ () => WA.loadVirtualMachines
+ ),
+
+ handle(
+ R.matchWorkflowRoute,
+ () => WA.loadWorkflow
+ ),
+
+];
+