[arvados] updated: 2.7.0-6047-g92a147d8e4
git repository hosting
git at public.arvados.org
Fri Mar 15 15:12:21 UTC 2024
Summary of changes:
.../multiselect-toolbar/MultiselectToolbar.tsx | 22 ++++++++++------------
.../project-details-card/project-details-card.tsx | 2 +-
.../src/views/main-panel/main-panel-root.tsx | 15 ++++++++++++---
.../workbench2/src/views/main-panel/main-panel.tsx | 8 ++++++--
4 files changed, 29 insertions(+), 18 deletions(-)
via 92a147d8e4fd5b02264c06ec432255777cb942c7 (commit)
from af40119a34d8437cdf51c1b69982a022a220e90d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 92a147d8e4fd5b02264c06ec432255777cb942c7
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Fri Mar 15 11:12:16 2024 -0400
21224: created global current uuid property in store state 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 36b8199f30..7e462512f7 100644
--- a/services/workbench2/src/components/multiselect-toolbar/MultiselectToolbar.tsx
+++ b/services/workbench2/src/components/multiselect-toolbar/MultiselectToolbar.tsx
@@ -77,8 +77,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
export type MultiselectToolbarProps = {
checkedList: TCheckedList;
- singleSelectedUuid: string | null
- inputSelectedUuid?: string
+ selectedResource: string | null;
iconProps: IconProps
user: User | null
disabledButtons: Set<string>
@@ -97,9 +96,8 @@ export const MultiselectToolbar = connect(
mapDispatchToProps
)(
withStyles(styles)((props: MultiselectToolbarProps & WithStyles<CssRules>) => {
- const { classes, checkedList, inputSelectedUuid, iconProps, user, disabledButtons } = props;
- const singleSelectedUuid = inputSelectedUuid ?? props.singleSelectedUuid
- const singleResourceKind = singleSelectedUuid ? [resourceToMsResourceKind(singleSelectedUuid, iconProps.resources, user)] : null
+ const { classes, checkedList, iconProps, user, disabledButtons, selectedResource } = props;
+ const singleResourceKind = selectedResource ? [resourceToMsResourceKind(selectedResource, iconProps.resources, user)] : null
const currentResourceKinds = singleResourceKind ? singleResourceKind : Array.from(selectedToKindSet(checkedList));
const currentPathIsTrash = window.location.pathname === "/trash";
const [isTransitioning, setIsTransitioning] = useState(false);
@@ -124,7 +122,7 @@ export const MultiselectToolbar = connect(
currentPathIsTrash && selectedToKindSet(checkedList).size
? [msToggleTrashAction]
: selectActionsByKind(currentResourceKinds as string[], multiselectActionsFilters).filter((action) =>
- singleSelectedUuid === null ? action.isForMulti : true
+ selectedResource === null ? action.isForMulti : true
);
return (
@@ -142,7 +140,7 @@ export const MultiselectToolbar = connect(
<Tooltip
className={classes.button}
data-targetid={name}
- title={currentPathIsTrash || (useAlts && useAlts(singleSelectedUuid, iconProps)) ? altName : name}
+ title={currentPathIsTrash || (useAlts && useAlts(selectedResource, iconProps)) ? altName : name}
key={i}
disableFocusListener
>
@@ -150,10 +148,10 @@ export const MultiselectToolbar = connect(
<IconButton
data-cy='multiselect-button'
disabled={disabledButtons.has(name)}
- onClick={() => props.executeMulti(action, singleSelectedUuid, checkedList, iconProps.resources)}
+ onClick={() => props.executeMulti(action, selectedResource, checkedList, iconProps.resources)}
className={classes.icon}
>
- {currentPathIsTrash || (useAlts && useAlts(singleSelectedUuid, iconProps)) ? altIcon && altIcon({}) : icon({})}
+ {currentPathIsTrash || (useAlts && useAlts(selectedResource, iconProps)) ? altIcon && altIcon({}) : icon({})}
</IconButton>
</span>
</Tooltip>
@@ -170,7 +168,7 @@ export const MultiselectToolbar = connect(
data-cy='multiselect-button'
onClick={() => {
console.log('executing action', action.name, 'with checkedList', checkedList, 'and iconProps', iconProps.resources)
- props.executeMulti(action, singleSelectedUuid, checkedList, iconProps.resources)}}
+ props.executeMulti(action, selectedResource, checkedList, iconProps.resources)}}
className={classes.icon}
>
{action.icon({})}
@@ -330,13 +328,13 @@ function selectActionsByKind(currentResourceKinds: Array<string>, filterSet: TMu
//--------------------------------------------------//
-function mapStateToProps({auth, multiselect, resources, favorites, publicFavorites}: RootState) {
+function mapStateToProps({auth, multiselect, resources, favorites, publicFavorites, selectedResource}: RootState) {
return {
checkedList: multiselect.checkedList as TCheckedList,
- singleSelectedUuid: isExactlyOneSelected(multiselect.checkedList),
user: auth && auth.user ? auth.user : null,
disabledButtons: new Set<string>(multiselect.disabledButtons),
auth,
+ selectedResource,
iconProps: {
resources,
favorites,
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 063ea77cd9..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
@@ -338,7 +338,7 @@ const ProjectCard: React.FC<ProjectCardProps> = ({ classes, currentResource, fro
</section>
}
action={
- <MultiselectToolbar inputSelectedUuid={currentResource.uuid} />
+ <MultiselectToolbar />
// <section className={classes.contextMenuSection}>
// <Tooltip
// title='More options'
diff --git a/services/workbench2/src/views/main-panel/main-panel-root.tsx b/services/workbench2/src/views/main-panel/main-panel-root.tsx
index cdfd0c300f..d94c97adc3 100644
--- a/services/workbench2/src/views/main-panel/main-panel-root.tsx
+++ b/services/workbench2/src/views/main-panel/main-panel-root.tsx
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import React from 'react';
+import React, { useEffect } from 'react';
import { StyleRulesCallback, WithStyles, withStyles, Grid, LinearProgress } from '@material-ui/core';
import { User } from "models/user";
import { ArvadosTheme } from 'common/custom-theme';
@@ -35,10 +35,12 @@ export interface MainPanelRootDataProps {
sidePanelIsCollapsed: boolean;
isTransitioning: boolean;
currentSideWidth: number;
+ currentRoute: string;
}
interface MainPanelRootDispatchProps {
- toggleSidePanel: () => void
+ toggleSidePanel: () => void,
+ setCurrentRouteUuid: (uuid: string) => void;
}
type MainPanelRootProps = MainPanelRootDataProps & MainPanelRootDispatchProps & WithStyles<CssRules>;
@@ -46,7 +48,14 @@ type MainPanelRootProps = MainPanelRootDataProps & MainPanelRootDispatchProps &
export const MainPanelRoot = withStyles(styles)(
({ classes, loading, working, user, buildInfo, uuidPrefix,
isNotLinking, isLinkingPath, siteBanner, sessionIdleTimeout,
- sidePanelIsCollapsed, isTransitioning, currentSideWidth}: MainPanelRootProps) =>{
+ sidePanelIsCollapsed, isTransitioning, currentSideWidth, currentRoute, setCurrentRouteUuid}: MainPanelRootProps) =>{
+
+ useEffect(() => {
+ const splitRoute = currentRoute.split('/');
+ const uuid = splitRoute[splitRoute.length - 1];
+ setCurrentRouteUuid(uuid);
+ }, [currentRoute]);
+
return loading
? <WorkbenchLoadingScreen />
: <>
diff --git a/services/workbench2/src/views/main-panel/main-panel.tsx b/services/workbench2/src/views/main-panel/main-panel.tsx
index 264390a8b3..556ce0d75c 100644
--- a/services/workbench2/src/views/main-panel/main-panel.tsx
+++ b/services/workbench2/src/views/main-panel/main-panel.tsx
@@ -11,6 +11,7 @@ import { isWorkbenchLoading } from 'store/workbench/workbench-actions';
import { LinkAccountPanelStatus } from 'store/link-account-panel/link-account-panel-reducer';
import { matchLinkAccountRoute } from 'routes/routes';
import { toggleSidePanel } from "store/side-panel/side-panel-action";
+import { propertiesActions } from 'store/properties/properties-actions';
const mapStateToProps = (state: RootState): MainPanelRootDataProps => {
return {
@@ -25,7 +26,8 @@ const mapStateToProps = (state: RootState): MainPanelRootDataProps => {
sessionIdleTimeout: parse(state.auth.config.clusterConfig.Workbench.IdleTimeout, 's') || 0,
sidePanelIsCollapsed: state.sidePanel.collapsedState,
isTransitioning: state.detailsPanel.isTransitioning,
- currentSideWidth: state.sidePanel.currentSideWidth
+ currentSideWidth: state.sidePanel.currentSideWidth,
+ currentRoute: state.router.location ? state.router.location.pathname : '',
};
};
@@ -33,7 +35,9 @@ const mapDispatchToProps = (dispatch) => {
return {
toggleSidePanel: (collapsedState)=>{
return dispatch(toggleSidePanel(collapsedState))
- }
+ },
+ setCurrentRouteUuid: (uuid: string) => {
+ return dispatch(propertiesActions.SET_PROPERTY({key: 'currentRouteUuid', value: uuid}))}
}
};
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list