-
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.
- Loading branch information
Showing
43 changed files
with
11,812 additions
and
12,479 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,4 +1,6 @@ | ||
# 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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); | ||
}; | ||
} |
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,56 @@ | ||
import actionNames from '../actionNames'; | ||
import axios from 'axios'; | ||
import participantSelectSorter from '../../components/Summary/participantSelectSorter'; | ||
import { sendMessageToBackend } from '../Error/errorActions'; | ||
|
||
export const setSelectedParticipant = (participant) => { | ||
return { | ||
type: actionNames.SET_SELECTED_PARTICIPANT, | ||
payload: participant | ||
} | ||
} | ||
|
||
export const setSelectedSlide = (slide) => { | ||
return { | ||
type: actionNames.SET_SELECTED_SLIDE, | ||
payload: slide | ||
} | ||
} | ||
|
||
export const setParticipants = (participants) => { | ||
return { | ||
type: actionNames.SET_PARTICIPANTS, | ||
payload: participants | ||
} | ||
} | ||
|
||
export const getParticipantSlides = (participantId, props) => { | ||
return (dispatch) => { | ||
var config = { headers: {'Content-Type': 'application/json', 'Cache-control': 'no-cache'}}; | ||
axios.get('/api/v1/slides/' + participantId, config) | ||
.then(result => { | ||
let slides = participantSelectSorter(result.data); | ||
dispatch(setSelectedParticipant({id: participantId, slides: slides, selectedSlide: slides[0]})); | ||
props.history.push(process.env.PUBLIC_URL + "/slides"); | ||
}) | ||
.catch(err => { | ||
console.log("We were unable to get a list of slides for " + participantId); | ||
dispatch(sendMessageToBackend(err)); | ||
}); | ||
} | ||
} | ||
|
||
export const getAllParticipants = () => { | ||
return (dispatch) => { | ||
var config = { headers: {'Content-Type': 'application/json', 'Cache-control': 'no-cache'}} | ||
axios.get('/api/v1/slides', config) | ||
.then(result => { | ||
let participants = result.data; | ||
dispatch(setParticipants(participants)); | ||
}) | ||
.catch(err => { | ||
console.log("We were unable to get the slides."); | ||
dispatch(sendMessageToBackend(err)); | ||
}); | ||
} | ||
} |
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,26 @@ | ||
import { setSelectedParticipant, setParticipants } from './participantActions'; | ||
import actionNames from '../actionNames'; | ||
|
||
|
||
describe('setSelectedParticipant', () => { | ||
it('should pass the argument through to the payload and set the action', () => { | ||
let payload = "I am a payload"; | ||
let actionName = actionNames.SET_SELECTED_PARTICIPANT; | ||
|
||
let result = setSelectedParticipant(payload); | ||
|
||
expect(result).toEqual( { payload: payload, type: actionName }); | ||
}); | ||
}); | ||
|
||
describe('setParticipants', () => { | ||
it('should pass the argument through to the payload and set the action', () => { | ||
let payload = "I am a payload"; | ||
let actionName = actionNames.SET_PARTICIPANTS; | ||
|
||
let result = setParticipants(payload); | ||
|
||
expect(result).toEqual( { payload: payload, type: actionName }); | ||
}); | ||
}); | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
class ErrorBoundary extends Component { | ||
|
||
componentDidCatch(error) { | ||
this.props.handleError(error); | ||
} | ||
|
||
render() { | ||
return this.props.children; | ||
} | ||
} | ||
|
||
ErrorBoundary.propTypes = { | ||
handleError: PropTypes.func.isRequired, | ||
children: PropTypes.node | ||
}; | ||
|
||
export default ErrorBoundary; |
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,18 @@ | ||
import { connect } from 'react-redux'; | ||
import ErrorBoundary from './ErrorBoundary'; | ||
import { sendMessageToBackend } from '../../actions/Error/errorActions'; | ||
import { withRouter } from 'react-router-dom'; | ||
|
||
const mapStateToProps = (state, props) => | ||
({ | ||
|
||
}); | ||
|
||
const mapDispatchToProps = (dispatch, props) => | ||
({ | ||
handleError(error) { | ||
dispatch(sendMessageToBackend(error)); | ||
} | ||
}); | ||
|
||
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(ErrorBoundary)); |
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,29 @@ | ||
import React, { Component } from 'react'; | ||
import { Col, Row, Button } from 'reactstrap'; | ||
|
||
class Oops extends Component { | ||
render() { | ||
return ( | ||
<article className="container-fluid"> | ||
<Row id="oops-content"> | ||
<Col xs={0} md={2}> </Col> | ||
<Col xs={12} md={4} className={"text-center"}> | ||
<img src="img/oops.png" alt="Oops, something went wrong" id="oops-image"/> | ||
</Col> | ||
<Col xs={12} md={6}> | ||
<p className="oops-big">Oops...</p> | ||
<p className="oops-small">Looks like something went wrong.<br/>We're working on it.</p> | ||
<p className="oops-button-container"> | ||
<Button className="btn btn-primary" | ||
onClick={() => window.location.href = "/"}> | ||
Back to Home | ||
</Button> | ||
</p> | ||
</Col> | ||
</Row> | ||
</article> | ||
); | ||
} | ||
} | ||
|
||
export default Oops; |
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.