From f604406453f95c82c3e5e4294a51245661868bbe Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Thu, 14 Sep 2017 14:07:21 +0200 Subject: First attempt at experiment list UI --- .../experiments/ExperimentListComponent.js | 19 ++--- .../experiments/ExperimentRowComponent.js | 17 +++++ .../NewExperimentModalComponent.js | 87 ++++++++++++++++++++++ 3 files changed, 114 insertions(+), 9 deletions(-) create mode 100644 src/components/experiments/ExperimentRowComponent.js create mode 100644 src/components/modals/custom-components/NewExperimentModalComponent.js (limited to 'src/components') diff --git a/src/components/experiments/ExperimentListComponent.js b/src/components/experiments/ExperimentListComponent.js index c3e3db8d..001b0e32 100644 --- a/src/components/experiments/ExperimentListComponent.js +++ b/src/components/experiments/ExperimentListComponent.js @@ -1,6 +1,8 @@ +import PropTypes from "prop-types"; import React from "react"; +import ExperimentRowContainer from "../../containers/experiments/ExperimentRowContainer"; -const ExperimentListContainer = ({experiments}) => ( +const ExperimentListComponent = ({experimentIds}) => ( @@ -11,16 +13,15 @@ const ExperimentListContainer = ({experiments}) => ( - {experiments.map(experiment => ( - - - - - - + {experimentIds.map(experimentId => ( + ))}
{experiment.name}{experiment.path.name}{experiment.trace.name}{experiment.scheduler.name}
); -export default ExperimentListContainer; +ExperimentListComponent.propTypes = { + experimentIds: PropTypes.arrayOf(PropTypes.number).isRequired, +}; + +export default ExperimentListComponent; diff --git a/src/components/experiments/ExperimentRowComponent.js b/src/components/experiments/ExperimentRowComponent.js new file mode 100644 index 00000000..79ce3eea --- /dev/null +++ b/src/components/experiments/ExperimentRowComponent.js @@ -0,0 +1,17 @@ +import React from "react"; +import Shapes from "../../shapes/index"; + +const ExperimentRowComponent = ({experiment}) => ( + + {experiment.name} + {experiment.path.name} + {experiment.trace.name} + {experiment.scheduler.name} + +); + +ExperimentRowComponent.propTypes = { + experiment: Shapes.Experiment +}; + +export default ExperimentRowComponent; diff --git a/src/components/modals/custom-components/NewExperimentModalComponent.js b/src/components/modals/custom-components/NewExperimentModalComponent.js new file mode 100644 index 00000000..9efccc8a --- /dev/null +++ b/src/components/modals/custom-components/NewExperimentModalComponent.js @@ -0,0 +1,87 @@ +import PropTypes from "prop-types"; +import React from "react"; +import Shapes from "../../../shapes"; +import Modal from "../Modal"; + +class NewExperimentModalComponent extends React.Component { + static propTypes = { + show: PropTypes.bool.isRequired, + paths: PropTypes.arrayOf(Shapes.Path), + schedulers: PropTypes.arrayOf(Shapes.Scheduler), + traces: PropTypes.arrayOf(Shapes.Trace), + callback: PropTypes.func.isRequired, + }; + + reset() { + this.textInput.value = ""; + this.pathSelect.selectedIndex = 0; + this.traceSelect.selectedIndex = 0; + this.schedulerSelect.selectedIndex = 0; + } + + onSubmit() { + this.props.callback(this.textInput.value, this.pathSelect.value, this.traceSelect.value, + this.schedulerSelect.value); + this.reset(); + } + + onCancel() { + this.props.callback(undefined); + this.reset(); + } + + render() { + return ( + +
{ + e.preventDefault(); + this.onSubmit(); + }}> +
+ + this.textInput = textInput}/> +
+
+ + +
+
+ + +
+
+ + +
+
+
+ ); + } +} + +export default NewExperimentModalComponent; -- cgit v1.2.3