15768: made separate file for project panel action binding Arvados-DCO-1.1-Signed...
authorLisa Knox <lisaknox83@gmail.com>
Wed, 11 Oct 2023 13:21:05 +0000 (09:21 -0400)
committerLisa Knox <lisaknox83@gmail.com>
Wed, 11 Oct 2023 13:21:05 +0000 (09:21 -0400)
14 files changed:
src/store/collections/collection-move-actions.ts
src/store/data-explorer/data-explorer-action.ts
src/store/processes/process-move-actions.ts
src/store/processes/process-update-actions.ts
src/store/processes/processes-actions.ts
src/store/project-panel/project-panel-action-bind.ts [new file with mode: 0644]
src/store/project-panel/project-panel-action.ts
src/store/project-panel/project-panel-middleware-service.ts
src/store/projects/project-lock-actions.ts
src/store/projects/project-move-actions.ts
src/store/projects/project-update-actions.ts
src/store/trash/trash-actions.ts
src/store/workbench/workbench-actions.ts
src/websocket/websocket.ts

index 16d31405565a809e5c9abefa2194c5f9069b0920..56c7b24c60e0ca555e097df8c58072447bae098a 100644 (file)
@@ -9,8 +9,7 @@ import { ServiceRepository } from "services/services";
 import { RootState } from "store/store";
 import { getCommonResourceServiceError, CommonResourceServiceError } from "services/common-service/common-resource-service";
 import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
-import { projectPanelActions } from "store/data-explorer/data-explorer-action";
-// import { projectPanelActions } from 'store/project-panel/project-panel-action';
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
 import { MoveToFormDialogData } from "store/move-to-dialog/move-to-dialog";
 import { resetPickerProjectTree } from "store/project-tree-picker/project-tree-picker-actions";
 import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
index 483ec14c58f26610e00ec17a8e577330d607711e..f686c9393c2ce0933b5589ca86d9fdb3c62c8ce0 100644 (file)
@@ -52,6 +52,3 @@ export const bindDataExplorerActions = (id: string) => ({
     RESET_EXPLORER_SEARCH_VALUE: () => dataExplorerActions.RESET_EXPLORER_SEARCH_VALUE({ id }),
     SET_REQUEST_STATE: (payload: { requestState: DataTableRequestState }) => dataExplorerActions.SET_REQUEST_STATE({ ...payload, id }),
 });
-
-const PROJECT_PANEL_ID = "projectPanel";
-export const projectPanelActions = bindDataExplorerActions(PROJECT_PANEL_ID);
index 6f9e157f884dc039b7458514ca81bef4339f6ba1..c3ac75f99571cbae600d71a00d5064626a11b925 100644 (file)
@@ -11,8 +11,7 @@ import { getCommonResourceServiceError, CommonResourceServiceError } from "servi
 import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
 import { MoveToFormDialogData } from "store/move-to-dialog/move-to-dialog";
 import { resetPickerProjectTree } from "store/project-tree-picker/project-tree-picker-actions";
-// import { projectPanelActions } from 'store/project-panel/project-panel-action';
-import { projectPanelActions } from "store/data-explorer/data-explorer-action";
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
 import { getProcess } from "store/processes/process";
 import { initProjectsTreePicker } from "store/tree-picker/tree-picker-actions";
 
index c7fd1b55d4baf9ff5bde6f33dcae9b572c2bcf3c..c7bd2c7beeac61febd3d1747eacd26d025a86493 100644 (file)
@@ -3,14 +3,14 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { Dispatch } from "redux";
-import { FormErrors, initialize, startSubmit, stopSubmit } from 'redux-form';
+import { FormErrors, initialize, startSubmit, stopSubmit } from "redux-form";
 import { RootState } from "store/store";
 import { dialogActions } from "store/dialog/dialog-actions";
 import { getCommonResourceServiceError, CommonResourceServiceError } from "services/common-service/common-resource-service";
 import { ServiceRepository } from "services/services";
