[arvados-workbench2] updated: 2.6.0-57-ge5682f2f

git repository hosting git at public.arvados.org
Wed Jul 19 16:17:28 UTC 2023


Summary of changes:
 .../copy-to-clipboard-snackbar.tsx                 |  80 ++++-----
 .../multiselectToolbar/MultiselectToolbar.tsx      |  26 ---
 .../open-in-new-tab/open-in-new-tab.actions.ts     |  17 +-
 .../context-menu/action-sets/project-action-set.ts | 187 +++++++++++----------
 .../action-sets/search-results-action-set.ts       |   2 +-
 .../action-sets/workflow-action-set.ts             |   2 +-
 6 files changed, 149 insertions(+), 165 deletions(-)

       via  e5682f2f1490de87f7727a364c717c06d5f58eee (commit)
      from  462f912b233957d9c944063d1f7872f0d32c7e13 (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 e5682f2f1490de87f7727a364c717c06d5f58eee
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Wed Jul 19 12:17:21 2023 -0400

    15768: project copy-to-clipboard works Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/src/components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar.tsx b/src/components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar.tsx
index 3b2ff68a..586bb13b 100644
--- a/src/components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar.tsx
+++ b/src/components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar.tsx
@@ -2,9 +2,9 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import React from "react";
-import { connect, DispatchProp } from "react-redux";
-import { StyleRulesCallback, Tooltip, WithStyles, withStyles } from "@material-ui/core";
+import React from 'react';
+import { connect, DispatchProp } from 'react-redux';
+import { StyleRulesCallback, Tooltip, WithStyles, withStyles } from '@material-ui/core';
 import { ArvadosTheme } from 'common/custom-theme';
 import CopyToClipboard from 'react-copy-to-clipboard';
 import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
@@ -13,46 +13,50 @@ import { CopyIcon } from 'components/icon/icon';
 type CssRules = 'copyIcon';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-  copyIcon: {
-    marginLeft: theme.spacing.unit,
-    color: theme.palette.grey["500"],
-    cursor: 'pointer',
-    display: 'inline',
-    '& svg': {
-      fontSize: '1rem',
-      verticalAlign: 'middle',
-    }
-  }
+    copyIcon: {
+        marginLeft: theme.spacing.unit,
+        color: theme.palette.grey['500'],
+        cursor: 'pointer',
+        display: 'inline',
+        '& svg': {
+            fontSize: '1rem',
+            verticalAlign: 'middle',
+        },
+    },
 });
 
 interface CopyToClipboardDataProps {
-  children?: React.ReactNode;
-  value: string;
+    children?: React.ReactNode;
+    value: string;
 }
 
 type CopyToClipboardProps = CopyToClipboardDataProps & WithStyles<CssRules> & DispatchProp;
 
