[ARVADOS-WORKBENCH2] created: 2.1.0-376-g55b961b8

Git user git at public.arvados.org
Thu May 13 14:46:40 UTC 2021


        at  55b961b8fb542c624725756d93c8eb5777211b72 (commit)


commit 55b961b8fb542c624725756d93c8eb5777211b72
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Wed May 12 18:34:34 2021 -0300

    17637: Fixes error snackbar when untrashing collection fails.
    
    Also, removes superfluous "About to do X..." snackbar messages on collection
    trash/untrash operations.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/src/store/trash/trash-actions.ts b/src/store/trash/trash-actions.ts
index 690f824d..5d654b76 100644
--- a/src/store/trash/trash-actions.ts
+++ b/src/store/trash/trash-actions.ts
@@ -50,36 +50,35 @@ export const toggleProjectTrashed = (uuid: string, ownerUuid: string, isTrashed:
 
 export const toggleCollectionTrashed = (uuid: string, isTrashed: boolean) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
+        let errorMessage = '';
+        let successMessage = '';
         try {
             if (isTrashed) {
                 const { location } = getState().router;
-                dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Restoring from trash...", kind: SnackbarKind.INFO }));
+                errorMessage = "Could not restore collection from trash";
+                successMessage = "Restored from trash";
                 await services.collectionService.untrash(uuid);
                 if (matchCollectionRoute(location ? location.pathname : '')) {
                     dispatch(navigateToTrash);
                 }
                 dispatch(trashPanelActions.REQUEST_ITEMS());
-                dispatch(snackbarActions.OPEN_SNACKBAR({
-                    message: "Restored from trash",
-                    hideDuration: 2000,
-                    kind: SnackbarKind.SUCCESS
-                }));
             } else {
-                dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Moving to trash...", kind: SnackbarKind.INFO }));
+                errorMessage = "Could not move collection to trash";
+                successMessage = "Added to trash";
                 await services.collectionService.trash(uuid);
                 dispatch(projectPanelActions.REQUEST_ITEMS());
-                dispatch(snackbarActions.OPEN_SNACKBAR({
-                    message: "Added to trash",
-                    hideDuration: 2000,
-                    kind: SnackbarKind.SUCCESS
-                }));
             }
         } catch (e) {
             dispatch(snackbarActions.OPEN_SNACKBAR({
-                message: "Could not move collection to trash",
+                message: errorMessage,
                 kind: SnackbarKind.ERROR
             }));
         }
+        dispatch(snackbarActions.OPEN_SNACKBAR({
+            message: successMessage,
+            hideDuration: 2000,
+            kind: SnackbarKind.SUCCESS
+        }));
     };
 
 export const toggleTrashed = (kind: ResourceKind, uuid: string, ownerUuid: string, isTrashed: boolean) =>

commit ea66f8c38e160e47975be9680ebea8878343a13b
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Wed May 12 18:15:50 2021 -0300

    17637: Takes the user to the recently untrashed project.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/src/store/trash/trash-actions.ts b/src/store/trash/trash-actions.ts
index 6a33e6a0..690f824d 100644
--- a/src/store/trash/trash-actions.ts
+++ b/src/store/trash/trash-actions.ts
@@ -22,8 +22,8 @@ export const toggleProjectTrashed = (uuid: string, ownerUuid: string, isTrashed:
                 errorMessage = "Could not restore project from trash";
                 successMessage = "Restored from trash";
                 await services.groupsService.untrash(uuid);
+                dispatch<any>(navigateTo(uuid));
                 dispatch<any>(activateSidePanelTreeItem(uuid));
-                dispatch(trashPanelActions.REQUEST_ITEMS());
             } else {
                 errorMessage = "Could not move project to trash";
                 successMessage = "Added to trash";

commit d3fbf11edf795080d6a7bf8276d92cfcc679b9ed
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Wed May 12 17:59:08 2021 -0300

    17637: Fixed function to (re)load projects on side panel.
    
    This fix makes the recently trashed project to dissapear from the left side
    tree.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts
index b889f7cb..3a37be71 100644
--- a/src/store/project-panel/project-panel-middleware-service.ts
+++ b/src/store/project-panel/project-panel-middleware-service.ts
@@ -23,7 +23,7 @@ import { ProjectResource } from "~/models/project";
 import { updateResources } from "~/store/resources/resources-actions";
 import { getProperty } from "~/store/properties/properties";
 import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
-import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions.ts';
+import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
 import { DataExplorer, getDataExplorer } from '~/store/data-explorer/data-explorer-reducer';
 import { ListResults } from '~/services/common-service/common-service';
 import { loadContainers } from '~/store/processes/processes-actions';
diff --git a/src/store/side-panel-tree/side-panel-tree-actions.ts b/src/store/side-panel-tree/side-panel-tree-actions.ts
index 6152b99f..ede4c00c 100644
--- a/src/store/side-panel-tree/side-panel-tree-actions.ts
+++ b/src/store/side-panel-tree/side-panel-tree-actions.ts
@@ -97,7 +97,7 @@ export const loadSidePanelTreeProjects = (projectUuid: string) =>
         const node = treePicker ? getNode(projectUuid)(treePicker) : undefined;
         if (projectUuid === SidePanelTreeCategory.SHARED_WITH_ME) {
             await dispatch<any>(loadSharedRoot);
-        } else if (node || projectUuid === '') {
+        } else if (node || projectUuid !== '') {
             await dispatch<any>(loadProject(projectUuid));
         }
     };

