X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9ee3502881020e41fa6557ec76a260fce3117cbe..eda7767bc88b7a2a3dc582af47417937ff4de38a:/src/views-components/context-menu/action-sets/collection-action-set.ts diff --git a/src/views-components/context-menu/action-sets/collection-action-set.ts b/src/views-components/context-menu/action-sets/collection-action-set.ts index 7e4c7b98ca..a870a813df 100644 --- a/src/views-components/context-menu/action-sets/collection-action-set.ts +++ b/src/views-components/context-menu/action-sets/collection-action-set.ts @@ -2,10 +2,23 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { ContextMenuActionSet } from "../context-menu-action-set"; +import { + ContextMenuAction, + ContextMenuActionSet +} from "../context-menu-action-set"; import { ToggleFavoriteAction } from "../actions/favorite-action"; import { toggleFavorite } from "~/store/favorites/favorites-actions"; -import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, AdvancedIcon, OpenIcon, Link, RecoverVersionIcon } from "~/components/icon/icon"; +import { + RenameIcon, + ShareIcon, + MoveToIcon, + CopyIcon, + DetailsIcon, + AdvancedIcon, + OpenIcon, + Link, + RecoverVersionIcon +} from "~/components/icon/icon"; import { openCollectionUpdateDialog } from "~/store/collections/collection-update-actions"; import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action"; import { openMoveCollectionDialog } from '~/store/collections/collection-move-actions'; @@ -21,16 +34,17 @@ import { TogglePublicFavoriteAction } from "../actions/public-favorite-action"; import { togglePublicFavorite } from "~/store/public-favorites/public-favorites-actions"; import { publicFavoritePanelActions } from "~/store/public-favorites-panel/public-favorites-action"; -export const readOnlyCollectionActionSet: ContextMenuActionSet = [[ - { - component: ToggleFavoriteAction, - name: 'ToggleFavoriteAction', - execute: (dispatch, resource) => { - dispatch(toggleFavorite(resource)).then(() => { - dispatch(favoritePanelActions.REQUEST_ITEMS()); - }); - } - }, +const toggleFavoriteAction: ContextMenuAction = { + component: ToggleFavoriteAction, + name: 'ToggleFavoriteAction', + execute: (dispatch, resource) => { + dispatch(toggleFavorite(resource)).then(() => { + dispatch(favoritePanelActions.REQUEST_ITEMS()); + }); + } +}; + +const commonActionSet: ContextMenuActionSet = [[ { icon: OpenIcon, name: "Open in new tab", @@ -69,6 +83,11 @@ export const readOnlyCollectionActionSet: ContextMenuActionSet = [[ }, ]]; +export const readOnlyCollectionActionSet: ContextMenuActionSet = [[ + ...commonActionSet.reduce((prev, next) => prev.concat(next), []), + toggleFavoriteAction, +]]; + export const collectionActionSet: ContextMenuActionSet = [ [ ...readOnlyCollectionActionSet.reduce((prev, next) => prev.concat(next), []), @@ -118,7 +137,7 @@ export const collectionAdminActionSet: ContextMenuActionSet = [ export const oldCollectionVersionActionSet: ContextMenuActionSet = [ [ - ...readOnlyCollectionActionSet.reduce((prev, next) => prev.concat(next), []), + ...commonActionSet.reduce((prev, next) => prev.concat(next), []), { icon: RecoverVersionIcon, name: 'Recover version',