X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/73774a5fe2d64970995e668576f8d4b632a8edee..35d6c5a870aeff7bb2cbf6ec80d306debad872c1:/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 948a20a07b..4e3d5acd9a 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -5,20 +5,18 @@ import * as React from 'react'; import { StyleRulesCallback, WithStyles, withStyles, Card, - CardHeader, IconButton, CardContent, Grid, Chip, Tooltip + CardHeader, IconButton, CardContent, Grid, Tooltip } 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, CopyIcon } from '~/components/icon/icon'; +import { MoreOptionsIcon, CollectionIcon } from '~/components/icon/icon'; import { DetailsAttribute } from '~/components/details-attribute/details-attribute'; import { CollectionResource } from '~/models/collection'; import { CollectionPanelFiles } from '~/views-components/collection-panel-files/collection-panel-files'; -import * as CopyToClipboard from 'react-copy-to-clipboard'; import { CollectionTagForm } from './collection-tag-form'; import { deleteCollectionTag, navigateToProcess } from '~/store/collection-panel/collection-panel-action'; -import { snackbarActions, SnackbarKind } 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'; @@ -26,8 +24,11 @@ import { formatFileSize } from "~/common/formatters"; import { getResourceData } from "~/store/resources-data/resources-data"; import { ResourceData } from "~/store/resources-data/resources-data-reducer"; import { openDetailsPanel } from '~/store/details-panel/details-panel-action'; +import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions'; +import { PropertyChipComponent } from '~/views-components/resource-properties-form/property-chip'; +import { IllegalNamingWarning } from '~/components/warning/warning'; -type CssRules = 'card' | 'iconHeader' | 'tag' | 'copyIcon' | 'label' | 'value' | 'link'; +type CssRules = 'card' | 'iconHeader' | 'tag' | 'label' | 'value' | 'link'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ card: { @@ -41,12 +42,6 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ marginRight: theme.spacing.unit, marginBottom: theme.spacing.unit }, - copyIcon: { - marginLeft: theme.spacing.unit, - fontSize: '1.125rem', - color: theme.palette.grey["500"], - cursor: 'pointer' - }, label: { fontSize: '0.875rem' }, @@ -72,11 +67,11 @@ type CollectionPanelProps = CollectionPanelDataProps & DispatchProp & WithStyles & RouteComponentProps<{ id: string }>; export const CollectionPanel = withStyles(styles)( - connect((state: RootState, props: RouteComponentProps<{ id: string }>) => { - const item = getResource(props.match.params.id)(state.resources); - const data = getResourceData(props.match.params.id)(state.resourcesData); - return { item, data }; - })( + connect((state: RootState, props: RouteComponentProps<{ id: string }>) => { + 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() { @@ -99,28 +94,25 @@ export const CollectionPanel = withStyles(styles)( } - title={item && item.name} + title={item && {item.name}} titleTypographyProps={this.titleProps} subheader={item && item.description} subheaderTypographyProps={this.titleProps} /> - + - - this.onCopy()}> - - - - + linkToUuid={item && item.uuid} /> + + label='Owner' linkToUuid={item && item.ownerUuid} /> {(item.properties.container_request || item.properties.containerRequest) && dispatch(navigateToProcess(item.properties.container_request || item.properties.containerRequest))}> @@ -139,13 +131,12 @@ export const CollectionPanel = withStyles(styles)( - { - Object.keys(item.properties).map(k => { - return ; - }) - } + {Object.keys(item.properties).map(k => + + )} @@ -172,16 +163,15 @@ export const CollectionPanel = withStyles(styles)( this.props.dispatch(openContextMenu(event, resource)); } - handleDelete = (key: string) => () => { - this.props.dispatch(deleteCollectionTag(key)); - } - - onCopy = () => { + onCopy = (message: string) => this.props.dispatch(snackbarActions.OPEN_SNACKBAR({ - message: "Uuid has been copied", + message, hideDuration: 2000, kind: SnackbarKind.SUCCESS - })); + })) + + handleDelete = (key: string) => () => { + this.props.dispatch(deleteCollectionTag(key)); } openCollectionDetails = () => {