diff options
Diffstat (limited to 'frontend/src/pages')
| -rw-r--r-- | frontend/src/pages/App.js | 60 | ||||
| -rw-r--r-- | frontend/src/pages/Experiments.js | 36 | ||||
| -rw-r--r-- | frontend/src/pages/Home.js | 22 | ||||
| -rw-r--r-- | frontend/src/pages/NotFound.js | 2 | ||||
| -rw-r--r-- | frontend/src/pages/Profile.js | 6 | ||||
| -rw-r--r-- | frontend/src/pages/Projects.js | 43 | ||||
| -rw-r--r-- | frontend/src/pages/Simulations.js | 43 |
7 files changed, 101 insertions, 111 deletions
diff --git a/frontend/src/pages/App.js b/frontend/src/pages/App.js index 89d1fa32..5075cec0 100644 --- a/frontend/src/pages/App.js +++ b/frontend/src/pages/App.js @@ -4,16 +4,14 @@ import DocumentTitle from 'react-document-title' import { connect } from 'react-redux' import { ShortcutManager } from 'react-shortcuts' import { openExperimentSucceeded } from '../actions/experiments' -import { openSimulationSucceeded } from '../actions/simulations' +import { openProjectSucceeded } from '../actions/projects' import { resetCurrentTopology } from '../actions/topology/building' import ToolPanelComponent from '../components/app/map/controls/ToolPanelComponent' import LoadingScreen from '../components/app/map/LoadingScreen' -import SimulationSidebarComponent from '../components/app/sidebars/simulation/SimulationSidebarComponent' import AppNavbar from '../components/navigation/AppNavbar' import ScaleIndicatorContainer from '../containers/app/map/controls/ScaleIndicatorContainer' import MapStage from '../containers/app/map/MapStage' import TopologySidebar from '../containers/app/sidebars/topology/TopologySidebar' -import TimelineContainer from '../containers/app/timeline/TimelineContainer' import DeleteMachineModal from '../containers/modals/DeleteMachineModal' import DeleteRackModal from '../containers/modals/DeleteRackModal' import DeleteRoomModal from '../containers/modals/DeleteRoomModal' @@ -27,10 +25,9 @@ const shortcutManager = new ShortcutManager(KeymapConfiguration) class AppComponent extends React.Component { static propTypes = { - simulationId: PropTypes.string.isRequired, - inSimulation: PropTypes.bool, + projectId: PropTypes.string.isRequired, experimentId: PropTypes.number, - simulationName: PropTypes.string, + projectName: PropTypes.string, onViewTopologies: PropTypes.func, } static childContextTypes = { @@ -38,12 +35,7 @@ class AppComponent extends React.Component { } componentDidMount() { - // TODO this.props.resetCurrentTopology() - if (this.props.inSimulation) { - this.props.openExperimentSucceeded(this.props.simulationId, this.props.experimentId) - return - } - this.props.openSimulationSucceeded(this.props.simulationId) + this.props.openProjectSucceeded(this.props.projectId) } getChildContext() { @@ -55,35 +47,33 @@ class AppComponent extends React.Component { render() { return ( <DocumentTitle - title={this.props.simulationName ? this.props.simulationName + ' - OpenDC' : 'Simulation - OpenDC'} + title={this.props.projectName ? this.props.projectName + ' - OpenDC' : 'Simulation - OpenDC'} > <div className="page-container full-height"> <AppNavbar - simulationId={this.props.simulationId} - inSimulation={true} + projectId={this.props.projectId} + inProject={true} fullWidth={true} onViewTopologies={this.props.onViewTopologies} /> {this.props.topologyIsLoading ? ( <div className="full-height d-flex align-items-center justify-content-center"> - <LoadingScreen /> + <LoadingScreen/> </div> ) : ( <div className="full-height"> - <MapStage /> - <ScaleIndicatorContainer /> - <ToolPanelComponent /> - <TopologySidebar /> - {this.props.inSimulation ? <TimelineContainer /> : undefined} - {this.props.inSimulation ? <SimulationSidebarComponent /> : undefined} + <MapStage/> + <ScaleIndicatorContainer/> + <ToolPanelComponent/> + <TopologySidebar/> </div> )} - <ChangeTopologyModal /> - <EditRoomNameModal /> - <DeleteRoomModal /> - <EditRackNameModal /> - <DeleteRackModal /> - <DeleteMachineModal /> + <ChangeTopologyModal/> + <EditRoomNameModal/> + <DeleteRoomModal/> + <EditRackNameModal/> + <DeleteRackModal/> + <DeleteMachineModal/> </div> </DocumentTitle> ) @@ -91,24 +81,24 @@ class AppComponent extends React.Component { } const mapStateToProps = (state) => { - let simulationName = undefined - if (state.currentSimulationId !== '-1' && state.objects.simulation[state.currentSimulationId]) { - simulationName = state.objects.simulation[state.currentSimulationId].name + let projectName = undefined + if (state.currentProjectId !== '-1' && state.objects.project[state.currentProjectId]) { + projectName = state.objects.project[state.currentProjectId].name } return { topologyIsLoading: state.currentTopologyId === '-1', - simulationName, + projectName, } } const mapDispatchToProps = (dispatch) => { return { resetCurrentTopology: () => dispatch(resetCurrentTopology()), - openSimulationSucceeded: (id) => dispatch(openSimulationSucceeded(id)), + openProjectSucceeded: (id) => dispatch(openProjectSucceeded(id)), onViewTopologies: () => dispatch(openChangeTopologyModal()), - openExperimentSucceeded: (simulationId, experimentId) => - dispatch(openExperimentSucceeded(simulationId, experimentId)), + openExperimentSucceeded: (projectId, experimentId) => + dispatch(openExperimentSucceeded(projectId, experimentId)), } } diff --git a/frontend/src/pages/Experiments.js b/frontend/src/pages/Experiments.js index 43bd15be..66362299 100644 --- a/frontend/src/pages/Experiments.js +++ b/frontend/src/pages/Experiments.js @@ -2,8 +2,8 @@ import PropTypes from 'prop-types' import React from 'react' import DocumentTitle from 'react-document-title' import { connect } from 'react-redux' -import { fetchExperimentsOfSimulation } from '../actions/experiments' -import { openSimulationSucceeded } from '../actions/simulations' +import { fetchExperimentsOfProject } from '../actions/experiments' +import { openProjectSucceeded } from '../actions/projects' import AppNavbar from '../components/navigation/AppNavbar' import ExperimentListContainer from '../containers/experiments/ExperimentListContainer' import NewExperimentButtonContainer from '../containers/experiments/NewExperimentButtonContainer' @@ -11,31 +11,31 @@ import NewExperimentModal from '../containers/modals/NewExperimentModal' class ExperimentsComponent extends React.Component { static propTypes = { - simulationId: PropTypes.string.isRequired, - simulationName: PropTypes.string, + projectId: PropTypes.string.isRequired, + projectName: PropTypes.string, } componentDidMount() { - this.props.storeSimulationId(this.props.simulationId) - this.props.fetchExperimentsOfSimulation(this.props.simulationId) + this.props.storeProjectId(this.props.projectId) + this.props.fetchExperimentsOfProject(this.props.projectId) } render() { return ( <DocumentTitle title={ - this.props.simulationName - ? 'Experiments - ' + this.props.simulationName + ' - OpenDC' + this.props.projectName + ? 'Experiments - ' + this.props.projectName + ' - OpenDC' : 'Experiments - OpenDC' } > <div className="full-height"> - <AppNavbar simulationId={this.props.simulationId} inSimulation={true} fullWidth={true} /> + <AppNavbar projectId={this.props.projectId} inProject={true} fullWidth={true}/> <div className="container text-page-container full-height"> - <ExperimentListContainer /> - <NewExperimentButtonContainer /> + <ExperimentListContainer/> + <NewExperimentButtonContainer/> </div> - <NewExperimentModal /> + <NewExperimentModal/> </div> </DocumentTitle> ) @@ -43,20 +43,20 @@ class ExperimentsComponent extends React.Component { } const mapStateToProps = (state) => { - let simulationName = undefined - if (state.currentSimulationId !== '-1' && state.objects.simulation[state.currentSimulationId]) { - simulationName = state.objects.simulation[state.currentSimulationId].name + let projectName = undefined + if (state.currentProjectId !== '-1' && state.objects.project[state.currentProjectId]) { + projectName = state.objects.project[state.currentProjectId].name } return { - simulationName, + projectName, } } const mapDispatchToProps = (dispatch) => { return { - storeSimulationId: (id) => dispatch(openSimulationSucceeded(id)), - fetchExperimentsOfSimulation: (id) => dispatch(fetchExperimentsOfSimulation(id)), + storeProjectId: (id) => dispatch(openProjectSucceeded(id)), + fetchExperimentsOfProject: (id) => dispatch(fetchExperimentsOfProject(id)), } } diff --git a/frontend/src/pages/Home.js b/frontend/src/pages/Home.js index 1bdfc5c7..e69c2049 100644 --- a/frontend/src/pages/Home.js +++ b/frontend/src/pages/Home.js @@ -21,7 +21,7 @@ class Home extends React.Component { const scrollOffset = 60 jQuery('#navbar') .find('li a') - .click(function (e) { + .click(function(e) { if (jQuery(e.target).parents('.auth-links').length > 0) { return } @@ -42,17 +42,17 @@ class Home extends React.Component { render() { return ( <div> - <HomeNavbar /> + <HomeNavbar/> <div className="body-wrapper page-container"> - <JumbotronHeader /> - <IntroSection /> - <StakeholderSection /> - <ModelingSection /> - <SimulationSection /> - <TechnologiesSection /> - <TeamSection /> - <ContactSection /> - <DocumentTitle title="OpenDC" /> + <JumbotronHeader/> + <IntroSection/> + <StakeholderSection/> + <ModelingSection/> + <SimulationSection/> + <TechnologiesSection/> + <TeamSection/> + <ContactSection/> + <DocumentTitle title="OpenDC"/> </div> </div> ) diff --git a/frontend/src/pages/NotFound.js b/frontend/src/pages/NotFound.js index f72c7d01..959cceec 100644 --- a/frontend/src/pages/NotFound.js +++ b/frontend/src/pages/NotFound.js @@ -6,7 +6,7 @@ import './NotFound.css' const NotFound = () => ( <DocumentTitle title="Page Not Found - OpenDC"> <div className="not-found-backdrop"> - <TerminalWindow /> + <TerminalWindow/> </div> </DocumentTitle> ) diff --git a/frontend/src/pages/Profile.js b/frontend/src/pages/Profile.js index 45b48247..00bf903e 100644 --- a/frontend/src/pages/Profile.js +++ b/frontend/src/pages/Profile.js @@ -8,18 +8,18 @@ import DeleteProfileModal from '../containers/modals/DeleteProfileModal' const ProfileContainer = ({ onDelete }) => ( <DocumentTitle title="My Profile - OpenDC"> <div className="full-height"> - <AppNavbar inSimulation={false} fullWidth={false} /> + <AppNavbar inProject={false} fullWidth={false}/> <div className="container text-page-container full-height"> <button className="btn btn-danger mb-2 ml-auto mr-auto" style={{ maxWidth: 300 }} onClick={onDelete}> Delete my account on OpenDC </button> <p className="text-muted text-center"> This does not delete your Google account, but simply disconnects it from the OpenDC platform and - deletes any simulation info that is associated with you (simulations you own and any authorizations + deletes any project info that is associated with you (projects you own and any authorizations you may have on other projects). </p> </div> - <DeleteProfileModal /> + <DeleteProfileModal/> </div> </DocumentTitle> ) diff --git a/frontend/src/pages/Projects.js b/frontend/src/pages/Projects.js new file mode 100644 index 00000000..450ff695 --- /dev/null +++ b/frontend/src/pages/Projects.js @@ -0,0 +1,43 @@ +import React from 'react' +import DocumentTitle from 'react-document-title' +import { connect } from 'react-redux' +import { openNewProjectModal } from '../actions/modals/projects' +import { fetchAuthorizationsOfCurrentUser } from '../actions/users' +import AppNavbar from '../components/navigation/AppNavbar' +import ProjectFilterPanel from '../components/projects/FilterPanel' +import NewProjectModal from '../containers/modals/NewProjectModal' +import NewProjectButtonContainer from '../containers/projects/NewProjectButtonContainer' +import VisibleProjectList from '../containers/projects/VisibleProjectAuthList' + +class ProjectsContainer extends React.Component { + componentDidMount() { + this.props.fetchAuthorizationsOfCurrentUser() + } + + render() { + return ( + <DocumentTitle title="My Projects - OpenDC"> + <div className="full-height"> + <AppNavbar inProject={false} fullWidth={false}/> + <div className="container text-page-container full-height"> + <ProjectFilterPanel/> + <VisibleProjectList/> + <NewProjectButtonContainer/> + </div> + <NewProjectModal/> + </div> + </DocumentTitle> + ) + } +} + +const mapDispatchToProps = (dispatch) => { + return { + fetchAuthorizationsOfCurrentUser: () => dispatch(fetchAuthorizationsOfCurrentUser()), + openNewProjectModal: () => dispatch(openNewProjectModal()), + } +} + +const Projects = connect(undefined, mapDispatchToProps)(ProjectsContainer) + +export default Projects diff --git a/frontend/src/pages/Simulations.js b/frontend/src/pages/Simulations.js deleted file mode 100644 index ce2386fd..00000000 --- a/frontend/src/pages/Simulations.js +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react' -import DocumentTitle from 'react-document-title' -import { connect } from 'react-redux' -import { openNewSimulationModal } from '../actions/modals/simulations' -import { fetchAuthorizationsOfCurrentUser } from '../actions/users' -import AppNavbar from '../components/navigation/AppNavbar' -import SimulationFilterPanel from '../components/simulations/FilterPanel' -import NewSimulationModal from '../containers/modals/NewSimulationModal' -import NewSimulationButtonContainer from '../containers/simulations/NewSimulationButtonContainer' -import VisibleSimulationList from '../containers/simulations/VisibleSimulationAuthList' - -class SimulationsContainer extends React.Component { - componentDidMount() { - this.props.fetchAuthorizationsOfCurrentUser() - } - - render() { - return ( - <DocumentTitle title="My Simulations - OpenDC"> - <div className="full-height"> - <AppNavbar inSimulation={false} fullWidth={false} /> - <div className="container text-page-container full-height"> - <SimulationFilterPanel /> - <VisibleSimulationList /> - <NewSimulationButtonContainer /> - </div> - <NewSimulationModal /> - </div> - </DocumentTitle> - ) - } -} - -const mapDispatchToProps = (dispatch) => { - return { - fetchAuthorizationsOfCurrentUser: () => dispatch(fetchAuthorizationsOfCurrentUser()), - openNewSimulationModal: () => dispatch(openNewSimulationModal()), - } -} - -const Simulations = connect(undefined, mapDispatchToProps)(SimulationsContainer) - -export default Simulations |
