[arvados] created: 2.7.0-5832-g502051ab7d
git repository hosting
git at public.arvados.org
Thu Jan 18 14:26:41 UTC 2024
at 502051ab7d3d721542adb981e3b5f828758ae3f4 (commit)
commit 502051ab7d3d721542adb981e3b5f828758ae3f4
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Thu Jan 18 09:26:09 2024 -0500
21224: basic frame up, converted ms toolbar to accept single input Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/services/workbench2/src/components/multiselect-toolbar/MultiselectToolbar.tsx b/services/workbench2/src/components/multiselect-toolbar/MultiselectToolbar.tsx
index f92c0dcf4e..cebf3cf259 100644
--- a/services/workbench2/src/components/multiselect-toolbar/MultiselectToolbar.tsx
+++ b/services/workbench2/src/components/multiselect-toolbar/MultiselectToolbar.tsx
@@ -85,10 +85,11 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
export type MultiselectToolbarProps = {
checkedList: TCheckedList;
singleSelectedUuid: string | null
+ inputSelectedUuid?: string
iconProps: IconProps
user: User | null
disabledButtons: Set<string>
- executeMulti: (action: ContextMenuAction, checkedList: TCheckedList, resources: ResourcesState) => void;
+ executeMulti: (action: ContextMenuAction, inputSelectedUuid: string | undefined, checkedList: TCheckedList, resources: ResourcesState) => void;
};
type IconProps = {
@@ -102,7 +103,8 @@ export const MultiselectToolbar = connect(
mapDispatchToProps
)(
withStyles(styles)((props: MultiselectToolbarProps & WithStyles<CssRules>) => {
- const { classes, checkedList, singleSelectedUuid, iconProps, user, disabledButtons } = props;
+ const { classes, checkedList, inputSelectedUuid, iconProps, user, disabledButtons } = props;
+ const singleSelectedUuid = inputSelectedUuid ?? props.singleSelectedUuid
const singleResourceKind = singleSelectedUuid ? [resourceToMsResourceKind(singleSelectedUuid, iconProps.resources, user)] : null
const currentResourceKinds = singleResourceKind ? singleResourceKind : Array.from(selectedToKindSet(checkedList));
const currentPathIsTrash = window.location.pathname === "/trash";
@@ -147,7 +149,7 @@ export const MultiselectToolbar = connect(
<IconButton
data-cy='multiselect-button'
disabled={disabledButtons.has(name)}
- onClick={() => props.executeMulti(action, checkedList, iconProps.resources)}
+ onClick={() => props.executeMulti(action, inputSelectedUuid, checkedList, iconProps.resources)}
>
{currentPathIsTrash || (useAlts && useAlts(singleSelectedUuid, iconProps)) ? altIcon && altIcon({}) : icon({})}
</IconButton>
@@ -163,7 +165,7 @@ export const MultiselectToolbar = connect(
<span className={classes.iconContainer}>
<IconButton
data-cy='multiselect-button'
- onClick={() => props.executeMulti(action, checkedList, iconProps.resources)}
+ onClick={() => props.executeMulti(action, inputSelectedUuid, checkedList, iconProps.resources)}
>
{action.icon({})}
</IconButton>
@@ -337,17 +339,18 @@ function mapStateToProps({auth, multiselect, resources, favorites, publicFavorit
function mapDispatchToProps(dispatch: Dispatch) {
return {
- executeMulti: (selectedAction: ContextMenuAction, checkedList: TCheckedList, resources: ResourcesState): void => {
- const kindGroups = groupByKind(checkedList, resources);
+ executeMulti: (selectedAction: ContextMenuAction, inputSelectedUuid: string | undefined, checkedList: TCheckedList, resources: ResourcesState): void => {
+ const kindGroups = inputSelectedUuid ? groupByKind({[inputSelectedUuid]: true}, resources) : groupByKind(checkedList, resources);
+ const currentList = inputSelectedUuid ? [inputSelectedUuid] : selectedToArray(checkedList)
switch (selectedAction.name) {
case MultiSelectMenuActionNames.MOVE_TO:
case MultiSelectMenuActionNames.REMOVE:
- const firstResource = getResource(selectedToArray(checkedList)[0])(resources) as ContainerRequestResource | Resource;
+ const firstResource = getResource(currentList[0])(resources) as ContainerRequestResource | Resource;
const action = findActionByName(selectedAction.name as string, kindToActionSet[firstResource.kind]);
if (action) action.execute(dispatch, kindGroups[firstResource.kind]);
break;
case MultiSelectMenuActionNames.COPY_TO_CLIPBOARD:
- const selectedResources = selectedToArray(checkedList).map(uuid => getResource(uuid)(resources));
+ const selectedResources = currentList.map(uuid => getResource(uuid)(resources));
dispatch<any>(copyToClipboardAction(selectedResources));
break;
default:
diff --git a/services/workbench2/src/views-components/details-card.tsx b/services/workbench2/src/views-components/details-card.tsx
new file mode 100644
index 0000000000..aa70343544
--- /dev/null
+++ b/services/workbench2/src/views-components/details-card.tsx
@@ -0,0 +1,67 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import React from 'react';
+import { Card, CardHeader, WithStyles, withStyles, Typography, CardContent } from '@material-ui/core';
+import { StyleRulesCallback } from '@material-ui/core';
+import { ArvadosTheme } from 'common/custom-theme';
+import { RootState } from 'store/store';
+import { connect } from 'react-redux';
+import { getResource } from 'store/resources/resources';
+import { MultiselectToolbar } from 'components/multiselect-toolbar/MultiselectToolbar';
+
+type CssRules = 'root';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+ root: {
+ width: '100%',
+ marginBottom: '1.5rem',
+ },
+});
+
+const mapStateToProps = (state: RootState) => {
+ const currentRoute = state.router.location?.pathname.split('/') || [];
+ const currentItemUuid = currentRoute[currentRoute?.length - 1];
+ const currentResource = getResource(currentItemUuid)(state.resources);
+ return {
+ currentResource,
+ };
+};
+
+type DetailsCardProps = {
+ currentResource: any;
+};
+
+export const DetailsCard = connect(mapStateToProps)(
+ withStyles(styles)((props: DetailsCardProps & WithStyles<CssRules>) => {
+ const { classes, currentResource } = props;
+ const { name, description, uuid } = currentResource;
+ return (
+ <Card className={classes.root}>
+ {console.log(currentResource)}
+ <CardHeader
+ title={
+ <Typography
+ noWrap
+ variant='h6'
+ >
+ {name}
+ </Typography>
+ }
+ subheader={
+ <Typography
+ noWrap
+ variant='body1'
+ color='inherit'
+ >
+ {description ? description.replace(/<[^>]*>/g, '') : '(no-description)'}
+ </Typography>
+ }
+ action={<MultiselectToolbar inputSelectedUuid={uuid} />}
+ />
+ <CardContent></CardContent>
+ </Card>
+ );
+ })
+);
diff --git a/services/workbench2/src/views/project-panel/project-panel.tsx b/services/workbench2/src/views/project-panel/project-panel.tsx
index 83b6c8ba47..4bb11eaa58 100644
--- a/services/workbench2/src/views/project-panel/project-panel.tsx
+++ b/services/workbench2/src/views/project-panel/project-panel.tsx
@@ -53,6 +53,7 @@ import { resourceIsFrozen } from 'common/frozen-resources';
import { ProjectResource } from 'models/project';
import { NotFoundView } from 'views/not-found-panel/not-found-panel';
import { deselectAllOthers, toggleOne } from 'store/multiselect/multiselect-actions';
+import { DetailsCard } from 'views-components/details-card';
type CssRules = 'root' | 'button';
@@ -263,10 +264,11 @@ export const ProjectPanel = withStyles(styles)(
connect(mapStateToProps)(
class extends React.Component<ProjectPanelProps> {
render() {
- const { classes } = this.props;
+ const { classes, userUuid, currentItemId } = this.props;
return this.props.project ?
<div data-cy='project-panel' className={classes.root}>
+ {currentItemId !== userUuid && <DetailsCard />}
<DataExplorer
id={PROJECT_PANEL_ID}
onRowClick={this.handleRowClick}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list