setSidePanelBreadcrumbs,
setTrashBreadcrumbs
} from '~/store/breadcrumbs/breadcrumbs-actions';
-import { navigateTo } from '~/store/navigation/navigation-action';
+import { navigateTo, navigateToRootProject } 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';
import * as projectUpdateActions from '~/store/projects/project-update-actions';
import * as collectionCreateActions from '~/store/collections/collection-create-actions';
import * as collectionCopyActions from '~/store/collections/collection-copy-actions';
-import * as collectionUpdateActions from '~/store/collections/collection-update-actions';
import * as collectionMoveActions from '~/store/collections/collection-move-actions';
import * as processesActions from '~/store/processes/processes-actions';
import * as processMoveActions from '~/store/processes/process-move-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';
+import { collectionPanelFilesAction } from '../collection-panel/collection-panel-files/collection-panel-files-actions';
+import { createTree } from '~/models/tree';
export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
return progress ? progress.working : false;
};
-const handleFirstTimeLoad = (action: any) =>
+export const handleFirstTimeLoad = (action: any) =>
async (dispatch: Dispatch<any>, getState: () => RootState) => {
try {
await dispatch(action);
if (router.location) {
const match = matchRootRoute(router.location.pathname);
if (match) {
- dispatch<any>(navigateTo(user.uuid));
+ dispatch<any>(navigateToRootProject);
}
}
} else {
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
const userUuid = getUserUuid(getState());
if (userUuid) {
+ // Clear collection files panel
+ dispatch(collectionPanelFilesAction.SET_COLLECTION_FILES({ files: createTree() }));
const match = await loadGroupContentsResource({ uuid, userUuid, services });
match({
OWNED: async collection => {
dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
dispatch(updateResources([collection]));
- await dispatch(activateSidePanelTreeItem(collection.ownerUuid));
+ dispatch(activateSidePanelTreeItem(collection.ownerUuid));
dispatch(setSidePanelBreadcrumbs(collection.ownerUuid));
dispatch(loadCollectionPanel(collection.uuid));
},
}
};
-export const updateCollection = (data: collectionUpdateActions.CollectionUpdateFormDialogData) =>
- async (dispatch: Dispatch) => {
- try {
- const collection = await dispatch<any>(collectionUpdateActions.updateCollection(data));
- if (collection) {
- dispatch(snackbarActions.OPEN_SNACKBAR({
- message: "Collection has been successfully updated.",
- hideDuration: 2000,
- kind: SnackbarKind.SUCCESS
- }));
- dispatch<any>(updateResources([collection]));
- dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
- }
- } catch (e) {
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.errors.join(''), hideDuration: 2000, kind: SnackbarKind.ERROR }));
- }
- };
-
export const copyCollection = (data: CopyFormDialogData) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
try {
const process = await dispatch<any>(processesActions.loadProcess(uuid));
await dispatch<any>(activateSidePanelTreeItem(process.containerRequest.ownerUuid));
dispatch<any>(setProcessBreadcrumbs(uuid));
- dispatch(loadDetailsPanel(uuid));
+ dispatch<any>(loadDetailsPanel(uuid));
});
export const updateProcess = (data: processUpdateActions.ProcessUpdateFormDialogData) =>