-import { getProcess } from 'store/processes/process';
-import { projectPanelActions } from 'store/project-panel/project-panel-action';
-import {snackbarActions, SnackbarKind} from 'store/snackbar/snackbar-actions';
+import { getProcess } from "store/processes/process";
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
+import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
 
 export interface ProcessUpdateFormDialogData {
     uuid: string;
@@ -18,34 +18,37 @@ export interface ProcessUpdateFormDialogData {
     description?: string;
 }
 
-export const PROCESS_UPDATE_FORM_NAME = 'processUpdateFormName';
+export const PROCESS_UPDATE_FORM_NAME = "processUpdateFormName";
 
-export const openProcessUpdateDialog = (resource: ProcessUpdateFormDialogData) =>
-    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+export const openProcessUpdateDialog =
+    (resource: ProcessUpdateFormDialogData) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const process = getProcess(resource.uuid)(getState().resources);
-        if(process) {
+        if (process) {
             dispatch(initialize(PROCESS_UPDATE_FORM_NAME, { ...resource, name: process.containerRequest.name }));
             dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_UPDATE_FORM_NAME, data: {} }));
         } else {
-            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process not found', hideDuration: 2000, kind: SnackbarKind.ERROR }));
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Process not found", hideDuration: 2000, kind: SnackbarKind.ERROR }));
         }
     };
 
-export const updateProcess = (resource: ProcessUpdateFormDialogData) =>
-    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+export const updateProcess =
+    (resource: ProcessUpdateFormDialogData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         dispatch(startSubmit(PROCESS_UPDATE_FORM_NAME));
         try {
-            const updatedProcess = await services.containerRequestService.update(resource.uuid, { name: resource.name, description: resource.description });
+            const updatedProcess = await services.containerRequestService.update(resource.uuid, {
+                name: resource.name,
+                description: resource.description,
+            });
             dispatch(projectPanelActions.REQUEST_ITEMS());
             dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_UPDATE_FORM_NAME }));
             return updatedProcess;
         } catch (e) {
             const error = getCommonResourceServiceError(e);
             if (error === CommonResourceServiceError.UNIQUE_NAME_VIOLATION) {
-                dispatch(stopSubmit(PROCESS_UPDATE_FORM_NAME, { name: 'Process with the same name already exists.' } as FormErrors));
+                dispatch(stopSubmit(PROCESS_UPDATE_FORM_NAME, { name: "Process with the same name already exists." } as FormErrors));
             } else {
                 dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_UPDATE_FORM_NAME }));
-                dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not update the process.', hideDuration: 2000, kind: SnackbarKind.ERROR }));
+                dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Could not update the process.", hideDuration: 2000, kind: SnackbarKind.ERROR }));
             }
             return;
         }
index 57dc7b171a2be9f3c62151e1f4090887a546c0c1..1cf5f49a76b853a00ea7efaf428300a159e41db6 100644 (file)
@@ -9,7 +9,7 @@ import { updateResources } from "store/resources/resources-actions";
 import { Process } from "./process";
 import { dialogActions } from "store/dialog/dialog-actions";
 import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
-import { projectPanelActions } from "store/data-explorer/data-explorer-action";
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
 import { navigateToRunProcess } from "store/navigation/navigation-action";
 import { goToStep, runProcessPanelActions } from "store/run-process-panel/run-process-panel-actions";
 import { getResource } from "store/resources/resources";
diff --git a/src/store/project-panel/project-panel-action-bind.ts b/src/store/project-panel/project-panel-action-bind.ts
new file mode 100644 (file)
index 0000000..31a5f8d
--- /dev/null
@@ -0,0 +1,9 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { bindDataExplorerActions } from "store/data-explorer/data-explorer-action";
+
+const PROJECT_PANEL_ID = "projectPanel";
+
+export const projectPanelActions = bindDataExplorerActions(PROJECT_PANEL_ID);
index 1a7caa6f6635aefb633381da50e38f84ad111f6c..305799e820f6c070a1797d457989ae022ff591c5 100644 (file)
@@ -3,12 +3,11 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { Dispatch } from "redux";
-import { bindDataExplorerActions } from "store/data-explorer/data-explorer-action";
 import { propertiesActions } from "store/properties/properties-actions";
 import { RootState } from "store/store";
 import { getProperty } from "store/properties/properties";
 import { loadProject } from "store/workbench/workbench-actions";
-import { projectPanelActions } from "store/data-explorer/data-explorer-action";
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
 
 export const PROJECT_PANEL_ID = "projectPanel";
 export const PROJECT_PANEL_CURRENT_UUID = "projectPanelCurrentUuid";
index 0eca18e2e53b21e5f97c824667031ca39d340f2c..7204993b5c2f9545077ff15243518df539a4fb2f 100644 (file)
@@ -18,7 +18,7 @@ import { FilterBuilder, joinFilters } from "services/api/filter-builder";
 import { GroupContentsResource, GroupContentsResourcePrefix } from "services/groups-service/groups-service";
 import { updateFavorites } from "store/favorites/favorites-actions";
 import { IS_PROJECT_PANEL_TRASHED, getProjectPanelCurrentUuid } from "store/project-panel/project-panel-action";
-import { projectPanelActions } from "store/data-explorer/data-explorer-action";
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
 import { Dispatch, MiddlewareAPI } from "redux";
 import { ProjectResource } from "models/project";
 import { updateResources } from "store/resources/resources-actions";
index 4a5cbfef34423d7759b8b4c832ff53642c8048e0..84f886d6db6026a9f3ce3636d75044451d4567d0 100644 (file)
@@ -4,7 +4,7 @@
 
 import { Dispatch } from "redux";
 import { ServiceRepository } from "services/services";
-import { projectPanelActions } from "store/data-explorer/data-explorer-action";
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
 import { loadResource } from "store/resources/resources-actions";
 import { RootState } from "store/store";
 
index 8fb0dc60574fc99343ab3202130057810e229b8b..97cd5dbe71280b464387ed83436e7d4d3e98f2cd 100644 (file)
@@ -12,7 +12,7 @@ import { getCommonResourceServiceError, CommonResourceServiceError } from "servi
 import { MoveToFormDialogData } from "store/move-to-dialog/move-to-dialog";
 import { resetPickerProjectTree } from "store/project-tree-picker/project-tree-picker-actions";
 import { initProjectsTreePicker } from "store/tree-picker/tree-picker-actions";
-import { projectPanelActions } from "store/data-explorer/data-explorer-action";
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
 import { loadSidePanelTreeProjects } from "../side-panel-tree/side-panel-tree-actions";
 
 export const PROJECT_MOVE_FORM_NAME = "projectMoveFormName";
index 057c7cfac59794b95dc7259b66c965551df5c28e..812490319aadd47620a142cc345cbe808d15c9ec 100644 (file)
@@ -3,22 +3,12 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { Dispatch } from "redux";
-import {
-    FormErrors,
-    formValueSelector,
-    initialize,
-    reset,
-    startSubmit,
-    stopSubmit
-} from 'redux-form';
+import { FormErrors, formValueSelector, initialize, reset, startSubmit, stopSubmit } from "redux-form";
 import { RootState } from "store/store";
 import { dialogActions } from "store/dialog/dialog-actions";
-import {
-    getCommonResourceServiceError,
-    CommonResourceServiceError
-} from "services/common-service/common-resource-service";
+import { getCommonResourceServiceError, CommonResourceServiceError } from "services/common-service/common-resource-service";
 import { ServiceRepository } from "services/services";
-import { projectPanelActions } from 'store/project-panel/project-panel-action';
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
 import { GroupClass } from "models/group";
 import { Participant } from "views-components/sharing-dialog/participant-select";
 import { ProjectProperties } from "./project-create-actions";
@@ -34,26 +24,27 @@ export interface ProjectUpdateFormDialogData {
     properties?: ProjectProperties;
 }
 
-export const PROJECT_UPDATE_FORM_NAME = 'projectUpdateFormName';
-export const PROJECT_UPDATE_PROPERTIES_FORM_NAME = 'projectUpdatePropertiesFormName';
+export const PROJECT_UPDATE_FORM_NAME = "projectUpdateFormName";
+export const PROJECT_UPDATE_PROPERTIES_FORM_NAME = "projectUpdatePropertiesFormName";
 export const PROJECT_UPDATE_FORM_SELECTOR = formValueSelector(PROJECT_UPDATE_FORM_NAME);
 
-export const openProjectUpdateDialog = (resource: ProjectUpdateFormDialogData) =>
-    (dispatch: Dispatch, getState: () => RootState) => {
-        // Get complete project resource from store to handle consumers passing in partial resources
-        const project = getResource<ProjectResource>(resource.uuid)(getState().resources);
-        dispatch(initialize(PROJECT_UPDATE_FORM_NAME, project));
-        dispatch(dialogActions.OPEN_DIALOG({
+export const openProjectUpdateDialog = (resource: ProjectUpdateFormDialogData) => (dispatch: Dispatch, getState: () => RootState) => {
+    // Get complete project resource from store to handle consumers passing in partial resources
+    const project = getResource<ProjectResource>(resource.uuid)(getState().resources);
+    dispatch(initialize(PROJECT_UPDATE_FORM_NAME, project));
+    dispatch(
+        dialogActions.OPEN_DIALOG({
             id: PROJECT_UPDATE_FORM_NAME,
             data: {
                 sourcePanel: GroupClass.PROJECT,
-            }
-        }));
-    };
+            },
+        })
+    );
+};
 
-export const updateProject = (project: ProjectUpdateFormDialogData) =>
-    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        const uuid = project.uuid || '';
+export const updateProject =
+    (project: ProjectUpdateFormDialogData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const uuid = project.uuid || "";
         dispatch(startSubmit(PROJECT_UPDATE_FORM_NAME));
         try {
             const updatedProject = await services.projectService.update(
@@ -63,7 +54,8 @@ export const updateProject = (project: ProjectUpdateFormDialogData) =>
                     description: project.description,
                     properties: project.properties,
                 },
-                false);
+                false
+            );
             dispatch(projectPanelActions.REQUEST_ITEMS());
             dispatch(reset(PROJECT_UPDATE_FORM_NAME));
             dispatch(dialogActions.CLOSE_DIALOG({ id: PROJECT_UPDATE_FORM_NAME }));
@@ -71,16 +63,17 @@ export const updateProject = (project: ProjectUpdateFormDialogData) =>
         } catch (e) {
             const error = getCommonResourceServiceError(e);
             if (error === CommonResourceServiceError.UNIQUE_NAME_VIOLATION) {
-                dispatch(stopSubmit(PROJECT_UPDATE_FORM_NAME, { name: 'Project with the same name already exists.' } as FormErrors));
+                dispatch(stopSubmit(PROJECT_UPDATE_FORM_NAME, { name: "Project with the same name already exists." } as FormErrors));
             } else {
                 dispatch(dialogActions.CLOSE_DIALOG({ id: PROJECT_UPDATE_FORM_NAME }));
-                const errMsg = e.errors
-                    ? e.errors.join('')
-                    : 'There was an error while updating the project';
-                dispatch(snackbarActions.OPEN_SNACKBAR({
-                    message: errMsg,
-                    hideDuration: 2000,
-                    kind: SnackbarKind.ERROR }));
+                const errMsg = e.errors ? e.errors.join("") : "There was an error while updating the project";
+                dispatch(
+                    snackbarActions.OPEN_SNACKBAR({
+                        message: errMsg,
+                        hideDuration: 2000,
+                        kind: SnackbarKind.ERROR,
+                    })
+                );
             }
             return;
         }
index 33442f465881ca9546720b99144c3cf9d1e75fdf..884293a90e57e4e914486fe864b9bb4ea9240473 100644 (file)
@@ -8,7 +8,7 @@ import { ServiceRepository } from "services/services";
 import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
 import { trashPanelActions } from "store/trash-panel/trash-panel-action";
 import { activateSidePanelTreeItem, loadSidePanelTreeProjects } from "store/side-panel-tree/side-panel-tree-actions";
-import { projectPanelActions } from "store/data-explorer/data-explorer-action";
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
 import { ResourceKind } from "models/resource";
 import { navigateTo, navigateToTrash } from "store/navigation/navigation-action";
 import { matchCollectionRoute } from "routes/routes";
index cd120f42ad0710bd9a13cf1ac74dc3ab7a8531d2..294aeaf849bc001d6b8ee043f84862c32b1b9734 100644 (file)
@@ -9,7 +9,7 @@ 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, setIsProjectPanelTrashed } from "store/project-panel/project-panel-action";
-import { projectPanelActions } from "store/data-explorer/data-explorer-action";
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
 import {
     activateSidePanelTreeItem,
     initSidePanelTree,
index 0a6a05df77ff947eb7101f73543dbb88461f14ef..a7be6ba1f9bee63471436bf4c15c6893ef7ca164 100644 (file)
@@ -12,7 +12,7 @@ import { loadProcess } from "store/processes/processes-actions";
 import { getProcess, getSubprocesses } from "store/processes/process";
 import { LogEventType } from "models/log";
 import { subprocessPanelActions } from "store/subprocess-panel/subprocess-panel-actions";
-import { projectPanelActions } from "store/data-explorer/data-explorer-action";
+import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
 import { getProjectPanelCurrentUuid } from "store/project-panel/project-panel-action";
 import { allProcessesPanelActions } from "store/all-processes-panel/all-processes-panel-action";
 import { loadCollection } from "store/workbench/workbench-actions";