X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fc898afbfa340c57062887083c96bc197fc283d0..f8fb6725beec5b2bf0eec7f375d49f9189ff1bc3:/src/components/collection-panel-files/collection-panel-files.tsx diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx index 48b36be16a..c7db48c4b8 100644 --- a/src/components/collection-panel-files/collection-panel-files.tsx +++ b/src/components/collection-panel-files/collection-panel-files.tsx @@ -6,27 +6,31 @@ import * as React from 'react'; import { TreeItem, TreeItemStatus } from '~/components/tree/tree'; import { FileTreeData } from '~/components/file-tree/file-tree-data'; import { FileTree } from '~/components/file-tree/file-tree'; -import { IconButton, Grid, Typography, StyleRulesCallback, withStyles, WithStyles, CardHeader, Card, Button, Tooltip } from '@material-ui/core'; +import { IconButton, Grid, Typography, StyleRulesCallback, withStyles, WithStyles, CardHeader, Card, Button, Tooltip, CircularProgress } from '@material-ui/core'; import { CustomizeTableIcon } from '~/components/icon/icon'; import { DownloadIcon } from '~/components/icon/icon'; export interface CollectionPanelFilesProps { items: Array>; isWritable: boolean; + isLoading: boolean; + tooManyFiles: boolean; onUploadDataClick: () => void; onItemMenuOpen: (event: React.MouseEvent, item: TreeItem, isWritable: boolean) => void; onOptionsMenuOpen: (event: React.MouseEvent, isWritable: boolean) => void; onSelectionToggle: (event: React.MouseEvent, item: TreeItem) => void; onCollapseToggle: (id: string, status: TreeItemStatus) => void; onFileClick: (id: string) => void; + loadFilesFunc: () => void; currentItemUuid?: string; } -type CssRules = 'root' | 'cardSubheader' | 'nameHeader' | 'fileSizeHeader' | 'uploadIcon' | 'button'; +type CssRules = 'root' | 'cardSubheader' | 'nameHeader' | 'fileSizeHeader' | 'uploadIcon' | 'button' | 'centeredLabel'; const styles: StyleRulesCallback = theme => ({ root: { - paddingBottom: theme.spacing.unit + paddingBottom: theme.spacing.unit, + height: '100%' }, cardSubheader: { paddingTop: 0, @@ -44,18 +48,24 @@ const styles: StyleRulesCallback = theme => ({ button: { marginRight: -theme.spacing.unit, marginTop: '0px' - } + }, + centeredLabel: { + fontSize: '0.875rem', + textAlign: 'center' + }, }); export const CollectionPanelFiles = withStyles(styles)( - ({ onItemMenuOpen, onOptionsMenuOpen, onUploadDataClick, classes, isWritable, ...treeProps }: CollectionPanelFilesProps & WithStyles) => + ({ onItemMenuOpen, onOptionsMenuOpen, onUploadDataClick, classes, + isWritable, isLoading, tooManyFiles, loadFilesFunc, ...treeProps }: CollectionPanelFilesProps & WithStyles) => + {isWritable && - } /> - } + {!tooManyFiles && onOptionsMenuOpen(ev, isWritable)}> - - } /> - - - Name - - - File size - - - onItemMenuOpen(ev, item, isWritable)} {...treeProps} /> + } + + } /> + { tooManyFiles + ?
+ File listing may take some time, please click to browse: +
+ : <> + + + Name + + + File size + + + { isLoading + ?
+ :
onItemMenuOpen(ev, item, isWritable)} {...treeProps} />
} + + }
);