X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/36c33008be2896228d3040c756d80e8878907655..5005f810d8c5e8c9e8c94c5981b014e41d2a40b3:/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 dce8ef8f..df1b1f1d 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -21,7 +21,7 @@ import { MoreOptionsIcon, CollectionIcon, ReadOnlyIcon, CollectionOldVersionIcon import { DetailsAttribute } from 'components/details-attribute/details-attribute'; import { CollectionResource, getCollectionUrl } from 'models/collection'; import { CollectionPanelFiles } from 'views-components/collection-panel-files/collection-panel-files'; -import { navigateToProcess, collectionPanelActions } from 'store/collection-panel/collection-panel-action'; +import { navigateToProcess } from 'store/collection-panel/collection-panel-action'; import { getResource } from 'store/resources/resources'; import { openContextMenu, resourceUuidToContextMenuKind } from 'store/context-menu/context-menu-actions'; import { formatDate, formatFileSize } from "common/formatters"; @@ -32,12 +32,11 @@ 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, loadCollectionFiles, COLLECTION_PANEL_LOAD_FILES_THRESHOLD } from 'store/collection-panel/collection-panel-files/collection-panel-files-actions'; import { Link } from 'react-router-dom'; import { Link as ButtonLink } from '@material-ui/core'; -import { ResourceOwnerWithName, ResponsiblePerson } from 'views-components/data-explorer/renderers'; +import { ResourceWithName, ResponsiblePerson } from 'views-components/data-explorer/renderers'; import { MPVContainer, MPVPanelContent, MPVPanelState } from 'components/multi-panel-view/multi-panel-view'; +import { resourceIsFrozen } from 'common/frozen-resources'; type CssRules = 'root' | 'button' @@ -74,14 +73,14 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ }, iconHeader: { fontSize: '1.875rem', - color: theme.customs.colors.yellow700 + color: theme.customs.colors.greyL }, tag: { marginRight: theme.spacing.unit / 2, marginBottom: theme.spacing.unit / 2 }, label: { - fontSize: '0.875rem' + fontSize: '0.875rem', }, centeredLabel: { fontSize: '0.875rem', @@ -115,14 +114,12 @@ interface CollectionPanelDataProps { isWritable: boolean; isOldVersion: boolean; isLoadingFiles: boolean; - tooManyFiles: boolean; } -type CollectionPanelProps = CollectionPanelDataProps & DispatchProp - & WithStyles & RouteComponentProps<{ id: string }>; +type CollectionPanelProps = CollectionPanelDataProps & DispatchProp & WithStyles -export const CollectionPanel = withStyles(styles)( - connect((state: RootState, props: RouteComponentProps<{ id: string }>) => { +export const CollectionPanel = withStyles(styles)(connect( + (state: RootState, props: RouteComponentProps<{ id: string }>) => { const currentUserUUID = getUserUuid(state); const item = getResource(props.match.params.id)(state.resources); let isWritable = false; @@ -137,17 +134,19 @@ export const CollectionPanel = withStyles(styles)( } } } - const loadingFilesIndicator = getProgressIndicator(COLLECTION_PANEL_LOAD_FILES)(state.progressIndicator); - const isLoadingFiles = (loadingFilesIndicator && loadingFilesIndicator!.working) || false; - const tooManyFiles = (!state.collectionPanel.loadBigCollections && item && item.fileCount > COLLECTION_PANEL_LOAD_FILES_THRESHOLD) || false; - return { item, isWritable, isOldVersion, isLoadingFiles, tooManyFiles }; + + if (item && isWritable) { + isWritable = !resourceIsFrozen(item, state.resources); + } + + return { item, isWritable, isOldVersion }; })( class extends React.Component { render() { - const { classes, item, dispatch, isWritable, isOldVersion, isLoadingFiles, tooManyFiles } = this.props; + const { classes, item, dispatch, isWritable, isOldVersion } = this.props; const panelsData: MPVPanelState[] = [ - {name: "Details"}, - {name: "Files"}, + { name: "Details" }, + { name: "Files" }, ]; return item ? @@ -195,7 +194,7 @@ export const CollectionPanel = withStyles(styles)( {isOldVersion && This is an old version. Make a copy to make changes. Go to the head version for sharing options. - + } @@ -203,15 +202,7 @@ export const CollectionPanel = withStyles(styles)( - { - dispatch(collectionPanelActions.LOAD_BIG_COLLECTIONS(true)); - dispatch(loadCollectionFiles(this.props.item.uuid)); - } - } /> + @@ -288,7 +279,7 @@ export const CollectionDetailsAttributes = (props: CollectionDetailsProps) => { } /> + uuidEnhancer={(uuid: string) => } />
@@ -341,13 +332,13 @@ export const CollectionDetailsAttributes = (props: CollectionDetailsProps) => { - { Object.keys(item.properties).length > 0 + {Object.keys(item.properties).length > 0 ? Object.keys(item.properties).map(k => - Array.isArray(item.properties[k]) + Array.isArray(item.properties[k]) ? item.properties[k].map((v: string) => getPropertyChip(k, v, undefined, classes.tag)) : getPropertyChip(k, item.properties[k], undefined, classes.tag)) - :
No properties
} + :
No properties
}
; };