X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/25dc48d4655faf7a6eebdb717e225b77d8ff5c3f..892d0e98eeb20624cf49ca408af6156b4d3b0f55:/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 81bd1ebc..bcf72edc 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
+import React from 'react';
 import {
     StyleRulesCallback, WithStyles, withStyles,
     IconButton, Grid, Tooltip, Typography, ExpansionPanel,
@@ -10,29 +10,30 @@ import {
 } from '@material-ui/core';
 import { connect, DispatchProp } from "react-redux";
 import { RouteComponentProps } from 'react-router';
-import { ArvadosTheme } from '~/common/custom-theme';
-import { RootState } from '~/store/store';
-import { MoreOptionsIcon, CollectionIcon, ReadOnlyIcon, ExpandIcon, CollectionOldVersionIcon } from '~/components/icon/icon';
-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 { ArvadosTheme } from 'common/custom-theme';
+import { RootState } from 'store/store';
+import { MoreOptionsIcon, CollectionIcon, ReadOnlyIcon, ExpandIcon, CollectionOldVersionIcon } from 'components/icon/icon';
+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 { CollectionTagForm } from './collection-tag-form';
-import { deleteCollectionTag, navigateToProcess, collectionPanelActions } 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";
-import { openDetailsPanel } from '~/store/details-panel/details-panel-action';
-import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
-import { getPropertyChip } from '~/views-components/resource-properties-form/property-chip';
-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 { deleteCollectionTag, navigateToProcess, collectionPanelActions } 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";
+import { openDetailsPanel } from 'store/details-panel/details-panel-action';
+import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
+import { getPropertyChip } from 'views-components/resource-properties-form/property-chip';
+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 { ResourceOwnerWithName, ResponsiblePerson } from 'views-components/data-explorer/renderers';
+import { MPVContainer, MPVPanelContent, MPVPanelState } from 'components/multi-panel-view/multi-panel-view';
 
 type CssRules = 'root'
     | 'button'
@@ -49,9 +50,7 @@ type CssRules = 'root'
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     root: {
-        display: 'flex',
-        flexFlow: 'column',
-        height: 'calc(100vh - 130px)', // (100% viewport height) - (top bar + breadcrumbs)
+        width: '100%',
     },
     button: {
         cursor: 'pointer'
@@ -120,22 +119,27 @@ export const CollectionPanel = withStyles(styles)(
                 isWritable = true;
             } else {
                 const itemOwner = getResource<GroupResource | UserResource>(item.ownerUuid)(state.resources);
-                if (itemOwner) {
+                if (itemOwner && itemOwner.writableBy) {
                     isWritable = itemOwner.writableBy.indexOf(currentUserUUID || '') >= 0;
                 }
             }
         }
         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;
+        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 };
     })(
         class extends React.Component<CollectionPanelProps> {
             render() {
                 const { classes, item, dispatch, isWritable, isOldVersion, isLoadingFiles, tooManyFiles } = this.props;
+                const panelsData: MPVPanelState[] = [
+                    {name: "Details"},
+                    {name: "Properties", visible: false},
+                    {name: "Files"},
+                ];
                 return item
-                    ? <div className={classes.root}>
-                        <ExpansionPanel data-cy='collection-info-panel' defaultExpanded>
+                    ? <MPVContainer className={classes.root} spacing={8} direction="column" justify-content="flex-start" wrap="nowrap" panelStates={panelsData}>
+                        <MPVPanelContent xs="auto"><ExpansionPanel data-cy='collection-info-panel' defaultExpanded>
                             <ExpansionPanelSummary expandIcon={<ExpandIcon />}>
                                 <Grid container justify="space-between">
                                     <Grid item xs={11}><span>
@@ -186,9 +190,9 @@ export const CollectionPanel = withStyles(styles)(
                                     </Grid>
                                 </Grid>
                             </ExpansionPanelDetails>
-                        </ExpansionPanel>
+                        </ExpansionPanel></MPVPanelContent>
 
-                        <ExpansionPanel data-cy='collection-properties-panel' defaultExpanded>
+                        <MPVPanelContent xs="auto"><ExpansionPanel data-cy='collection-properties-panel' defaultExpanded>
                             <ExpansionPanelSummary expandIcon={<ExpandIcon />}>
                                 {"Properties"}
                             </ExpansionPanelSummary>
@@ -220,8 +224,8 @@ export const CollectionPanel = withStyles(styles)(
                                     </Grid>
                                 </Grid>
                             </ExpansionPanelDetails>
-                        </ExpansionPanel>
-                        <div className={classes.filesCard}>
+                        </ExpansionPanel></MPVPanelContent>
+                        <MPVPanelContent xs className={classes.filesCard}>
                             <CollectionPanelFiles
                                 isWritable={isWritable}
                                 isLoading={isLoadingFiles}
@@ -231,19 +235,20 @@ export const CollectionPanel = withStyles(styles)(
                                     dispatch<any>(loadCollectionFiles(this.props.item.uuid));
                                 }
                                 } />
-                        </div>
-                    </div>
+                        </MPVPanelContent>
+                    </MPVContainer>
                     : null;
             }
 
             handleContextMenu = (event: React.MouseEvent<any>) => {
-                const { uuid, ownerUuid, name, description, kind } = this.props.item;
+                const { uuid, ownerUuid, name, description, kind, storageClassesDesired } = this.props.item;
                 const menuKind = this.props.dispatch<any>(resourceUuidToContextMenuKind(uuid));
                 const resource = {
                     uuid,
                     ownerUuid,
                     name,
                     description,
+                    storageClassesDesired,
                     kind,
                     menuKind,
                 };
@@ -303,7 +308,7 @@ export const CollectionDetailsAttributes = (props: { item: CollectionResource, t
                 uuidEnhancer={(uuid: string) => <ResourceOwnerWithName uuid={uuid} />} />
         </Grid>
         <div data-cy="responsible-person-wrapper" ref={responsiblePersonRef}>
-            <Grid item xs={12} md={mdSize}>
+            <Grid item xs={12} md={12}>
                 <DetailsAttribute classLabel={classes.label} classValue={classes.value}
                     label='Responsible person' linkToUuid={item.ownerUuid}
                     uuidEnhancer={(uuid: string) => <ResponsiblePerson uuid={item.uuid} parentRef={responsiblePersonRef.current} />} />
@@ -341,5 +346,9 @@ export const CollectionDetailsAttributes = (props: { item: CollectionResource, t
             <DetailsAttribute classLabel={classes.label} classValue={classes.value}
                 label='Content size' value={formatFileSize(item.fileSizeTotal)} />
         </Grid>
+        <Grid item xs={12} md={mdSize}>
+            <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                label='Storage classes' value={item.storageClassesDesired.join(', ')} />
+        </Grid>
     </Grid>;
 };
