[ARVADOS-WORKBENCH2] updated: 1.3.1-435-g33efd480

Git user git at public.curoverse.com
Tue Apr 23 08:44:13 UTC 2019


Summary of changes:
 package.json                                 |  2 +-
 src/store/breadcrumbs/breadcrumbs-actions.ts | 47 +++++++++++++++++++---------
 2 files changed, 34 insertions(+), 15 deletions(-)

       via  33efd480aa7fc664b6b42097172e44ae3ccc3b79 (commit)
      from  8c9d8feac89bac4696df12ec4c75b99919fe9093 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 33efd480aa7fc664b6b42097172e44ae3ccc3b79
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Tue Apr 23 10:43:53 2019 +0200

    refs #15085-breadcrumbs-are-not-presenting-names-of-processes-and-collections
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/package.json b/package.json
index 0e5805a3..098b7849 100644
--- a/package.json
+++ b/package.json
@@ -55,7 +55,7 @@
     "start": "react-scripts-ts start",
     "build": "REACT_APP_BUILD_NUMBER=$BUILD_NUMBER REACT_APP_GIT_COMMIT=$GIT_COMMIT react-scripts-ts build",
     "build-local": "react-scripts-ts build",
-    "test": "CI=true react-scripts-ts test --env=jsdom",
+    "test": "react-scripts-ts test --env=jsdom",
     "test-local": "react-scripts-ts test --env=jsdom",
     "eject": "react-scripts-ts eject",
     "lint": "tslint src/** -t verbose",
diff --git a/src/store/breadcrumbs/breadcrumbs-actions.ts b/src/store/breadcrumbs/breadcrumbs-actions.ts
index 71de5ce4..04b5689c 100644
--- a/src/store/breadcrumbs/breadcrumbs-actions.ts
+++ b/src/store/breadcrumbs/breadcrumbs-actions.ts
@@ -15,6 +15,7 @@ import { SidePanelTreeCategory, activateSidePanelTreeItem } from '~/store/side-p
 import { updateResources } from '../resources/resources-actions';
 import { ResourceKind } from '~/models/resource';
 import { GroupResource } from '~/models/group';
+import { extractUuidKind } from '~/models/resource';
 
 export const BREADCRUMBS = 'breadcrumbs';
 
@@ -22,8 +23,14 @@ export interface ResourceBreadcrumb extends Breadcrumb {
     uuid: string;
 }
 
-export const setBreadcrumbs = (breadcrumbs: Breadcrumb[]) =>
-    propertiesActions.SET_PROPERTY({ key: BREADCRUMBS, value: breadcrumbs });
+export const setBreadcrumbs = (breadcrumbs: any, currentItem?: any) => {
+    if (currentItem) {
+        const addLastItem = { label: currentItem.name, uuid: currentItem.uuid };
+        breadcrumbs.push(addLastItem);
+    }
+    return propertiesActions.SET_PROPERTY({ key: BREADCRUMBS, value: breadcrumbs });
+};
+
 
 const getSidePanelTreeBreadcrumbs = (uuid: string) => (treePicker: TreePicker): ResourceBreadcrumb[] => {
     const nodes = getSidePanelTreeBranch(uuid)(treePicker);
@@ -34,9 +41,20 @@ const getSidePanelTreeBreadcrumbs = (uuid: string) => (treePicker: TreePicker):
 };
 
 export const setSidePanelBreadcrumbs = (uuid: string) =>
-    (dispatch: Dispatch, getState: () => RootState) => {
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const { treePicker } = getState();
         const breadcrumbs = getSidePanelTreeBreadcrumbs(uuid)(treePicker);
+        const path = getState().router.location!.pathname;
+        const currentUuid = path.split('/')[2];
+        const uuidKind = extractUuidKind(currentUuid);
+        
+        if (uuidKind === ResourceKind.COLLECTION) {
+            const collectionItem = await services.collectionService.get(currentUuid);
+            dispatch(setBreadcrumbs(breadcrumbs, collectionItem));
+        } else if (uuidKind === ResourceKind.PROCESS) {
+            const processItem = await services.containerRequestService.get(currentUuid);
+            dispatch(setBreadcrumbs(breadcrumbs, processItem));
+        }
         dispatch(setBreadcrumbs(breadcrumbs));
     };
 
@@ -53,13 +71,22 @@ export const setCategoryBreadcrumbs = (uuid: string, category: SidePanelTreeCate
         const initialBreadcrumbs: ResourceBreadcrumb[] = [
             { label: category, uuid: category }
         ];
-        const breadrumbs = ancestors.reduce((breadcrumbs, ancestor) =>
+        const path = getState().router.location!.pathname;
+        const currentUuid = path.split('/')[2];
+        const uuidKind = extractUuidKind(currentUuid);
+        const breadcrumbs = ancestors.reduce((breadcrumbs, ancestor) =>
             ancestor.kind === ResourceKind.GROUP
                 ? [...breadcrumbs, { label: ancestor.name, uuid: ancestor.uuid }]
                 : breadcrumbs,
             initialBreadcrumbs);
-
-        dispatch(setBreadcrumbs(breadrumbs));
+        if (uuidKind === ResourceKind.COLLECTION) {
+            const collectionItem = await services.collectionService.get(currentUuid);
+            dispatch(setBreadcrumbs(breadcrumbs, collectionItem));
+        } else if (uuidKind === ResourceKind.PROCESS) {
+            const processItem = await services.containerRequestService.get(currentUuid);
+            dispatch(setBreadcrumbs(breadcrumbs, processItem));
+        }
+        dispatch(setBreadcrumbs(breadcrumbs));
     };
 
 export const setProjectBreadcrumbs = (uuid: string) =>
@@ -74,14 +101,6 @@ export const setProjectBreadcrumbs = (uuid: string) =>
         }
     };
 
-export const setCollectionBreadcrumbs = (collectionUuid: string) =>
-    (dispatch: Dispatch, getState: () => RootState) => {
-        const { resources } = getState();
-        const collection = getResource(collectionUuid)(resources);
-        if (collection) {
-            dispatch<any>(setProjectBreadcrumbs(collection.ownerUuid));
-        }
-    };
 export const setProcessBreadcrumbs = (processUuid: string) =>
     (dispatch: Dispatch, getState: () => RootState) => {
         const { resources } = getState();

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list