Skip to content

Commit 9a2e0ca

Browse files
authored
Merge pull request #170 from mercedes-benz/VULCAN-983/CustomNotification
NotificationModal edited
2 parents d15c70a + effdee1 commit 9a2e0ca

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

src/application/ApplicationThunks.ts

+17-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,21 @@ export const createConnectionThunk =
7575
// eslint-disable-next-line no-console
7676
console.log('Confirming connection was established...');
7777
if (records && records[0] && records[0].error) {
78-
dispatch(createNotificationThunk('Unable to establish connection', records[0].error));
78+
if (
79+
records[0].error.startsWith('The client is unauthorized due to authentication failure') ||
80+
records[0].error.startsWith(
81+
'The client has provided incorrect authentication details too many times in a row.'
82+
)
83+
) {
84+
dispatch(
85+
createNotificationThunk(
86+
'Something went wrong!',
87+
'We are working on it. You can try to reload without cache.'
88+
)
89+
);
90+
} else {
91+
dispatch(createNotificationThunk('Unable to establish connection', records[0].error));
92+
}
7993
if (loggingSettings.loggingMode > '0') {
8094
dispatch(
8195
createLogThunk(
@@ -170,7 +184,7 @@ export const createConnectionThunk =
170184
query,
171185
parameters,
172186
1,
173-
() => { },
187+
() => {},
174188
(records) => validateConnection(records)
175189
);
176190
} catch (e) {
@@ -420,7 +434,7 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
420434
standaloneUsername: '',
421435
standalonePassword: '',
422436
skipConfirmation: false,
423-
skipAddDashErrorPopup: false
437+
skipAddDashErrorPopup: false,
424438
};
425439
try {
426440
config = await (await fetch('config.json')).json();

src/modal/NotificationModal.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from '../application/ApplicationSelectors';
1111
import { clearNotification, setConnectionModalOpen } from '../application/ApplicationActions';
1212
import { Dialog } from '@neo4j-ndl/react';
13+
import { Button, DialogActions } from '@mui/material';
1314

1415
/**
1516
* A modal to save a dashboard as a JSON text string.
@@ -24,6 +25,9 @@ export const NeoNotificationModal = ({
2425
setConnectionModalOpen,
2526
onNotificationClose,
2627
}) => {
28+
const handleReload = () => {
29+
window.location.reload();
30+
};
2731
return (
2832
<div>
2933
<Dialog
@@ -42,7 +46,14 @@ export const NeoNotificationModal = ({
4246
>
4347
<Dialog.Header id='form-dialog-title'>{title}</Dialog.Header>
4448

45-
<Dialog.Content style={{ minWidth: '300px' }}>{text && text.toString()}</Dialog.Content>
49+
<Dialog.Content style={{ minWidth: '300px' }}>
50+
{text && text.toString()}
51+
<DialogActions>
52+
<Button onClick={handleReload} autoFocus variant='contained'>
53+
Reload without cache
54+
</Button>
55+
</DialogActions>
56+
</Dialog.Content>
4657
</Dialog>
4758
</div>
4859
);

0 commit comments

Comments
 (0)