[arvados-workbench2] updated: 2.6.0-15-g5b7e7988

git repository hosting git at public.arvados.org
Mon May 22 13:49:37 UTC 2023


Summary of changes:
 src/index.tsx                                      |  4 +-
 .../collection-panel-files-state.ts                |  2 +-
 src/store/context-menu/context-menu-actions.ts     | 10 +--
 .../action-sets/collection-files-action-set.ts     | 78 +++++++++++++++-------
 src/views-components/context-menu/context-menu.tsx |  4 +-
 .../sharing-dialog/sharing-dialog-component.tsx    |  4 +-
 .../sharing-dialog/sharing-invitation-form.tsx     |  3 -
 .../sharing-public-access-form-component.tsx       |  2 +-
 8 files changed, 70 insertions(+), 37 deletions(-)

       via  5b7e7988f1992e04e676c0c1e3e969ea2ef3b627 (commit)
       via  8b7a3f52ea0b0ee7ae7a744e76b337e90d4da1f6 (commit)
      from  7b8448155a3b9ca4c3c17c4879ed7ca256b4a42a (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 5b7e7988f1992e04e676c0c1e3e969ea2ef3b627
Author: Stephen Smith <stephen at curii.com>
Date:   Mon May 22 09:45:31 2023 -0400

    20031: Add multiple/single collection files context menu to selectively show actions for multiple selected files
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/src/index.tsx b/src/index.tsx
index 244d1387..9293dd74 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -25,7 +25,7 @@ import { rootProjectActionSet } from "views-components/context-menu/action-sets/
 import { filterGroupActionSet, frozenActionSet, projectActionSet, readOnlyProjectActionSet } from "views-components/context-menu/action-sets/project-action-set";
 import { resourceActionSet } from 'views-components/context-menu/action-sets/resource-action-set';
 import { favoriteActionSet } from "views-components/context-menu/action-sets/favorite-action-set";
-import { collectionFilesActionSet, readOnlyCollectionFilesActionSet } from 'views-components/context-menu/action-sets/collection-files-action-set';
+import { collectionFilesActionSet, collectionFilesMultipleActionSet, readOnlyCollectionFilesActionSet, readOnlyCollectionFilesMultipleActionSet } from 'views-components/context-menu/action-sets/collection-files-action-set';
 import { collectionDirectoryItemActionSet, collectionFileItemActionSet, readOnlyCollectionDirectoryItemActionSet, readOnlyCollectionFileItemActionSet } from 'views-components/context-menu/action-sets/collection-files-item-action-set';
 import { collectionFilesNotSelectedActionSet } from 'views-components/context-menu/action-sets/collection-files-not-selected-action-set';
 import { collectionActionSet, collectionAdminActionSet, oldCollectionVersionActionSet, readOnlyCollectionActionSet } from 'views-components/context-menu/action-sets/collection-action-set';
@@ -77,7 +77,9 @@ addMenuActionSet(ContextMenuKind.FILTER_GROUP, filterGroupActionSet);
 addMenuActionSet(ContextMenuKind.RESOURCE, resourceActionSet);
 addMenuActionSet(ContextMenuKind.FAVORITE, favoriteActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES, collectionFilesActionSet);
+addMenuActionSet(ContextMenuKind.COLLECTION_FILES_MULTIPLE, collectionFilesMultipleActionSet);
 addMenuActionSet(ContextMenuKind.READONLY_COLLECTION_FILES, readOnlyCollectionFilesActionSet);
+addMenuActionSet(ContextMenuKind.READONLY_COLLECTION_FILES_MULTIPLE, readOnlyCollectionFilesMultipleActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES_NOT_SELECTED, collectionFilesNotSelectedActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_DIRECTORY_ITEM, collectionDirectoryItemActionSet);
 addMenuActionSet(ContextMenuKind.READONLY_COLLECTION_DIRECTORY_ITEM, readOnlyCollectionDirectoryItemActionSet);
diff --git a/src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts
index 405e7eac..d987c84a 100644
--- a/src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts
+++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts
@@ -36,7 +36,7 @@ export const mergeCollectionPanelFilesStates = (oldState: CollectionPanelFilesSt
     })(newState);
 };
 