commit de3b8d1fa96ec9a5d28b05dade868abf8132904b
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Wed May 12 17:54:06 2021 -0300

    17637: Fixes supurious "not found" error when trashing project being viewed.
    
    Also, fixed error snackbar when an untrash operation fails.
    Also, removed superfluous "about to do X..." snackbar messages.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/src/store/trash/trash-actions.ts b/src/store/trash/trash-actions.ts
index b810b1e4..6a33e6a0 100644
--- a/src/store/trash/trash-actions.ts
+++ b/src/store/trash/trash-actions.ts
@@ -8,41 +8,44 @@ 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/project-panel/project-panel-action";
+import { getProjectPanelCurrentUuid, projectPanelActions } from "~/store/project-panel/project-panel-action";
 import { ResourceKind } from "~/models/resource";
-import { navigateToTrash } from '~/store/navigation/navigation-action';
+import { navigateTo, navigateToTrash } from '~/store/navigation/navigation-action';
 import { matchCollectionRoute } from '~/routes/routes';
 
 export const toggleProjectTrashed = (uuid: string, ownerUuid: string, isTrashed: boolean) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
+        let errorMessage = '';
+        let successMessage = '';
         try {
             if (isTrashed) {
-                dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Restoring from trash...", kind: SnackbarKind.INFO }));
+                errorMessage = "Could not restore project from trash";
+                successMessage = "Restored from trash";
                 await services.groupsService.untrash(uuid);
                 dispatch<any>(activateSidePanelTreeItem(uuid));
                 dispatch(trashPanelActions.REQUEST_ITEMS());
-                dispatch(snackbarActions.OPEN_SNACKBAR({
-                    message: "Restored from trash",
-                    hideDuration: 2000,
-                    kind: SnackbarKind.SUCCESS
-                }));
             } else {
-                dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Moving to trash...", kind: SnackbarKind.INFO }));
+                errorMessage = "Could not move project to trash";
+                successMessage = "Added to trash";
                 await services.groupsService.trash(uuid);
-                dispatch(projectPanelActions.REQUEST_ITEMS());
+                if (getProjectPanelCurrentUuid(getState()) === uuid) {
+                    dispatch<any>(navigateTo(ownerUuid));
+                } else {
+                    dispatch(projectPanelActions.REQUEST_ITEMS());
+                }
                 dispatch<any>(loadSidePanelTreeProjects(ownerUuid));
-                dispatch(snackbarActions.OPEN_SNACKBAR({
-                    message: "Added to trash",
-                    hideDuration: 2000,
-                    kind: SnackbarKind.SUCCESS
-                }));
             }
         } catch (e) {
             dispatch(snackbarActions.OPEN_SNACKBAR({
-                message: "Could not move project to trash",
+                message: errorMessage,
                 kind: SnackbarKind.ERROR
             }));
         }
+        dispatch(snackbarActions.OPEN_SNACKBAR({
+            message: successMessage,
+            hideDuration: 2000,
+            kind: SnackbarKind.SUCCESS
+        }));
     };
 
 export const toggleCollectionTrashed = (uuid: string, isTrashed: boolean) =>

commit 59eaefe09c2bc7e20c8bd2f2944e6c53cd4f38b6
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Thu May 13 11:39:36 2021 -0300

    17637: Adds test exposing the bug.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/cypress/integration/project.spec.js b/cypress/integration/project.spec.js
index 76a6d0ff..86dcbc2a 100644
--- a/cypress/integration/project.spec.js
+++ b/cypress/integration/project.spec.js
@@ -105,4 +105,34 @@ describe('Project tests', function() {
         cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
         cy.get('[data-cy=breadcrumb-last]').should('contain', subProjName);
     });
+
+    it('navigates to the parent project after trashing the one being displayed', function() {
+        cy.createGroup(activeUser.token, {
+            name: `Test root project ${Math.floor(Math.random() * 999999)}`,
+            group_class: 'project',
+        }).as('testRootProject').then(function() {
+            cy.createGroup(activeUser.token, {
+                name : `Test subproject ${Math.floor(Math.random() * 999999)}`,
+                group_class: 'project',
+                owner_uuid: this.testRootProject.uuid,
+            }).as('testSubProject');
+        });
+        cy.getAll('@testRootProject', '@testSubProject').then(function([testRootProject, testSubProject]) {
+            cy.loginAs(activeUser);
+
+            // Go to subproject and trash it.
+            cy.goToPath(`/projects/${testSubProject.uuid}`);
+            cy.get('[data-cy=breadcrumb-last]').should('contain', testSubProject.name);
+            cy.get('[data-cy=breadcrumb-last]').rightclick();
+            cy.get('[data-cy=context-menu]').contains('Move to trash').click();
+
+            // Confirm that the parent project should be displayed.
+            cy.get('[data-cy=breadcrumb-last]').should('contain', testRootProject.name);
+            cy.url().should('contain', `/projects/${testRootProject.uuid}`);
+
+            // Checks for bugfix #17637.
+            cy.get('[data-cy=not-found-content]').should('not.exist');
+            cy.get('[data-cy=not-found-page]').should('not.exist');
+        });
+    });
 })
\ No newline at end of file

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list