From: Michal Klobukowski Date: Wed, 29 Aug 2018 14:37:35 +0000 (+0200) Subject: Update navigation with processes X-Git-Tag: 1.3.0~128^2~2 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/21ee15421471ce0f0aa4a1241cab3498c335d682 Update navigation with processes Feature #14099 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- diff --git a/src/routes/routes.ts b/src/routes/routes.ts index 0bf71101..c46239e2 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -31,6 +31,8 @@ export const getResourceUrl = (uuid: string) => { } }; +export const getProcessUrl = (uuid: string) => `/processes/${uuid}`; + export const addRouteChangeHandlers = (history: History, store: RootStore) => { const handler = handleLocationChange(store); handler(history.location); @@ -43,30 +45,32 @@ export const matchRootRoute = (route: string) => export const matchFavoritesRoute = (route: string) => matchPath(route, { path: Routes.FAVORITES }); -export interface ProjectRouteParams { +export interface ResourceRouteParams { id: string; } export const matchProjectRoute = (route: string) => - matchPath(route, { path: Routes.PROJECTS }); - -export interface CollectionRouteParams { - id: string; -} + matchPath(route, { path: Routes.PROJECTS }); export const matchCollectionRoute = (route: string) => - matchPath(route, { path: Routes.COLLECTIONS }); + matchPath(route, { path: Routes.COLLECTIONS }); + +export const matchProcessRoute = (route: string) => + matchPath(route, { path: Routes.COLLECTIONS }); const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { const projectMatch = matchProjectRoute(pathname); const collectionMatch = matchCollectionRoute(pathname); const favoriteMatch = matchFavoritesRoute(pathname); + const processMatch = matchProcessRoute(pathname); if (projectMatch) { store.dispatch(loadProject(projectMatch.params.id)); } else if (collectionMatch) { store.dispatch(loadCollection(collectionMatch.params.id)); } else if (favoriteMatch) { store.dispatch(loadFavorites()); + } else if (processMatch) { + store.dispatch(processMatch.params.id); } }; diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts index 1d36beec..188acf12 100644 --- a/src/store/navigation/navigation-action.ts +++ b/src/store/navigation/navigation-action.ts @@ -9,7 +9,7 @@ import { getCollectionUrl } from "~/models/collection"; import { getProjectUrl } from "~/models/project"; import { SidePanelTreeCategory } from '../side-panel-tree/side-panel-tree-actions'; -import { Routes } from '~/routes/routes'; +import { Routes, getProcessUrl } from '~/routes/routes'; export const navigateTo = (uuid: string) => async (dispatch: Dispatch) => { @@ -18,6 +18,8 @@ export const navigateTo = (uuid: string) => dispatch(navigateToProject(uuid)); } else if (kind === ResourceKind.COLLECTION) { dispatch(navigateToCollection(uuid)); + } else if (kind === ResourceKind.CONTAINER_REQUEST) { + dispatch(navigateToProcess(uuid)); } if (uuid === SidePanelTreeCategory.FAVORITES) { dispatch(navigateToFavorites); @@ -29,3 +31,5 @@ export const navigateToFavorites = push(Routes.FAVORITES); export const navigateToProject = compose(push, getProjectUrl); export const navigateToCollection = compose(push, getCollectionUrl); + +export const navigateToProcess = compose(push, getProcessUrl); diff --git a/src/views-components/details-panel/process-details.tsx b/src/views-components/details-panel/process-details.tsx index d9ddfad8..e3c9823d 100644 --- a/src/views-components/details-panel/process-details.tsx +++ b/src/views-components/details-panel/process-details.tsx @@ -37,7 +37,7 @@ export class ProcessDetails extends DetailsData { - + {/* Link but we dont have view */} ;