Merge branch 'master'
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Wed, 12 Sep 2018 07:47:15 +0000 (09:47 +0200)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Wed, 12 Sep 2018 07:47:15 +0000 (09:47 +0200)
Feature #13751

Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>

1  2 
src/routes/routes.ts
src/store/workbench/workbench-actions.ts
src/views/workbench/workbench.tsx

diff --combined src/routes/routes.ts
index 107b9e6fb37bb88869b2b09d35dcceb19017a87c,29941b47e89989cec2417e653c8364fa5b3a21f7..fb28bd05bee5ff360c17cedd01bf2487d7cf4f22
@@@ -15,8 -15,7 +15,8 @@@ export const Routes = 
      PROCESSES: `/processes/:id(${RESOURCE_UUID_PATTERN})`,
      FAVORITES: '/favorites',
      TRASH: '/trash',
 -    PROCESS_LOGS: `/process-logs/:id(${RESOURCE_UUID_PATTERN})`
 +    PROCESS_LOGS: `/process-logs/:id(${RESOURCE_UUID_PATTERN})`,
 +    SHARED_WITH_ME: '/shared-with-me',
  };
  
  export const getResourceUrl = (uuid: string) => {
@@@ -26,6 -25,8 +26,8 @@@
              return getProjectUrl(uuid);
          case ResourceKind.COLLECTION:
              return getCollectionUrl(uuid);
+         case ResourceKind.PROCESS:
+             return getProcessUrl(uuid);
          default:
              return undefined;
      }
@@@ -59,6 -60,3 +61,6 @@@ export const matchProcessRoute = (route
  
  export const matchProcessLogRoute = (route: string) =>
      matchPath<ResourceRouteParams>(route, { path: Routes.PROCESS_LOGS });
 +
 +export const matchSharedWithMeRoute = (route: string) =>
 +    matchPath(route, { path: Routes.SHARED_WITH_ME });
index 7b8fdb25ad83f97ccf12260472e94f0758ed4f64,d1b0fae953281b562d7edebeb2c9c5d1bcf8435d..bb41fa28fc99c89eaf70933d98aa8ede644e1749
@@@ -29,13 -29,14 +29,17 @@@ import * as collectionCopyActions from 
  import * as collectionUpdateActions from '~/store/collections/collection-update-actions';
  import * as collectionMoveActions from '~/store/collections/collection-move-actions';
  import * as processesActions from '../processes/processes-actions';
+ import * as processMoveActions from '~/store/processes/process-move-actions';
+ import * as processUpdateActions from '~/store/processes/process-update-actions';
+ import * as processCopyActions from '~/store/processes/process-copy-actions';
  import { trashPanelColumns } from "~/views/trash-panel/trash-panel";
  import { loadTrashPanel, trashPanelActions } from "~/store/trash-panel/trash-panel-action";
  import { initProcessLogsPanel } from '../process-logs-panel/process-logs-panel-actions';
  import { loadProcessPanel } from '~/store/process-panel/process-panel-actions';
 +import { sharedWithMePanelActions } from '~/store/shared-with-me-panel/shared-with-me-panel-actions';
 +import { loadSharedWithMePanel } from '../shared-with-me-panel/shared-with-me-panel-actions';
 +
+ import { CopyFormDialogData } from '~/store/copy-dialog/copy-dialog';
  
  export const loadWorkbench = () =>
      async (dispatch: Dispatch, getState: () => RootState) => {
@@@ -47,7 -48,6 +51,7 @@@
                  dispatch(projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
                  dispatch(favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns }));
                  dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns }));
 +                dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
                  dispatch<any>(initSidePanelTree());
                  if (router.location) {
                      const match = matchRootRoute(router.location.pathname);
@@@ -79,9 -79,9 +83,9 @@@ export const loadTrash = () =
  
  export const loadProject = (uuid: string) =>
      async (dispatch: Dispatch) => {
 +        dispatch<any>(openProjectPanel(uuid));
          await dispatch<any>(activateSidePanelTreeItem(uuid));
          dispatch<any>(setProjectBreadcrumbs(uuid));
 -        dispatch<any>(openProjectPanel(uuid));
          dispatch(loadDetailsPanel(uuid));
      };
  
@@@ -163,7 -163,7 +167,7 @@@ export const updateCollection = (data: 
          }
      };
  
