X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/bc49fa261517a5027980570a903b6b6aa5c1f82a..4530e2fcf4cac004af67cecddefc742a83c82b16:/src/views/collection-panel/collection-panel.tsx diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx index be2afc72..27a68541 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -5,7 +5,7 @@ import * as React from 'react'; import { StyleRulesCallback, WithStyles, withStyles, Card, - CardHeader, IconButton, CardContent, Grid, Tooltip, Chip + CardHeader, IconButton, CardContent, Grid, Tooltip } from '@material-ui/core'; import { connect, DispatchProp } from "react-redux"; import { RouteComponentProps } from 'react-router'; @@ -28,8 +28,10 @@ import { IllegalNamingWarning } from '~/components/warning/warning'; import { GroupResource } from '~/models/group'; import { UserResource } from '~/models/user'; import { getUserUuid } from '~/common/getuser'; +import { getProgressIndicator } from '~/store/progress-indicator/progress-indicator-reducer'; +import { COLLECTION_PANEL_LOAD_FILES } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions'; -type CssRules = 'card' | 'iconHeader' | 'tag' | 'label' | 'value' | 'link' | 'centeredLabel'; +type CssRules = 'card' | 'iconHeader' | 'tag' | 'label' | 'value' | 'link' | 'centeredLabel' | 'readOnlyIcon'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ card: { @@ -60,12 +62,17 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ '&:hover': { cursor: 'pointer' } + }, + readOnlyIcon: { + marginLeft: theme.spacing.unit, + fontSize: 'small', } }); interface CollectionPanelDataProps { item: CollectionResource; isWritable: boolean; + isLoadingFiles: boolean; } type CollectionPanelProps = CollectionPanelDataProps & DispatchProp @@ -84,11 +91,13 @@ export const CollectionPanel = withStyles(styles)( isWritable = itemOwner.writableBy.indexOf(currentUserUUID || '') >= 0; } } - return { item, isWritable }; + const loadingFilesIndicator = getProgressIndicator(COLLECTION_PANEL_LOAD_FILES)(state.progressIndicator); + const isLoadingFiles = loadingFilesIndicator && loadingFilesIndicator!.working || false; + return { item, isWritable, isLoadingFiles }; })( class extends React.Component { render() { - const { classes, item, dispatch, isWritable } = this.props; + const { classes, item, dispatch, isWritable, isLoadingFiles } = this.props; return item ? <> @@ -101,6 +110,7 @@ export const CollectionPanel = withStyles(styles)( action={ @@ -111,7 +121,11 @@ export const CollectionPanel = withStyles(styles)( {item.name} - {isWritable || } label="Read-only"/>} + {isWritable || + + + + } } titleTypographyProps={this.titleProps} @@ -142,7 +156,7 @@ export const CollectionPanel = withStyles(styles)( - + @@ -173,8 +187,8 @@ export const CollectionPanel = withStyles(styles)( -
- +
+
: null;