diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-13 22:32:58 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:06:01 +0200 |
| commit | 7151ae60cf587a502a7e09d19ebd0fd33e761bf2 (patch) | |
| tree | 5c672458220c52cd192ef9a268a716dee3d38649 /src | |
| parent | f3dbecbf55832df686d6969756640f6f5853f996 (diff) | |
Add routes for experiments UI
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/routes/experiments.js | 5 | ||||
| -rw-r--r-- | src/api/routes/schedulers.js | 5 | ||||
| -rw-r--r-- | src/api/routes/simulations.js | 20 | ||||
| -rw-r--r-- | src/api/routes/traces.js | 9 | ||||
| -rw-r--r-- | src/components/experiments/ExperimentListComponent.js | 26 | ||||
| -rw-r--r-- | src/pages/App.js | 4 | ||||
| -rw-r--r-- | src/pages/Experiments.js | 10 |
7 files changed, 74 insertions, 5 deletions
diff --git a/src/api/routes/experiments.js b/src/api/routes/experiments.js new file mode 100644 index 00000000..8e9cfd2f --- /dev/null +++ b/src/api/routes/experiments.js @@ -0,0 +1,5 @@ +import {deleteById} from "./util"; + +export function deleteExperiment(experimentId) { + return deleteById("/experiments/{experimentId}", {experimentId}); +} diff --git a/src/api/routes/schedulers.js b/src/api/routes/schedulers.js new file mode 100644 index 00000000..246abf32 --- /dev/null +++ b/src/api/routes/schedulers.js @@ -0,0 +1,5 @@ +import {getAll} from "./util"; + +export function getAllSchedulers() { + return getAll("/schedulers"); +} diff --git a/src/api/routes/simulations.js b/src/api/routes/simulations.js index d65460ee..09f4b6d7 100644 --- a/src/api/routes/simulations.js +++ b/src/api/routes/simulations.js @@ -46,3 +46,23 @@ export function getAuthorizationsBySimulation(simulationId) { export function getPathsOfSimulation(simulationId) { return getById("/simulations/{simulationId}/paths", {simulationId}); } + +export function getExperimentsOfSimulation(simulationId) { + return getById("/simulations/{simulationId}/experiments", {simulationId}); +} + +export function addExperiment(simulationId, experiment) { + return sendRequest({ + path: "/simulations/{simulationId}/experiments", + method: "POST", + parameters: { + body: { + experiment + }, + path: { + simulationId + }, + query: {} + } + }); +} diff --git a/src/api/routes/traces.js b/src/api/routes/traces.js new file mode 100644 index 00000000..6a34ca7c --- /dev/null +++ b/src/api/routes/traces.js @@ -0,0 +1,9 @@ +import {getAll, getById} from "./util"; + +export function getAllTraces() { + return getAll("/traces"); +} + +export function getJobsOfTrace(traceId) { + return getById("/traces/{traceId}/jobs", {traceId}); +} diff --git a/src/components/experiments/ExperimentListComponent.js b/src/components/experiments/ExperimentListComponent.js new file mode 100644 index 00000000..c3e3db8d --- /dev/null +++ b/src/components/experiments/ExperimentListComponent.js @@ -0,0 +1,26 @@ +import React from "react"; + +const ExperimentListContainer = ({experiments}) => ( + <table className="table"> + <thead> + <tr> + <th>Name</th> + <th>Path</th> + <th>Trace</th> + <th>Scheduler</th> + </tr> + </thead> + <tbody> + {experiments.map(experiment => ( + <tr> + <td>{experiment.name}</td> + <td>{experiment.path.name}</td> + <td>{experiment.trace.name}</td> + <td>{experiment.scheduler.name}</td> + </tr> + ))} + </tbody> + </table> +); + +export default ExperimentListContainer; diff --git a/src/pages/App.js b/src/pages/App.js index 8254853d..e70c7e48 100644 --- a/src/pages/App.js +++ b/src/pages/App.js @@ -17,7 +17,7 @@ import KeymapConfiguration from "../shortcuts/keymap"; const shortcutManager = new ShortcutManager(KeymapConfiguration); -class AppContainer extends React.Component { +class AppComponent extends React.Component { static propTypes = { simulationId: PropTypes.number.isRequired, }; @@ -77,6 +77,6 @@ const mapDispatchToProps = dispatch => { const App = connect( mapStateToProps, mapDispatchToProps -)(AppContainer); +)(AppComponent); export default App; diff --git a/src/pages/Experiments.js b/src/pages/Experiments.js index b35916e5..9dbe0dc0 100644 --- a/src/pages/Experiments.js +++ b/src/pages/Experiments.js @@ -1,14 +1,16 @@ import PropTypes from "prop-types"; import React from "react"; import {connect} from "react-redux"; +import {openSimulationSucceeded} from "../actions/simulations"; import AppNavbar from "../components/navigation/AppNavbar"; -class ExperimentsContainer extends React.Component { +class ExperimentsComponent extends React.Component { static propTypes = { simulationId: PropTypes.number.isRequired, }; componentDidMount() { + this.props.storeSimulationId(this.props.simulationId); // TODO fetch experiments } @@ -25,12 +27,14 @@ class ExperimentsContainer extends React.Component { } const mapDispatchToProps = dispatch => { - return {}; + return { + storeSimulationId: id => dispatch(openSimulationSucceeded(id)), + }; }; const Experiments = connect( undefined, mapDispatchToProps -)(ExperimentsContainer); +)(ExperimentsComponent); export default Experiments; |
