import PropTypes from 'prop-types' import React, { useRef } from 'react' import { Form, FormGroup, Input, Label } from 'reactstrap' import Shapes from '../../../shapes' import Modal from '../Modal' const NewScenarioModalComponent = ({ show, callback, currentPortfolioId, currentPortfolioScenarioIds, traces, topologies, schedulers, }) => { const form = useRef(null) const textInput = useRef(null) const traceSelect = useRef(null) const traceLoadInput = useRef(null) const topologySelect = useRef(null) const failuresCheckbox = useRef(null) const performanceInterferenceCheckbox = useRef(null) const schedulerSelect = useRef(null) const onSubmit = () => { if (!form.current.reportValidity()) { return false } callback( textInput.current.value, currentPortfolioId, { traceId: traceSelect.current.value, loadSamplingFraction: parseFloat(traceLoadInput.current.value), }, { topologyId: topologySelect.current.value, }, { failuresEnabled: failuresCheckbox.current.checked, performanceInterferenceEnabled: performanceInterferenceCheckbox.current.checked, schedulerName: schedulerSelect.current.value, } ) return true } const onCancel = () => { callback(undefined) } return (
{ e.preventDefault() onSubmit() }} innerRef={form} >

Trace

{traces.map((trace) => ( ))}

Topology

{topologies.map((topology) => ( ))}

Operational Phenomena

{schedulers.map((scheduler) => ( ))}
) } NewScenarioModalComponent.propTypes = { show: PropTypes.bool.isRequired, currentPortfolioId: PropTypes.string.isRequired, currentPortfolioScenarioIds: PropTypes.arrayOf(PropTypes.string), traces: PropTypes.arrayOf(Shapes.Trace), topologies: PropTypes.arrayOf(Shapes.Topology), schedulers: PropTypes.arrayOf(Shapes.Scheduler), callback: PropTypes.func.isRequired, } export default NewScenarioModalComponent