fileCount column up Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox@curii.com>
authorLisa Knox <lisaknox83@gmail.com>
Mon, 28 Nov 2022 21:15:40 +0000 (16:15 -0500)
committerLisa Knox <lisaknox83@gmail.com>
Mon, 28 Nov 2022 21:15:40 +0000 (16:15 -0500)
src/views-components/data-explorer/renderers.tsx
src/views/project-panel/project-panel.tsx

index c01e3918a7c7d2534438b02092e935cde415b276..1623f17674622a8791f3c6e36efdae3efcbdd0ab 100644 (file)
@@ -726,6 +726,7 @@ export const ResourceOwnerName = connect(
 export const ResourceUUID = connect(
     (state: RootState, props: { uuid: string }) => {
         const resource = getResource<CollectionResource>(props.uuid)(state.resources);
+        console.log('COLLECTION_RESOIRCE', resource)
         return { uuid: resource ? resource.uuid : '' };
     })((props: { uuid: string }) => renderUuid({uuid: props.uuid}));
 
@@ -758,6 +759,16 @@ const renderDescription = (description: string)=>{
     return <Typography title={description}>{truncatedDescription}</Typography>;
 }
 
+const renderFileCount = (fileCount: number) =>{
+    return <Typography>{fileCount ?? '-'}</Typography>
+}
+
+export const ResourceFileCount = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<CollectionResource>(props.uuid)(state.resources);
+        return { fileCount: resource ? resource.fileCount: '' };
+    })((props: { fileCount: number }) => renderFileCount(props.fileCount));
+
 export const ResourceDescription = connect(
     (state: RootState, props: { uuid: string }) => {
         const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
index 0ba61893c1240500c082030d397e580ce9994c6c..4723e409aab649b384aaa47aca9357ca7f62f434 100644 (file)
@@ -17,6 +17,7 @@ import { SortDirection } from 'components/data-table/data-column';
 import { ResourceKind, Resource } from 'models/resource';
 import {
     ResourceFileSize,
+    ResourceFileCount,
     ResourceCreatedAtDate,
     ResourceLastModifiedDate,
     ResourceTrashDate,
@@ -71,6 +72,7 @@ export enum ProjectPanelColumnNames {
     TYPE = "Type",
     OWNER = "Owner",
     FILE_SIZE = "File size",
+    FILE_COUNT = "File count",
     UUID = "UUID",
     CREATED_AT = "Date created",
     LAST_MODIFIED = "Last modified",
@@ -123,6 +125,13 @@ export const projectPanelColumns: DataColumns<string> = [
         filters: createTree(),
         render: uuid => <ResourceFileSize uuid={uuid} />
     },
+    {
+        name: ProjectPanelColumnNames.FILE_COUNT,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid =><ResourceFileCount uuid={uuid}/>
+    },
     {
         name: ProjectPanelColumnNames.UUID,
         selected: true,
@@ -182,6 +191,7 @@ export const projectPanelColumns: DataColumns<string> = [
         filters: createTree(),
         render: uuid =><ResourceVersion uuid={uuid}/>
     }
+    
 ];
 
 export const PROJECT_PANEL_ID = "projectPanel";