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
......@@ -24,8 +24,8 @@ import PropTypes from 'prop-types';
import { FormGroup, FormControl, FormLabel, FormText } from 'react-bootstrap';
import validator from 'validator';
import Table from './table';
import TableColumn from './table-column';
import Table from '../common/table';
import TableColumn from '../common/table-column';
class SignalMapping extends React.Component {
constructor(props) {
......
......@@ -19,7 +19,7 @@
* along with VILLASweb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import ArrayStore from './array-store';
import SimulationModelsDataManager from '../data-managers/simulation-models-data-manager';
import ArrayStore from '../common/array-store';
import SimulationModelsDataManager from './simulation-models-data-manager';
export default new ArrayStore('simulationModels', SimulationModelsDataManager);
......@@ -23,15 +23,15 @@ import React from 'react';
import { Container } from 'flux/utils';
import { Button, Col, Form, FormLabel } from 'react-bootstrap';
import SimulationModelStore from '../stores/simulation-model-store';
import UserStore from '../stores/user-store';
import AppDispatcher from '../app-dispatcher';
import SimulationModelStore from './simulation-model-store';
import UserStore from '../user/user-store';
import AppDispatcher from '../common/app-dispatcher';
import SelectSimulator from './select-simulator';
import SelectFile from './select-file';
import SignalMapping from '../components/signal-mapping';
import EditableHeader from '../components/editable-header';
import ParametersEditor from '../components/parameters-editor';
import SelectSimulator from '../simulator/select-simulator';
import SelectFile from '../file/select-file';
import SignalMapping from './signal-mapping';
import EditableHeader from '../common/editable-header';
import ParametersEditor from '../common/parameters-editor';
class SimulationModel extends React.Component {
static getStores() {
......@@ -141,14 +141,14 @@ class SimulationModel extends React.Component {
<div>
<Col componentClass={FormLabel} sm={3} md={2}>
Start Parameters
Start Parameters
</Col>
<Col sm={9} md={10}>
<ParametersEditor content={this.state.simulationModel.startParameters} onChange={this.handleStartParametersChange} />
</Col>
</div>
</Col>
<Col xs={12} sm={6}>
......@@ -168,5 +168,5 @@ class SimulationModel extends React.Component {
}
}
let fluxContainerConverter = require('./FluxContainerConverter');
let fluxContainerConverter = require('../common/FluxContainerConverter');
export default Container.create(fluxContainerConverter.convert(SimulationModel), { withProps: true });
......@@ -19,8 +19,8 @@
* along with VILLASweb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import RestDataManager from './rest-data-manager';
import AppDispatcher from '../app-dispatcher';
import RestDataManager from '../common/data-managers/rest-data-manager';
import AppDispatcher from '../common/app-dispatcher';
class SimulationModelDataManager extends RestDataManager {
constructor() {
......
......@@ -23,8 +23,8 @@ import React from 'react';
import { FormGroup, FormControl, FormLabel } from 'react-bootstrap';
import _ from 'lodash';
import Dialog from './dialog';
import ParametersEditor from '../parameters-editor';
import Dialog from '../common/dialogs/dialog';
import ParametersEditor from '../common/parameters-editor';
class EditSimulatorDialog extends React.Component {
valid = true;
......
......@@ -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 ImportSimulatorDialog extends React.Component {
valid = false;
......@@ -42,7 +42,7 @@ class ImportSimulatorDialog extends React.Component {
onClose(canceled) {
if (canceled === false) {
if (this.valid) {
const data = {
const data = {
properties: {
name: this.state.name
},
......@@ -83,10 +83,10 @@ class ImportSimulatorDialog extends React.Component {
// read simulator
const simulator = JSON.parse(event.target.result);
self.imported = true;
self.setState({
name: _.get(simulator, 'properties.name') || _.get(simulator, 'rawProperties.name'),
self.setState({
name: _.get(simulator, 'properties.name') || _.get(simulator, 'rawProperties.name'),
endpoint: _.get(simulator, 'properties.endpoint') || _.get(simulator, 'rawProperties.endpoint'),
uuid: simulator.uuid
uuid: simulator.uuid
});
};
......
......@@ -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 NewSimulatorDialog extends React.Component {
valid = false;
......
......@@ -24,7 +24,7 @@ import { Container } from 'flux/utils';
import { FormGroup, FormControl, FormLabel, Col } from 'react-bootstrap';
import _ from 'lodash';
import SimulatorStore from '../stores/simulator-store';
import SimulatorStore from './simulator-store';
class SelectSimulator extends React.Component {
static getStores() {
......@@ -67,7 +67,7 @@ class SelectSimulator extends React.Component {
}
render() {
const simulatorOptions = this.state.simulators.map(s =>
const simulatorOptions = this.state.simulators.map(s =>
<option key={s._id} value={s._id}>{_.get(s, 'properties.name') || _.get(s, 'rawProperties.name') || s.uuid}</option>
);
......@@ -85,5 +85,5 @@ class SelectSimulator extends React.Component {
}
}
let fluxContainerConverter = require('./FluxContainerConverter');
let fluxContainerConverter = require('../common/FluxContainerConverter');
export default Container.create(fluxContainerConverter.convert(SelectSimulator));
......@@ -19,8 +19,8 @@
* along with VILLASweb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import WebsocketAPI from '../api/websocket-api';
import AppDispatcher from '../app-dispatcher';
import WebsocketAPI from '../common/api/websocket-api';
import AppDispatcher from '../common/app-dispatcher';
const OFFSET_TYPE = 2;
const OFFSET_VERSION = 4;
......
......@@ -21,8 +21,8 @@
import { ReduceStore } from 'flux/utils';
import AppDispatcher from '../app-dispatcher';
import SimulatorDataDataManager from '../data-managers/simulator-data-data-manager';
import AppDispatcher from '../common/app-dispatcher';
import SimulatorDataDataManager from './simulator-data-data-manager';
const MAX_VALUES = 10000;
......
......@@ -21,9 +21,9 @@
import _ from 'lodash';
import ArrayStore from './array-store';
import SimulatorsDataManager from '../data-managers/simulators-data-manager';
import SimulatorDataDataManager from '../data-managers/simulator-data-data-manager';
import ArrayStore from '../common/array-store';
import SimulatorsDataManager from './simulators-data-manager';
import SimulatorDataDataManager from './simulator-data-data-manager';
class SimulatorStore 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 SimulatorsDataManager extends RestDataManager {
constructor() {
......
......@@ -25,19 +25,19 @@ import { Button } from 'react-bootstrap';
import FileSaver from 'file-saver';
import _ from 'lodash';
import AppDispatcher from '../app-dispatcher';
import SimulatorStore from '../stores/simulator-store';
import UserStore from '../stores/user-store';
import AppDispatcher from '../common/app-dispatcher';
import SimulatorStore from './simulator-store';
import UserStore from '../user/user-store';
import Icon from '../components/icon';
import Table from '../components/table';
import TableColumn from '../components/table-column';
import NewSimulatorDialog from '../components/dialogs/new-simulator';
import EditSimulatorDialog from '../components/dialogs/edit-simulator';
import ImportSimulatorDialog from '../components/dialogs/import-simulator';
import Icon from '../common/icon';
import Table from '../common/table';
import TableColumn from '../common/table-column';
import NewSimulatorDialog from './new-simulator';
import EditSimulatorDialog from './edit-simulator';
import ImportSimulatorDialog from './import-simulator';
import SimulatorAction from '../components/simulator-action';
import DeleteDialog from '../components/dialogs/delete-dialog';
import SimulatorAction from './simulator-action';
import DeleteDialog from '../common/dialogs/delete-dialog';
class Simulators extends Component {
static getStores() {
......@@ -330,5 +330,5 @@ class Simulators extends Component {
}
}
let fluxContainerConverter = require('./FluxContainerConverter');
let fluxContainerConverter = require('../common/FluxContainerConverter');
export default Container.create(fluxContainerConverter.convert(Simulators));
......@@ -22,7 +22,7 @@
import React from 'react';
import {FormGroup, FormControl, FormLabel, Col} from 'react-bootstrap';
import Dialog from './dialog';
import Dialog from '../common/dialogs/dialog';
class EditUserDialog extends React.Component {
valid: true;
......
......@@ -22,7 +22,7 @@
import React, { Component } from 'react';
import { Form, Button, FormGroup, FormControl, FormLabel, Col } from 'react-bootstrap';
import AppDispatcher from '../app-dispatcher';
import AppDispatcher from '../common/app-dispatcher';
class LoginForm extends Component {
constructor(props) {
......
......@@ -25,13 +25,13 @@ import { NavbarBrand } from 'react-bootstrap';
import NotificationSystem from 'react-notification-system';
import { Redirect } from 'react-router-dom';
import LoginForm from '../components/login-form';
import Header from '../components/header';
import Footer from '../components/footer';
import NotificationsDataManager from '../data-managers/notifications-data-manager';
import LoginForm from './login-form';
import Header from '../common/header';
import Footer from '../common/footer';
import NotificationsDataManager from '../common/data-managers/notifications-data-manager';
import AppDispatcher from '../app-dispatcher';
import UserStore from '../stores/user-store';
import AppDispatcher from '../common/app-dispatcher';
import UserStore from './user-store';
class Login extends Component {
static getStores() {
......@@ -97,5 +97,5 @@ class Login extends Component {
}
}
let fluxContainerConverter = require('./FluxContainerConverter');
let fluxContainerConverter = require('../common/FluxContainerConverter');
export default Container.create(fluxContainerConverter.convert(Login));
......@@ -22,7 +22,7 @@
import React from 'react';
import { Redirect } from 'react-router-dom';
import AppDispatcher from '../app-dispatcher';
import AppDispatcher from '../common/app-dispatcher';
class Logout extends React.Component {
componentWillMount() {
......
......@@ -22,7 +22,7 @@
import React from 'react';
import { FormGroup, FormControl, FormLabel, FormText, Col } from 'react-bootstrap';
import Dialog from './dialog';
import Dialog from '../common/dialogs/dialog';
class NewUserDialog extends React.Component {
valid: false;
......
......@@ -21,9 +21,9 @@
import { ReduceStore } from 'flux/utils';
import AppDispatcher from '../app-dispatcher';
import UsersDataManager from '../data-managers/users-data-manager';
import SimulatorDataDataManager from '../data-managers/simulator-data-data-manager';
import AppDispatcher from '../common/app-dispatcher';
import UsersDataManager from './users-data-manager';
import SimulatorDataDataManager from '../simulator/simulator-data-data-manager';
class UserStore extends ReduceStore {
constructor() {
......@@ -73,7 +73,7 @@ class UserStore extends ReduceStore {
state = Object.assign({}, state, { loginMessage: 'Wrong credentials! Please try again.' });
}
return state;
return state;
default:
return state;
......
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