Merge branch '21128-toolbar-context-menu'
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / search-results-action-set.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { ContextMenuActionSet } from '../context-menu-action-set';
6 import { DetailsIcon, AdvancedIcon, OpenIcon, Link } from 'components/icon/icon';
7 import { openAdvancedTabDialog } from 'store/advanced-tab/advanced-tab';
8 import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
9 import { copyToClipboardAction, openInNewTabAction } from 'store/open-in-new-tab/open-in-new-tab.actions';
10
11 export const searchResultsActionSet: ContextMenuActionSet = [
12     [
13         {
14             icon: OpenIcon,
15             name: 'Open in new tab',
16             execute: (dispatch, resources) => {
17                 resources.forEach((resource) => dispatch<any>(openInNewTabAction(resource)));
18             },
19         },
20         {
21             icon: Link,
22             name: 'Copy to clipboard',
23             execute: (dispatch, resources) => {
24                 dispatch<any>(copyToClipboardAction(resources));
25             },
26         },
27         {
28             icon: DetailsIcon,
29             name: 'View details',
30             execute: (dispatch) => {
31                 dispatch<any>(toggleDetailsPanel());
32             },
33         },
34         {
35             icon: AdvancedIcon,
36             name: 'API Details',
37             execute: (dispatch, resources) => {
38                 dispatch<any>(openAdvancedTabDialog(resources[0].uuid));
39             },
40         },
41     ],
42 ];