X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/122fba47e0b0629ebb449c5206ba400021bc6de1..20844fff7469abc3caaf0e14c05741e0acc62611:/src/store/workbench/workbench-actions.ts diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts index 9917782a..dbf795b6 100644 --- a/src/store/workbench/workbench-actions.ts +++ b/src/store/workbench/workbench-actions.ts @@ -4,6 +4,7 @@ import { Dispatch } from 'redux'; import { RootState } from "~/store/store"; +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'; @@ -19,7 +20,7 @@ import { loadSidePanelTreeProjects, SidePanelTreeCategory } from '~/store/side-panel-tree/side-panel-tree-actions'; -import { loadResource, updateResources } from '~/store/resources/resources-actions'; +import { updateResources } from '~/store/resources/resources-actions'; import { projectPanelColumns } from '~/views/project-panel/project-panel'; import { favoritePanelColumns } from '~/views/favorite-panel/favorite-panel'; import { matchRootRoute } from '~/routes/routes'; @@ -32,7 +33,7 @@ import { setSidePanelBreadcrumbs, setTrashBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions'; -import { navigateToProject } from '~/store/navigation/navigation-action'; +import { navigateTo } from '~/store/navigation/navigation-action'; import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog'; import { ServiceRepository } from '~/services/services'; import { getResource } from '~/store/resources/resources'; @@ -96,6 +97,10 @@ import { loadPublicFavoritePanel, publicFavoritePanelActions } from '~/store/pub import { publicFavoritePanelColumns } from '~/views/public-favorites-panel/public-favorites-panel'; import { loadCollectionsContentAddressPanel, collectionsContentAddressActions } from '~/store/collections-content-address-panel/collections-content-address-panel-actions'; import { collectionContentAddressPanelColumns } from '~/views/collection-content-address-panel/collection-content-address-panel'; +import { subprocessPanelActions } from '~/store/subprocess-panel/subprocess-panel-actions'; +import { subprocessPanelColumns } from '~/views/subprocess-panel/subprocess-panel-root'; +import { loadAllProcessesPanel, allProcessesPanelActions } from '../all-processes-panel/all-processes-panel-action'; +import { allProcessesPanelColumns } from '~/views/all-processes-panel/all-processes-panel'; export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen'; @@ -123,6 +128,7 @@ export const loadWorkbench = () => if (user) { dispatch(projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns })); dispatch(favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns })); + dispatch(allProcessesPanelActions.SET_COLUMNS({ columns: allProcessesPanelColumns })); dispatch(publicFavoritePanelActions.SET_COLUMNS({ columns: publicFavoritePanelColumns })); dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns })); dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns })); @@ -136,6 +142,7 @@ export const loadWorkbench = () => dispatch(computeNodesActions.SET_COLUMNS({ columns: computeNodePanelColumns })); dispatch(apiClientAuthorizationsActions.SET_COLUMNS({ columns: apiClientAuthorizationPanelColumns })); dispatch(collectionsContentAddressActions.SET_COLUMNS({ columns: collectionContentAddressPanelColumns })); + dispatch(subprocessPanelActions.SET_COLUMNS({ columns: subprocessPanelColumns })); if (services.linkAccountService.getAccountToLink()) { dispatch(linkAccountPanelActions.HAS_SESSION_DATA()); @@ -145,7 +152,7 @@ export const loadWorkbench = () => if (router.location) { const match = matchRootRoute(router.location.pathname); if (match) { - dispatch(navigateToProject(user.uuid)); + dispatch(navigateTo(user.uuid)); } } } else { @@ -174,10 +181,19 @@ export const loadTrash = () => dispatch(setSidePanelBreadcrumbs(SidePanelTreeCategory.TRASH)); }); +export const loadAllProcesses = () => + handleFirstTimeLoad( + (dispatch: Dispatch) => { + dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.ALL_PROCESSES)); + dispatch(loadAllProcessesPanel()); + dispatch(setSidePanelBreadcrumbs(SidePanelTreeCategory.ALL_PROCESSES)); + } + ); + export const loadProject = (uuid: string) => handleFirstTimeLoad( async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - const userUuid = services.authService.getUuid(); + const userUuid = getUserUuid(getState()); dispatch(setIsProjectPanelTrashed(false)); if (userUuid) { if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) { @@ -260,7 +276,7 @@ export const updateProject = (data: projectUpdateActions.ProjectUpdateFormDialog export const loadCollection = (uuid: string) => handleFirstTimeLoad( async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - const userUuid = services.authService.getUuid(); + const userUuid = getUserUuid(getState()); if (userUuid) { const match = await loadGroupContentsResource({ uuid, userUuid, services }); match({ @@ -306,15 +322,19 @@ export const createCollection = (data: collectionCreateActions.CollectionCreateF export const updateCollection = (data: collectionUpdateActions.CollectionUpdateFormDialogData) => async (dispatch: Dispatch) => { - const collection = await dispatch(collectionUpdateActions.updateCollection(data)); - if (collection) { - dispatch(snackbarActions.OPEN_SNACKBAR({ - message: "Collection has been successfully updated.", - hideDuration: 2000, - kind: SnackbarKind.SUCCESS - })); - dispatch(updateResources([collection])); - dispatch(reloadProjectMatchingUuid([collection.ownerUuid])); + try { + const collection = await dispatch(collectionUpdateActions.updateCollection(data)); + if (collection) { + dispatch(snackbarActions.OPEN_SNACKBAR({ + message: "Collection has been successfully updated.", + hideDuration: 2000, + kind: SnackbarKind.SUCCESS + })); + dispatch(updateResources([collection])); + dispatch(reloadProjectMatchingUuid([collection.ownerUuid])); + } + } catch (e) { + dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.errors.join(''), hideDuration: 2000, kind: SnackbarKind.ERROR })); } };