X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/378c6a3a18cd9849bf4233e130a9ffdf250de35e..7b2c1a2e5b38246b9360fb062e66997ebfa888ea:/src/views-components/context-menu/action-sets/project-action-set.ts diff --git a/src/views-components/context-menu/action-sets/project-action-set.ts b/src/views-components/context-menu/action-sets/project-action-set.ts index 25e0ba3731..e466b94f9a 100644 --- a/src/views-components/context-menu/action-sets/project-action-set.ts +++ b/src/views-components/context-menu/action-sets/project-action-set.ts @@ -2,25 +2,52 @@ // // SPDX-License-Identifier: AGPL-3.0 +import { reset, initialize } from "redux-form"; + import { ContextMenuActionSet } from "../context-menu-action-set"; -import { projectActions } from "../../../store/project/project-action"; -import { NewProjectIcon } from "../../../components/icon/icon"; +import { projectActions, PROJECT_FORM_NAME } from "~/store/project/project-action"; +import { NewProjectIcon, RenameIcon, CopyIcon, MoveToIcon } from "~/components/icon/icon"; import { ToggleFavoriteAction } from "../actions/favorite-action"; -import { toggleFavorite } from "../../../store/favorites/favorites-actions"; -import { dataExplorerActions } from "../../../store/data-explorer/data-explorer-action"; -import { FAVORITE_PANEL_ID } from "../../../views/favorite-panel/favorite-panel"; +import { toggleFavorite } from "~/store/favorites/favorites-actions"; +import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action"; +import { openMoveProjectDialog } from '~/store/move-project-dialog/move-project-dialog'; +import { PROJECT_CREATE_FORM_NAME, openProjectCreateDialog } from '~/store/projects/project-create-actions'; +import { openProjectUpdateDialog } from '~/store/projects/project-update-actions'; -export const projectActionSet: ContextMenuActionSet = [[{ - icon: NewProjectIcon, - name: "New project", - execute: (dispatch, resource) => { - dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid })); - } -}, { - component: ToggleFavoriteAction, - execute: (dispatch, resource) => { - dispatch(toggleFavorite(resource)).then(() => { - dispatch(dataExplorerActions.REQUEST_ITEMS({ id : FAVORITE_PANEL_ID })); - }); - } -}]]; +export const projectActionSet: ContextMenuActionSet = [[ + { + icon: NewProjectIcon, + name: "New project", + execute: (dispatch, resource) => { + dispatch(reset(PROJECT_CREATE_FORM_NAME)); + dispatch(openProjectCreateDialog(resource.uuid)); + } + }, + { + icon: RenameIcon, + name: "Edit project", + execute: (dispatch, resource) => { + dispatch(openProjectUpdateDialog(resource)); + } + }, + { + component: ToggleFavoriteAction, + execute: (dispatch, resource) => { + dispatch(toggleFavorite(resource)).then(() => { + dispatch(favoritePanelActions.REQUEST_ITEMS()); + }); + } + }, + { + icon: MoveToIcon, + name: "Move to", + execute: (dispatch, resource) => dispatch(openMoveProjectDialog(resource)) + }, + { + icon: CopyIcon, + name: "Copy to project", + execute: (dispatch, resource) => { + // add code + } + }, +]];