From 23a7c88df4d188880a2613c826f1537aa8f132af Mon Sep 17 00:00:00 2001 From: Lisa Knox Date: Fri, 10 Nov 2023 14:17:13 -0500 Subject: [PATCH] 21128: project favorite in place Arvados-DCO-1.1-Signed-off-by: Lisa Knox --- .../ms-toolbar-action-filters.ts | 5 +++-- .../multiselect-toolbar/ms-project-action-set.ts | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts b/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts index 9145a82069..18063da778 100644 --- a/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts +++ b/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts @@ -14,15 +14,16 @@ export const contextMenuActionConsts = { MAKE_A_COPY: "Make a copy", MOVE_TO: "Move to", TOGGLE_TRASH_ACTION: "ToggleTrashAction", + TOGGLE_FAVORITE_ACTION: "ToggleFavoriteAction", COPY_TO_CLIPBOARD: "Copy to clipboard", COPY_AND_RERUN_PROCESS: "Copy and re-run process", REMOVE: "Remove", }; -const { MOVE_TO, TOGGLE_TRASH_ACTION, REMOVE, MAKE_A_COPY } = contextMenuActionConsts; +const { MOVE_TO, TOGGLE_TRASH_ACTION, TOGGLE_FAVORITE_ACTION, REMOVE, MAKE_A_COPY } = contextMenuActionConsts; //these sets govern what actions are on the ms toolbar for each resource kind -const projectMSActionsFilter = new Set([MOVE_TO, TOGGLE_TRASH_ACTION]); +const projectMSActionsFilter = new Set([MOVE_TO, TOGGLE_TRASH_ACTION, TOGGLE_FAVORITE_ACTION]); const processResourceMSActionsFilter = new Set([MOVE_TO, REMOVE]); const collectionMSActionsFilter = new Set([MAKE_A_COPY, MOVE_TO, TOGGLE_TRASH_ACTION]); diff --git a/src/views-components/multiselect-toolbar/ms-project-action-set.ts b/src/views-components/multiselect-toolbar/ms-project-action-set.ts index 2b5dfa22a5..2907686aff 100644 --- a/src/views-components/multiselect-toolbar/ms-project-action-set.ts +++ b/src/views-components/multiselect-toolbar/ms-project-action-set.ts @@ -8,6 +8,19 @@ import { openMoveProjectDialog } from "store/projects/project-move-actions"; import { ToggleTrashAction } from "views-components/context-menu/actions/trash-action"; import { toggleProjectTrashed } from "store/trash/trash-actions"; import { copyToClipboardAction } from "store/open-in-new-tab/open-in-new-tab.actions"; +import { ToggleFavoriteAction } from "views-components/context-menu/actions/favorite-action"; +import { toggleFavorite } from "store/favorites/favorites-actions"; +import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action"; + +export const msToggleFavoriteAction = { + component: ToggleFavoriteAction, + name: "ToggleFavoriteAction", + execute: (dispatch, resources) => { + dispatch(toggleFavorite(resources[0])).then(() => { + dispatch(favoritePanelActions.REQUEST_ITEMS()); + }); + }, +}; export const msCopyToClipboardMenuAction = { icon: Link, @@ -35,4 +48,4 @@ export const msToggleTrashAction = { }, }; -export const msProjectActionSet: ContextMenuActionSet = [[msCopyToClipboardMenuAction, msMoveToAction, msToggleTrashAction]]; +export const msProjectActionSet: ContextMenuActionSet = [[msCopyToClipboardMenuAction, msMoveToAction, msToggleTrashAction, msToggleFavoriteAction]]; -- 2.30.2