X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/7f5aa7c58dde29568ecb7b6bfb16f6b762c0ac1c..e09a9e644ad7937bb3800ca8096f444f6ff4411b:/src/store/workbench/workbench-actions.ts diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts index 8401ba95..188dba05 100644 --- a/src/store/workbench/workbench-actions.ts +++ b/src/store/workbench/workbench-actions.ts @@ -8,12 +8,8 @@ import { getUserUuid } from "common/getuser"; import { loadDetailsPanel } from "store/details-panel/details-panel-action"; import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions"; import { favoritePanelActions, loadFavoritePanel } from "store/favorite-panel/favorite-panel-action"; -import { - getProjectPanelCurrentUuid, - openProjectPanel, - projectPanelActions, - setIsProjectPanelTrashed, -} from "store/project-panel/project-panel-action"; +import { getProjectPanelCurrentUuid, setIsProjectPanelTrashed } from "store/project-panel/project-panel-action"; +import { projectPanelActions } from "store/project-panel/project-panel-action-bind"; import { activateSidePanelTreeItem, initSidePanelTree, @@ -54,6 +50,7 @@ import { trashPanelColumns } from "views/trash-panel/trash-panel"; import { loadTrashPanel, trashPanelActions } from "store/trash-panel/trash-panel-action"; import { loadProcessPanel } from "store/process-panel/process-panel-actions"; import { loadSharedWithMePanel, sharedWithMePanelActions } from "store/shared-with-me-panel/shared-with-me-panel-actions"; +import { sharedWithMePanelColumns } from "views/shared-with-me-panel/shared-with-me-panel"; import { CopyFormDialogData } from "store/copy-dialog/copy-dialog"; import { workflowPanelActions } from "store/workflow-panel/workflow-panel-actions"; import { loadSshKeysPanel } from "store/auth/auth-action-ssh"; @@ -100,7 +97,8 @@ import { loadAllProcessesPanel, allProcessesPanelActions } from "../all-processe import { allProcessesPanelColumns } from "views/all-processes-panel/all-processes-panel"; import { AdminMenuIcon } from "components/icon/icon"; import { userProfileGroupsColumns } from "views/user-profile-panel/user-profile-panel-root"; -import { selectedToArray, selectedToKindSet } from "components/multiselectToolbar/MultiselectToolbar"; +import { selectedToArray, selectedToKindSet } from "components/multiselect-toolbar/MultiselectToolbar"; +import { multiselectActions } from "store/multiselect/multiselect-actions"; export const WORKBENCH_LOADING_SCREEN = "workbenchLoadingScreen"; @@ -112,6 +110,12 @@ export const isWorkbenchLoading = (state: RootState) => { export const handleFirstTimeLoad = (action: any) => async (dispatch: Dispatch, getState: () => RootState) => { try { await dispatch(action); + } catch (e) { + snackbarActions.OPEN_SNACKBAR({ + message: "Error " + e, + hideDuration: 8000, + kind: SnackbarKind.WARNING, + }) } finally { if (isWorkbenchLoading(getState())) { dispatch(progressIndicatorActions.STOP_WORKING(WORKBENCH_LOADING_SCREEN)); @@ -137,7 +141,7 @@ export const loadWorkbench = () => async (dispatch: Dispatch, getState: () => Ro }) ); dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns })); - dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns })); + dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: sharedWithMePanelColumns })); dispatch(workflowPanelActions.SET_COLUMNS({ columns: workflowPanelColumns })); dispatch( searchResultsPanelActions.SET_FETCH_MODE({ @@ -231,35 +235,40 @@ export const loadProject = (uuid: string) => if (!userUuid) { return; } - if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) { - // Load another users home projects - dispatch(finishLoadingProject(uuid)); - } else if (userUuid !== uuid) { - await dispatch(finishLoadingProject(uuid)); - const match = await loadGroupContentsResource({ - uuid, - userUuid, - services, - }); - match({ - OWNED: async () => { - await dispatch(activateSidePanelTreeItem(uuid)); - dispatch(setSidePanelBreadcrumbs(uuid)); - }, - SHARED: async () => { - await dispatch(activateSidePanelTreeItem(uuid)); - dispatch(setSharedWithMeBreadcrumbs(uuid)); - }, - TRASHED: async () => { - await dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH)); - dispatch(setTrashBreadcrumbs(uuid)); - dispatch(setIsProjectPanelTrashed(true)); - }, - }); - } else { - await dispatch(finishLoadingProject(userUuid)); - await dispatch(activateSidePanelTreeItem(userUuid)); - dispatch(setSidePanelBreadcrumbs(userUuid)); + try { + dispatch(progressIndicatorActions.START_WORKING(uuid)); + if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) { + // Load another users home projects + dispatch(finishLoadingProject(uuid)); + } else if (userUuid !== uuid) { + await dispatch(finishLoadingProject(uuid)); + const match = await loadGroupContentsResource({ + uuid, + userUuid, + services, + }); + match({ + OWNED: async () => { + await dispatch(activateSidePanelTreeItem(uuid)); + dispatch(setSidePanelBreadcrumbs(uuid)); + }, + SHARED: async () => { + await dispatch(activateSidePanelTreeItem(uuid)); + dispatch(setSharedWithMeBreadcrumbs(uuid)); + }, + TRASHED: async () => { + await dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH)); + dispatch(setTrashBreadcrumbs(uuid)); + dispatch(setIsProjectPanelTrashed(true)); + }, + }); + } else { + await dispatch(finishLoadingProject(userUuid)); + await dispatch(activateSidePanelTreeItem(userUuid)); + dispatch(setSidePanelBreadcrumbs(userUuid)); + } + } finally { + dispatch(progressIndicatorActions.STOP_WORKING(uuid)); } }); @@ -280,63 +289,62 @@ export const createProject = (data: projectCreateActions.ProjectCreateFormDialog export const moveProject = (data: MoveToFormDialogData, isSecondaryMove = false) => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - const checkedList = getState().multiselect.checkedList; - const uuidsToMove: string[] = selectedToArray(checkedList); + async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + const checkedList = getState().multiselect.checkedList; + const uuidsToMove: string[] = data.fromContextMenu ? [data.uuid] : selectedToArray(checkedList); - //if no items in checkedlist && no items passed in, default to normal context menu behavior - if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid); + //if no items in checkedlist default to normal context menu behavior + if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid); - const sourceUuid = getResource(data.uuid)(getState().resources)?.ownerUuid; - const destinationUuid = data.ownerUuid; + const sourceUuid = getResource(data.uuid)(getState().resources)?.ownerUuid; + const destinationUuid = data.ownerUuid; - const projectsToMove: MoveableResource[] = uuidsToMove - .map(uuid => getResource(uuid)(getState().resources) as MoveableResource) - .filter(resource => resource.kind === ResourceKind.PROJECT); + const projectsToMove: MoveableResource[] = uuidsToMove + .map(uuid => getResource(uuid)(getState().resources) as MoveableResource) + .filter(resource => resource.kind === ResourceKind.PROJECT); - for (const project of projectsToMove) { - await moveSingleProject(project); - } + for (const project of projectsToMove) { + await moveSingleProject(project); + } - //omly propagate if this call is the original - if (!isSecondaryMove) { - const kindsToMove: Set = selectedToKindSet(checkedList); - kindsToMove.delete(ResourceKind.PROJECT); + //omly propagate if this call is the original + if (!isSecondaryMove) { + const kindsToMove: Set = selectedToKindSet(checkedList); + kindsToMove.delete(ResourceKind.PROJECT); - kindsToMove.forEach(kind => { - secondaryMove[kind](data, true)(dispatch, getState, services); - }); - } + kindsToMove.forEach(kind => { + secondaryMove[kind](data, true)(dispatch, getState, services); + }); + } - async function moveSingleProject(project: MoveableResource) { - try { - const oldProject: MoveToFormDialogData = { name: project.name, uuid: project.uuid, ownerUuid: data.ownerUuid }; - const oldOwnerUuid = oldProject ? oldProject.ownerUuid : ""; - const movedProject = await dispatch(projectMoveActions.moveProject(oldProject)); - if (movedProject) { + async function moveSingleProject(project: MoveableResource) { + try { + const oldProject: MoveToFormDialogData = { name: project.name, uuid: project.uuid, ownerUuid: data.ownerUuid }; + const oldOwnerUuid = oldProject ? oldProject.ownerUuid : ""; + const movedProject = await dispatch(projectMoveActions.moveProject(oldProject)); + if (movedProject) { + dispatch( + snackbarActions.OPEN_SNACKBAR({ + message: "Project has been moved", + hideDuration: 2000, + kind: SnackbarKind.SUCCESS, + }) + ); + await dispatch(reloadProjectMatchingUuid([oldOwnerUuid, movedProject.ownerUuid, movedProject.uuid])); + } + } catch (e) { dispatch( snackbarActions.OPEN_SNACKBAR({ - message: "Project has been moved", + message: !!(project as any).frozenByUuid ? 'Could not move frozen project.' : e.message, hideDuration: 2000, - kind: SnackbarKind.SUCCESS, + kind: SnackbarKind.ERROR, }) ); - await dispatch(reloadProjectMatchingUuid([oldOwnerUuid, movedProject.ownerUuid, movedProject.uuid])); } - } catch (e) { - dispatch( - snackbarActions.OPEN_SNACKBAR({ - message: e.message, - hideDuration: 2000, - kind: SnackbarKind.ERROR, - }) - ); - // } } - } - if (sourceUuid) await dispatch(loadSidePanelTreeProjects(sourceUuid)); - await dispatch(loadSidePanelTreeProjects(destinationUuid)); - }; + if (sourceUuid) await dispatch(loadSidePanelTreeProjects(sourceUuid)); + await dispatch(loadSidePanelTreeProjects(destinationUuid)); + }; export const updateProject = (data: projectUpdateActions.ProjectUpdateFormDialogData) => async (dispatch: Dispatch) => { const updatedProject = await dispatch(projectUpdateActions.updateProject(data)); @@ -371,42 +379,47 @@ export const updateGroup = (data: projectUpdateActions.ProjectUpdateFormDialogDa export const loadCollection = (uuid: string) => handleFirstTimeLoad(async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const userUuid = getUserUuid(getState()); - if (userUuid) { - const match = await loadGroupContentsResource({ - uuid, - userUuid, - services, - }); - let collection: CollectionResource | undefined; - let breadcrumbfunc: - | ((uuid: string) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => Promise) - | undefined; - let sidepanel: string | undefined; - match({ - OWNED: thecollection => { - collection = thecollection as CollectionResource; - sidepanel = collection.ownerUuid; - breadcrumbfunc = setSidePanelBreadcrumbs; - }, - SHARED: thecollection => { - collection = thecollection as CollectionResource; - sidepanel = collection.ownerUuid; - breadcrumbfunc = setSharedWithMeBreadcrumbs; - }, - TRASHED: thecollection => { - collection = thecollection as CollectionResource; - sidepanel = SidePanelTreeCategory.TRASH; - breadcrumbfunc = () => setTrashBreadcrumbs(""); - }, - }); - if (collection && breadcrumbfunc && sidepanel) { - dispatch(updateResources([collection])); - await dispatch(finishLoadingProject(collection.ownerUuid)); - dispatch(collectionPanelActions.SET_COLLECTION(collection)); - await dispatch(activateSidePanelTreeItem(sidepanel)); - dispatch(breadcrumbfunc(collection.ownerUuid)); - dispatch(loadCollectionPanel(collection.uuid)); + try { + dispatch(progressIndicatorActions.START_WORKING(uuid)); + if (userUuid) { + const match = await loadGroupContentsResource({ + uuid, + userUuid, + services, + }); + let collection: CollectionResource | undefined; + let breadcrumbfunc: + | ((uuid: string) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => Promise) + | undefined; + let sidepanel: string | undefined; + match({ + OWNED: thecollection => { + collection = thecollection as CollectionResource; + sidepanel = collection.ownerUuid; + breadcrumbfunc = setSidePanelBreadcrumbs; + }, + SHARED: thecollection => { + collection = thecollection as CollectionResource; + sidepanel = collection.ownerUuid; + breadcrumbfunc = setSharedWithMeBreadcrumbs; + }, + TRASHED: thecollection => { + collection = thecollection as CollectionResource; + sidepanel = SidePanelTreeCategory.TRASH; + breadcrumbfunc = () => setTrashBreadcrumbs(""); + }, + }); + if (collection && breadcrumbfunc && sidepanel) { + dispatch(updateResources([collection])); + await dispatch(finishLoadingProject(collection.ownerUuid)); + dispatch(collectionPanelActions.SET_COLLECTION(collection)); + await dispatch(activateSidePanelTreeItem(sidepanel)); + dispatch(breadcrumbfunc(collection.ownerUuid)); + dispatch(loadCollectionPanel(collection.uuid)); + } } + } finally { + dispatch(progressIndicatorActions.STOP_WORKING(uuid)); } }); @@ -426,92 +439,121 @@ export const createCollection = (data: collectionCreateActions.CollectionCreateF }; export const copyCollection = (data: CopyFormDialogData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - try { - const copyToProject = getResource(data.ownerUuid)(getState().resources); - const collection = await dispatch(collectionCopyActions.copyCollection(data)); - if (copyToProject && collection) { - dispatch(reloadProjectMatchingUuid([copyToProject.uuid])); + const checkedList = getState().multiselect.checkedList; + const uuidsToCopy: string[] = data.fromContextMenu ? [data.uuid] : selectedToArray(checkedList); + + //if no items in checkedlist && no items passed in, default to normal context menu behavior + if (!uuidsToCopy.length) uuidsToCopy.push(data.uuid); + + const collectionsToCopy: CollectionCopyResource[] = uuidsToCopy + .map(uuid => getResource(uuid)(getState().resources) as CollectionCopyResource) + .filter(resource => resource.kind === ResourceKind.COLLECTION); + + for (const collection of collectionsToCopy) { + await copySingleCollection({ ...collection, ownerUuid: data.ownerUuid } as CollectionCopyResource); + } + + async function copySingleCollection(copyToProject: CollectionCopyResource) { + const newName = data.fromContextMenu || collectionsToCopy.length === 1 ? data.name : `Copy of: ${copyToProject.name}`; + try { + const collection = await dispatch( + collectionCopyActions.copyCollection({ + ...copyToProject, + name: newName, + fromContextMenu: collectionsToCopy.length === 1 ? true : data.fromContextMenu, + }) + ); + if (copyToProject && collection) { + await dispatch(reloadProjectMatchingUuid([copyToProject.uuid])); + dispatch( + snackbarActions.OPEN_SNACKBAR({ + message: "Collection has been copied.", + hideDuration: 3000, + kind: SnackbarKind.SUCCESS, + link: collection.ownerUuid, + }) + ); + dispatch(multiselectActions.deselectOne(copyToProject.uuid)); + } + } catch (e) { dispatch( snackbarActions.OPEN_SNACKBAR({ - message: "Collection has been copied.", - hideDuration: 3000, - kind: SnackbarKind.SUCCESS, - link: collection.ownerUuid, + message: e.message, + hideDuration: 2000, + kind: SnackbarKind.ERROR, }) ); } - } catch (e) { - dispatch( - snackbarActions.OPEN_SNACKBAR({ - message: e.message, - hideDuration: 2000, - kind: SnackbarKind.ERROR, - }) - ); } + dispatch(projectPanelActions.REQUEST_ITEMS()); }; export const moveCollection = (data: MoveToFormDialogData, isSecondaryMove = false) => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - const checkedList = getState().multiselect.checkedList; - const uuidsToMove: string[] = selectedToArray(checkedList); + async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + const checkedList = getState().multiselect.checkedList; + const uuidsToMove: string[] = data.fromContextMenu ? [data.uuid] : selectedToArray(checkedList); - //if no items in checkedlist && no items passed in, default to normal context menu behavior - if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid); + //if no items in checkedlist && no items passed in, default to normal context menu behavior + if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid); - const collectionsToMove: MoveableResource[] = uuidsToMove - .map(uuid => getResource(uuid)(getState().resources) as MoveableResource) - .filter(resource => resource.kind === ResourceKind.COLLECTION); + const collectionsToMove: MoveableResource[] = uuidsToMove + .map(uuid => getResource(uuid)(getState().resources) as MoveableResource) + .filter(resource => resource.kind === ResourceKind.COLLECTION); - for (const collection of collectionsToMove) { - await moveSingleCollection(collection); - } + for (const collection of collectionsToMove) { + await moveSingleCollection(collection); + } - //omly propagate if this call is the original - if (!isSecondaryMove) { - const kindsToMove: Set = selectedToKindSet(checkedList); - kindsToMove.delete(ResourceKind.COLLECTION); + //omly propagate if this call is the original + if (!isSecondaryMove) { + const kindsToMove: Set = selectedToKindSet(checkedList); + kindsToMove.delete(ResourceKind.COLLECTION); - kindsToMove.forEach(kind => { - secondaryMove[kind](data, true)(dispatch, getState, services); - }); - } + kindsToMove.forEach(kind => { + secondaryMove[kind](data, true)(dispatch, getState, services); + }); + } - async function moveSingleCollection(collection: MoveableResource) { - try { - const oldCollection: MoveToFormDialogData = { name: collection.name, uuid: collection.uuid, ownerUuid: data.ownerUuid }; - const movedCollection = await dispatch(collectionMoveActions.moveCollection(oldCollection)); - dispatch(updateResources([movedCollection])); - dispatch(reloadProjectMatchingUuid([movedCollection.ownerUuid])); - dispatch( - snackbarActions.OPEN_SNACKBAR({ - message: "Collection has been moved.", - hideDuration: 2000, - kind: SnackbarKind.SUCCESS, - }) - ); - } catch (e) { - dispatch( - snackbarActions.OPEN_SNACKBAR({ - message: e.message, - hideDuration: 2000, - kind: SnackbarKind.ERROR, - }) - ); + async function moveSingleCollection(collection: MoveableResource) { + try { + const oldCollection: MoveToFormDialogData = { name: collection.name, uuid: collection.uuid, ownerUuid: data.ownerUuid }; + const movedCollection = await dispatch(collectionMoveActions.moveCollection(oldCollection)); + dispatch(updateResources([movedCollection])); + dispatch(reloadProjectMatchingUuid([movedCollection.ownerUuid])); + dispatch( + snackbarActions.OPEN_SNACKBAR({ + message: "Collection has been moved.", + hideDuration: 2000, + kind: SnackbarKind.SUCCESS, + }) + ); + } catch (e) { + dispatch( + snackbarActions.OPEN_SNACKBAR({ + message: e.message, + hideDuration: 2000, + kind: SnackbarKind.ERROR, + }) + ); + } } - } - }; + }; export const loadProcess = (uuid: string) => handleFirstTimeLoad(async (dispatch: Dispatch, getState: () => RootState) => { - dispatch(loadProcessPanel(uuid)); - const process = await dispatch(processesActions.loadProcess(uuid)); - if (process) { - await dispatch(finishLoadingProject(process.containerRequest.ownerUuid)); - await dispatch(activateSidePanelTreeItem(process.containerRequest.ownerUuid)); - dispatch(setProcessBreadcrumbs(uuid)); - dispatch(loadDetailsPanel(uuid)); + try { + dispatch(progressIndicatorActions.START_WORKING(uuid)); + dispatch(loadProcessPanel(uuid)); + const process = await dispatch(processesActions.loadProcess(uuid)); + if (process) { + await dispatch(finishLoadingProject(process.containerRequest.ownerUuid)); + await dispatch(activateSidePanelTreeItem(process.containerRequest.ownerUuid)); + dispatch(setProcessBreadcrumbs(uuid)); + dispatch(loadDetailsPanel(uuid)); + } + } finally { + dispatch(progressIndicatorActions.STOP_WORKING(uuid)); } }); @@ -537,7 +579,7 @@ export const loadRegisteredWorkflow = (uuid: string) => workflow = theworkflow as WorkflowResource; breadcrumbfunc = setSharedWithMeBreadcrumbs; }, - TRASHED: () => {}, + TRASHED: () => { }, }); if (workflow && breadcrumbfunc) { dispatch(updateResources([workflow])); @@ -575,55 +617,55 @@ export const updateProcess = (data: processUpdateActions.ProcessUpdateFormDialog export const moveProcess = (data: MoveToFormDialogData, isSecondaryMove = false) => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - const checkedList = getState().multiselect.checkedList; - const uuidsToMove: string[] = selectedToArray(checkedList); + async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + const checkedList = getState().multiselect.checkedList; + const uuidsToMove: string[] = data.fromContextMenu ? [data.uuid] : selectedToArray(checkedList); - //if no items in checkedlist && no items passed in, default to normal context menu behavior - if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid); + //if no items in checkedlist && no items passed in, default to normal context menu behavior + if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid); - const processesToMove: MoveableResource[] = uuidsToMove - .map(uuid => getResource(uuid)(getState().resources) as MoveableResource) - .filter(resource => resource.kind === ResourceKind.PROCESS); + const processesToMove: MoveableResource[] = uuidsToMove + .map(uuid => getResource(uuid)(getState().resources) as MoveableResource) + .filter(resource => resource.kind === ResourceKind.PROCESS); - for (const process of processesToMove) { - await moveSingleProcess(process); - } + for (const process of processesToMove) { + await moveSingleProcess(process); + } - //omly propagate if this call is the original - if (!isSecondaryMove) { - const kindsToMove: Set = selectedToKindSet(checkedList); - kindsToMove.delete(ResourceKind.PROCESS); + //omly propagate if this call is the original + if (!isSecondaryMove) { + const kindsToMove: Set = selectedToKindSet(checkedList); + kindsToMove.delete(ResourceKind.PROCESS); - kindsToMove.forEach(kind => { - secondaryMove[kind](data, true)(dispatch, getState, services); - }); - } + kindsToMove.forEach(kind => { + secondaryMove[kind](data, true)(dispatch, getState, services); + }); + } - async function moveSingleProcess(process: MoveableResource) { - try { - const oldProcess: MoveToFormDialogData = { name: process.name, uuid: process.uuid, ownerUuid: data.ownerUuid }; - const movedProcess = await dispatch(processMoveActions.moveProcess(oldProcess)); - dispatch(updateResources([movedProcess])); - dispatch(reloadProjectMatchingUuid([movedProcess.ownerUuid])); - dispatch( - snackbarActions.OPEN_SNACKBAR({ - message: "Process has been moved.", - hideDuration: 2000, - kind: SnackbarKind.SUCCESS, - }) - ); - } catch (e) { - dispatch( - snackbarActions.OPEN_SNACKBAR({ - message: e.message, - hideDuration: 2000, - kind: SnackbarKind.ERROR, - }) - ); + async function moveSingleProcess(process: MoveableResource) { + try { + const oldProcess: MoveToFormDialogData = { name: process.name, uuid: process.uuid, ownerUuid: data.ownerUuid }; + const movedProcess = await dispatch(processMoveActions.moveProcess(oldProcess)); + dispatch(updateResources([movedProcess])); + dispatch(reloadProjectMatchingUuid([movedProcess.ownerUuid])); + dispatch( + snackbarActions.OPEN_SNACKBAR({ + message: "Process has been moved.", + hideDuration: 2000, + kind: SnackbarKind.SUCCESS, + }) + ); + } catch (e) { + dispatch( + snackbarActions.OPEN_SNACKBAR({ + message: e.message, + hideDuration: 2000, + kind: SnackbarKind.ERROR, + }) + ); + } } - } - }; + }; export const copyProcess = (data: CopyFormDialogData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { try { @@ -762,7 +804,6 @@ export const loadGroupDetailsPanel = (groupUuid: string) => const finishLoadingProject = (project: GroupContentsResource | string) => async (dispatch: Dispatch) => { const uuid = typeof project === "string" ? project : project.uuid; - dispatch(openProjectPanel(uuid)); dispatch(loadDetailsPanel(uuid)); if (typeof project !== "string") { dispatch(updateResources([project])); @@ -812,6 +853,8 @@ const groupContentsHandlers = unionize(groupContentsHandlersRecord); type GroupContentsHandler = UnionOf; +type CollectionCopyResource = Resource & { name: string; fromContextMenu: boolean }; + type MoveableResource = Resource & { name: string }; type MoveFunc = (