[arvados-workbench2] updated: 2.4.0-228-g9b989f22

git repository hosting git at public.arvados.org
Wed Oct 12 21:27:03 UTC 2022


Summary of changes:
 src/views/process-panel/process-io-card.tsx | 39 ++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 15 deletions(-)

       via  9b989f2260031fe7fbe92bbeb27c7815e20f7440 (commit)
      from  ebd12721a86b922de85a7ea57271d24a7a2df596 (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 9b989f2260031fe7fbe92bbeb27c7815e20f7440
Author: Stephen Smith <stephen at curii.com>
Date:   Wed Oct 12 17:01:33 2022 -0400

    16073: Process io file array and secondaryFiles into groups preserving main file association, indent secondaryFiles
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/src/views/process-panel/process-io-card.tsx b/src/views/process-panel/process-io-card.tsx
index 0e93c9a6..45ba76b3 100644
--- a/src/views/process-panel/process-io-card.tsx
+++ b/src/views/process-panel/process-io-card.tsx
@@ -63,6 +63,7 @@ import { RootState } from 'store/store';
 import { ProcessOutputCollectionFiles } from './process-output-collection-files';
 import { Process } from 'store/processes/process';
 import { navigateTo } from 'store/navigation/navigation-action';
+import classNames from 'classnames';
 
 type CssRules =
   | "card"
@@ -78,6 +79,7 @@ type CssRules =
   | "collectionLink"
   | "imagePreview"
   | "valArray"
+  | "secondaryVal"
   | "emptyValue"
   | "halfRow"
   | "symmetricTabs"
@@ -160,6 +162,9 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
             display: 'inline',
         }
     },
+    secondaryVal: {
+        paddingLeft: '20px',
+    },
     emptyValue: {
         color: theme.customs.colors.grey500,
     },
@@ -320,6 +325,7 @@ export type ProcessIOValue = {
     display: ReactElement<any, any>;
     imageUrl?: string;
     collection?: ReactElement<any, any>;
+    secondary?: boolean;
 }
 
 export type ProcessIOParameter = {
@@ -398,7 +404,7 @@ const ProcessValuePreview = withStyles(styles)(
         <Typography className={classes.paramValue}>
             {value.imageUrl && showImagePreview ? <img className={classes.imagePreview} src={value.imageUrl} alt="Inline Preview" /> : ""}
             {value.imageUrl && !showImagePreview ? <ImagePlaceholder /> : ""}
-            <span className={classes.valArray}>
+            <span className={classNames(classes.valArray, value.secondary && classes.secondaryVal)}>
                 {value.display}
             </span>
         </Typography>
@@ -497,7 +503,7 @@ export const getIOParamDisplayValue = (auth: AuthState, input: CommandInputParam
             ];
 
             return files.length ?
-                files.map(file => fileToProcessIOValue(file, auth, pdh)) :
+                files.map((file, i) => fileToProcessIOValue(file, (i > 0), auth, pdh)) :
                 [{display: <EmptyValue />}];
 
         case isPrimitiveOfType(input, CWLType.DIRECTORY):
@@ -540,18 +546,20 @@ export const getIOParamDisplayValue = (auth: AuthState, input: CommandInputParam
                 [{display: <EmptyValue />}];
 
         case isArrayOfType(input, CWLType.FILE):
-            const fileArrayMainFile = ((input as FileArrayCommandInputParameter).value || []);
-            const fileArraySecondaryFiles = fileArrayMainFile.map((file) => (
-                ((file as unknown) as FileWithSecondaryFiles)?.secondaryFiles || []
-            )).reduce((acc: File[], params: File[]) => (acc.concat(params)), []);
-
-            const fileArrayFiles = [
-                ...fileArrayMainFile,
-                ...fileArraySecondaryFiles
-            ];
-
-            return fileArrayFiles.length ?
-                fileArrayFiles.map(file => fileToProcessIOValue(file, auth, pdh)) :
+            const fileArrayMainFiles = ((input as FileArrayCommandInputParameter).value || []);
+
+            // Convert each main file into separate arrays of ProcessIOValue to preserve secondaryFile grouping
+            const fileArrayValues = fileArrayMainFiles.map((mainFile: File): ProcessIOValue[] => {
+                const secondaryFiles = ((mainFile as unknown) as FileWithSecondaryFiles)?.secondaryFiles || [];
+                return [
+                    fileToProcessIOValue(mainFile, false, auth, pdh),
+                    ...(secondaryFiles.map(file => fileToProcessIOValue(file, true, auth, pdh)))
+                ];
+            // Reduce each mainFile/secondaryFile group into single array preserving ordering
+            }).reduce((acc: ProcessIOValue[], mainFile: ProcessIOValue[]) => (acc.concat(mainFile)), []);
+
+            return fileArrayValues.length ?
+                fileArrayValues :
                 [{display: <EmptyValue />}];
 
         case isArrayOfType(input, CWLType.DIRECTORY):
@@ -637,9 +645,10 @@ const directoryToProcessIOValue = (directory: Directory, auth: AuthState, pdh?:
     };
 };
 
-const fileToProcessIOValue = (file: File, auth: AuthState, pdh?: string): ProcessIOValue => {
+const fileToProcessIOValue = (file: File, secondary: boolean, auth: AuthState, pdh?: string): ProcessIOValue => {
     return {
         display: <KeepUrlPath auth={auth} res={file} pdh={pdh}/>,
+        secondary,
         imageUrl: isFileImage(file.basename) ? getImageUrl(auth, file, pdh) : undefined,
         collection: <KeepUrlBase auth={auth} res={file} pdh={pdh}/>,
     }

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list