[ARVADOS-WORKBENCH2] created: 2.1.0-397-gad79cd83

Git user git at public.arvados.org
Wed Jun 2 21:55:08 UTC 2021


        at  ad79cd83fc26c3314a6c79137db02b12d1f2714a (commit)


commit ad79cd83fc26c3314a6c79137db02b12d1f2714a
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Wed Jun 2 23:52:53 2021 +0200

    17305: Added handling for non collection file size display
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/src/common/formatters.ts b/src/common/formatters.ts
index 17917127..d8228bf5 100644
--- a/src/common/formatters.ts
+++ b/src/common/formatters.ts
@@ -20,7 +20,7 @@ export const formatDate = (isoDate?: string | null, utc: boolean = false) => {
     return "(none)";
 };
 
-export const formatFileSize = (size?: number) => {
+export const formatFileSize = (size?: number | string) => {
     if (typeof size === "number") {
         if (size === 0) { return "0 B"; }
 
@@ -29,6 +29,9 @@ export const formatFileSize = (size?: number) => {
                 return `${(size / base).toFixed()} ${unit}`;
             }
         }
+    } 
+    if ((typeof size === "string" && size === '') || size === undefined) {
+        return '';
     }
     return "0 B";
 };
diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index ee40dd39..4ec07344 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -417,6 +417,11 @@ export const renderFileSize = (fileSize?: number) =>
 export const ResourceFileSize = connect(
     (state: RootState, props: { uuid: string }) => {
         const resource = getResource<CollectionResource>(props.uuid)(state.resources);
+
+        if (resource && resource.kind === ResourceKind.COLLECTION) {
+            return { fileSize: '' };
+        }
+
         return { fileSize: resource ? resource.fileSizeTotal : 0 };
     })((props: { fileSize?: number }) => renderFileSize(props.fileSize));
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list