X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/63c5742cf2ca07c0068ab69affbfcf8e4f3f6d35..92a147d8e4fd5b02264c06ec432255777cb942c7:/services/workbench2/src/views-components/project-details-card/project-details-card.tsx diff --git a/services/workbench2/src/views-components/project-details-card/project-details-card.tsx b/services/workbench2/src/views-components/project-details-card/project-details-card.tsx index 270e9157d4..0988d7c168 100644 --- a/services/workbench2/src/views-components/project-details-card/project-details-card.tsx +++ b/services/workbench2/src/views-components/project-details-card/project-details-card.tsx @@ -17,29 +17,30 @@ import { FavoriteStar, PublicFavoriteStar } from 'views-components/favorite-star import { MoreVerticalIcon, FreezeIcon } from 'components/icon/icon'; import { Resource } from 'models/resource'; import { IconButton } from '@material-ui/core'; -import { ContextMenuResource, openUserContextMenu } from 'store/context-menu/context-menu-actions'; +import { ContextMenuResource } from 'store/context-menu/context-menu-actions'; import { openContextMenu, resourceUuidToContextMenuKind } from 'store/context-menu/context-menu-actions'; import { CollectionResource } from 'models/collection'; import { ContextMenuKind } from 'views-components/context-menu/context-menu'; import { Dispatch } from 'redux'; import classNames from 'classnames'; import { loadDetailsPanel } from 'store/details-panel/details-panel-action'; +import { ExpandChevronRight } from 'components/expand-chevron-right/expand-chevron-right'; +import { MultiselectToolbar } from 'components/multiselect-toolbar/MultiselectToolbar'; type CssRules = | 'root' | 'selected' | 'cardHeader' - | 'descriptionLabel' + | 'descriptionToggle' | 'showMore' | 'noDescription' - | 'nameContainer' + | 'userNameContainer' | 'cardContent' - | 'subHeader' + | 'nameSection' | 'namePlate' | 'faveIcon' | 'frozenIcon' | 'contextMenuSection' - | 'chipSection' | 'tag' | 'description'; @@ -48,46 +49,51 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ width: '100%', marginBottom: '1rem', flex: '0 0 auto', - paddingTop: '0.2rem', + padding: 0, border: '2px solid transparent', }, selected: { border: '2px solid #ccc', }, showMore: { - color: theme.palette.primary.main, cursor: 'pointer', + background: 'linear-gradient(to right, black, transparent)', + backgroundClip: 'text', + color: 'transparent', }, noDescription: { color: theme.palette.grey['600'], fontStyle: 'italic', }, - nameContainer: { + userNameContainer: { display: 'flex', }, cardHeader: { - paddingTop: '0.4rem', + padding: '0.2rem 0.4rem 0.1rem 1rem', }, - descriptionLabel: { - paddingTop: '1rem', - marginBottom: 0, - minHeight: '2.5rem', - marginRight: '0.8rem', + descriptionToggle: { + display: 'flex', + flexDirection: 'row', + cursor: 'pointer', + paddingBottom: '0.5rem', }, cardContent: { display: 'flex', flexDirection: 'column', - transition: 'height 0.3s ease', + marginTop: '-1.75rem', }, - subHeader: { + nameSection: { display: 'flex', flexDirection: 'row', + alignItems: 'center', justifyContent: 'space-between', - marginTop: '-2rem', }, namePlate: { display: 'flex', flexDirection: 'row', + alignItems: 'center', + margin: 0, + paddingBottom: '0.5rem', }, faveIcon: { fontSize: '0.8rem', @@ -97,7 +103,7 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ frozenIcon: { fontSize: '0.5rem', marginLeft: '0.3rem', - marginTop: '0.57rem', + marginTop: '0.1rem', height: '1rem', color: theme.palette.text.primary, }, @@ -105,18 +111,15 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ display: 'flex', flexDirection: 'row', alignItems: 'center', - marginTop: '0.6rem', - }, - chipSection: { - display: 'flex', - flexWrap: 'wrap', + paddingTop: '0.25rem', }, tag: { marginRight: '1rem', - marginTop: '0.5rem', + marginTop: '1rem', }, description: { - marginTop: '1rem', + maxWidth: '90%', + marginTop: 0, }, }); @@ -147,10 +150,11 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ if (resource.groupClass === 'filter') { readOnly = true; } - const menuKind = dispatch(resourceUuidToContextMenuKind(resource.uuid, readOnly)); + let menuKind = dispatch(resourceUuidToContextMenuKind(resource.uuid, readOnly)); if (menuKind === ContextMenuKind.ROOT_PROJECT) { - dispatch(openUserContextMenu(event, resource as UserResource)); - } else if (menuKind && resource) { + menuKind = ContextMenuKind.USER_DETAILS; + } + if (menuKind && resource) { dispatch( openContextMenu(event, { name: resource.name, @@ -239,11 +243,15 @@ const UserCard: React.FC = ({ classes, currentResource, handleCon const { fullName, uuid } = currentResource as UserResource & { fullName: string }; return ( - handleCardClick(uuid)}> + handleCardClick(uuid)} + data-cy='user-details-card' + > +
= ({ classes, currentResource, handleCon > handleContextMenu(ev, currentResource as any, isAdmin)} > @@ -280,91 +289,132 @@ const UserCard: React.FC = ({ classes, currentResource, handleCon const ProjectCard: React.FC = ({ classes, currentResource, frozenByFullName, handleContextMenu, handleCardClick, isAdmin, isSelected }) => { const { name, description, uuid } = currentResource as ProjectResource; const [showDescription, setShowDescription] = React.useState(false); + const [showProperties, setShowProperties] = React.useState(false); const toggleDescription = () => { setShowDescription(!showDescription); }; + const toggleProperties = () => { + setShowProperties(!showProperties); + }; + return ( - handleCardClick(uuid)}> + handleCardClick(uuid)} + data-cy='project-details-card' + > - - {name} - - - - {!!frozenByFullName && ( - Project was frozen by {frozenByFullName}} +
+
+ - - - )} + {name} + + + + {!!frozenByFullName && ( + Project was frozen by {frozenByFullName}} + > + + + )} +
} action={ -
- - handleContextMenu(ev, currentResource as any, isAdmin)} - > - - - -
+ + //
+ // + // handleContextMenu(ev, currentResource as any, isAdmin)} + // > + // + // + // + //
} /> - -
-
- - {typeof currentResource.properties === 'object' && - Object.keys(currentResource.properties).map((k) => - Array.isArray(currentResource.properties[k]) - ? currentResource.properties[k].map((v: string) => getPropertyChip(k, v, undefined, classes.tag)) - : getPropertyChip(k, currentResource.properties[k], undefined, classes.tag) - )} - -
-
ev.stopPropagation()}> - {description ? ( - ev.stopPropagation()}> + {description ? ( +
+ +
+ - {!showDescription ? "Show full description" : "Hide full description"} - - ) : ( - no description available - )} + + {description} + + +
-
- -
ev.stopPropagation()}> - - {description} - + ) : ( + + no description available + + )} + {typeof currentResource.properties === 'object' && Object.keys(currentResource.properties).length > 0 ? ( +
+ +
+ + + + + {Object.keys(currentResource.properties).map((k) => + Array.isArray(currentResource.properties[k]) + ? currentResource.properties[k].map((v: string) => getPropertyChip(k, v, undefined, classes.tag)) + : getPropertyChip(k, currentResource.properties[k], undefined, classes.tag) + )} + + + + +
- - + ) : null} +
); };