- export const copyCollection = (data: collectionCopyActions.CollectionCopyFormDialogData) =>
+ export const copyCollection = (data: CopyFormDialogData) =>
      async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
          try {
              const collection = await dispatch<any>(collectionCopyActions.copyCollection(data));
@@@ -197,6 -197,47 +201,47 @@@ export const loadProcess = (uuid: strin
  
      };
  
+ export const updateProcess = (data: processUpdateActions.ProcessUpdateFormDialogData) =>
+     async (dispatch: Dispatch) => {
+         try {
+             const process = await dispatch<any>(processUpdateActions.updateProcess(data));
+             if (process) {
+                 dispatch(snackbarActions.OPEN_SNACKBAR({
+                     message: "Process has been successfully updated.",
+                     hideDuration: 2000
+                 }));
+                 dispatch<any>(updateResources([process]));
+                 dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
+             }
+         } catch (e) {
+             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
+         }
+     };
+ export const moveProcess = (data: MoveToFormDialogData) =>
+     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+         try {
+             const process = await dispatch<any>(processMoveActions.moveProcess(data));
+             dispatch<any>(updateResources([process]));
+             dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
+             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process has been moved.', hideDuration: 2000 }));
+         } catch (e) {
+             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
+         }
+     };
+ export const copyProcess = (data: CopyFormDialogData) =>
+     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+         try {
+             const process = await dispatch<any>(processCopyActions.copyProcess(data));
+             dispatch<any>(updateResources([process]));
+             dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
+             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process has been copied.', hideDuration: 2000 }));
+         } catch (e) {
+             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
+         }
+     };
  export const loadProcessLog = (uuid: string) =>
      async (dispatch: Dispatch) => {
          const process = await dispatch<any>(processesActions.loadProcess(uuid));
@@@ -225,9 -266,3 +270,9 @@@ export const reloadProjectMatchingUuid 
              dispatch<any>(loadProject(currentProjectPanelUuid));
          }
      };
 +
 +export const loadSharedWithMe = (dispatch: Dispatch) => {
 +    dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.SHARED_WITH_ME));
 +    dispatch<any>(loadSharedWithMePanel());
 +    dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.SHARED_WITH_ME));
 +};
index e075680de4981262cc4147eb61f755d9069646d2,5c4648b6d35810e63520943c7b922fc9205792d1..fee7652b0ae89fbd619037ecfa6fc81855cd75a3
@@@ -30,17 -30,19 +30,20 @@@ import { ProcessLogPanel } from '~/view
  import { CreateProjectDialog } from '~/views-components/dialog-forms/create-project-dialog';
  import { CreateCollectionDialog } from '~/views-components/dialog-forms/create-collection-dialog';
  import { CopyCollectionDialog } from '~/views-components/dialog-forms/copy-collection-dialog';
+ import { CopyProcessDialog } from '~/views-components/dialog-forms/copy-process-dialog';
  import { UpdateCollectionDialog } from '~/views-components/dialog-forms/update-collection-dialog';
+ import { UpdateProcessDialog } from '~/views-components/dialog-forms/update-process-dialog';
  import { UpdateProjectDialog } from '~/views-components/dialog-forms/update-project-dialog';
+ import { MoveProcessDialog } from '~/views-components/dialog-forms/move-process-dialog';
  import { MoveProjectDialog } from '~/views-components/dialog-forms/move-project-dialog';
  import { MoveCollectionDialog } from '~/views-components/dialog-forms/move-collection-dialog';
  import { FilesUploadCollectionDialog } from '~/views-components/dialog-forms/files-upload-collection-dialog';
  import { PartialCopyCollectionDialog } from '~/views-components/dialog-forms/partial-copy-collection-dialog';
  import { TrashPanel } from "~/views/trash-panel/trash-panel";
- import { MainContentBar } from '../../views-components/main-content-bar/main-content-bar';
+ import { MainContentBar } from '~/views-components/main-content-bar/main-content-bar';
  import { Grid } from '@material-ui/core';
 +import { SharedWithMePanel } from '../shared-with-me-panel/shared-with-me-panel';
+ import { ProcessCommandDialog } from '~/views-components/process-command-dialog/process-command-dialog';
  
  type CssRules = 'root' | 'contentWrapper' | 'content' | 'appBar';
  
@@@ -134,7 -136,6 +137,7 @@@ export const Workbench = withStyles(sty
                                              <Route path={Routes.PROCESSES} component={ProcessPanel} />
                                              <Route path={Routes.TRASH} component={TrashPanel} />
                                              <Route path={Routes.PROCESS_LOGS} component={ProcessLogPanel} />
 +                                            <Route path={Routes.SHARED_WITH_ME} component={SharedWithMePanel} />
                                          </Switch>
                                      </Grid>
                                  </Grid>
                              </Grid>}
                      </Grid>
                      <ContextMenu />
-                     <Snackbar />
-                     <CreateProjectDialog />
+                     <CopyCollectionDialog />
+                     <CopyProcessDialog />
                      <CreateCollectionDialog />
-                     <RenameFileDialog />
-                     <PartialCopyCollectionDialog />
+                     <CreateProjectDialog />
+                     <CurrentTokenDialog />
                      <FileRemoveDialog />
-                     <CopyCollectionDialog />
                      <FileRemoveDialog />
-                     <MultipleFilesRemoveDialog />
-                     <UpdateCollectionDialog />
                      <FilesUploadCollectionDialog />
-                     <UpdateProjectDialog />
                      <MoveCollectionDialog />
+                     <MoveProcessDialog />
                      <MoveProjectDialog />
-                     <CurrentTokenDialog />
+                     <MultipleFilesRemoveDialog />
+                     <PartialCopyCollectionDialog />
+                     <ProcessCommandDialog />
+                     <RenameFileDialog />
+                     <Snackbar />
+                     <UpdateCollectionDialog />
+                     <UpdateProcessDialog />
+                     <UpdateProjectDialog />
                  </>;
              }