[ARVADOS-WORKBENCH2] updated: 1.4.1-395-g56c9663b

Git user git at public.arvados.org
Sat Jul 11 15:58:47 UTC 2020


Summary of changes:
 cypress/integration/page-not-found.spec.js         |  47 +++++
 package.json                                       |   4 +
 src/common/custom-theme.ts                         |  22 +++
 .../collection-panel-files.tsx                     |  63 ++++---
 src/components/file-tree/file-tree.tsx             |   3 +-
 src/components/tree/virtual-tree.tsx               | 193 +++++++++++++++++++++
 src/index.tsx                                      |  20 ++-
 src/models/collection-file.ts                      |   1 -
 src/models/tree.ts                                 |  34 +---
 .../collection-files-service.ts                    |  58 -------
 .../collection-manifest-mapper.test.ts             |  98 -----------
 .../collection-manifest-mapper.ts                  |  96 ----------
 .../collection-manifest-parser.test.ts             |  40 -----
 .../collection-manifest-parser.ts                  |  55 ------
 .../collection-service-files-response.ts           |   1 -
 .../collection-service/collection-service.ts       |   2 +-
 src/services/services.ts                           |   3 -
 .../collection-panel/collection-panel-action.ts    |  13 +-
 .../collection-panel-files-actions.ts              |   6 +
 .../collection-panel-files-reducer.ts              |  12 +-
 .../collection-panel/collection-panel-reducer.ts   |  13 +-
 .../not-found-panel/not-found-panel-action.tsx     |  16 ++
 src/store/workbench/workbench-actions.ts           |   4 +
 .../collection-panel-files.ts                      |  32 ++--
 .../collection-files-item-action-set.ts            |  19 +-
 .../not-found-dialog/not-found-dialog.tsx          |  66 +++++++
 .../generic-projects-tree-picker.tsx               |   2 +-
 src/views/collection-panel/collection-panel.tsx    | 131 ++++++++------
 src/views/not-found-panel/not-found-panel-root.tsx |  50 +++++-
 src/views/not-found-panel/not-found-panel.tsx      |   5 +-
 src/views/workbench/workbench.tsx                  |   2 +
 yarn.lock                                          |  32 ++++
 32 files changed, 636 insertions(+), 507 deletions(-)
 create mode 100644 cypress/integration/page-not-found.spec.js
 create mode 100644 src/components/tree/virtual-tree.tsx
 delete mode 100644 src/services/collection-files-service/collection-files-service.ts
 delete mode 100644 src/services/collection-files-service/collection-manifest-mapper.test.ts
 delete mode 100644 src/services/collection-files-service/collection-manifest-mapper.ts
 delete mode 100644 src/services/collection-files-service/collection-manifest-parser.test.ts
 delete mode 100644 src/services/collection-files-service/collection-manifest-parser.ts
 create mode 100644 src/store/not-found-panel/not-found-panel-action.tsx
 create mode 100644 src/views-components/not-found-dialog/not-found-dialog.tsx

       via  56c9663bbdb3f4b86a499f736f1663e20d64a959 (commit)
       via  4969ea388f1d4ed1ab64bbb5f0cf6e454193b077 (commit)
       via  7df53777e4709d990131785fea7a3cde13889505 (commit)
       via  f8fb6725beec5b2bf0eec7f375d49f9189ff1bc3 (commit)
       via  3d578b971d14bc816da8ad4ace5db635a73aa35d (commit)
       via  0ef145be19d3ec0880cece45399c2b83950b4510 (commit)
       via  e364e8697dff2661ca386f14c38af9040af9fc8e (commit)
       via  31b5226e2d0d5db1bf24802ba51d4baae264cab6 (commit)
       via  9a63709896ad2b3beaed1d5e5b959351dc4d2701 (commit)
       via  44c5f86e438c3651904a1d5c9ccf6cd4089f5f86 (commit)
       via  9ab0347489bd312c986c3ff2f9489a83545f213f (commit)
       via  159c84a15b7739c02dc4bc0d9626b515e8426b92 (commit)
       via  8edacc9b2dac6520ace9a2d420979bbeb5558a6f (commit)
       via  e92207c912aed73a07340b5fb2a9e2cb23e1da5f (commit)
       via  7131c732cffb1383099b5e1593b3ee4b48635df5 (commit)
       via  6381c9957d1b936937ebe79a9e4b5c08f74dce16 (commit)
       via  4530e2fcf4cac004af67cecddefc742a83c82b16 (commit)
       via  bcc074c282de71fe63d2ce23127b58f92c90037c (commit)
       via  b3c45e57f0b488e98bb24b342c37724c8ef7bb5f (commit)
      from  70ec54043c81e3612cc4711c1a6b763ba099b44b (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 56c9663bbdb3f4b86a499f736f1663e20d64a959
Merge: 4969ea38 f8fb6725
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Sat Jul 11 17:57:48 2020 +0200

    14990: merged master
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>


commit 4969ea388f1d4ed1ab64bbb5f0cf6e454193b077
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Sat Jul 11 17:56:22 2020 +0200

    14990: not found modal added
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/cypress/integration/page-not-found.spec.js b/cypress/integration/page-not-found.spec.js
new file mode 100644
index 00000000..3dd15a67
--- /dev/null
+++ b/cypress/integration/page-not-found.spec.js
@@ -0,0 +1,47 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+describe('Page not found tests', function() {
+    let adminUser;
+
+    before(function() {
+        cy.getUser('admin', 'Admin', 'User', true, true)
+            .as('adminUser').then(function() {
+                adminUser = this.adminUser;
+            }
+        );
+    });
+
+    beforeEach(function() {
+        cy.clearCookies()
+        cy.clearLocalStorage()
+    });
+
+    it('shows not found page', function() {
+        // given
+        const invalidUUID = '1212r12r12r12r12r12r21r'
+
+        // when
+        cy.loginAs(adminUser);
+        cy.visit(`/collections/${invalidUUID}`);
+
+        // then
+        cy.get('[data-cy=not-found-page]').should('exist');
+        cy.get('[data-cy=not-found-content]').should('exist');
+    });
+
+
+    it('shows not found popup', function() {
+        // given
+        const notExistingUUID = 'zzzzz-tpzed-5o5tg0l9a57gxxx';
+
+        // when
+        cy.loginAs(adminUser);
+        cy.visit(`/projects/${notExistingUUID}`);
+
+        // then
+        cy.get('[data-cy=not-found-page]').should('not.exist');
+        cy.get('[data-cy=not-found-content]').should('exist');
+    });
+})
\ No newline at end of file
diff --git a/src/views/not-found-panel/not-found-panel-root.tsx b/src/views/not-found-panel/not-found-panel-root.tsx
index 07cfdf33..41d9b316 100644
--- a/src/views/not-found-panel/not-found-panel-root.tsx
+++ b/src/views/not-found-panel/not-found-panel-root.tsx
@@ -83,7 +83,7 @@ export const NotFoundPanelRoot = withStyles(styles)(
     ({ classes, clusterConfig, location, notWrapped }: NotFoundPanelRootProps) => {
 
         const content = <Grid container justify="space-between" wrap="nowrap" alignItems="center">
-            <div className={classes.title}>
+            <div data-cy="not-found-content" className={classes.title}>
                 <h2>Not Found</h2>
                 {getAdditionalMessage(location)}
                 <p>
@@ -98,6 +98,6 @@ export const NotFoundPanelRoot = withStyles(styles)(
             </div>
         </Grid>;
 
-        return !notWrapped ? <Paper> {content}</Paper> : content;
+        return !notWrapped ? <Paper data-cy="not-found-page"> {content}</Paper> : content;
     }
 );

commit 7df53777e4709d990131785fea7a3cde13889505
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Sat Jul 11 13:57:29 2020 +0200

    14990: not found modal added
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/src/index.tsx b/src/index.tsx
index 1a58dad1..d07d3c9e 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -62,6 +62,7 @@ import { collectionAdminActionSet } from '~/views-components/context-menu/action
 import { processResourceAdminActionSet } from '~/views-components/context-menu/action-sets/process-resource-admin-action-set';
 import { projectAdminActionSet } from '~/views-components/context-menu/action-sets/project-admin-action-set';
 import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions";
+import { openNotFoundDialog } from './store/not-found-panel/not-found-panel-action';
 
 console.log(`Starting arvados [${getBuildInfo()}]`);
 
@@ -106,13 +107,18 @@ fetchConfig()
             errorFn: (id, error, showSnackBar) => {
                 if (showSnackBar) {
                     console.error("Backend error:", error);
-                    store.dispatch(snackbarActions.OPEN_SNACKBAR({
-                        message: `${error.errors
-                            ? error.errors[0]
-                            : error.message}`,
-                        kind: SnackbarKind.ERROR,
-                        hideDuration: 8000})
-                    );
+
+                    if (error.errors[0].indexOf("not found") > -1) {
+                        store.dispatch(openNotFoundDialog());
+                    } else {
+                        store.dispatch(snackbarActions.OPEN_SNACKBAR({
+                            message: `${error.errors
+                                ? error.errors[0]
+                                : error.message}`,
+                            kind: SnackbarKind.ERROR,
+                            hideDuration: 8000})
+                        );
+                    }
                 }
             }
         });
