[arvados-workbench2] updated: 2.4.0-158-gdaa412a1

git repository hosting git at public.arvados.org
Tue Jul 12 20:27:19 UTC 2022


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

       via  daa412a179a8d7fec006ae21991a1daaffb9fa3d (commit)
       via  49e1f6fb14585a40cf199c24fe952ace68016b75 (commit)
      from  55acac755ba2516c63e902a11e90c6e3754e5c48 (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 daa412a179a8d7fec006ae21991a1daaffb9fa3d
Author: Stephen Smith <stephen at curii.com>
Date:   Tue Jul 12 16:25:40 2022 -0400

    16073: Refactor process io file processing
    
    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 e683bedb..b9aea931 100644
--- a/src/views/process-panel/process-io-card.tsx
+++ b/src/views/process-panel/process-io-card.tsx
@@ -233,12 +233,7 @@ export const getInputDisplayValue = (auth: AuthState, input: CommandInputParamet
                 ...(mainFile ? [mainFile] : []),
                 ...secondaryFiles
             ];
-
-            return files.map(file => ({
-                display: getKeepUrl(file, pdh),
-                nav: getNavUrl(auth, file, pdh),
-                imageUrl: isFileImage(file.basename) ? getImageUrl(auth, file, pdh) : undefined,
-            }));
+            return files.map(file => fileToProcessIOValue(file, auth, pdh));
 
         case isPrimitiveOfType(input, CWLType.DIRECTORY):
             const directory = (input as DirectoryCommandInputParameter).value;
@@ -261,11 +256,8 @@ export const getInputDisplayValue = (auth: AuthState, input: CommandInputParamet
             return [{ display: ((input as FloatArrayCommandInputParameter).value || []).join(', ') }];
 
         case isArrayOfType(input, CWLType.FILE):
-            return ((input as FileArrayCommandInputParameter).value || []).map(file => ({
-                display: getKeepUrl(file, pdh),
-                nav: getNavUrl(auth, file, pdh),
-                imageUrl: isFileImage(file.basename) ? getImageUrl(auth, file, pdh) : undefined,
-            }));
+            return ((input as FileArrayCommandInputParameter).value || [])
+                .map(file => fileToProcessIOValue(file, auth, pdh));
 
         case isArrayOfType(input, CWLType.DIRECTORY):
             const directories = (input as DirectoryArrayCommandInputParameter).value || [];
@@ -308,3 +300,9 @@ const directoryToProcessIOValue = (directory: Directory, auth: AuthState, pdh?:
         nav: getNavUrl(auth, normalizedDirectory, pdh),
     };
 };
+
+const fileToProcessIOValue = (file: File, auth: AuthState, pdh?: string): ProcessIOValue => ({
+    display: getKeepUrl(file, pdh),
+    nav: getNavUrl(auth, file, pdh),
+    imageUrl: isFileImage(file.basename) ? getImageUrl(auth, file, pdh) : undefined,
+});

commit 49e1f6fb14585a40cf199c24fe952ace68016b75
Author: Stephen Smith <stephen at curii.com>
Date:   Tue Jul 12 16:18:53 2022 -0400

    16073: Fix keep path for directory pdh links, refactor
    
    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 5540caed..e683bedb 100644
--- a/src/views/process-panel/process-io-card.tsx
+++ b/src/views/process-panel/process-io-card.tsx
@@ -242,10 +242,7 @@ export const getInputDisplayValue = (auth: AuthState, input: CommandInputParamet
 
         case isPrimitiveOfType(input, CWLType.DIRECTORY):
             const directory = (input as DirectoryCommandInputParameter).value;
-            return directory ? [{
-                display: getKeepUrl(directory, pdh),
-                nav: getNavUrl(auth, directory, pdh),
-            }] : [];
+            return directory ? [directoryToProcessIOValue(directory, auth, pdh)] : [];
 
         case typeof input.type === 'object' &&
             !(input.type instanceof Array) &&
@@ -272,13 +269,10 @@ export const getInputDisplayValue = (auth: AuthState, input: CommandInputParamet
 
         case isArrayOfType(input, CWLType.DIRECTORY):
             const directories = (input as DirectoryArrayCommandInputParameter).value || [];
-            return directories.map(directory => ({
-                display: getKeepUrl(directory, pdh),
-                nav: getNavUrl(auth, directory, pdh),
-            }));
+            return directories.map(directory => directoryToProcessIOValue(directory, auth, pdh));
 
         default:
-            return [{display: ''}];
+            return [];
     }
 };
 
@@ -286,22 +280,31 @@ const getKeepUrl = (file: File | Directory, pdh?: string): string => {
     const isKeepUrl = file.location?.startsWith('keep:') || false;
     const keepUrl = isKeepUrl ? file.location : pdh ? `keep:${pdh}/${file.location}` : file.location;
     return keepUrl || '';
-}
+};
 
 const getNavUrl = (auth: AuthState, file: File | Directory, pdh?: string): string => {
     let keepUrl = getKeepUrl(file, pdh).replace('keep:', '');
-    // Directory urls lack a trailing slash
-    if (!keepUrl.endsWith('/')) {
-        keepUrl += '/';
-    }
     return (getInlineFileUrl(`${auth.config.keepWebServiceUrl}/c=${keepUrl}?api_token=${auth.apiToken}`, auth.config.keepWebServiceUrl, auth.config.keepWebInlineServiceUrl));
-}
+};
 
 const getImageUrl = (auth: AuthState, file: File, pdh?: string): string => {
     const keepUrl = getKeepUrl(file, pdh).replace('keep:', '');
     return getInlineFileUrl(`${auth.config.keepWebServiceUrl}/c=${keepUrl}?api_token=${auth.apiToken}`, auth.config.keepWebServiceUrl, auth.config.keepWebInlineServiceUrl);
-}
+};
 
 const isFileImage = (basename?: string): boolean => {
     return basename ? (mime.getType(basename) || "").startsWith('image/') : false;
-}
+};
+
+const normalizeDirectoryLocation = (directory: Directory): Directory => ({
+    ...directory,
+    location: (directory.location || '').endsWith('/') ? directory.location : directory.location + '/',
+});
+
+const directoryToProcessIOValue = (directory: Directory, auth: AuthState, pdh?: string): ProcessIOValue => {
+    const normalizedDirectory = normalizeDirectoryLocation(directory);
+    return {
+        display: getKeepUrl(normalizedDirectory, pdh),
+        nav: getNavUrl(auth, normalizedDirectory, pdh),
+    };
+};

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list