-export const CopyToClipboardSnackbar = connect()(withStyles(styles)(
-  class CopyToClipboardSnackbar extends React.Component<CopyToClipboardProps> {
-    onCopy = () => {
-      this.props.dispatch(snackbarActions.OPEN_SNACKBAR({
-        message: 'Copied',
-        hideDuration: 2000,
-        kind: SnackbarKind.SUCCESS
-    }));
-    };
+export const CopyToClipboardSnackbar = connect()(
+    withStyles(styles)(
+        class CopyToClipboardSnackbar extends React.Component<CopyToClipboardProps> {
+            onCopy = () => {
+                this.props.dispatch(
+                    snackbarActions.OPEN_SNACKBAR({
+                        message: 'Copied',
+                        hideDuration: 2000,
+                        kind: SnackbarKind.SUCCESS,
+                    })
+                );
+            };
 
-    render() {
-      const { children, value, classes } = this.props;
-      return (
-        <Tooltip title="Copy to clipboard">
-          <span className={classes.copyIcon}>
-            <CopyToClipboard text={value} onCopy={this.onCopy}>
-              {children || <CopyIcon />}
-            </CopyToClipboard>
-          </span>
-        </Tooltip>
-      );
-    }
-  }
-));
+            render() {
+                const { children, value, classes } = this.props;
+                return (
+                    <Tooltip title='Copy to clipboard'>
+                        <span className={classes.copyIcon}>
+                            <CopyToClipboard text={value} onCopy={this.onCopy}>
+                                {children || <CopyIcon />}
+                            </CopyToClipboard>
+                        </span>
+                    </Tooltip>
+                );
+            }
+        }
+    )
+);
diff --git a/src/components/multiselectToolbar/MultiselectToolbar.tsx b/src/components/multiselectToolbar/MultiselectToolbar.tsx
index 0ef7240b..04174223 100644
--- a/src/components/multiselectToolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselectToolbar/MultiselectToolbar.tsx
@@ -167,24 +167,11 @@ function mapStateToProps(state: RootState) {
 
 function mapDispatchToProps(dispatch: Dispatch) {
     return {
-        // executeMulti: (action: ContextMenuAction, checkedList: TCheckedList, resources: ResourcesState) => {
-        //     selectedToArray(checkedList).forEach((uuid) => {
-        //         const resource = getResource(uuid)(resources);
-        //         executeSpecific(dispatch, action.name, resource);
-        //     });
-        // },
         executeMulti: (selectedAction: ContextMenuAction, checkedList: TCheckedList, resources: ResourcesState) => {
-            // selectedToArray(checkedList).forEach((uuid) => {
-            //     const resource = getResource(uuid)(resources);
-            //     executeSpecific(dispatch, action.name, resource);
-            // });
             const kindGroups = groupByKind(checkedList, resources);
-            // console.log(kindGroups);
             for (const kind in kindGroups) {
                 const actionSet = kindToActionSet[kind];
                 const action = findActionByName(selectedAction.name as string, actionSet);
-                console.log(action?.execute);
-                console.log(kindGroups[kind]);
 
                 if (action) action.execute(dispatch, kindGroups[kind]);
                 // if (action && action.name === 'ToggleTrashAction') action.execute(dispatch, kindGroups[kind]);
@@ -193,20 +180,7 @@ function mapDispatchToProps(dispatch: Dispatch) {
     };
 }
 
-// function executeSpecific(dispatch: Dispatch, actionName, resource) {
-//     const actionSet = kindToActionSet[resource.kind];
-//     const action = findActionByName(actionName, actionSet);
-//     if (action) action.execute(dispatch, resource);
-// }
-
-function executeSpecific(dispatch: Dispatch, actionName, resource) {
-    const actionSet = kindToActionSet[resource.kind];
-    const action = findActionByName(actionName, actionSet);
-    if (action) action.execute(dispatch, resource);
-}
-
 function groupByKind(checkedList: TCheckedList, resources: ResourcesState): Record<string, ContextMenuResource[]> {
-    // function groupByKind(checkedList: TCheckedList, resources: ResourcesState): Record<string, Array<Resource | undefined>> {
     const result = {};
     selectedToArray(checkedList).forEach((uuid) => {
         const resource = getResource(uuid)(resources) as Resource;
diff --git a/src/store/open-in-new-tab/open-in-new-tab.actions.ts b/src/store/open-in-new-tab/open-in-new-tab.actions.ts
index 6b9db6a5..f9b1ef55 100644
--- a/src/store/open-in-new-tab/open-in-new-tab.actions.ts
+++ b/src/store/open-in-new-tab/open-in-new-tab.actions.ts
@@ -17,13 +17,18 @@ export const openInNewTabAction = (resource: any) => (dispatch: Dispatch, getSta
     }
 };
 
-export const copyToClipboardAction = (resource: any) => (dispatch: Dispatch, getState: () => RootState) => {
+export const copyToClipboardAction = (resources: Array<any>) => (dispatch: Dispatch, getState: () => RootState) => {
     // Copy to clipboard omits token to avoid accidental sharing
-    const url = getNavUrl(resource.uuid, getState().auth, false);
 
-    if (url[0] === '/') {
-        copy(`${window.location.origin}${url}`);
-    } else if (url.length) {
-        copy(url);
+    let output = '';
+
+    resources.forEach((resource) => {
+        let url = getNavUrl(resource.uuid, getState().auth, false);
+        if (url[0] === '/') url = `${window.location.origin}${url}`;
+        output += output.length ? `, ${url}` : url;
+    });
+
+    if (output.length) {
+        copy(output);
     }
 };
diff --git a/src/views-components/context-menu/action-sets/project-action-set.ts b/src/views-components/context-menu/action-sets/project-action-set.ts
index 8181045c..d778f6b9 100644
--- a/src/views-components/context-menu/action-sets/project-action-set.ts
+++ b/src/views-components/context-menu/action-sets/project-action-set.ts
@@ -2,24 +2,24 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { ContextMenuActionSet } from "../context-menu-action-set";
+import { ContextMenuActionSet } from '../context-menu-action-set';
 import { NewProjectIcon, RenameIcon, MoveToIcon, DetailsIcon, AdvancedIcon, OpenIcon, Link, FolderSharedIcon } from 'components/icon/icon';
-import { ToggleFavoriteAction } from "../actions/favorite-action";
-import { toggleFavorite } from "store/favorites/favorites-actions";
-import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action";
+import { ToggleFavoriteAction } from '../actions/favorite-action';
+import { toggleFavorite } from 'store/favorites/favorites-actions';
+import { favoritePanelActions } from 'store/favorite-panel/favorite-panel-action';
 import { openMoveProjectDialog } from 'store/projects/project-move-actions';
 import { openProjectCreateDialog } from 'store/projects/project-create-actions';
 import { openProjectUpdateDialog } from 'store/projects/project-update-actions';
-import { ToggleTrashAction } from "views-components/context-menu/actions/trash-action";
-import { toggleProjectTrashed } from "store/trash/trash-actions";
+import { ToggleTrashAction } from 'views-components/context-menu/actions/trash-action';
+import { toggleProjectTrashed } from 'store/trash/trash-actions';
 import { ShareIcon } from 'components/icon/icon';
-import { openSharingDialog } from "store/sharing-dialog/sharing-dialog-actions";
-import { openAdvancedTabDialog } from "store/advanced-tab/advanced-tab";
+import { openSharingDialog } from 'store/sharing-dialog/sharing-dialog-actions';
+import { openAdvancedTabDialog } from 'store/advanced-tab/advanced-tab';
 import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
-import { copyToClipboardAction, openInNewTabAction } from "store/open-in-new-tab/open-in-new-tab.actions";
-import { openWebDavS3InfoDialog } from "store/collections/collection-info-actions";
-import { ToggleLockAction } from "../actions/lock-action";
-import { freezeProject, unfreezeProject } from "store/projects/project-lock-actions";
+import { copyToClipboardAction, openInNewTabAction } from 'store/open-in-new-tab/open-in-new-tab.actions';
+import { openWebDavS3InfoDialog } from 'store/collections/collection-info-actions';
+import { ToggleLockAction } from '../actions/lock-action';
+import { freezeProject, unfreezeProject } from 'store/projects/project-lock-actions';
 
 export const toggleFavoriteAction = {
     component: ToggleFavoriteAction,
@@ -28,80 +28,80 @@ export const toggleFavoriteAction = {
         dispatch(toggleFavorite(resource)).then(() => {
             dispatch(favoritePanelActions.REQUEST_ITEMS());
         });
-    }
+    },
 };
 
 export const openInNewTabMenuAction = {
     icon: OpenIcon,
-    name: "Open in new tab",
+    name: 'Open in new tab',
     execute: (dispatch, resource) => {
         dispatch(openInNewTabAction(resource));
-    }
+    },
 };
 
 export const copyToClipboardMenuAction = {
     icon: Link,
-    name: "Copy to clipboard",
-    execute: (dispatch, resource) => {
-        dispatch(copyToClipboardAction(resource));
-    }
+    name: 'Copy to clipboard',
+    execute: (dispatch, resources) => {
+        dispatch(copyToClipboardAction(resources));
+    },
 };
 
 export const viewDetailsAction = {
     icon: DetailsIcon,
-    name: "View details",
-    execute: dispatch => {
+    name: 'View details',
+    execute: (dispatch) => {
         dispatch(toggleDetailsPanel());
-    }
-}
+    },
+};
 
 export const advancedAction = {
     icon: AdvancedIcon,
-    name: "API Details",
+    name: 'API Details',
     execute: (dispatch, resource) => {
         dispatch(openAdvancedTabDialog(resource.uuid));
-    }
-}
+    },
+};
 
 export const openWith3rdPartyClientAction = {
     icon: FolderSharedIcon,
-    name: "Open with 3rd party client",
+    name: 'Open with 3rd party client',
     execute: (dispatch, resource) => {
         dispatch(openWebDavS3InfoDialog(resource.uuid));
-    }
-}
+    },
+};
 
 export const editProjectAction = {
     icon: RenameIcon,
-    name: "Edit project",
+    name: 'Edit project',
     execute: (dispatch, resource) => {
         dispatch(openProjectUpdateDialog(resource));
-    }
-}
+    },
+};
 
 export const shareAction = {
     icon: ShareIcon,
-    name: "Share",
+    name: 'Share',
     execute: (dispatch, { uuid }) => {
         dispatch(openSharingDialog(uuid));
-    }
-}
+    },
+};
 
 export const moveToAction = {
     icon: MoveToIcon,
-    name: "Move to",
+    name: 'Move to',
     execute: (dispatch, resource) => {
         dispatch(openMoveProjectDialog(resource));
-    }
-}
+    },
+};
 
 export const toggleTrashAction = {
     component: ToggleTrashAction,
     name: 'ToggleTrashAction',
     execute: (dispatch, resource) => {
         dispatch(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.isTrashed!!));
-    }
-}
+    },
+};
 
 export const freezeProjectAction = {
     component: ToggleLockAction,
@@ -112,61 +112,62 @@ export const freezeProjectAction = {
         } else {
             dispatch(freezeProject(resource.uuid));
         }
-    }
-}
+    },
+};
 
 export const newProjectAction: any = {
     icon: NewProjectIcon,
-    name: "New project",
+    name: 'New project',
     execute: (dispatch, resource): void => {
         dispatch(openProjectCreateDialog(resource.uuid));
-    }
-}
-
-export const readOnlyProjectActionSet: ContextMenuActionSet = [[
-    toggleFavoriteAction,
-    openInNewTabMenuAction,
-    copyToClipboardMenuAction,
-    viewDetailsAction,
-    advancedAction,
-    openWith3rdPartyClientAction,
-]];
-
-export const filterGroupActionSet: ContextMenuActionSet = [[
-    toggleFavoriteAction,
-    openInNewTabMenuAction,
-    copyToClipboardMenuAction,
-    viewDetailsAction,
-    advancedAction,
-    openWith3rdPartyClientAction,
-    editProjectAction,
-    shareAction,
-    moveToAction,
-    toggleTrashAction,
-]];
-
-export const frozenActionSet: ContextMenuActionSet = [[
-    shareAction,
-    toggleFavoriteAction,
-    openInNewTabMenuAction,
-    copyToClipboardMenuAction,
-    viewDetailsAction,
-    advancedAction,
-    openWith3rdPartyClientAction,
-    freezeProjectAction
-]];
-
-export const projectActionSet: ContextMenuActionSet = [[
-    toggleFavoriteAction,
-    openInNewTabMenuAction,
-    copyToClipboardMenuAction,
-    viewDetailsAction,
-    advancedAction,
-    openWith3rdPartyClientAction,
-    editProjectAction,
-    shareAction,
-    moveToAction,
-    toggleTrashAction,
-    newProjectAction,
-    freezeProjectAction,
-]];
+    },
+};
+
+export const readOnlyProjectActionSet: ContextMenuActionSet = [
+    [toggleFavoriteAction, openInNewTabMenuAction, copyToClipboardMenuAction, viewDetailsAction, advancedAction, openWith3rdPartyClientAction],
+];
+
+export const filterGroupActionSet: ContextMenuActionSet = [
+    [
+        toggleFavoriteAction,
+        openInNewTabMenuAction,
+        copyToClipboardMenuAction,
+        viewDetailsAction,
+        advancedAction,
+        openWith3rdPartyClientAction,
+        editProjectAction,
+        shareAction,
+        moveToAction,
+        toggleTrashAction,
+    ],
+];
+
+export const frozenActionSet: ContextMenuActionSet = [
+    [
+        shareAction,
+        toggleFavoriteAction,
+        openInNewTabMenuAction,
+        copyToClipboardMenuAction,
+        viewDetailsAction,
+        advancedAction,
+        openWith3rdPartyClientAction,
+        freezeProjectAction,
+    ],
+];
+
+export const projectActionSet: ContextMenuActionSet = [
+    [
+        toggleFavoriteAction,
+        openInNewTabMenuAction,
+        copyToClipboardMenuAction,
+        viewDetailsAction,
+        advancedAction,
+        openWith3rdPartyClientAction,
+        editProjectAction,
+        shareAction,
+        moveToAction,
+        toggleTrashAction,
+        newProjectAction,
+        freezeProjectAction,
+    ],
+];
diff --git a/src/views-components/context-menu/action-sets/search-results-action-set.ts b/src/views-components/context-menu/action-sets/search-results-action-set.ts
index 943be4c7..4921cfc3 100644
--- a/src/views-components/context-menu/action-sets/search-results-action-set.ts
+++ b/src/views-components/context-menu/action-sets/search-results-action-set.ts
@@ -21,7 +21,7 @@ export const searchResultsActionSet: ContextMenuActionSet = [
             icon: Link,
             name: 'Copy to clipboard',
             execute: (dispatch, resources) => {
-                resources.forEach((resource) => dispatch<any>(copyToClipboardAction(resource)));
+                dispatch<any>(copyToClipboardAction(resources));
             },
         },
         {
diff --git a/src/views-components/context-menu/action-sets/workflow-action-set.ts b/src/views-components/context-menu/action-sets/workflow-action-set.ts
index 7902e1c0..cfcb2c24 100644
--- a/src/views-components/context-menu/action-sets/workflow-action-set.ts
+++ b/src/views-components/context-menu/action-sets/workflow-action-set.ts
@@ -22,7 +22,7 @@ export const workflowActionSet: ContextMenuActionSet = [
             icon: Link,
             name: 'Copy to clipboard',
             execute: (dispatch, resources) => {
-                resources.forEach((resource) => dispatch<any>(copyToClipboardAction(resource)));
+                dispatch<any>(copyToClipboardAction(resources));
             },
         },
         {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list