diff --git a/src/store/not-found-panel/not-found-panel-action.tsx b/src/store/not-found-panel/not-found-panel-action.tsx
new file mode 100644
index 00000000..2cb397c0
--- /dev/null
+++ b/src/store/not-found-panel/not-found-panel-action.tsx
@@ -0,0 +1,16 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { dialogActions } from '~/store/dialog/dialog-actions';
+
+export const NOT_FOUND_DIALOG_NAME = 'notFoundDialog';
+
+export const openNotFoundDialog = () =>
+    (dispatch: Dispatch) => {
+        dispatch(dialogActions.OPEN_DIALOG({
+            id: NOT_FOUND_DIALOG_NAME,
+            data: {},
+        }));
+    };
\ No newline at end of file
diff --git a/src/views-components/not-found-dialog/not-found-dialog.tsx b/src/views-components/not-found-dialog/not-found-dialog.tsx
new file mode 100644
index 00000000..e9744310
--- /dev/null
+++ b/src/views-components/not-found-dialog/not-found-dialog.tsx
@@ -0,0 +1,66 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { Dispatch } from "redux";
+import { connect } from "react-redux";
+import { RootState } from '~/store/store';
+import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog";
+import { NOT_FOUND_DIALOG_NAME } from '~/store/not-found-panel/not-found-panel-action';
+import { Dialog, DialogContent, DialogActions, Button, withStyles, StyleRulesCallback, WithStyles } from '@material-ui/core';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { NotFoundPanel } from "~/views/not-found-panel/not-found-panel";
+
+type CssRules = 'tag';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    tag: {
+        marginRight: theme.spacing.unit,
+        marginBottom: theme.spacing.unit
+    }
+});
+
+interface NotFoundDialogDataProps {
+
+}
+
+interface NotFoundDialogActionProps {
+
+}
+
+const mapStateToProps = (state: RootState): NotFoundDialogDataProps => ({
+
+});
+
+const mapDispatchToProps = (dispatch: Dispatch): NotFoundDialogActionProps => ({
+
+});
+
+type NotFoundDialogProps =  NotFoundDialogDataProps & NotFoundDialogActionProps & WithDialogProps<{}> & WithStyles<CssRules>;
+
+export const NotFoundDialog = connect(mapStateToProps, mapDispatchToProps)(
+    withStyles(styles)(
+    withDialog(NOT_FOUND_DIALOG_NAME)(
+        ({ open, closeDialog }: NotFoundDialogProps) =>
+            <Dialog open={open}
+                onClose={closeDialog}
+                fullWidth
+                maxWidth='md'
+                disableBackdropClick
+                disableEscapeKeyDown>
+                {/* <DialogTitle>Page not found</DialogTitle> */}
+                <DialogContent>
+                    <NotFoundPanel notWrapped />
+                </DialogContent>
+                <DialogActions>
+                    <Button
+                        variant='text'
+                        color='primary'
+                        onClick={closeDialog}>
+                        Close
+                    </Button>
+                </DialogActions>
+            </Dialog>
+    )
+));
\ No newline at end of file
diff --git a/src/views/not-found-panel/not-found-panel-root.tsx b/src/views/not-found-panel/not-found-panel-root.tsx
index 2c61726c..07cfdf33 100644
--- a/src/views/not-found-panel/not-found-panel-root.tsx
+++ b/src/views/not-found-panel/not-found-panel-root.tsx
@@ -28,12 +28,16 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     }
 });
 
