1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { ContextMenuActionSet } from "../context-menu-action-set";
6 import { NewProjectIcon, RenameIcon, MoveToIcon, DetailsIcon, AdvancedIcon, OpenIcon, Link, FolderSharedIcon } from 'components/icon/icon';
7 import { ToggleFavoriteAction } from "../actions/favorite-action";
8 import { toggleFavorite } from "store/favorites/favorites-actions";
9 import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action";
10 import { openMoveProjectDialog } from 'store/projects/project-move-actions';
11 import { openProjectCreateDialog } from 'store/projects/project-create-actions';
12 import { openProjectUpdateDialog } from 'store/projects/project-update-actions';
13 import { ToggleTrashAction } from "views-components/context-menu/actions/trash-action";
14 import { toggleProjectTrashed } from "store/trash/trash-actions";
15 import { ShareIcon } from 'components/icon/icon';
16 import { openSharingDialog } from "store/sharing-dialog/sharing-dialog-actions";
17 import { openAdvancedTabDialog } from "store/advanced-tab/advanced-tab";
18 import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
19 import { copyToClipboardAction, openInNewTabAction } from "store/open-in-new-tab/open-in-new-tab.actions";
20 import { openWebDavS3InfoDialog } from "store/collections/collection-info-actions";
22 export const readOnlyProjectActionSet: ContextMenuActionSet = [[
24 component: ToggleFavoriteAction,
25 name: 'ToggleFavoriteAction',
26 execute: (dispatch, resource) => {
27 dispatch<any>(toggleFavorite(resource)).then(() => {
28 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
34 name: "Open in new tab",
35 execute: (dispatch, resource) => {
36 dispatch<any>(openInNewTabAction(resource));
41 name: "Copy to clipboard",
42 execute: (dispatch, resource) => {
43 dispatch<any>(copyToClipboardAction(resource));
49 execute: dispatch => {
50 dispatch<any>(toggleDetailsPanel());
56 execute: (dispatch, resource) => {
57 dispatch<any>(openAdvancedTabDialog(resource.uuid));
61 icon: FolderSharedIcon,
62 name: "Open as network folder or S3 bucket",
63 execute: (dispatch, resource) => {
64 dispatch<any>(openWebDavS3InfoDialog(resource.uuid));
69 export const filterGroupActionSet: ContextMenuActionSet = [
71 ...readOnlyProjectActionSet.reduce((prev, next) => prev.concat(next), []),
75 execute: (dispatch, resource) => {
76 dispatch<any>(openProjectUpdateDialog(resource));
82 execute: (dispatch, { uuid }) => {
83 dispatch<any>(openSharingDialog(uuid));
89 execute: (dispatch, resource) => {
90 dispatch<any>(openMoveProjectDialog(resource));
94 component: ToggleTrashAction,
95 name: 'ToggleTrashAction',
96 execute: (dispatch, resource) => {
97 dispatch<any>(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.isTrashed!!));
103 export const projectActionSet: ContextMenuActionSet = [
105 ...filterGroupActionSet.reduce((prev, next) => prev.concat(next), []),
107 icon: NewProjectIcon,
109 execute: (dispatch, resource) => {
110 dispatch<any>(openProjectCreateDialog(resource.uuid));