-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from KPMP/develop
v1.1
- Loading branch information
Showing
17 changed files
with
3,202 additions
and
3,345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/76fbecb57cb6451ab4df40afe4c444f0)](https://www.codacy.com/manual/rlreamy/delphinus-web?utm_source=github.com&utm_medium=referral&utm_content=KPMP/delphinus-web&utm_campaign=Badge_Grade) | ||
[![Build Status](https://travis-ci.org/KPMP/delphinus-web.svg?branch=develop)](https://travis-ci.org/KPMP/delphinus-web) | ||
|
||
# delphinus-web | ||
This project is the web front-end for the Digital Pathology Repository for the Kidney Precision Medicine Project. | ||
|
||
NOTE: Doesn't build with Node 12+ | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,35 @@ | ||
import Api from '../../helpers/Api'; | ||
|
||
const api = Api.getInstance(); | ||
|
||
export const handleError = () => { | ||
return (dispatch) => { | ||
window.location.href = "/oops"; | ||
} | ||
}; | ||
|
||
export const sendMessageToBackend = (error) => { | ||
let errorMessage = { error: error.message , stackTrace: error.stack } | ||
return (dispatch) => { | ||
dispatch(handleError()); | ||
api.post('/api/v1/error', errorMessage); | ||
}; | ||
} | ||
import Api from '../../helpers/Api'; | ||
|
||
const api = Api.getInstance(); | ||
|
||
export const handleError = (statusCode) => { | ||
return (dispatch) => { | ||
if (statusCode === 404) { | ||
window.location.href = '/notRegistered'; | ||
} else if (statusCode === 403) { | ||
window.location.href = '/permissionDenied'; | ||
} else { | ||
window.location.href = '/oops'; | ||
} | ||
} | ||
}; | ||
|
||
export const sendMessageToBackend = (error) => { | ||
|
||
if (error.response && error.response.status && error.response.status >= 400) { | ||
return (dispatch) => { | ||
let href = window.location.href; | ||
if (!href.includes('/oops') && !href.includes('/permissionDenied') && !href.includes('/notRegistered')) { | ||
dispatch(handleError(error.response.status)); | ||
} | ||
} | ||
} else { | ||
let errorMessage = { error: error.message , stackTrace: error.stack }; | ||
return (dispatch) => { | ||
api.post('/api/v1/error', errorMessage) | ||
.then((res) => { | ||
dispatch(handleError(error.response.status)); | ||
}); | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { Component } from 'react'; | ||
import { Col, Row } from 'reactstrap'; | ||
|
||
class NotRegistered extends Component { | ||
|
||
render() { | ||
return ( | ||
<article id='permissions' className='container justify-content-center pt-3'> | ||
<Row > | ||
<Col xs={12} className='error-header pb-3'> | ||
We're sorry. You are not authorized to access this application. | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col xs={12}> | ||
<div className='alert alert-danger'> | ||
You must be a registered user in order to use this KPMP application. If you would like to register or believe you received this page in error, please contact: | ||
<a href='mailto:[email protected]'>[email protected]</a> | ||
</div> | ||
</Col> | ||
</Row> | ||
</article> | ||
); | ||
} | ||
} | ||
|
||
export default NotRegistered; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { Component } from 'react'; | ||
import { Col, Row } from 'reactstrap'; | ||
|
||
class PermissionDenied extends Component { | ||
|
||
render() { | ||
return ( | ||
<article id='permissions' className='container justify-content-center pt-3'> | ||
<Row > | ||
<Col xs={12} className='error-header pb-3'> | ||
We're sorry. You are not authorized to access this application. | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col xs={12}> | ||
<div className='alert alert-danger'> | ||
Your account does not have permission to use this KPMP application. If you believe you received this page in error, please contact: | ||
<a href='mailto:[email protected]'>[email protected]</a> | ||
</div> | ||
</Col> | ||
</Row> | ||
</article> | ||
); | ||
} | ||
} | ||
|
||
export default PermissionDenied; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.