Merge branch '21705-go-deps-update-all'
[arvados.git] / services / workbench2 / src / views-components / context-menu / action-sets / favorite-action-set.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { ContextMenuActionSet, ContextMenuActionNames } from '../context-menu-action-set';
6 import { ToggleFavoriteAction } from '../actions/favorite-action';
7 import { toggleFavorite } from 'store/favorites/favorites-actions';
8 import { favoritePanelActions } from 'store/favorite-panel/favorite-panel-action';
9
10 export const favoriteActionSet: ContextMenuActionSet = [
11     [
12         {
13             component: ToggleFavoriteAction,
14             name: ContextMenuActionNames.ADD_TO_FAVORITES,
15             execute: (dispatch, resources) => {
16                 resources.forEach((resource) =>
17                     dispatch<any>(toggleFavorite(resource)).then(() => {
18                         dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
19                     })
20                 );
21             },
22         },
23     ],
24 ];