Commit f468b445 authored by Sonja Happ's avatar Sonja Happ
Browse files

Refactoring of js code base:

- Grouping js files based on the elements of the data model instead of parent js class
- All js files providing functionality for one element of the data model are now in one folder; this makes is easier to implement changes for one element in all affected files/ classes
- js files which are common to multiple elements are in the common folder
- The new structure is more in alignment with the new Go backend code base structure
- This commit does not contain any changes in functionality of the frontend
parent 982e5661
......@@ -19,8 +19,8 @@
* along with VILLASweb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import ArrayStore from './array-store';
import FilesDataManager from '../data-managers/files-data-manager';
import ArrayStore from '../common/array-store';
import FilesDataManager from './files-data-manager';
class FileStore extends ArrayStore {
constructor() {
......
......@@ -19,9 +19,9 @@
* along with VILLASweb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import RestDataManager from './rest-data-manager';
import RestAPI from '../api/rest-api';
import AppDispatcher from '../app-dispatcher';
import RestDataManager from '../common/data-managers/rest-data-manager';
import RestAPI from '../common/api/rest-api';
import AppDispatcher from '../common/app-dispatcher';
class FilesDataManager extends RestDataManager {
constructor() {
......
......@@ -23,10 +23,10 @@ import React from 'react';
import { Container } from 'flux/utils';
import { FormGroup, FormControl, FormLabel, Button, ProgressBar, Col } from 'react-bootstrap';
import FileStore from '../stores/file-store';
import UserStore from '../stores/user-store';
import FileStore from './file-store';
import UserStore from '../user/user-store';
import AppDispatcher from '../app-dispatcher';
import AppDispatcher from '../common/app-dispatcher';
class SelectFile extends React.Component {
static getStores() {
......@@ -107,12 +107,12 @@ class SelectFile extends React.Component {
}
render() {
const fileOptions = this.state.files.map(f =>
const fileOptions = this.state.files.map(f =>
<option key={f._id} value={f._id}>{f.name}</option>
);
const progressBarStyle = {
marginLeft: '100px',
marginLeft: '100px',
marginTop: '-25px'
};
......@@ -121,7 +121,7 @@ class SelectFile extends React.Component {
<Col componentClass={FormLabel} sm={3} md={2}>
{this.props.name}
</Col>
<Col sm={9} md={10}>
<FormControl disabled={this.props.disabled} componentClass='select' placeholder='Select file' onChange={this.handleChange}>
{fileOptions}
......@@ -148,5 +148,5 @@ class SelectFile extends React.Component {
}
}
let fluxContainerConverter = require('./FluxContainerConverter');
let fluxContainerConverter = require('../common/FluxContainerConverter');
export default Container.create(fluxContainerConverter.convert(SelectFile));
......@@ -22,7 +22,7 @@
import React from 'react';
import { FormGroup, FormControl, FormLabel } from 'react-bootstrap';
import Dialog from './dialog';
import Dialog from '../common/dialogs/dialog';
class EditProjectDialog extends React.Component {
valid: true;
......
......@@ -22,7 +22,7 @@
import React from 'react';
import { FormGroup, FormControl, FormLabel } from 'react-bootstrap';
import Dialog from './dialog';
import Dialog from '../common/dialogs/dialog';
class NewProjectDialog extends React.Component {
valid: false;
......
......@@ -19,7 +19,7 @@
* along with VILLASweb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import ArrayStore from './array-store';
import ProjectsDataManager from '../data-managers/projects-data-manager';
import ArrayStore from '../common/array-store';
import ProjectsDataManager from './projects-data-manager';
export default new ArrayStore('projects', ProjectsDataManager);
......@@ -24,20 +24,20 @@ import { Container } from 'flux/utils';
import { Button } from 'react-bootstrap';
import FileSaver from 'file-saver';
import AppDispatcher from '../app-dispatcher';
import ProjectStore from '../stores/project-store';
import UserStore from '../stores/user-store';
import VisualizationStore from '../stores/visualization-store';
import SimulationStore from '../stores/simulation-store';
import AppDispatcher from '../common/app-dispatcher';
import ProjectStore from './project-store';
import UserStore from '../user/user-store';
import VisualizationStore from '../visualization/visualization-store';
import SimulationStore from '../simulation/simulation-store';
import Icon from '../components/icon';
import CustomTable from '../components/table';
import TableColumn from '../components/table-column';
import NewVisualzationDialog from '../components/dialogs/new-visualization';
import EditVisualizationDialog from '../components/dialogs/edit-visualization';
import ImportVisualizationDialog from '../components/dialogs/import-visualization';
import Icon from '../common/icon';
import CustomTable from '../common/table';
import TableColumn from '../common/table-column';
import NewVisualzationDialog from '../visualization/new-visualization';
import EditVisualizationDialog from '../visualization/edit-visualization';
import ImportVisualizationDialog from '../visualization/import-visualization';
import DeleteDialog from '../components/dialogs/delete-dialog';
import DeleteDialog from '../common/dialogs/delete-dialog';
class Visualizations extends Component {
static getStores() {
......@@ -231,5 +231,5 @@ class Visualizations extends Component {
}
}
let fluxContainerConverter = require('./FluxContainerConverter');
let fluxContainerConverter = require('../common/FluxContainerConverter');
export default Container.create(fluxContainerConverter.convert(Visualizations), {withProps: true});
......@@ -19,6 +19,6 @@
* along with VILLASweb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import RestDataManager from './rest-data-manager';
import RestDataManager from '../common/data-managers/rest-data-manager';
export default new RestDataManager('project', '/projects');
......@@ -23,18 +23,18 @@ import React from 'react';
import { Container } from 'flux/utils';
import { Button } from 'react-bootstrap';
import AppDispatcher from '../app-dispatcher';
import ProjectStore from '../stores/project-store';
import UserStore from '../stores/user-store';
import SimulationStore from '../stores/simulation-store';
import AppDispatcher from '../common/app-dispatcher';
import ProjectStore from './project-store';
import UserStore from '../user/user-store';
import SimulationStore from '../simulation/simulation-store';
import Icon from '../components/icon';
import Table from '../components/table';
import TableColumn from '../components/table-column';
import NewProjectDialog from '../components/dialogs/new-project';
import EditProjectDialog from '../components/dialogs/edit-project';
import Icon from '../common/icon';
import Table from '../common/table';
import TableColumn from '../common/table-column';
import NewProjectDialog from './new-project';
import EditProjectDialog from './edit-project';
import DeleteDialog from '../components/dialogs/delete-dialog';
import DeleteDialog from '../common/dialogs/delete-dialog';
class Projects extends React.Component {
static getStores() {
......@@ -156,5 +156,5 @@ class Projects extends React.Component {
}
}
let fluxContainerConverter = require('./FluxContainerConverter');
let fluxContainerConverter = require('../common/FluxContainerConverter');
export default Container.create(fluxContainerConverter.convert(Projects));
......@@ -22,9 +22,9 @@
import React from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import App from './containers/app';
import Login from './containers/login';
import Logout from './containers/logout';
import App from './app';
import Login from './user/login';
import Logout from './user/logout';
class Root extends React.Component {
render() {
......
......@@ -22,8 +22,8 @@
import React from 'react';
import { FormGroup, FormControl, FormLabel } from 'react-bootstrap';
import Dialog from './dialog';
import ParametersEditor from '../parameters-editor';
import Dialog from '../common/dialogs/dialog';
import ParametersEditor from '../common/parameters-editor';
class EditSimulationDialog extends React.Component {
valid = true;
......
......@@ -22,8 +22,8 @@
import React from 'react';
import { FormGroup, FormControl, FormLabel } from 'react-bootstrap';
import Dialog from './dialog';
import ParametersEditor from '../parameters-editor';
import Dialog from '../common/dialogs/dialog';
import ParametersEditor from '../common/parameters-editor';
class ImportSimulationDialog extends React.Component {
valid = false;
......@@ -47,7 +47,7 @@ class ImportSimulationDialog extends React.Component {
return;
}
if (this.valid && this.props.onClose != null) {
this.props.onClose(this.state);
}
......@@ -62,7 +62,7 @@ class ImportSimulationDialog extends React.Component {
return;
}
this.setState({ [e.target.id]: e.target.value });
}
......
......@@ -22,8 +22,8 @@
import React from 'react';
import { FormGroup, FormControl, FormLabel } from 'react-bootstrap';
import Dialog from './dialog';
import ParametersEditor from '../parameters-editor';
import Dialog from '../common/dialogs/dialog';
import ParametersEditor from '../common/parameters-editor';
class NewSimulationDialog extends React.Component {
valid = false;
......@@ -42,7 +42,7 @@ class NewSimulationDialog extends React.Component {
if (this.props.onClose != null) {
this.props.onClose();
}
return;
}
......
......@@ -19,7 +19,7 @@
* along with VILLASweb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import ArrayStore from './array-store';
import SimulationsDataManager from '../data-managers/simulations-data-manager';
import ArrayStore from '../common/array-store';
import SimulationsDataManager from './simulations-data-manager';
export default new ArrayStore('simulations', SimulationsDataManager);
......@@ -25,19 +25,19 @@ import { Button } from 'react-bootstrap';
import FileSaver from 'file-saver';
import _ from 'lodash';
import SimulationStore from '../stores/simulation-store';
import SimulatorStore from '../stores/simulator-store';
import SimulationModelStore from '../stores/simulation-model-store';
import UserStore from '../stores/user-store';
import AppDispatcher from '../app-dispatcher';
import SimulationStore from './simulation-store';
import SimulatorStore from '../simulator/simulator-store';
import SimulationModelStore from '../simulationmodel/simulation-model-store';
import UserStore from '../user/user-store';
import AppDispatcher from '../common/app-dispatcher';
import Icon from '../components/icon';
import Table from '../components/table';
import TableColumn from '../components/table-column';
import ImportSimulationModelDialog from '../components/dialogs/import-simulation-model';
import Icon from '../common/icon';
import Table from '../common/table';
import TableColumn from '../common/table-column';
import ImportSimulationModelDialog from '../simulationmodel/import-simulation-model';
import SimulatorAction from '../components/simulator-action';
import DeleteDialog from '../components/dialogs/delete-dialog';
import SimulatorAction from '../simulator/simulator-action';
import DeleteDialog from '../common/dialogs/delete-dialog';
class Simulation extends React.Component {
static getStores() {
......@@ -285,5 +285,5 @@ class Simulation extends React.Component {
}
}
let fluxContainerConverter = require('./FluxContainerConverter');
let fluxContainerConverter = require('../common/FluxContainerConverter');
export default Container.create(fluxContainerConverter.convert(Simulation), { withProps: true });
......@@ -19,6 +19,6 @@
* along with VILLASweb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import RestDataManager from './rest-data-manager';
import RestDataManager from '../common/data-managers/rest-data-manager';
export default new RestDataManager('simulation', '/simulations', [ '_id', 'name', 'projects', 'models', 'startParameters' ]);
......@@ -24,21 +24,21 @@ import { Container } from 'flux/utils';
import { Button } from 'react-bootstrap';
import FileSaver from 'file-saver';
import AppDispatcher from '../app-dispatcher';
import SimulationStore from '../stores/simulation-store';
import UserStore from '../stores/user-store';
import SimulatorStore from '../stores/simulator-store';
import SimulationModelStore from '../stores/simulation-model-store';
import Icon from '../components/icon';
import Table from '../components/table';
import TableColumn from '../components/table-column';
import NewSimulationDialog from '../components/dialogs/new-simulation';
import EditSimulationDialog from '../components/dialogs/edit-simulation';
import ImportSimulationDialog from '../components/dialogs/import-simulation';
import SimulatorAction from '../components/simulator-action';
import DeleteDialog from '../components/dialogs/delete-dialog';
import AppDispatcher from '../common/app-dispatcher';
import SimulationStore from './simulation-store';
import UserStore from '../user/user-store';
import SimulatorStore from '../simulator/simulator-store';
import SimulationModelStore from '../simulationmodel/simulation-model-store';
import Icon from '../common/icon';
import Table from '../common/table';
import TableColumn from '../common/table-column';
import NewSimulationDialog from './new-simulation';
import EditSimulationDialog from './edit-simulation';
import ImportSimulationDialog from './import-simulation';
import SimulatorAction from '../simulator/simulator-action';
import DeleteDialog from '../common/dialogs/delete-dialog';
class Simulations extends Component {
static getStores() {
......@@ -325,5 +325,5 @@ class Simulations extends Component {
}
}
let fluxContainerConverter = require('./FluxContainerConverter');
let fluxContainerConverter = require('../common/FluxContainerConverter');
export default Container.create(fluxContainerConverter.convert(Simulations));
......@@ -23,7 +23,7 @@ import React from 'react';
import { FormGroup, FormControl, FormLabel } from 'react-bootstrap';
import _ from 'lodash';
import Dialog from './dialog';
import Dialog from '../common/dialogs/dialog';
class ImportSimulationModelDialog extends React.Component {
imported = false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment