[arvados-workbench2] updated: 2.6.0-98-gd4896785

git repository hosting git at public.arvados.org
Thu Sep 14 14:11:01 UTC 2023


Summary of changes:
 src/index.tsx                                      | 285 ++++++++++++---------
 src/store/trash/trash-actions.ts                   |  16 +-
 .../action-sets/collection-action-set.ts           |   8 +-
 3 files changed, 177 insertions(+), 132 deletions(-)

       via  d4896785f36c82edc5fbf14a2e58d94623c09c1c (commit)
      from  6b9cb4f828257684edba0809461fa2f508d20f15 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit d4896785f36c82edc5fbf14a2e58d94623c09c1c
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Thu Sep 14 10:10:42 2023 -0400

    15768: fixed 422 err showing in browser Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/src/index.tsx b/src/index.tsx
index 244d1387..f2c06666 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -2,71 +2,90 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import React from 'react';
-import ReactDOM from 'react-dom';
+import React from "react";
+import ReactDOM from "react-dom";
 import { Provider } from "react-redux";
-import { MainPanel } from 'views/main-panel/main-panel';
-import 'index.css';
-import { Route, Switch } from 'react-router';
+import { MainPanel } from "views/main-panel/main-panel";
+import "index.css";
+import { Route, Switch } from "react-router";
 import { createBrowserHistory } from "history";
 import { History } from "history";
-import { configureStore, RootStore } from 'store/store';
+import { configureStore, RootStore } from "store/store";
 import { ConnectedRouter } from "react-router-redux";
 import { ApiToken } from "views-components/api-token/api-token";
 import { AddSession } from "views-components/add-session/add-session";
 import { initAuth, logout } from "store/auth/auth-action";
 import { createServices } from "services/services";
-import { MuiThemeProvider } from '@material-ui/core/styles';
-import { CustomTheme } from 'common/custom-theme';
-import { fetchConfig } from 'common/config';
-import servicesProvider from 'common/service-provider';
-import { addMenuActionSet, ContextMenuKind } from 'views-components/context-menu/context-menu';
+import { MuiThemeProvider } from "@material-ui/core/styles";
+import { CustomTheme } from "common/custom-theme";
+import { fetchConfig } from "common/config";
+import servicesProvider from "common/service-provider";
+import { addMenuActionSet, ContextMenuKind } from "views-components/context-menu/context-menu";
 import { rootProjectActionSet } from "views-components/context-menu/action-sets/root-project-action-set";
-import { filterGroupActionSet, frozenActionSet, projectActionSet, readOnlyProjectActionSet } from "views-components/context-menu/action-sets/project-action-set";
-import { resourceActionSet } from 'views-components/context-menu/action-sets/resource-action-set';
+import {
+    filterGroupActionSet,
+    frozenActionSet,
+    projectActionSet,
+    readOnlyProjectActionSet,
+} from "views-components/context-menu/action-sets/project-action-set";
+import { resourceActionSet } from "views-components/context-menu/action-sets/resource-action-set";
 import { favoriteActionSet } from "views-components/context-menu/action-sets/favorite-action-set";
-import { collectionFilesActionSet, readOnlyCollectionFilesActionSet } from 'views-components/context-menu/action-sets/collection-files-action-set';
-import { collectionDirectoryItemActionSet, collectionFileItemActionSet, readOnlyCollectionDirectoryItemActionSet, readOnlyCollectionFileItemActionSet } from 'views-components/context-menu/action-sets/collection-files-item-action-set';
-import { collectionFilesNotSelectedActionSet } from 'views-components/context-menu/action-sets/collection-files-not-selected-action-set';
-import { collectionActionSet, collectionAdminActionSet, oldCollectionVersionActionSet, readOnlyCollectionActionSet } from 'views-components/context-menu/action-sets/collection-action-set';
-import { loadWorkbench } from 'store/workbench/workbench-actions';
-import { Routes } from 'routes/routes';
+import { collectionFilesActionSet, readOnlyCollectionFilesActionSet } from "views-components/context-menu/action-sets/collection-files-action-set";
+import {
+    collectionDirectoryItemActionSet,
+    collectionFileItemActionSet,
+    readOnlyCollectionDirectoryItemActionSet,
+    readOnlyCollectionFileItemActionSet,
+} from "views-components/context-menu/action-sets/collection-files-item-action-set";
+import { collectionFilesNotSelectedActionSet } from "views-components/context-menu/action-sets/collection-files-not-selected-action-set";
+import {
+    collectionActionSet,
+    collectionAdminActionSet,
+    oldCollectionVersionActionSet,
+    readOnlyCollectionActionSet,
+} from "views-components/context-menu/action-sets/collection-action-set";
+import { loadWorkbench } from "store/workbench/workbench-actions";
+import { Routes } from "routes/routes";
 import { trashActionSet } from "views-components/context-menu/action-sets/trash-action-set";
-import { ServiceRepository } from 'services/services';
-import { initWebSocket } from 'websocket/websocket';
-import { Config } from 'common/config';
-import { addRouteChangeHandlers } from './routes/route-change-handlers';
-import { setTokenDialogApiHost } from 'store/token-dialog/token-dialog-actions';
+import { ServiceRepository } from "services/services";
+import { initWebSocket } from "websocket/websocket";
+import { Config } from "common/config";
+import { addRouteChangeHandlers } from "./routes/route-change-handlers";
+import { setTokenDialogApiHost } from "store/token-dialog/token-dialog-actions";
 import {
     processResourceActionSet,
     processResourceAdminActionSet,
-    readOnlyProcessResourceActionSet
-} from 'views-components/context-menu/action-sets/process-resource-action-set';
-import { progressIndicatorActions } from 'store/progress-indicator/progress-indicator-actions';
-import { trashedCollectionActionSet } from 'views-components/context-menu/action-sets/trashed-collection-action-set';
-import { setBuildInfo } from 'store/app-info/app-info-actions';
-import { getBuildInfo } from 'common/app-info';
-import { DragDropContextProvider } from 'react-dnd';
-import HTML5Backend from 'react-dnd-html5-backend';
-import { initAdvancedFormProjectsTree } from 'store/search-bar/search-bar-actions';
-import { repositoryActionSet } from 'views-components/context-menu/action-sets/repository-action-set';
-import { sshKeyActionSet } from 'views-components/context-menu/action-sets/ssh-key-action-set';
-import { keepServiceActionSet } from 'views-components/context-menu/action-sets/keep-service-action-set';
-import { loadVocabulary } from 'store/vocabulary/vocabulary-actions';
-import { virtualMachineActionSet } from 'views-components/context-menu/action-sets/virtual-machine-action-set';
-import { userActionSet } from 'views-components/context-menu/action-sets/user-action-set';
-import { apiClientAuthorizationActionSet } from 'views-components/context-menu/action-sets/api-client-authorization-action-set';
-import { groupActionSet } from 'views-components/context-menu/action-sets/group-action-set';
-import { groupMemberActionSet } from 'views-components/context-menu/action-sets/group-member-action-set';
-import { linkActionSet } from 'views-components/context-menu/action-sets/link-action-set';
-import { loadFileViewersConfig } from 'store/file-viewers/file-viewers-actions';
-import { filterGroupAdminActionSet, frozenAdminActionSet, projectAdminActionSet } from 'views-components/context-menu/action-sets/project-admin-action-set';
-import { permissionEditActionSet } from 'views-components/context-menu/action-sets/permission-edit-action-set';
-import { workflowActionSet } from 'views-components/context-menu/action-sets/workflow-action-set';
+    readOnlyProcessResourceActionSet,
+} from "views-components/context-menu/action-sets/process-resource-action-set";
+import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
+import { trashedCollectionActionSet } from "views-components/context-menu/action-sets/trashed-collection-action-set";
+import { setBuildInfo } from "store/app-info/app-info-actions";
+import { getBuildInfo } from "common/app-info";
+import { DragDropContextProvider } from "react-dnd";
+import HTML5Backend from "react-dnd-html5-backend";
+import { initAdvancedFormProjectsTree } from "store/search-bar/search-bar-actions";
+import { repositoryActionSet } from "views-components/context-menu/action-sets/repository-action-set";
+import { sshKeyActionSet } from "views-components/context-menu/action-sets/ssh-key-action-set";
+import { keepServiceActionSet } from "views-components/context-menu/action-sets/keep-service-action-set";
+import { loadVocabulary } from "store/vocabulary/vocabulary-actions";
+import { virtualMachineActionSet } from "views-components/context-menu/action-sets/virtual-machine-action-set";
+import { userActionSet } from "views-components/context-menu/action-sets/user-action-set";
+import { apiClientAuthorizationActionSet } from "views-components/context-menu/action-sets/api-client-authorization-action-set";
+import { groupActionSet } from "views-components/context-menu/action-sets/group-action-set";
+import { groupMemberActionSet } from "views-components/context-menu/action-sets/group-member-action-set";
+import { linkActionSet } from "views-components/context-menu/action-sets/link-action-set";
+import { loadFileViewersConfig } from "store/file-viewers/file-viewers-actions";
+import {
+    filterGroupAdminActionSet,
+    frozenAdminActionSet,
+    projectAdminActionSet,
+} from "views-components/context-menu/action-sets/project-admin-action-set";
+import { permissionEditActionSet } from "views-components/context-menu/action-sets/permission-edit-action-set";
+import { workflowActionSet } from "views-components/context-menu/action-sets/workflow-action-set";
 import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