+export interface NotFoundPanelOwnProps {
+    notWrapped?: boolean;
+}
+
 export interface NotFoundPanelRootDataProps {
     location: Location<any> | null;
     clusterConfig: ClusterConfigJSON;
 }
 
-type NotFoundPanelRootProps = NotFoundPanelRootDataProps & WithStyles<CssRules>;
+type NotFoundPanelRootProps = NotFoundPanelRootDataProps & NotFoundPanelOwnProps & WithStyles<CssRules>;
 
 const getAdditionalMessage = (location: Location | null) => {
     if (!location) {
@@ -55,17 +59,45 @@ const getAdditionalMessage = (location: Location | null) => {
     return null;
 };
 
+const getEmailLink = (email: string, classes: Record<CssRules, string>, location: Location | null) => {
+    let href = `mailto:${email}`;
+
+    if (location) {
+        const { pathname } = location;
+        href += `?body=Problem while viewing page ${pathname}`;
+        href += ';subject=Workbench problem report';
+
+    } else {
+        href += '?subject=Workbench problem report';
+    }
+
+    return (<a
+        className={classes.active}
+        href={`mailto:${href}`}>
+        email us
+    </a>);
+};
+
+
 export const NotFoundPanelRoot = withStyles(styles)(
-    ({ classes, clusterConfig, location }: NotFoundPanelRootProps) =>
-    <Paper>
-        <Grid container justify="space-between" wrap="nowrap" alignItems="center">
+    ({ classes, clusterConfig, location, notWrapped }: NotFoundPanelRootProps) => {
+
+        const content = <Grid container justify="space-between" wrap="nowrap" alignItems="center">
             <div className={classes.title}>
                 <h2>Not Found</h2>
-                { getAdditionalMessage(location) }
+                {getAdditionalMessage(location)}
                 <p>
-                    The page you requested was not found, <a className={classes.active} href={`mailto:${(clusterConfig.Mail || {} as any).SupportEmailAddress}`}>email us</a> us if you suspect this is a bug.
+                    The page you requested was not found, 
+                    {
+                        !!clusterConfig.Mail ?
+                            getEmailLink((clusterConfig.Mail || {} as any).SupportEmailAddress, classes, location) :
+                            'email us'
+                    }
+                     if you suspect this is a bug.
                 </p>
             </div>
-        </Grid>
-    </Paper>
+        </Grid>;
+
+        return !notWrapped ? <Paper> {content}</Paper> : content;
+    }
 );
diff --git a/src/views/not-found-panel/not-found-panel.tsx b/src/views/not-found-panel/not-found-panel.tsx
index adfaf720..0f9f13b5 100644
--- a/src/views/not-found-panel/not-found-panel.tsx
+++ b/src/views/not-found-panel/not-found-panel.tsx
@@ -4,7 +4,7 @@
 
 import { RootState } from '~/store/store';
 import { connect } from 'react-redux';
-import { NotFoundPanelRoot, NotFoundPanelRootDataProps } from '~/views/not-found-panel/not-found-panel-root';
+import { NotFoundPanelRoot, NotFoundPanelRootDataProps, NotFoundPanelOwnProps } from '~/views/not-found-panel/not-found-panel-root';
 
 const mapStateToProps = (state: RootState): NotFoundPanelRootDataProps => {
     return {
@@ -15,4 +15,5 @@ const mapStateToProps = (state: RootState): NotFoundPanelRootDataProps => {
 
 const mapDispatchToProps = null;
 
-export const NotFoundPanel = connect(mapStateToProps, mapDispatchToProps)(NotFoundPanelRoot);
+export const NotFoundPanel = connect<NotFoundPanelRootDataProps, null, NotFoundPanelOwnProps>(mapStateToProps, mapDispatchToProps)
+    (NotFoundPanelRoot);
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 4526132a..906c649c 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -48,6 +48,7 @@ import { SshKeyPanel } from '~/views/ssh-key-panel/ssh-key-panel';
 import { SiteManagerPanel } from "~/views/site-manager-panel/site-manager-panel";
 import { MyAccountPanel } from '~/views/my-account-panel/my-account-panel';
 import { SharingDialog } from '~/views-components/sharing-dialog/sharing-dialog';
+import { NotFoundDialog } from '~/views-components/not-found-dialog/not-found-dialog';
 import { AdvancedTabDialog } from '~/views-components/advanced-tab-dialog/advanced-tab-dialog';
 import { ProcessInputDialog } from '~/views-components/process-input-dialog/process-input-dialog';
 import { VirtualMachineUserPanel } from '~/views/virtual-machine-panel/virtual-machine-user-panel';
@@ -247,6 +248,7 @@ export const WorkbenchPanel =
             <RichTextEditorDialog />
             <SetupShellAccountDialog />
             <SharingDialog />
+            <NotFoundDialog />
             <Snackbar />
             <UpdateCollectionDialog />
             <UpdateProcessDialog />

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list