X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/2f0ac8c05c27a6cb41afe90d40a35a0195a8f885..ef3b2c15f10a3fea50170bc346105d909145a98f:/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 0b264b6b..42f7787c 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -22,6 +22,9 @@ import { snackbarActions } from '~/store/snackbar/snackbar-actions'; 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 { formatFileSize } from "~/common/formatters"; +import { getResourceData } from "~/store/resources-data/resources-data"; +import { ResourceData } from "~/store/resources-data/resources-data-reducer"; type CssRules = 'card' | 'iconHeader' | 'tag' | 'copyIcon' | 'label' | 'value'; @@ -54,6 +57,7 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ interface CollectionPanelDataProps { item: CollectionResource; + data: ResourceData; } type CollectionPanelProps = CollectionPanelDataProps & DispatchProp @@ -62,84 +66,89 @@ type CollectionPanelProps = CollectionPanelDataProps & DispatchProp export const CollectionPanel = withStyles(styles)( connect((state: RootState, props: RouteComponentProps<{ id: string }>) => { - const collection = getResource(props.match.params.id)(state.resources); - return { - item: collection - }; + const item = getResource(props.match.params.id)(state.resources); + const data = getResourceData(props.match.params.id)(state.resourcesData); + return { item, data }; })( class extends React.Component { render() { - const { classes, item } = this.props; - return
- - } - action={ - - - - - - } - title={item && item.name} - subheader={item && item.description} /> - - - - - - this.onCopy()}> - - - - - - - + const { classes, item, data } = this.props; + return item + ? <> + + } + action={ + + + + + + } + title={item && item.name} + subheader={item && item.description} /> + + + + + + this.onCopy()}> + + + + + + + + - - - + + - - - - - - - { - Object.keys(item.properties).map( key => { - return ; - }) - } + + + + + + + + + { + Object.keys(item.properties).map(k => { + return ; + }) + } + - - - -
- -
-
; + + +
+ +
+ + : null; } handleContextMenu = (event: React.MouseEvent) => { - const { uuid, ownerUuid, name, description, kind } = this.props.item; + const { uuid, ownerUuid, name, description, kind, isTrashed } = this.props.item; const resource = { uuid, ownerUuid, name, description, kind, - menuKind: ContextMenuKind.COLLECTION + menuKind: isTrashed + ? ContextMenuKind.TRASHED_COLLECTION + : ContextMenuKind.COLLECTION }; this.props.dispatch(openContextMenu(event, resource)); }