19143: Workflow objects appear in project view, are runnable.
authorPeter Amstutz <peter.amstutz@curii.com>
Fri, 20 May 2022 22:24:53 +0000 (18:24 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Fri, 20 May 2022 22:24:53 +0000 (18:24 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

src/models/details.ts
src/store/navigation/navigation-action.ts
src/views-components/details-panel/details-panel.tsx
src/views/workflow-panel/workflow-description-card.tsx

index 150b694083bc9378ca9a41087afdb9e310fec2fb..b6eabd7014efade5dea3c51775f876413573d0bb 100644 (file)
@@ -7,5 +7,6 @@ import { CollectionResource } from "./collection";
 import { ProcessResource } from "./process";
 import { EmptyResource } from "./empty";
 import { CollectionFile, CollectionDirectory } from 'models/collection-file';
+import { WorkflowResource } from 'models/workflow';
 
-export type DetailsResource = ProjectResource | CollectionResource | ProcessResource | EmptyResource | CollectionFile | CollectionDirectory;
+export type DetailsResource = ProjectResource | CollectionResource | ProcessResource | EmptyResource | CollectionFile | CollectionDirectory | WorkflowResource;
index 1cdb6784bf42390c88ef60fa920a76c773ab71c8..973ba25a36645b7b0d00178239d72c95d085efde 100644 (file)
@@ -8,6 +8,7 @@ import { ResourceKind, extractUuidKind } from 'models/resource';
 import { SidePanelTreeCategory } from '../side-panel-tree/side-panel-tree-actions';
 import { Routes, getGroupUrl, getNavUrl, getUserProfileUrl } from 'routes/routes';
 import { RootState } from 'store/store';
+import { openDetailsPanel } from 'store/details-panel/details-panel-action';
 import { ServiceRepository } from 'services/services';
 import { pluginConfig } from 'plugins';
 import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
@@ -40,6 +41,9 @@ export const navigateTo = (uuid: string) =>
             case ResourceKind.VIRTUAL_MACHINE:
                 dispatch<any>(navigateToAdminVirtualMachines);
                 return;
+            case ResourceKind.WORKFLOW:
+                dispatch<any>(openDetailsPanel(uuid));
+                return;
         }
 
         switch (uuid) {
index 399f4ef4ef273569dda2c30d440229b58f4c8708..adbbab79333b385eec7b028c98c75aa7c4a041cb 100644 (file)
@@ -18,6 +18,7 @@ import { ProjectDetails } from "./project-details";
 import { CollectionDetails } from "./collection-details";
 import { ProcessDetails } from "./process-details";
 import { EmptyDetails } from "./empty-details";
+import { WorkflowDetails } from "./workflow-details";
 import { DetailsData } from "./details-data";
 import { DetailsResource } from "models/details";
 import { Config } from 'common/config';
@@ -71,6 +72,8 @@ const getItem = (res: DetailsResource): DetailsData => {
                 return new CollectionDetails(res);
             case ResourceKind.PROCESS:
                 return new ProcessDetails(res);
+            case ResourceKind.WORKFLOW:
+                return new WorkflowDetails(res);
             default:
                 return new EmptyDetails(res);
         }
@@ -152,9 +155,9 @@ export const DetailsPanel = withStyles(styles)(
                 let shouldShowInlinePreview = false;
                 if (!('kind' in res)) {
                     shouldShowInlinePreview = isInlineFileUrlSafe(
-                      res ? res.url : "",
-                      authConfig.keepWebServiceUrl,
-                      authConfig.keepWebInlineServiceUrl
+                        res ? res.url : "",
+                        authConfig.keepWebServiceUrl,
+                        authConfig.keepWebInlineServiceUrl
                     ) || authConfig.clusterConfig.Collections.TrustAllContent;
                 }
 
@@ -191,14 +194,14 @@ export const DetailsPanel = withStyles(styles)(
                     </Grid>
                     <Grid item>
                         <Tabs onChange={this.handleChange}
-                            value={(item.getTabLabels().length >= tabNr+1) ? tabNr : 0}>
-                            { item.getTabLabels().map((tabLabel, idx) =>
+                            value={(item.getTabLabels().length >= tabNr + 1) ? tabNr : 0}>
+                            {item.getTabLabels().map((tabLabel, idx) =>
                                 <Tab key={`tab-label-${idx}`} disableRipple label={tabLabel} />)
                             }
                         </Tabs>
                     </Grid>
                     <Grid item xs className={this.props.classes.tabContainer} >
-                        {item.getDetails({tabNr, showPreview: shouldShowInlinePreview})}
+                        {item.getDetails({ tabNr, showPreview: shouldShowInlinePreview })}
                     </Grid>
                 </Grid >;
             }
index b9e89c7631a192801c0c7b6e0bef9e6e770a013a..e93caea4debc6bfd6961b37ee2b8062dfb62ba65 100644 (file)
@@ -15,16 +15,14 @@ import {
     TableCell,
     TableBody,
     TableRow,
-    Grid,
 } from '@material-ui/core';
 import { ArvadosTheme } from 'common/custom-theme';
 import { WorkflowIcon } from 'components/icon/icon';
 import { DataTableDefaultView } from 'components/data-table-default-view/data-table-default-view';
-import { WorkflowResource, parseWorkflowDefinition, getWorkflowInputs, getInputLabel, stringifyInputType } from 'models/workflow';
+import { parseWorkflowDefinition, getWorkflowInputs, getInputLabel, stringifyInputType } from 'models/workflow';
 // import { WorkflowGraph } from "views/workflow-panel/workflow-graph";
-import { DetailsAttribute } from 'components/details-attribute/details-attribute';
-import { ResourceOwnerWithName } from 'views-components/data-explorer/renderers';
-import { formatDate } from "common/formatters";
+
+import { WorkflowDetailsCardDataProps, WorkflowDetailsAttributes } from 'views-components/details-panel/workflow-details';
 
 export type CssRules = 'root' | 'tab' | 'inputTab' | 'graphTab' | 'graphTabWithChosenWorkflow' | 'descriptionTab' | 'inputsTable';
 
@@ -58,10 +56,6 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     },
 });
 
-interface WorkflowDetailsCardDataProps {
-    workflow?: WorkflowResource;
-}
-
 type WorkflowDetailsCardProps = WorkflowDetailsCardDataProps & WithStyles<CssRules>;
 
 export const WorkflowDetailsCard = withStyles(styles)(
@@ -150,29 +144,3 @@ export const WorkflowDetailsCard = withStyles(styles)(
             </Table>;
         }
     });
-
-export const WorkflowDetailsAttributes = ({ workflow }: WorkflowDetailsCardDataProps) => {
-    return <Grid container>
-        <Grid item xs={12} >
-            <DetailsAttribute
-                label={"Workflow UUID"}
-                linkToUuid={workflow?.uuid} />
-        </Grid>
-        <Grid item xs={12} >
-            <DetailsAttribute
-                label='Owner' linkToUuid={workflow?.ownerUuid}
-                uuidEnhancer={(uuid: string) => <ResourceOwnerWithName uuid={uuid} />} />
-        </Grid>
-        <Grid item xs={12}>
-            <DetailsAttribute label='Created at' value={formatDate(workflow?.createdAt)} />
-        </Grid>
-        <Grid item xs={12}>
-            <DetailsAttribute label='Last modified' value={formatDate(workflow?.modifiedAt)} />
-        </Grid>
-        <Grid item xs={12} >
-            <DetailsAttribute
-                label='Last modified by user' linkToUuid={workflow?.modifiedByUserUuid}
-                uuidEnhancer={(uuid: string) => <ResourceOwnerWithName uuid={uuid} />} />
-        </Grid>
-    </Grid >;
-};