Skip to content

Commit

Permalink
Merge pull request #170 from mercedes-benz/VULCAN-983/CustomNotification
Browse files Browse the repository at this point in the history
NotificationModal edited
  • Loading branch information
m-o-n-i-s-h authored Dec 17, 2024
2 parents d15c70a + effdee1 commit 9a2e0ca
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
20 changes: 17 additions & 3 deletions src/application/ApplicationThunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,21 @@ export const createConnectionThunk =
// eslint-disable-next-line no-console
console.log('Confirming connection was established...');
if (records && records[0] && records[0].error) {
dispatch(createNotificationThunk('Unable to establish connection', records[0].error));
if (
records[0].error.startsWith('The client is unauthorized due to authentication failure') ||
records[0].error.startsWith(
'The client has provided incorrect authentication details too many times in a row.'
)
) {
dispatch(
createNotificationThunk(
'Something went wrong!',
'We are working on it. You can try to reload without cache.'
)
);
} else {
dispatch(createNotificationThunk('Unable to establish connection', records[0].error));
}
if (loggingSettings.loggingMode > '0') {
dispatch(
createLogThunk(
Expand Down Expand Up @@ -170,7 +184,7 @@ export const createConnectionThunk =
query,
parameters,
1,
() => { },
() => {},
(records) => validateConnection(records)
);
} catch (e) {
Expand Down Expand Up @@ -420,7 +434,7 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
standaloneUsername: '',
standalonePassword: '',
skipConfirmation: false,
skipAddDashErrorPopup: false
skipAddDashErrorPopup: false,
};
try {
config = await (await fetch('config.json')).json();
Expand Down
13 changes: 12 additions & 1 deletion src/modal/NotificationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '../application/ApplicationSelectors';
import { clearNotification, setConnectionModalOpen } from '../application/ApplicationActions';
import { Dialog } from '@neo4j-ndl/react';
import { Button, DialogActions } from '@mui/material';

/**
* A modal to save a dashboard as a JSON text string.
Expand All @@ -24,6 +25,9 @@ export const NeoNotificationModal = ({
setConnectionModalOpen,
onNotificationClose,
}) => {
const handleReload = () => {
window.location.reload();
};
return (
<div>
<Dialog
Expand All @@ -42,7 +46,14 @@ export const NeoNotificationModal = ({
>
<Dialog.Header id='form-dialog-title'>{title}</Dialog.Header>

<Dialog.Content style={{ minWidth: '300px' }}>{text && text.toString()}</Dialog.Content>
<Dialog.Content style={{ minWidth: '300px' }}>
{text && text.toString()}
<DialogActions>
<Button onClick={handleReload} autoFocus variant='contained'>
Reload without cache
</Button>
</DialogActions>
</Dialog.Content>
</Dialog>
</div>
);
Expand Down

0 comments on commit 9a2e0ca

Please sign in to comment.