[arvados-workbench2] updated: 2.4.0-229-g3c6ea6de

git repository hosting git at public.arvados.org
Thu Oct 13 17:31:59 UTC 2022


Summary of changes:
 cypress/integration/process.spec.js         | 18 +++++++++---------
 src/views/process-panel/process-io-card.tsx | 24 ++++++++++++++++--------
 2 files changed, 25 insertions(+), 17 deletions(-)

       via  3c6ea6ded33b5740035d059d7d9812ed951ab215 (commit)
      from  9b989f2260031fe7fbe92bbeb27c7815e20f7440 (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 3c6ea6ded33b5740035d059d7d9812ed951ab215
Author: Stephen Smith <stephen at curii.com>
Date:   Thu Oct 13 13:31:16 2022 -0400

    16073: Hide io param pdh links when equal to the first main file of that param
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/cypress/integration/process.spec.js b/cypress/integration/process.spec.js
index f4e57578..e877c8e3 100644
--- a/cypress/integration/process.spec.js
+++ b/cypress/integration/process.spec.js
@@ -872,9 +872,9 @@ describe('Process tests', function() {
                     cy.wait(2000);
                     cy.waitForDom();
                     verifyIOParameter('input_file', null, "Label Description", 'input1.tar', '00000000000000000000000000000000+01');
-                    verifyIOParameter('input_file', null, "Label Description", 'input1-2.txt', '00000000000000000000000000000000+01', true);
-                    verifyIOParameter('input_file', null, "Label Description", 'input1-3.txt', '00000000000000000000000000000000+01', true);
-                    verifyIOParameter('input_file', null, "Label Description", 'input1-4.txt', '00000000000000000000000000000000+01', true);
+                    verifyIOParameter('input_file', null, "Label Description", 'input1-2.txt', undefined, true);
+                    verifyIOParameter('input_file', null, "Label Description", 'input1-3.txt', undefined, true);
+                    verifyIOParameter('input_file', null, "Label Description", 'input1-4.txt', undefined, true);
                     verifyIOParameter('input_dir', null, "Doc Description", 'No value', '11111111111111111111111111111111+01');
                     verifyIOParameter('input_bool', null, "Doc desc 1, Doc desc 2", 'true');
                     verifyIOParameter('input_int', null, null, '1');
@@ -883,8 +883,8 @@ describe('Process tests', function() {
                     verifyIOParameter('input_double', null, null, '1.3');
                     verifyIOParameter('input_string', null, null, 'Hello World');
                     verifyIOParameter('input_file_array', null, null, 'input2.tar', '00000000000000000000000000000000+02');
-                    verifyIOParameter('input_file_array', null, null, 'input3.tar', '00000000000000000000000000000000+03', true);
-                    verifyIOParameter('input_file_array', null, null, 'input3-2.txt', '00000000000000000000000000000000+03', true);
+                    verifyIOParameter('input_file_array', null, null, 'input3.tar', undefined, true);
+                    verifyIOParameter('input_file_array', null, null, 'input3-2.txt', undefined, true);
                     verifyIOParameter('input_dir_array', null, null, 'No value', '11111111111111111111111111111111+02');
                     verifyIOParameter('input_dir_array', null, null, 'No value', '11111111111111111111111111111111+03', true);
                     verifyIOParameter('input_int_array', null, null, ["1", "3", "5"]);
@@ -902,8 +902,8 @@ describe('Process tests', function() {
                     verifyIOParameter('output_file', null, "Label Description", 'cat.png', `${outPdh}`);
                     verifyIOParameterImage('output_file', `/c=${outPdh}/cat.png`);
                     verifyIOParameter('output_file_with_secondary', null, "Doc Description", 'main.dat', `${outPdh}`);
-                    verifyIOParameter('output_file_with_secondary', null, "Doc Description", 'secondary.dat', `${outPdh}`, true);
-                    verifyIOParameter('output_file_with_secondary', null, "Doc Description", 'secondary2.dat', `${outPdh}`, true);
+                    verifyIOParameter('output_file_with_secondary', null, "Doc Description", 'secondary.dat', undefined, true);
+                    verifyIOParameter('output_file_with_secondary', null, "Doc Description", 'secondary2.dat', undefined, true);
                     verifyIOParameter('output_dir', null, "Doc desc 1, Doc desc 2", 'outdir1', `${outPdh}`);
                     verifyIOParameter('output_bool', null, null, 'true');
                     verifyIOParameter('output_int', null, null, '1');
@@ -912,9 +912,9 @@ describe('Process tests', function() {
                     verifyIOParameter('output_double', null, null, '100.3');
                     verifyIOParameter('output_string', null, null, 'Hello output');
                     verifyIOParameter('output_file_array', null, null, 'output2.tar', `${outPdh}`);
-                    verifyIOParameter('output_file_array', null, null, 'output3.tar', `${outPdh}`, true);
+                    verifyIOParameter('output_file_array', null, null, 'output3.tar', undefined, true);
                     verifyIOParameter('output_dir_array', null, null, 'outdir2', `${outPdh}`);
-                    verifyIOParameter('output_dir_array', null, null, 'outdir3', `${outPdh}`, true);
+                    verifyIOParameter('output_dir_array', null, null, 'outdir3', undefined, true);
                     verifyIOParameter('output_int_array', null, null, ["10", "11", "12"]);
                     verifyIOParameter('output_long_array', null, null, ["51", "52"]);
                     verifyIOParameter('output_float_array', null, null, ["100.2", "100.4", "100.6"]);
diff --git a/src/views/process-panel/process-io-card.tsx b/src/views/process-panel/process-io-card.tsx
index 45ba76b3..94544918 100644
--- a/src/views/process-panel/process-io-card.tsx
+++ b/src/views/process-panel/process-io-card.tsx
@@ -501,9 +501,10 @@ export const getIOParamDisplayValue = (auth: AuthState, input: CommandInputParam
                 ...(mainFile && !(Array.isArray(mainFile) && mainFile.length === 0) ? [mainFile] : []),
                 ...secondaryFiles
             ];
+            const mainFilePdhUrl = mainFile ? getResourcePdhUrl(mainFile, pdh) : "";
 
             return files.length ?
-                files.map((file, i) => fileToProcessIOValue(file, (i > 0), auth, pdh)) :
+                files.map((file, i) => fileToProcessIOValue(file, (i > 0), auth, pdh, (i > 0 ? mainFilePdhUrl : ""))) :
                 [{display: <EmptyValue />}];
 
         case isPrimitiveOfType(input, CWLType.DIRECTORY):
@@ -547,13 +548,15 @@ export const getIOParamDisplayValue = (auth: AuthState, input: CommandInputParam
 
         case isArrayOfType(input, CWLType.FILE):
             const fileArrayMainFiles = ((input as FileArrayCommandInputParameter).value || []);
+            const firstMainFilePdh = fileArrayMainFiles.length > 0 ? getResourcePdhUrl(fileArrayMainFiles[0], pdh) : "";
 
             // Convert each main file into separate arrays of ProcessIOValue to preserve secondaryFile grouping
-            const fileArrayValues = fileArrayMainFiles.map((mainFile: File): ProcessIOValue[] => {
+            const fileArrayValues = fileArrayMainFiles.map((mainFile: File, i): ProcessIOValue[] => {
                 const secondaryFiles = ((mainFile as unknown) as FileWithSecondaryFiles)?.secondaryFiles || [];
                 return [
-                    fileToProcessIOValue(mainFile, false, auth, pdh),
-                    ...(secondaryFiles.map(file => fileToProcessIOValue(file, true, auth, pdh)))
+                    // Pass firstMainFilePdh to secondary files and every main file besides the first to hide pdh if equal
+                    fileToProcessIOValue(mainFile, false, auth, pdh, i > 0 ? firstMainFilePdh : ""),
+                    ...(secondaryFiles.map(file => fileToProcessIOValue(file, true, auth, pdh, firstMainFilePdh)))
                 ];
             // Reduce each mainFile/secondaryFile group into single array preserving ordering
             }).reduce((acc: ProcessIOValue[], mainFile: ProcessIOValue[]) => (acc.concat(mainFile)), []);
@@ -591,9 +594,13 @@ interface KeepUrlProps {
     pdh?: string;
 }
 
-const KeepUrlBase = withStyles(styles)(({auth, res, pdh, classes}: KeepUrlProps & WithStyles<CssRules>) => {
+const getResourcePdhUrl = (res: File | Directory, pdh?: string): string => {
     const keepUrl = getKeepUrl(res, pdh);
-    const pdhUrl = keepUrl ? keepUrl.split('/').slice(0, 1)[0] : '';
+    return keepUrl ? keepUrl.split('/').slice(0, 1)[0] : '';
+};
+
+const KeepUrlBase = withStyles(styles)(({auth, res, pdh, classes}: KeepUrlProps & WithStyles<CssRules>) => {
+    const pdhUrl = getResourcePdhUrl(res, pdh);
     // Passing a pdh always returns a relative wb2 collection url
     const pdhWbPath = getNavUrl(pdhUrl, auth);
     return pdhUrl && pdhWbPath ?
@@ -645,12 +652,13 @@ const directoryToProcessIOValue = (directory: Directory, auth: AuthState, pdh?:
     };
 };
 
-const fileToProcessIOValue = (file: File, secondary: boolean, auth: AuthState, pdh?: string): ProcessIOValue => {
+const fileToProcessIOValue = (file: File, secondary: boolean, auth: AuthState, pdh: string | undefined, mainFilePdh: string): ProcessIOValue => {
+    const resourcePdh = getResourcePdhUrl(file, pdh);
     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}/>,
+        collection: (resourcePdh !== mainFilePdh) ? <KeepUrlBase auth={auth} res={file} pdh={pdh}/> : <></>,
     }
 };
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list