-export const filterCollectionFilesBySelection = (tree: CollectionPanelFilesState, selected: boolean) => {
+export const filterCollectionFilesBySelection = (tree: CollectionPanelFilesState, selected: boolean): (CollectionPanelFile | CollectionPanelDirectory)[] => {
     const allFiles = getNodeDescendants('')(tree).map(node => node.value);
     const selectedDirectories = allFiles.filter(file => file.selected === selected && file.type === CollectionFileType.DIRECTORY);
     const selectedFiles = allFiles.filter(file => file.selected === selected && !selectedDirectories.some(dir => dir.id === file.path));
diff --git a/src/store/context-menu/context-menu-actions.ts b/src/store/context-menu/context-menu-actions.ts
index 3bc91ae0..e659de8a 100644
--- a/src/store/context-menu/context-menu-actions.ts
+++ b/src/store/context-menu/context-menu-actions.ts
@@ -23,6 +23,7 @@ import { GroupContentsResource } from 'services/groups-service/groups-service';
 import { LinkResource } from 'models/link';
 import { resourceIsFrozen } from 'common/frozen-resources';
 import { ProjectResource } from 'models/project';
+import { filterCollectionFilesBySelection } from 'store/collection-panel/collection-panel-files/collection-panel-files-state';
 
 export const contextMenuActions = unionize({
     OPEN_CONTEXT_MENU: ofType<{ position: ContextMenuPosition, resource: ContextMenuResource }>(),
@@ -67,17 +68,18 @@ export const openContextMenu = (event: React.MouseEvent<HTMLElement>, resource:
 
 export const openCollectionFilesContextMenu = (event: React.MouseEvent<HTMLElement>, isWritable: boolean) =>
     (dispatch: Dispatch, getState: () => RootState) => {
-        const isCollectionFileSelected = JSON.stringify(getState().collectionPanelFiles).includes('"selected":true');
+        const selectedCount = filterCollectionFilesBySelection(getState().collectionPanelFiles, true).length;
+        const multiple = selectedCount > 1;
         dispatch<any>(openContextMenu(event, {
             name: '',
             uuid: '',
             ownerUuid: '',
             description: '',
             kind: ResourceKind.COLLECTION,
-            menuKind: isCollectionFileSelected
+            menuKind: selectedCount > 0
                 ? isWritable
-                    ? ContextMenuKind.COLLECTION_FILES
-                    : ContextMenuKind.READONLY_COLLECTION_FILES
+                    ? multiple ? ContextMenuKind.COLLECTION_FILES_MULTIPLE : ContextMenuKind.COLLECTION_FILES
+                    : multiple ? ContextMenuKind.READONLY_COLLECTION_FILES_MULTIPLE : ContextMenuKind.READONLY_COLLECTION_FILES
                 : ContextMenuKind.COLLECTION_FILES_NOT_SELECTED
         }));
     };
diff --git a/src/views-components/context-menu/action-sets/collection-files-action-set.ts b/src/views-components/context-menu/action-sets/collection-files-action-set.ts
index c1c541d3..06f7789e 100644
--- a/src/views-components/context-menu/action-sets/collection-files-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-files-action-set.ts
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set";
+import { ContextMenuAction, ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set";
 import { collectionPanelFilesAction, openMultipleFilesRemoveDialog } from "store/collection-panel/collection-panel-files/collection-panel-files-actions";
 import {
     openCollectionPartialCopyToNewCollectionDialog,
@@ -11,20 +11,7 @@ import {
 } from 'store/collections/collection-partial-copy-actions';
 import { openCollectionPartialMoveToExistingCollectionDialog, openCollectionPartialMoveToNewCollectionDialog, openCollectionPartialMoveToSeparateCollectionsDialog } from "store/collections/collection-partial-move-actions";
 
-// These action sets are used on the multi-select actions button.
-export const readOnlyCollectionFilesActionSet: ContextMenuActionSet = [[
-    {
-        name: "Select all",
-        execute: dispatch => {
-            dispatch(collectionPanelFilesAction.SELECT_ALL_COLLECTION_FILES());
-        }
-    },
-    {
-        name: "Unselect all",
-        execute: dispatch => {
-            dispatch(collectionPanelFilesAction.UNSELECT_ALL_COLLECTION_FILES());
-        }
-    },
+const copyActions: ContextMenuAction[] = [
     {
         name: "Copy selected into new collection",
         execute: dispatch => {
@@ -37,21 +24,19 @@ export const readOnlyCollectionFilesActionSet: ContextMenuActionSet = [[
             dispatch<any>(openCollectionPartialCopyToExistingCollectionDialog());
         }
     },
+];
+
+const copyActionsMultiple: ContextMenuAction[] = [
+    ...copyActions,
     {
         name: "Copy selected into separate collections",
         execute: dispatch => {
             dispatch<any>(openCollectionPartialCopyToSeparateCollectionsDialog());
         }
     }
-]];
+];
 
-export const collectionFilesActionSet: ContextMenuActionSet = readOnlyCollectionFilesActionSet.concat([[
-    {
-        name: "Remove selected",
-        execute: dispatch => {
-            dispatch(openMultipleFilesRemoveDialog());
-        }
-    },
+const moveActions: ContextMenuAction[] = [
     {
         name: "Move selected into new collection",
         execute: dispatch => {
@@ -64,10 +49,57 @@ export const collectionFilesActionSet: ContextMenuActionSet = readOnlyCollection
             dispatch<any>(openCollectionPartialMoveToExistingCollectionDialog());
         }
     },
+];
+
+const moveActionsMultiple: ContextMenuAction[] = [
+    ...moveActions,
     {
         name: "Move selected into separate collections",
         execute: dispatch => {
             dispatch<any>(openCollectionPartialMoveToSeparateCollectionsDialog());
         }
     }
+];
+
+const selectActions: ContextMenuAction[] = [
+    {
+        name: "Select all",
+        execute: dispatch => {
+            dispatch(collectionPanelFilesAction.SELECT_ALL_COLLECTION_FILES());
+        }
+    },
+    {
+        name: "Unselect all",
+        execute: dispatch => {
+            dispatch(collectionPanelFilesAction.UNSELECT_ALL_COLLECTION_FILES());
+        }
+    },
+];
+
+const removeAction: ContextMenuAction = {
+    name: "Remove selected",
+    execute: dispatch => {
+        dispatch(openMultipleFilesRemoveDialog());
+    }
+};
+
+// These action sets are used on the multi-select actions button.
+export const readOnlyCollectionFilesActionSet: ContextMenuActionSet = [
+    selectActions,
+    copyActions,
+];
+
+export const readOnlyCollectionFilesMultipleActionSet: ContextMenuActionSet = [
+    selectActions,
+    copyActionsMultiple,
+];
+
+export const collectionFilesActionSet: ContextMenuActionSet = readOnlyCollectionFilesActionSet.concat([[
+    removeAction,
+    ...moveActions
+]]);
+
+export const collectionFilesMultipleActionSet: ContextMenuActionSet = readOnlyCollectionFilesMultipleActionSet.concat([[
+    removeAction,
+    ...moveActionsMultiple
 ]]);
diff --git a/src/views-components/context-menu/context-menu.tsx b/src/views-components/context-menu/context-menu.tsx
index c659b7c5..81c1a51e 100644
--- a/src/views-components/context-menu/context-menu.tsx
+++ b/src/views-components/context-menu/context-menu.tsx
@@ -87,12 +87,14 @@ export enum ContextMenuKind {
     FAVORITE = "Favorite",
     TRASH = "Trash",
     COLLECTION_FILES = "CollectionFiles",
+    COLLECTION_FILES_MULTIPLE = "CollectionFilesMultiple",
     READONLY_COLLECTION_FILES = "ReadOnlyCollectionFiles",
+    READONLY_COLLECTION_FILES_MULTIPLE = "ReadOnlyCollectionFilesMultiple",
+    COLLECTION_FILES_NOT_SELECTED = "CollectionFilesNotSelected",
     COLLECTION_FILE_ITEM = "CollectionFileItem",
     COLLECTION_DIRECTORY_ITEM = "CollectionDirectoryItem",
     READONLY_COLLECTION_FILE_ITEM = "ReadOnlyCollectionFileItem",
     READONLY_COLLECTION_DIRECTORY_ITEM = "ReadOnlyCollectionDirectoryItem",
-    COLLECTION_FILES_NOT_SELECTED = "CollectionFilesNotSelected",
     COLLECTION = 'Collection',
     COLLECTION_ADMIN = 'CollectionAdmin',
     READONLY_COLLECTION = 'ReadOnlyCollection',

commit 8b7a3f52ea0b0ee7ae7a744e76b337e90d4da1f6
Author: Stephen Smith <stephen at curii.com>
Date:   Thu May 18 10:57:53 2023 -0400

    20031: Remove unused imports
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/src/views-components/sharing-dialog/sharing-dialog-component.tsx b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
index df232724..f83cec60 100644
--- a/src/views-components/sharing-dialog/sharing-dialog-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
@@ -16,7 +16,6 @@ import {
     Checkbox,
     FormControlLabel,
     Typography,
-    Tooltip,
 } from '@material-ui/core';
 import {
     StyleRulesCallback,
@@ -40,7 +39,6 @@ import {
 import DateFnsUtils from "@date-io/date-fns";
 import moment from 'moment';
 import { SharingPublicAccessForm } from './sharing-public-access-form';
-import { AddIcon } from 'components/icon/icon';
 
 export interface SharingDialogDataProps {
     open: boolean;
@@ -66,7 +64,7 @@ export type SharingDialogComponentProps = SharingDialogDataProps & SharingDialog
 
 export default (props: SharingDialogComponentProps) => {
     const { open, loading, saveEnabled, sharedResourceUuid,
-        sharingURLsNr, privateAccess, sharingURLsDisabled, permissions,
+        sharingURLsNr, privateAccess, sharingURLsDisabled,
         onClose, onSave, onCreateSharingToken, refreshPermissions } = props;
     const showTabs = !sharingURLsDisabled && extractUuidObjectType(sharedResourceUuid) === ResourceObjectType.COLLECTION;
     const [tabNr, setTabNr] = React.useState<number>(SharingDialogTab.PERMISSIONS);
diff --git a/src/views-components/sharing-dialog/sharing-invitation-form.tsx b/src/views-components/sharing-dialog/sharing-invitation-form.tsx
index 702add91..33154732 100644
--- a/src/views-components/sharing-dialog/sharing-invitation-form.tsx
+++ b/src/views-components/sharing-dialog/sharing-invitation-form.tsx
@@ -3,12 +3,9 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { reduxForm } from 'redux-form';
-import { connect } from 'react-redux';
-import { compose } from 'redux';
 import SharingInvitationFormComponent from './sharing-invitation-form-component';
 import { SHARING_INVITATION_FORM_NAME } from 'store/sharing-dialog/sharing-dialog-types';
 import { PermissionLevel } from 'models/permission';
-import { WithStyles } from '@material-ui/core/styles';
 
 interface InvitationFormData {
     permissions: PermissionLevel;
diff --git a/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx b/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx
index 03885a43..5fc3f4e3 100644
--- a/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import React from 'react';
-import { Grid, StyleRulesCallback, Divider, Typography } from '@material-ui/core';
+import { Grid, StyleRulesCallback, Typography } from '@material-ui/core';
 import { Field, WrappedFieldProps } from 'redux-form';
 import { WithStyles } from '@material-ui/core/styles';
 import withStyles from '@material-ui/core/styles/withStyles';

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list