X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/f63f3a5360ae6381d4b332bf86ef52b4e22107fb..95bba613751af0c9371e15dc8d2d1612079a6fe5:/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 d2412e7e..a079bf4f 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,46 +2,113 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { reset, initialize } from "redux-form"; - import { ContextMenuActionSet } from "../context-menu-action-set"; -import { projectActions, PROJECT_FORM_NAME, toggleProjectTrashed } from "~/store/project/project-action"; -import { NewProjectIcon, RenameIcon } from "~/components/icon/icon"; +import { NewProjectIcon, RenameIcon, MoveToIcon, DetailsIcon, AdvancedIcon, OpenIcon, Link, FolderSharedIcon } 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 { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create"; -import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action"; +import { toggleFavorite } from "store/favorites/favorites-actions"; +import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action"; +import { openMoveProjectDialog } from 'store/projects/project-move-actions'; +import { openProjectCreateDialog } from 'store/projects/project-create-actions'; +import { openProjectUpdateDialog } from 'store/projects/project-update-actions'; +import { ToggleTrashAction } from "views-components/context-menu/actions/trash-action"; +import { toggleProjectTrashed } from "store/trash/trash-actions"; +import { ShareIcon } from 'components/icon/icon'; +import { openSharingDialog } from "store/sharing-dialog/sharing-dialog-actions"; +import { openAdvancedTabDialog } from "store/advanced-tab/advanced-tab"; +import { toggleDetailsPanel } from 'store/details-panel/details-panel-action'; +import { copyToClipboardAction, openInNewTabAction } from "store/open-in-new-tab/open-in-new-tab.actions"; +import { openWebDavS3InfoDialog } from "store/collections/collection-info-actions"; -export const projectActionSet: ContextMenuActionSet = [[ +export const readOnlyProjectActionSet: ContextMenuActionSet = [[ { - icon: NewProjectIcon, - name: "New project", + component: ToggleFavoriteAction, + name: 'ToggleFavoriteAction', execute: (dispatch, resource) => { - dispatch(reset(PROJECT_CREATE_DIALOG)); - dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid })); + dispatch(toggleFavorite(resource)).then(() => { + dispatch(favoritePanelActions.REQUEST_ITEMS()); + }); } }, { - icon: RenameIcon, - name: "Edit project", + icon: OpenIcon, + name: "Open in new tab", execute: (dispatch, resource) => { - dispatch(projectActions.OPEN_PROJECT_UPDATER({ uuid: resource.uuid })); - dispatch(initialize(PROJECT_FORM_NAME, { name: resource.name, description: resource.description })); + dispatch(openInNewTabAction(resource)); } }, { - component: ToggleFavoriteAction, + icon: Link, + name: "Copy to clipboard", execute: (dispatch, resource) => { - dispatch(toggleFavorite(resource)).then(() => { - dispatch(favoritePanelActions.REQUEST_ITEMS()); - }); + dispatch(copyToClipboardAction(resource)); } }, { - component: ToggleTrashAction, + icon: DetailsIcon, + name: "View details", + execute: dispatch => { + dispatch(toggleDetailsPanel()); + } + }, + { + icon: AdvancedIcon, + name: "Advanced", execute: (dispatch, resource) => { - dispatch(toggleProjectTrashed(resource)); + dispatch(openAdvancedTabDialog(resource.uuid)); } - } + }, + { + icon: FolderSharedIcon, + name: "Open with 3rd party client", + execute: (dispatch, resource) => { + dispatch(openWebDavS3InfoDialog(resource.uuid)); + } + }, ]]; + +export const filterGroupActionSet: ContextMenuActionSet = [ + [ + ...readOnlyProjectActionSet.reduce((prev, next) => prev.concat(next), []), + { + icon: RenameIcon, + name: "Edit project", + execute: (dispatch, resource) => { + dispatch(openProjectUpdateDialog(resource)); + } + }, + { + icon: ShareIcon, + name: "Share", + execute: (dispatch, { uuid }) => { + dispatch(openSharingDialog(uuid)); + } + }, + { + icon: MoveToIcon, + name: "Move to", + execute: (dispatch, resource) => { + dispatch(openMoveProjectDialog(resource)); + } + }, + { + component: ToggleTrashAction, + name: 'ToggleTrashAction', + execute: (dispatch, resource) => { + dispatch(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.isTrashed!!)); + } + }, + ] +]; + +export const projectActionSet: ContextMenuActionSet = [ + [ + ...filterGroupActionSet.reduce((prev, next) => prev.concat(next), []), + { + icon: NewProjectIcon, + name: "New project", + execute: (dispatch, resource) => { + dispatch(openProjectCreateDialog(resource.uuid)); + } + }, + ] +];