21128: full set of project actions in place Arvados-DCO-1.1-Signed-off-by: Lisa Knox...
authorLisa Knox <lisaknox83@gmail.com>
Thu, 16 Nov 2023 17:08:58 +0000 (12:08 -0500)
committerLisa Knox <lisaknox83@gmail.com>
Thu, 16 Nov 2023 17:08:58 +0000 (12:08 -0500)
src/components/icon/icon.tsx
src/components/multiselect-toolbar/ms-toolbar-action-filters.ts
src/views-components/multiselect-toolbar/ms-menu-action-set.ts
src/views-components/multiselect-toolbar/ms-project-action-set.ts

index 5f3f4e659b5f3491cbe4f76c7b3154d826fa38cd..4168e2a2f44e4921c6f066dcf2e1ec5c9fe0c25f 100644 (file)
@@ -84,13 +84,13 @@ import { faPencilAlt, faSlash, faUsers, faEllipsisH } from "@fortawesome/free-so
 import { FormatAlignLeft } from "@material-ui/icons";
 library.add(faPencilAlt, faSlash, faUsers, faEllipsisH);
 
-export const FreezeIcon = (props: any) => (
+export const FreezeIcon: IconType = (props: any) => (
     <SvgIcon {...props}>
         <path d="M20.79,13.95L18.46,14.57L16.46,13.44V10.56L18.46,9.43L20.79,10.05L21.31,8.12L19.54,7.65L20,5.88L18.07,5.36L17.45,7.69L15.45,8.82L13,7.38V5.12L14.71,3.41L13.29,2L12,3.29L10.71,2L9.29,3.41L11,5.12V7.38L8.5,8.82L6.5,7.69L5.92,5.36L4,5.88L4.47,7.65L2.7,8.12L3.22,10.05L5.55,9.43L7.55,10.56V13.45L5.55,14.58L3.22,13.96L2.7,15.89L4.47,16.36L4,18.12L5.93,18.64L6.55,16.31L8.55,15.18L11,16.62V18.88L9.29,20.59L10.71,22L12,20.71L13.29,22L14.7,20.59L13,18.88V16.62L15.5,15.17L17.5,16.3L18.12,18.63L20,18.12L19.53,16.35L21.3,15.88L20.79,13.95M9.5,10.56L12,9.11L14.5,10.56V13.44L12,14.89L9.5,13.44V10.56Z" />
     </SvgIcon>
 );
 
-export const UnfreezeIcon = (props: any) => (
+export const UnfreezeIcon: IconType = (props: any) => (
     <SvgIcon {...props}>
         <path d="M11 5.12L9.29 3.41L10.71 2L12 3.29L13.29 2L14.71 3.41L13 5.12V7.38L15.45 8.82L17.45 7.69L18.07 5.36L20 5.88L19.54 7.65L21.31 8.12L20.79 10.05L18.46 9.43L16.46 10.56V13.26L14.5 11.3V10.56L12.74 9.54L10.73 7.53L11 7.38V5.12M18.46 14.57L16.87 13.67L19.55 16.35L21.3 15.88L20.79 13.95L18.46 14.57M13 16.62V18.88L14.7 20.59L13.29 22L12 20.71L10.71 22L9.29 20.59L11 18.88V16.62L8.55 15.18L6.55 16.31L5.93 18.64L4 18.12L4.47 16.36L2.7 15.89L3.22 13.96L5.55 14.58L7.55 13.45V10.56L5.55 9.43L3.22 10.05L2.7 8.12L4.47 7.65L4 5.89L1.11 3L2.39 1.73L22.11 21.46L20.84 22.73L14.1 16L13 16.62M12 14.89L12.63 14.5L9.5 11.39V13.44L12 14.89Z" />
     </SvgIcon>
index 8d8b6f0f7ef83ff2087d6d69669a78e0b464d650..12910e4377ccfcc8241163253fd8158a23a45f64 100644 (file)
@@ -2,20 +2,52 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { ResourceKind } from "models/resource";
-import { MultiSelectMenuActionSet, MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-action-set";
-import { msCollectionActionSet } from "views-components/multiselect-toolbar/ms-collection-action-set";
-import { msProjectActionSet } from "views-components/multiselect-toolbar/ms-project-action-set";
-import { msProcessActionSet } from "views-components/multiselect-toolbar/ms-process-action-set";
+import { ResourceKind } from 'models/resource';
+import { MultiSelectMenuActionSet, MultiSelectMenuActionNames } from 'views-components/multiselect-toolbar/ms-menu-action-set';
+import { msCollectionActionSet } from 'views-components/multiselect-toolbar/ms-collection-action-set';
+import { msProjectActionSet } from 'views-components/multiselect-toolbar/ms-project-action-set';
+import { msProcessActionSet } from 'views-components/multiselect-toolbar/ms-process-action-set';
 
 export type TMultiselectActionsFilters = Record<string, [MultiSelectMenuActionSet, Set<string>]>;
 
-const { MOVE_TO, ADD_TO_TRASH: TOGGLE_TRASH_ACTION, ADD_TO_FAVORITES: TOGGLE_FAVORITE_ACTION, REMOVE, MAKE_A_COPY } = MultiSelectMenuActionNames;
+const {
+    ADD_TO_FAVORITES,
+    ADD_TO_TRASH,
+    API_DETAILS,
+    COPY_AND_RERUN_PROCESS,
+    COPY_TO_CLIPBOARD,
+    EDIT_PPROJECT,
+    FREEZE_PROJECT,
+    MAKE_A_COPY,
+    MOVE_TO,
+    NEW_PROJECT,
+    OPEN_IN_NEW_TAB,
+    OPEN_W_3RD_PARTY_CLIENT,
+    REMOVE,
+    SHARE,
+    VIEW_DETAILS,
+} = MultiSelectMenuActionNames;
 
 //these sets govern what actions are on the ms toolbar for each resource kind
-const projectMSActionsFilter = new Set([MOVE_TO, TOGGLE_TRASH_ACTION, TOGGLE_FAVORITE_ACTION]);
+const projectMSActionsFilter = new Set([
+    ADD_TO_FAVORITES,
+    ADD_TO_TRASH,
+    API_DETAILS,
+    COPY_AND_RERUN_PROCESS,
+    COPY_TO_CLIPBOARD,
+    EDIT_PPROJECT,
+    FREEZE_PROJECT,
+    MAKE_A_COPY,
+    MOVE_TO,
+    NEW_PROJECT,
+    OPEN_IN_NEW_TAB,
+    OPEN_W_3RD_PARTY_CLIENT,
+    REMOVE,
+    SHARE,
+    VIEW_DETAILS,
+]);
 const processResourceMSActionsFilter = new Set([MOVE_TO, REMOVE]);
-const collectionMSActionsFilter = new Set([MAKE_A_COPY, MOVE_TO, TOGGLE_TRASH_ACTION]);
+const collectionMSActionsFilter = new Set([MAKE_A_COPY, MOVE_TO, ADD_TO_TRASH]);
 
 const { COLLECTION, PROJECT, PROCESS } = ResourceKind;
 
index 38c5748f9873252b0e504aa20c78e255f0268399..fa4f9283f259bcaded0e2257be98d642c4322e44 100644 (file)
@@ -9,13 +9,21 @@ import { FavoritesState } from "store/favorites/favorites-reducer";
 import { ContextMenuResource } from "store/context-menu/context-menu-actions";
 
 export const MultiSelectMenuActionNames = {
-  MAKE_A_COPY: "Make a copy",
-  MOVE_TO: "Move to",
-  ADD_TO_TRASH: "Add to Trash",
   ADD_TO_FAVORITES: "Add to Favorites",
-  COPY_TO_CLIPBOARD: "Copy to clipboard",
+  ADD_TO_TRASH: "Add to Trash",
+  API_DETAILS: 'API Details',
   COPY_AND_RERUN_PROCESS: "Copy and re-run process",
+  COPY_TO_CLIPBOARD: "Copy to clipboard",
+  EDIT_PPROJECT: 'Edit project',
+  FREEZE_PROJECT: 'Freeze Project',
+  MAKE_A_COPY: "Make a copy",
+  MOVE_TO: "Move to",
+  NEW_PROJECT: 'New project',
+  OPEN_IN_NEW_TAB: 'Open in new tab',
+  OPEN_W_3RD_PARTY_CLIENT: 'Open with 3rd party client',
   REMOVE: "Remove",
+  SHARE: 'Share',
+  VIEW_DETAILS: 'View details',
 };
 
 export type MultiSelectMenuAction = {
index ff28f0ad97d2448c141326bcc6c9b82dac765e04..dc620a19f0a9986fa4e01940664293d975c5c768 100644 (file)
@@ -2,17 +2,37 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { MultiSelectMenuAction, MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-action-set";
-import { MoveToIcon, Link } from "components/icon/icon";
-import { openMoveProjectDialog } from "store/projects/project-move-actions";
-import { toggleProjectTrashed } from "store/trash/trash-actions";
-import { copyToClipboardAction } from "store/open-in-new-tab/open-in-new-tab.actions";
-import { toggleFavorite } from "store/favorites/favorites-actions";
-import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action";
-import { AddFavoriteIcon, RemoveFavoriteIcon } from "components/icon/icon";
-import { RestoreFromTrashIcon, TrashIcon } from "components/icon/icon";
-import { getResource } from "store/resources/resources";
-import { checkFavorite } from "store/favorites/favorites-reducer";
+import { MultiSelectMenuAction, MultiSelectMenuActionNames } from 'views-components/multiselect-toolbar/ms-menu-action-set';
+import { openMoveProjectDialog } from 'store/projects/project-move-actions';
+import { toggleProjectTrashed } from 'store/trash/trash-actions';
+import { copyToClipboardAction, openInNewTabAction } from 'store/open-in-new-tab/open-in-new-tab.actions';
+import { toggleFavorite } from 'store/favorites/favorites-actions';
+import { favoritePanelActions } from 'store/favorite-panel/favorite-panel-action';
+import {
+    AddFavoriteIcon,
+    AdvancedIcon,
+    DetailsIcon,
+    FreezeIcon,
+    FolderSharedIcon,
+    Link,
+    MoveToIcon,
+    NewProjectIcon,
+    OpenIcon,
+    RemoveFavoriteIcon,
+    RenameIcon,
+    ShareIcon,
+    UnfreezeIcon,
+} from 'components/icon/icon';
+import { RestoreFromTrashIcon, TrashIcon } from 'components/icon/icon';
+import { getResource } from 'store/resources/resources';
+import { checkFavorite } from 'store/favorites/favorites-reducer';
+import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
+import { openAdvancedTabDialog } from 'store/advanced-tab/advanced-tab';
+import { openWebDavS3InfoDialog } from 'store/collections/collection-info-actions';
+import { openSharingDialog } from 'store/sharing-dialog/sharing-dialog-actions';
+import { openProjectCreateDialog } from 'store/projects/project-create-actions';
+import { openProjectUpdateDialog } from 'store/projects/project-update-actions';
+import { freezeProject, unfreezeProject } from 'store/projects/project-lock-actions';
 
 export const msToggleFavoriteAction = {
     name: MultiSelectMenuActionNames.ADD_TO_FAVORITES,
@@ -21,7 +41,7 @@ export const msToggleFavoriteAction = {
     altName: 'Remove from Favorites',
     altIcon: RemoveFavoriteIcon,
     isForMulti: false,
-    useAlts: (uuid, resources, favorites)=>{
+    useAlts: (uuid, resources, favorites) => {
         return checkFavorite(uuid, favorites);
     },
     execute: (dispatch, resources) => {
@@ -31,6 +51,16 @@ export const msToggleFavoriteAction = {
     },
 };
 
+export const msOpenInNewTabMenuAction = {
+    name: MultiSelectMenuActionNames.OPEN_IN_NEW_TAB,
+    icon: OpenIcon,
+    hasAlts: false,
+    isForMulti: false,
+    execute: (dispatch, resources) => {
+        dispatch(openInNewTabAction(resources[0]));
+    },
+};
+
 export const msCopyToClipboardMenuAction = {
     name: MultiSelectMenuActionNames.COPY_TO_CLIPBOARD,
     icon: Link,
@@ -41,6 +71,56 @@ export const msCopyToClipboardMenuAction = {
     },
 };
 
+export const msViewDetailsAction = {
+    name: MultiSelectMenuActionNames.VIEW_DETAILS,
+    icon: DetailsIcon,
+    hasAlts: false,
+    isForMulti: false,
+    execute: (dispatch) => {
+        dispatch(toggleDetailsPanel());
+    },
+};
+
+export const msAdvancedAction = {
+    name: MultiSelectMenuActionNames.API_DETAILS,
+    icon: AdvancedIcon,
+    hasAlts: false,
+    isForMulti: false,
+    execute: (dispatch, resources) => {
+        dispatch(openAdvancedTabDialog(resources[0].uuid));
+    },
+};
+
+export const msOpenWith3rdPartyClientAction = {
+    name: MultiSelectMenuActionNames.OPEN_W_3RD_PARTY_CLIENT,
+    icon: FolderSharedIcon,
+    hasAlts: false,
+    isForMulti: false,
+    execute: (dispatch, resources) => {
+        dispatch(openWebDavS3InfoDialog(resources[0].uuid));
+    },
+};
+
+export const msEditProjectAction = {
+    name: MultiSelectMenuActionNames.EDIT_PPROJECT,
+    icon: RenameIcon,
+    hasAlts: false,
+    isForMulti: false,
+    execute: (dispatch, resources) => {
+        dispatch(openProjectUpdateDialog(resources[0]));
+    },
+};
+
+export const msShareAction = {
+    name: MultiSelectMenuActionNames.SHARE,
+    icon: ShareIcon,
+    hasAlts: false,
+    isForMulti: false,
+    execute: (dispatch, resources) => {
+        dispatch(openSharingDialog(resources[0].uuid));
+    },
+};
+
 export const msMoveToAction = {
     name: MultiSelectMenuActionNames.MOVE_TO,
     icon: MoveToIcon,
@@ -68,4 +148,47 @@ export const msToggleTrashAction = {
     },
 };
 
-export const msProjectActionSet: MultiSelectMenuAction[][] = [[msCopyToClipboardMenuAction, msMoveToAction, msToggleTrashAction, msToggleFavoriteAction]];
+export const msFreezeProjectAction = {
+    name: MultiSelectMenuActionNames.FREEZE_PROJECT,
+    icon: FreezeIcon,
+    hasAlts: true,
+    altName: 'Unfreeze Project',
+    altIcon: UnfreezeIcon,
+    isForMulti: false,
+    useAlts: () => false,
+    execute: (dispatch, resources) => {
+        if (resources[0].isFrozen) {
+            dispatch(unfreezeProject(resources[0].uuid));
+        } else {
+            dispatch(freezeProject(resources[0].uuid));
+        }
+    },
+};
+
+export const msNewProjectAction: any = {
+    name: MultiSelectMenuActionNames.NEW_PROJECT,
+    icon: NewProjectIcon,
+    hasAlts: false,
+    isForMulti: false,
+    execute: (dispatch, resource): void => {
+        dispatch(openProjectCreateDialog(resource.uuid));
+    },
+};
+
+export const msProjectActionSet: MultiSelectMenuAction[][] = [
+    [
+        msCopyToClipboardMenuAction,
+        msToggleFavoriteAction,
+        msOpenInNewTabMenuAction,
+        msCopyToClipboardMenuAction,
+        msViewDetailsAction,
+        msAdvancedAction,
+        msOpenWith3rdPartyClientAction,
+        msEditProjectAction,
+        msShareAction,
+        msMoveToAction,
+        msToggleTrashAction,
+        msFreezeProjectAction,
+        msNewProjectAction,
+    ],
+];