[ARVADOS-WORKBENCH2] updated: 1.4.1-397-g4badc373
Git user
git at public.arvados.org
Mon Jul 13 18:11:20 UTC 2020
Summary of changes:
.../not-found-dialog/not-found-dialog.tsx | 1 -
.../not-found-panel/not-found-panel-root.test.tsx | 20 +++++++++++++++++++-
src/views/not-found-panel/not-found-panel-root.tsx | 20 ++++++--------------
3 files changed, 25 insertions(+), 16 deletions(-)
via 4badc373d653f27010b01ddb12fb5275e706b666 (commit)
from 90460e90dfb2ac4863b133bc477098252f677fea (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 4badc373d653f27010b01ddb12fb5275e706b666
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date: Mon Jul 13 20:10:35 2020 +0200
14990: removed double mailto, added tests, code cleanup
Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
diff --git a/src/views-components/not-found-dialog/not-found-dialog.tsx b/src/views-components/not-found-dialog/not-found-dialog.tsx
index e9744310..2410ddcb 100644
--- a/src/views-components/not-found-dialog/not-found-dialog.tsx
+++ b/src/views-components/not-found-dialog/not-found-dialog.tsx
@@ -49,7 +49,6 @@ export const NotFoundDialog = connect(mapStateToProps, mapDispatchToProps)(
maxWidth='md'
disableBackdropClick
disableEscapeKeyDown>
- {/* <DialogTitle>Page not found</DialogTitle> */}
<DialogContent>
<NotFoundPanel notWrapped />
</DialogContent>
diff --git a/src/views/not-found-panel/not-found-panel-root.test.tsx b/src/views/not-found-panel/not-found-panel-root.test.tsx
index e4178a53..315b4b8c 100644
--- a/src/views/not-found-panel/not-found-panel-root.test.tsx
+++ b/src/views/not-found-panel/not-found-panel-root.test.tsx
@@ -46,7 +46,22 @@ describe('NotFoundPanelRoot', () => {
expect(wrapper.find('p').text()).toContain(expectedMessage);
});
- it('should render component with additional message', () => {
+ it('should render component without email url when no email', () => {
+ // setup
+ props.clusterConfig.Mail.SupportEmailAddress = '';
+
+ // when
+ const wrapper = mount(
+ <MuiThemeProvider theme={CustomTheme}>
+ <NotFoundPanelRoot {...props} />
+ </MuiThemeProvider>
+ );
+
+ // then
+ expect(wrapper.find('a').length).toBe(0);
+ });
+
+ it('should render component with additional message and email url', () => {
// given
const hash = '123hash123';
const pathname = `/collections/${hash}`;
@@ -65,5 +80,8 @@ describe('NotFoundPanelRoot', () => {
// then
expect(wrapper.find('p').first().text()).toContain(hash);
+
+ // and
+ expect(wrapper.find('a').length).toBe(1);
});
});
\ 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 41d9b316..6780b842 100644
--- a/src/views/not-found-panel/not-found-panel-root.tsx
+++ b/src/views/not-found-panel/not-found-panel-root.tsx
@@ -59,21 +59,13 @@ 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';
- }
+const getEmailLink = (email: string, classes: Record<CssRules, string>) => {
+ const { location: { href: windowHref } } = window;
+ const href = `mailto:${email}?body=${encodeURIComponent('Problem while viewing page ')}${encodeURIComponent(windowHref)}&subject=${encodeURIComponent('Workbench problem report')}`;
return (<a
className={classes.active}
- href={`mailto:${href}`}>
+ href={href}>
email us
</a>);
};
@@ -89,8 +81,8 @@ export const NotFoundPanelRoot = withStyles(styles)(
<p>
The page you requested was not found,
{
- !!clusterConfig.Mail ?
- getEmailLink((clusterConfig.Mail || {} as any).SupportEmailAddress, classes, location) :
+ !!clusterConfig.Mail && clusterConfig.Mail.SupportEmailAddress ?
+ getEmailLink(clusterConfig.Mail.SupportEmailAddress, classes) :
'email us'
}
if you suspect this is a bug.
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list