X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f62ba0aeff590ef1c57669d4f46e43b5ee169522..25dc48d4655faf7a6eebdb717e225b77d8ff5c3f:/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 feade60c1d..81bd1ebc15 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -19,8 +19,7 @@ import { CollectionPanelFiles } from '~/views-components/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 } from '~/store/context-menu/context-menu-actions'; -import { ContextMenuKind } from '~/views-components/context-menu/context-menu'; +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'; @@ -32,8 +31,11 @@ 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'; type CssRules = 'root' + | 'button' | 'filesCard' | 'iconHeader' | 'tag' @@ -51,6 +53,9 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ flexFlow: 'column', height: 'calc(100vh - 130px)', // (100% viewport height) - (top bar + breadcrumbs) }, + button: { + cursor: 'pointer' + }, filesCard: { marginBottom: theme.spacing.unit * 2, flex: 1, @@ -167,7 +172,7 @@ export const CollectionPanel = withStyles(styles)( {item.description} - + dispatch(openDetailsPanel(item.uuid, 1))} /> {(item.properties.container_request || item.properties.containerRequest) && dispatch(navigateToProcess(item.properties.container_request || item.properties.containerRequest))}> @@ -200,7 +205,7 @@ export const CollectionPanel = withStyles(styles)( getPropertyChip( k, v, isWritable - ? this.handleDelete(k, item.properties[k]) + ? this.handleDelete(k, v) : undefined, classes.tag)) : getPropertyChip( @@ -232,19 +237,15 @@ export const CollectionPanel = withStyles(styles)( } handleContextMenu = (event: React.MouseEvent) => { - const { uuid, ownerUuid, name, description, kind, isTrashed } = this.props.item; - const { isWritable } = this.props; + const { uuid, ownerUuid, name, description, kind } = this.props.item; + const menuKind = this.props.dispatch(resourceUuidToContextMenuKind(uuid)); const resource = { uuid, ownerUuid, name, description, kind, - menuKind: isWritable - ? isTrashed - ? ContextMenuKind.TRASHED_COLLECTION - : ContextMenuKind.COLLECTION - : ContextMenuKind.READONLY_COLLECTION + menuKind, }; // Avoid expanding/collapsing the panel event.stopPropagation(); @@ -266,7 +267,7 @@ export const CollectionPanel = withStyles(styles)( const { item } = this.props; if (item) { e.stopPropagation(); - this.props.dispatch(openDetailsPanel(item.uuid)); + this.props.dispatch(openDetailsPanel(item.uuid)); } } @@ -278,11 +279,13 @@ export const CollectionPanel = withStyles(styles)( ) ); -export const CollectionDetailsAttributes = (props: { item: CollectionResource, twoCol: boolean, classes?: Record }) => { +export const CollectionDetailsAttributes = (props: { item: CollectionResource, twoCol: boolean, classes?: Record, showVersionBrowser?: () => void }) => { const item = props.item; - const classes = props.classes || { label: '', value: '' }; + const classes = props.classes || { label: '', value: '', button: '' }; const isOldVersion = item && item.currentVersionUuid !== item.uuid; const mdSize = props.twoCol ? 6 : 12; + const showVersionBrowser = props.showVersionBrowser; + const responsiblePersonRef = React.useRef(null); return + label='Owner' linkToUuid={item.ownerUuid} + uuidEnhancer={(uuid: string) => } /> - - {isOldVersion && +
+ label='Responsible person' linkToUuid={item.ownerUuid} + uuidEnhancer={(uuid: string) => } /> - } +
+ label='Head version' + value={isOldVersion ? undefined : 'this one'} + linkToUuid={isOldVersion ? item.currentVersionUuid : undefined} /> + + + showVersionBrowser()}> + {{item.version}} + + : item.version + } + />