[ARVADOS-WORKBENCH2] created: 1.3.0-80-g188fed6

Git user git at public.curoverse.com
Mon Dec 10 09:53:44 EST 2018


        at  188fed64a7cfe68460f64a874dba3fd280d5d561 (commit)


commit 188fed64a7cfe68460f64a874dba3fd280d5d561
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Mon Dec 10 15:53:25 2018 +0100

    show-link-to-process-which-created-a-collection
    
    Feature #14480
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/store/collection-panel/collection-panel-action.ts b/src/store/collection-panel/collection-panel-action.ts
index 265b5cf..3b3e34c 100644
--- a/src/store/collection-panel/collection-panel-action.ts
+++ b/src/store/collection-panel/collection-panel-action.ts
@@ -13,6 +13,8 @@ import { TagProperty } from "~/models/tag";
 import { snackbarActions } from "../snackbar/snackbar-actions";
 import { resourcesActions } from "~/store/resources/resources-actions";
 import { unionize, ofType, UnionOf } from '~/common/unionize';
+import { SnackbarKind } from '~/store/snackbar/snackbar-actions';
+import { navigateTo } from '~/store/navigation/navigation-action';
 
 export const collectionPanelActions = unionize({
     SET_COLLECTION: ofType<CollectionResource>(),
@@ -53,6 +55,16 @@ export const createCollectionTag = (data: TagProperty) =>
         }
     };
 
+export const navigateToProcess = (uuid: string) =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        try {
+            await services.containerRequestService.get(uuid);
+            dispatch<any>(navigateTo(uuid));
+        } catch {
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'This process does not exists!', hideDuration: 2000, kind: SnackbarKind.ERROR }));
+        }
+    };
+
 export const deleteCollectionTag = (key: string) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const item = getState().collectionPanel.item;
diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index 26ee188..119b9e9 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -17,7 +17,7 @@ import { CollectionResource } from '~/models/collection';
 import { CollectionPanelFiles } from '~/views-components/collection-panel-files/collection-panel-files';
 import * as CopyToClipboard from 'react-copy-to-clipboard';
 import { CollectionTagForm } from './collection-tag-form';
-import { deleteCollectionTag } from '~/store/collection-panel/collection-panel-action';
+import { deleteCollectionTag, navigateToProcess } from '~/store/collection-panel/collection-panel-action';
 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 import { getResource } from '~/store/resources/resources';
 import { openContextMenu } from '~/store/context-menu/context-menu-actions';
@@ -26,7 +26,7 @@ import { formatFileSize } from "~/common/formatters";
 import { getResourceData } from "~/store/resources-data/resources-data";
 import { ResourceData } from "~/store/resources-data/resources-data-reducer";
 
-type CssRules = 'card' | 'iconHeader' | 'tag' | 'copyIcon' | 'label' | 'value';
+type CssRules = 'card' | 'iconHeader' | 'tag' | 'copyIcon' | 'label' | 'value' | 'link';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     card: {
@@ -52,6 +52,13 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     value: {
         textTransform: 'none',
         fontSize: '0.875rem'
+    },
+    link: {
+        fontSize: '0.875rem',
+        color: theme.palette.primary.main,
+        '&:hover': {
+            cursor: 'pointer'
+        }
     }
 });
 
@@ -63,7 +70,6 @@ interface CollectionPanelDataProps {
 type CollectionPanelProps = CollectionPanelDataProps & DispatchProp
     & WithStyles<CssRules> & RouteComponentProps<{ id: string }>;
 
-
 export const CollectionPanel = withStyles(styles)(
     connect((state: RootState, props: RouteComponentProps<{ id: string }>) => {
         const item = getResource(props.match.params.id)(state.resources);
@@ -72,7 +78,7 @@ export const CollectionPanel = withStyles(styles)(
     })(
         class extends React.Component<CollectionPanelProps> {
             render() {
-                const { classes, item, data } = this.props;
+                const { classes, item, data, dispatch } = this.props;
                 return item
                     ? <>
                         <Card className={classes.card}>
@@ -107,6 +113,9 @@ export const CollectionPanel = withStyles(styles)(
                                             label='Content size' value={data && formatFileSize(data.fileSize)} />
                                         <DetailsAttribute classLabel={classes.label} classValue={classes.value}
                                             label='Owner' value={item && item.ownerUuid} />
+                                        <span onClick={() => dispatch<any>(navigateToProcess(item.properties.container_request))}>
+                                            <DetailsAttribute classLabel={classes.link} label='Link to process' />
+                                        </span>
                                     </Grid>
                                 </Grid>
                             </CardContent>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list