From de8f12d74faef5fa3f9e38d1340948cab2d06ea3 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Wed, 1 Jul 2020 13:33:31 +0200 Subject: Manually generate IDs --- .../containers/app/timeline/PlayButtonContainer.js | 38 ++++++------- .../containers/app/timeline/TimelineContainer.js | 62 +++++++++++----------- .../app/timeline/TimelineControlsContainer.js | 54 +++++++++---------- .../app/timeline/TimelineLabelsContainer.js | 20 +++---- 4 files changed, 87 insertions(+), 87 deletions(-) (limited to 'frontend/src/containers/app/timeline') diff --git a/frontend/src/containers/app/timeline/PlayButtonContainer.js b/frontend/src/containers/app/timeline/PlayButtonContainer.js index 4e3c3d81..e332f08b 100644 --- a/frontend/src/containers/app/timeline/PlayButtonContainer.js +++ b/frontend/src/containers/app/timeline/PlayButtonContainer.js @@ -1,27 +1,27 @@ -import { connect } from "react-redux"; +import { connect } from 'react-redux' import { - pauseSimulation, - playSimulation -} from "../../../actions/simulation/playback"; -import PlayButtonComponent from "../../../components/app/timeline/PlayButtonComponent"; + pauseSimulation, + playSimulation, +} from '../../../actions/simulation/playback' +import PlayButtonComponent from '../../../components/app/timeline/PlayButtonComponent' const mapStateToProps = state => { - return { - isPlaying: state.isPlaying, - currentTick: state.currentTick, - lastSimulatedTick: state.lastSimulatedTick - }; -}; + return { + isPlaying: state.isPlaying, + currentTick: state.currentTick, + lastSimulatedTick: state.lastSimulatedTick, + } +} const mapDispatchToProps = dispatch => { - return { - onPlay: () => dispatch(playSimulation()), - onPause: () => dispatch(pauseSimulation()) - }; -}; + return { + onPlay: () => dispatch(playSimulation()), + onPause: () => dispatch(pauseSimulation()), + } +} const PlayButtonContainer = connect(mapStateToProps, mapDispatchToProps)( - PlayButtonComponent -); + PlayButtonComponent, +) -export default PlayButtonContainer; +export default PlayButtonContainer diff --git a/frontend/src/containers/app/timeline/TimelineContainer.js b/frontend/src/containers/app/timeline/TimelineContainer.js index 74d37d58..4fcaaaaf 100644 --- a/frontend/src/containers/app/timeline/TimelineContainer.js +++ b/frontend/src/containers/app/timeline/TimelineContainer.js @@ -1,41 +1,41 @@ -import { connect } from "react-redux"; -import { pauseSimulation } from "../../../actions/simulation/playback"; -import { incrementTick } from "../../../actions/simulation/tick"; -import { setCurrentDatacenter } from "../../../actions/topology/building"; -import TimelineComponent from "../../../components/app/timeline/TimelineComponent"; +import { connect } from 'react-redux' +import { pauseSimulation } from '../../../actions/simulation/playback' +import { incrementTick } from '../../../actions/simulation/tick' +import { setCurrentDatacenter } from '../../../actions/topology/building' +import TimelineComponent from '../../../components/app/timeline/TimelineComponent' const mapStateToProps = state => { - let sections = []; - if (state.currentExperimentId !== -1) { - const sectionIds = - state.objects.path[ - state.objects.experiment[state.currentExperimentId].pathId - ].sectionIds; + let sections = [] + if (state.currentExperimentId !== -1) { + const sectionIds = + state.objects.path[ + state.objects.experiment[state.currentExperimentId].pathId + ].sectionIds - if (sectionIds) { - sections = sectionIds.map(sectionId => state.objects.section[sectionId]); + if (sectionIds) { + sections = sectionIds.map(sectionId => state.objects.section[sectionId]) + } } - } - return { - isPlaying: state.isPlaying, - currentTick: state.currentTick, - lastSimulatedTick: state.lastSimulatedTick, - currentDatacenterId: state.currentDatacenterId, - sections - }; -}; + return { + isPlaying: state.isPlaying, + currentTick: state.currentTick, + lastSimulatedTick: state.lastSimulatedTick, + currentDatacenterId: state.currentDatacenterId, + sections, + } +} const mapDispatchToProps = dispatch => { - return { - incrementTick: () => dispatch(incrementTick()), - pauseSimulation: () => dispatch(pauseSimulation()), - setCurrentDatacenter: id => dispatch(setCurrentDatacenter(id)) - }; -}; + return { + incrementTick: () => dispatch(incrementTick()), + pauseSimulation: () => dispatch(pauseSimulation()), + setCurrentDatacenter: id => dispatch(setCurrentDatacenter(id)), + } +} const TimelineContainer = connect(mapStateToProps, mapDispatchToProps)( - TimelineComponent -); + TimelineComponent, +) -export default TimelineContainer; +export default TimelineContainer diff --git a/frontend/src/containers/app/timeline/TimelineControlsContainer.js b/frontend/src/containers/app/timeline/TimelineControlsContainer.js index ac851b2e..92e03e6a 100644 --- a/frontend/src/containers/app/timeline/TimelineControlsContainer.js +++ b/frontend/src/containers/app/timeline/TimelineControlsContainer.js @@ -1,36 +1,36 @@ -import { connect } from "react-redux"; -import { goToTick } from "../../../actions/simulation/tick"; -import TimelineControlsComponent from "../../../components/app/timeline/TimelineControlsComponent"; +import { connect } from 'react-redux' +import { goToTick } from '../../../actions/simulation/tick' +import TimelineControlsComponent from '../../../components/app/timeline/TimelineControlsComponent' const mapStateToProps = state => { - let sectionTicks = []; - if (state.currentExperimentId !== -1) { - const sectionIds = - state.objects.path[ - state.objects.experiment[state.currentExperimentId].pathId - ].sectionIds; - if (sectionIds) { - sectionTicks = sectionIds - .filter(sectionId => state.objects.section[sectionId].startTick !== 0) - .map(sectionId => state.objects.section[sectionId].startTick); + let sectionTicks = [] + if (state.currentExperimentId !== -1) { + const sectionIds = + state.objects.path[ + state.objects.experiment[state.currentExperimentId].pathId + ].sectionIds + if (sectionIds) { + sectionTicks = sectionIds + .filter(sectionId => state.objects.section[sectionId].startTick !== 0) + .map(sectionId => state.objects.section[sectionId].startTick) + } } - } - return { - currentTick: state.currentTick, - lastSimulatedTick: state.lastSimulatedTick, - sectionTicks - }; -}; + return { + currentTick: state.currentTick, + lastSimulatedTick: state.lastSimulatedTick, + sectionTicks, + } +} const mapDispatchToProps = dispatch => { - return { - goToTick: tick => dispatch(goToTick(tick)) - }; -}; + return { + goToTick: tick => dispatch(goToTick(tick)), + } +} const TimelineControlsContainer = connect(mapStateToProps, mapDispatchToProps)( - TimelineControlsComponent -); + TimelineControlsComponent, +) -export default TimelineControlsContainer; +export default TimelineControlsContainer diff --git a/frontend/src/containers/app/timeline/TimelineLabelsContainer.js b/frontend/src/containers/app/timeline/TimelineLabelsContainer.js index 9d7f268d..192d21c3 100644 --- a/frontend/src/containers/app/timeline/TimelineLabelsContainer.js +++ b/frontend/src/containers/app/timeline/TimelineLabelsContainer.js @@ -1,15 +1,15 @@ -import { connect } from "react-redux"; -import TimelineLabelsComponent from "../../../components/app/timeline/TimelineLabelsComponent"; +import { connect } from 'react-redux' +import TimelineLabelsComponent from '../../../components/app/timeline/TimelineLabelsComponent' const mapStateToProps = state => { - return { - currentTick: state.currentTick, - lastSimulatedTick: state.lastSimulatedTick - }; -}; + return { + currentTick: state.currentTick, + lastSimulatedTick: state.lastSimulatedTick, + } +} const TimelineLabelsContainer = connect(mapStateToProps)( - TimelineLabelsComponent -); + TimelineLabelsComponent, +) -export default TimelineLabelsContainer; +export default TimelineLabelsContainer -- cgit v1.2.3