X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/b6a5b173cd4e9f325f371d26204dfe156d911c20..45d9b3d7298daf82bfb93c82e4f2f8c125c45e79:/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 66dbd4d1..efba4578 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,18 +2,45 @@ // // 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 { ShareIcon, NewProjectIcon } from "../../../components/icon/icon"; +import { projectActions, PROJECT_FORM_NAME } from "~/store/project/project-action"; +import { NewProjectIcon, MoveToIcon, RenameIcon } from "~/components/icon/icon"; +import { ToggleFavoriteAction } from "../actions/favorite-action"; +import { toggleFavorite } from "~/store/favorites/favorites-actions"; +import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action"; +import { openMoveToDialog } from "../../move-to-dialog/move-to-dialog"; +import { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create"; -export const projectActionSet: ContextMenuActionSet = [[{ - icon: NewProjectIcon, - name: "New project", - execute: (dispatch, resource) => { - dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid })); - } -}, { - icon: ShareIcon, - name: "Share", - execute: () => { return; } -}]]; +export const projectActionSet: ContextMenuActionSet = [[ + { + icon: NewProjectIcon, + name: "New project", + execute: (dispatch, resource) => { + dispatch(reset(PROJECT_CREATE_DIALOG)); + dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid })); + } + }, + { + icon: RenameIcon, + name: "Edit project", + execute: (dispatch, resource) => { + dispatch(projectActions.OPEN_PROJECT_UPDATER({ uuid: resource.uuid })); + dispatch(initialize(PROJECT_FORM_NAME, { name: resource.name, description: resource.description })); + } + }, + { + component: ToggleFavoriteAction, + execute: (dispatch, resource) => { + dispatch(toggleFavorite(resource)).then(() => { + dispatch(favoritePanelActions.REQUEST_ITEMS()); + }); + } + }, + { + icon: MoveToIcon, + name: "Move to", + execute: dispatch => dispatch(openMoveToDialog()) + }, +]];