Merge branch 'master' into 14582-missing-output-link-inside-process-views 14582-missing-output-link-inside-process-views
authorPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 11 Dec 2018 08:38:48 +0000 (09:38 +0100)
committerPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 11 Dec 2018 08:38:48 +0000 (09:38 +0100)
refs #14582

Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>

src/store/process-panel/process-panel-actions.ts
src/views/process-panel/process-information-card.tsx
src/views/process-panel/process-panel-root.tsx
src/views/process-panel/process-panel.tsx

index 832d4d5118749088ca39fae276d0f7cb9e8faa44..2aa914af2ae505c8faaf08ff75b54c50fe17224c 100644 (file)
@@ -6,6 +6,11 @@ import { unionize, ofType, UnionOf } from "~/common/unionize";
 import { loadProcess } from '~/store/processes/processes-actions';
 import { Dispatch } from 'redux';
 import { ProcessStatus } from '~/store/processes/process';
+import { RootState } from '~/store/store';
+import { ServiceRepository } from "~/services/services";
+import { navigateToCollection } from '~/store/navigation/navigation-action';
+import { snackbarActions } from '~/store/snackbar/snackbar-actions';
+import { SnackbarKind } from '../snackbar/snackbar-actions';
 
 export const procesPanelActions = unionize({
     SET_PROCESS_PANEL_FILTERS: ofType<string[]>(),
@@ -22,6 +27,16 @@ export const loadProcessPanel = (uuid: string) =>
         dispatch(initProcessPanelFilters);
     };
 
+export const navigateToOutput = (uuid: string) =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        try {
+            await services.collectionService.get(uuid);
+            dispatch<any>(navigateToCollection(uuid));
+        } catch {
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'This collection does not exists!', hideDuration: 2000, kind: SnackbarKind.ERROR }));
+        }
+    };
+
 export const initProcessPanelFilters = procesPanelActions.SET_PROCESS_PANEL_FILTERS([
     ProcessStatus.QUEUED,
     ProcessStatus.COMPLETED,
index e5d15e729d6d32b26f07e934d7a2fbb854c87b5d..7f3e025f8dc7e97a7f1b7616a09d9013949260b1 100644 (file)
@@ -11,7 +11,7 @@ import { ArvadosTheme } from '~/common/custom-theme';
 import { MoreOptionsIcon, ProcessIcon } from '~/components/icon/icon';
 import { DetailsAttribute } from '~/components/details-attribute/details-attribute';
 import { Process } from '~/store/processes/process';
-import { getProcessStatus, getProcessStatusColor } from '../../store/processes/process';
+import { getProcessStatus, getProcessStatusColor } from '~/store/processes/process';
 import { formatDate } from '~/common/formatters';
 
 
@@ -69,12 +69,13 @@ export interface ProcessInformationCardDataProps {
     process: Process;
     onContextMenu: (event: React.MouseEvent<HTMLElement>) => void;
     openProcessInputDialog: (uuid: string) => void;
+    navigateToOutput: (uuid: string) => void;
 }
 
 type ProcessInformationCardProps = ProcessInformationCardDataProps & WithStyles<CssRules, true>;
 
 export const ProcessInformationCard = withStyles(styles, { withTheme: true })(
-    ({ classes, process, onContextMenu, theme, openProcessInputDialog }: ProcessInformationCardProps) =>
+    ({ classes, process, onContextMenu, theme, openProcessInputDialog, navigateToOutput }: ProcessInformationCardProps) =>
         <Card className={classes.card}>
             <CardHeader
                 classes={{
@@ -120,7 +121,9 @@ export const ProcessInformationCard = withStyles(styles, { withTheme: true })(
                             label='Workflow' value='???' />
                     </Grid>
                     <Grid item xs={6}>
-                        <DetailsAttribute classLabel={classes.link} label='Outputs' />
+                        <span onClick={() => navigateToOutput(process.containerRequest.outputUuid!)}>
+                            <DetailsAttribute classLabel={classes.link} label='Outputs' />
+                        </span>
                         <span onClick={() => openProcessInputDialog(process.containerRequest.uuid)}>
                             <DetailsAttribute classLabel={classes.link} label='Inputs' />
                         </span>
index 52c0f4515145120caf1d6f95038323d4f5fdb307..73f71e5e0a139b0fbbe007213b0f1d6705070868 100644 (file)
@@ -23,6 +23,7 @@ export interface ProcessPanelRootActionProps {
     onContextMenu: (event: React.MouseEvent<HTMLElement>, process: Process) => void;
     onToggle: (status: string) => void;
     openProcessInputDialog: (uuid: string) => void;
+    navigateToOutput: (uuid: string) => void;
 }
 
 export type ProcessPanelRootProps = ProcessPanelRootDataProps & ProcessPanelRootActionProps;
@@ -34,7 +35,8 @@ export const ProcessPanelRoot = ({ process, ...props }: ProcessPanelRootProps) =
                 <ProcessInformationCard
                     process={process}
                     onContextMenu={event => props.onContextMenu(event, process)}
-                    openProcessInputDialog={props.openProcessInputDialog} />
+                    openProcessInputDialog={props.openProcessInputDialog}
+                    navigateToOutput={props.navigateToOutput} />
             </Grid>
             <Grid item sm={12} md={5}>
                 <SubprocessesCard
index 8108cd1ef4d0b19a51fc7c530e6880e61b529334..5672469677a3d29c5150a39f955ae71078d8c022 100644 (file)
@@ -11,7 +11,7 @@ import { matchProcessRoute } from '~/routes/routes';
 import { ProcessPanelRootDataProps, ProcessPanelRootActionProps, ProcessPanelRoot } from './process-panel-root';
 import { ProcessPanel as ProcessPanelState} from '~/store/process-panel/process-panel';
 import { groupBy } from 'lodash';
-import { toggleProcessPanelFilter } from '~/store/process-panel/process-panel-actions';
+import { toggleProcessPanelFilter, navigateToOutput } from '~/store/process-panel/process-panel-actions';
 import { openProcessInputDialog } from '~/store/processes/process-input-actions';
 
 const mapStateToProps = ({ router, resources, processPanel }: RootState): ProcessPanelRootDataProps => {
@@ -34,7 +34,8 @@ const mapDispatchToProps = (dispatch: Dispatch): ProcessPanelRootActionProps =>
     onToggle: status => {
         dispatch<any>(toggleProcessPanelFilter(status));
     },
-    openProcessInputDialog: (uuid) => dispatch<any>(openProcessInputDialog(uuid))
+    openProcessInputDialog: (uuid) => dispatch<any>(openProcessInputDialog(uuid)),
+    navigateToOutput: (uuid) => dispatch<any>(navigateToOutput(uuid))
 });
 
 export const ProcessPanel = connect(mapStateToProps, mapDispatchToProps)(ProcessPanelRoot);