-import { openNotFoundDialog } from './store/not-found-panel/not-found-panel-action';
-import { storeRedirects } from './common/redirect-to';
-import { searchResultsActionSet } from 'views-components/context-menu/action-sets/search-results-action-set';
+import { openNotFoundDialog } from "./store/not-found-panel/not-found-panel-action";
+import { storeRedirects } from "./common/redirect-to";
+import { searchResultsActionSet } from "views-components/context-menu/action-sets/search-results-action-set";
 
 console.log(`Starting arvados [${getBuildInfo()}]`);
 
@@ -111,84 +130,106 @@ addMenuActionSet(ContextMenuKind.SEARCH_RESULTS, searchResultsActionSet);
 
 storeRedirects();
 
-fetchConfig()
-    .then(({ config, apiHost }) => {
-        const history = createBrowserHistory();
-
-        // Provide browser's history access to Cypress to allow programmatic
-        // navigation.
-        if ((window as any).Cypress) {
-            (window as any).appHistory = history;
-        }
-
-        const services = createServices(config, {
-            progressFn: (id, working) => {
-                store.dispatch(progressIndicatorActions.TOGGLE_WORKING({ id, working }));
-            },
-            errorFn: (id, error, showSnackBar: boolean) => {
-                if (showSnackBar) {
-                    console.error("Backend error:", error);
-
-                    if (error.status === 404) {
-                        store.dispatch(openNotFoundDialog());
-                    } else if (error.status === 401 && error.errors[0].indexOf("Not logged in") > -1) {
-                        // Catch auth errors when navigating and redirect to login preserving url location
-                        store.dispatch(logout(false, true));
-                    } else {
-                        store.dispatch(snackbarActions.OPEN_SNACKBAR({
-                            message: `${error.errors
-                                ? error.errors[0]
-                                : error.message}`,
+fetchConfig().then(({ config, apiHost }) => {
+    const history = createBrowserHistory();
+
+    // Provide browser's history access to Cypress to allow programmatic
+    // navigation.
+    if ((window as any).Cypress) {
+        (window as any).appHistory = history;
+    }
+
+    const services = createServices(config, {
+        progressFn: (id, working) => {
+            store.dispatch(progressIndicatorActions.TOGGLE_WORKING({ id, working }));
+        },
+        errorFn: (id, error, showSnackBar: boolean) => {
+            if (showSnackBar) {
+                console.error("Backend error:", error);
+
+                if (error.status === 404) {
+                    store.dispatch(openNotFoundDialog());
+                } else if (error.status === 401 && error.errors[0].indexOf("Not logged in") > -1) {
+                    // Catch auth errors when navigating and redirect to login preserving url location
+                    store.dispatch(logout(false, true));
+                } else if (error.status !== 422) {
+                    store.dispatch(
+                        snackbarActions.OPEN_SNACKBAR({
+                            message: `${error.errors ? error.errors[0] : error.message}`,
                             kind: SnackbarKind.ERROR,
-                            hideDuration: 8000
+                            hideDuration: 8000,
                         })
-                        );
-                    }
+                    );
                 }
             }
-        });
-
-        // be sure this is initiated before the app starts
-        servicesProvider.setServices(services);
-
-        const store = configureStore(history, services, config);
-
-        servicesProvider.setStore(store);
-
-        store.subscribe(initListener(history, store, services, config));
-        store.dispatch(initAuth(config));
-        store.dispatch(setBuildInfo());
-        store.dispatch(setTokenDialogApiHost(apiHost));
-        store.dispatch(loadVocabulary);
-        store.dispatch(loadFileViewersConfig);
-
-        const TokenComponent = (props: any) => <ApiToken authService={services.authService} config={config} loadMainApp={true} {...props} />;
-        const AddSessionComponent = (props: any) => <AddSession {...props} />;
-        const FedTokenComponent = (props: any) => <ApiToken authService={services.authService} config={config} loadMainApp={false} {...props} />;
-        const MainPanelComponent = (props: any) => <MainPanel {...props} />;
-
-        const App = () =>
-            <MuiThemeProvider theme={CustomTheme}>
-                <DragDropContextProvider backend={HTML5Backend}>
-                    <Provider store={store}>
-                        <ConnectedRouter history={history}>
-                            <Switch>
-                                <Route path={Routes.TOKEN} component={TokenComponent} />
-                                <Route path={Routes.FED_LOGIN} component={FedTokenComponent} />
-                                <Route path={Routes.ADD_SESSION} component={AddSessionComponent} />
-                                <Route path={Routes.ROOT} component={MainPanelComponent} />
-                            </Switch>
-                        </ConnectedRouter>
-                    </Provider>
-                </DragDropContextProvider>
-            </MuiThemeProvider>;
-
-        ReactDOM.render(
-            <App />,
-            document.getElementById('root') as HTMLElement
-        );
+        },
     });
 
+    // be sure this is initiated before the app starts
+    servicesProvider.setServices(services);
+
+    const store = configureStore(history, services, config);
+
+    servicesProvider.setStore(store);
+
+    store.subscribe(initListener(history, store, services, config));
+    store.dispatch(initAuth(config));
+    store.dispatch(setBuildInfo());
+    store.dispatch(setTokenDialogApiHost(apiHost));
+    store.dispatch(loadVocabulary);
+    store.dispatch(loadFileViewersConfig);
+
+    const TokenComponent = (props: any) => (
+        <ApiToken
+            authService={services.authService}
+            config={config}
+            loadMainApp={true}
+            {...props}
+        />
+    );
+    const AddSessionComponent = (props: any) => <AddSession {...props} />;
+    const FedTokenComponent = (props: any) => (
+        <ApiToken
+            authService={services.authService}
+            config={config}
+            loadMainApp={false}
+            {...props}
+        />
+    );
+    const MainPanelComponent = (props: any) => <MainPanel {...props} />;
+
+    const App = () => (
+        <MuiThemeProvider theme={CustomTheme}>
+            <DragDropContextProvider backend={HTML5Backend}>
+                <Provider store={store}>
+                    <ConnectedRouter history={history}>
+                        <Switch>
+                            <Route
+                                path={Routes.TOKEN}
+                                component={TokenComponent}
+                            />
+                            <Route
+                                path={Routes.FED_LOGIN}
+                                component={FedTokenComponent}
+                            />
+                            <Route
+                                path={Routes.ADD_SESSION}
+                                component={AddSessionComponent}
+                            />
+                            <Route
+                                path={Routes.ROOT}
+                                component={MainPanelComponent}
+                            />
+                        </Switch>
+                    </ConnectedRouter>
+                </Provider>
+            </DragDropContextProvider>
+        </MuiThemeProvider>
+    );
+
+    ReactDOM.render(<App />, document.getElementById("root") as HTMLElement);
+});
+
 const initListener = (history: History, store: RootStore, services: ServiceRepository, config: Config) => {
     let initialized = false;
     return async () => {
diff --git a/src/store/trash/trash-actions.ts b/src/store/trash/trash-actions.ts
index e999719d..ffdad04a 100644
--- a/src/store/trash/trash-actions.ts
+++ b/src/store/trash/trash-actions.ts
@@ -27,11 +27,18 @@ export const toggleProjectTrashed =
                 dispatch<any>(activateSidePanelTreeItem(uuid));
             } else {
                 errorMessage = "Could not move project to trash";
-                successMessage = "Added to trash";
+                successMessage = "Added project to trash";
                 await services.groupsService.trash(uuid);
                 dispatch<any>(loadSidePanelTreeProjects(ownerUuid));
                 dispatch<any>(navigateTo(ownerUuid));
             }
+            dispatch(
+                snackbarActions.OPEN_SNACKBAR({
+                    message: successMessage,
+                    hideDuration: 2000,
+                    kind: SnackbarKind.SUCCESS,
+                })
+            );
         } catch (e) {
             dispatch(
                 snackbarActions.OPEN_SNACKBAR({
@@ -40,13 +47,6 @@ export const toggleProjectTrashed =
                 })
             );
         }
-        dispatch(
-            snackbarActions.OPEN_SNACKBAR({
-                message: successMessage,
-                hideDuration: 2000,
-                kind: SnackbarKind.SUCCESS,
-            })
-        );
     };
 
 export const toggleCollectionTrashed =
diff --git a/src/views-components/context-menu/action-sets/collection-action-set.ts b/src/views-components/context-menu/action-sets/collection-action-set.ts
index 55da6676..86c850f0 100644
--- a/src/views-components/context-menu/action-sets/collection-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-action-set.ts
@@ -127,7 +127,9 @@ export const collectionActionSet: ContextMenuActionSet = [
             component: ToggleTrashAction,
             name: "ToggleTrashAction",
             execute: (dispatch, resources: ContextMenuResource[]) => {
-                resources.forEach(resource => dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!)));
+                for (const resource of resources) {
+                    dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
+                }
             },
         },
     ],
@@ -157,7 +159,9 @@ export const oldCollectionVersionActionSet: ContextMenuActionSet = [
             icon: RestoreVersionIcon,
             name: "Restore version",
             execute: (dispatch, resources) => {
-                resources.forEach(({ uuid }) => dispatch<any>(openRestoreCollectionVersionDialog(uuid)));
+                for (const resource of resources) {
+                    dispatch<any>(openRestoreCollectionVersionDialog(resource.uuid));
+                }
             },
         },
     ],

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list