Commit 10bb5c26 authored by Laura Fuentes Grau's avatar Laura Fuentes Grau

fixed edit bug

parent d40d5b29
......@@ -322,13 +322,13 @@ class Dashboard extends Component {
}
widgetChange(widget, index, callback = null){
console.log("widget change was called (dashboard)");
AppDispatcher.dispatch({
type: 'widgets/start-edit',
token: this.state.sessionToken,
data: widget
});
});
}
......@@ -358,8 +358,7 @@ class Dashboard extends Component {
closeEdit(data){
console.log("dashboard close edit was called: ");
console.log(data);
if (data == null) {
this.setState({ editModal: false });
......@@ -383,7 +382,6 @@ class Dashboard extends Component {
const dashboard = this.state.dashboard.set('widgets');
this.setState({ dashboard });*/
console.log("delete Widget in dashboard was called");
AppDispatcher.dispatch({
type: 'widgets/start-remove',
data: widget,
......
......@@ -38,7 +38,7 @@ import EditWidgetMinMaxControl from './edit-widget-min-max-control';
import EditWidgetHTMLContent from './edit-widget-html-content';
import EditWidgetParametersControl from './edit-widget-parameters-control';
export default function CreateControls(widgetType = null, widget = null, sessionToken = null, files = null, validateForm, simulationModels = null, handleChange) {
export default function CreateControls(widgetType = null, widget = null, sessionToken = null, files = null, validateForm, simulationModels, handleChange) {
// Use a list to concatenate the controls according to the widget type
var DialogControls = [];
......
......@@ -60,7 +60,7 @@ class EditWidgetOrientation extends Component {
let name = WidgetSlider.OrientationTypes[type].name;
return (
<FormCheck inline label={name} id={value} type='radio' title='orientation' checked={ value === this.state.widget.customProperties.orientation } onChange={(e) => this.handleOrientationChange(value)}>
<FormCheck inline label={name} key={value} id={value} type='radio' title='orientation' checked={ value === this.state.widget.customProperties.orientation } onChange={(e) => this.handleOrientationChange(value)}>
</FormCheck>)
})
}
......
......@@ -28,18 +28,20 @@ class EditWidgetSimulationControl extends Component {
this.state = {
widget: {
customProperties: {
simulationModel: ''
}
}
};
}
componentDidUpdate(nextProps) {
componentWillReceiveProps(nextProps) {
// Update state's widget with props
this.setState({ widget: nextProps.widget });
}
render() {
console.log("editwidgetsimulationcontrol was called");
console.log(this.state.widget);
return (
<FormGroup controlId="simulationModel">
<FormLabel>Simulation Model</FormLabel>
......
......@@ -46,8 +46,6 @@ class EditWidgetDialog extends React.Component {
onClose(canceled) {
console.log("in editWidget. the temporal state: ");
console.log(this.state.temporal);
if (canceled === false) {
if (this.valid) {
this.props.onClose(this.state.temporal);
......@@ -72,11 +70,8 @@ class EditWidgetDialog extends React.Component {
if (e.constructor === Array) {
// Every property in the array will be updated
console.log("####its an array!");
let changes = e.reduce( (changesObject, event) => {
changesObject[event.target.id] = event.target.value;
console.log("hier ist changes object: ");
console.log(changesObject);
return changesObject;
}, {});
......@@ -110,13 +105,6 @@ class EditWidgetDialog extends React.Component {
changeObject[e.target.id] = e.target.value;
}
console.log("this.state.temporal is: ");
console.log(this.state.temporal);
console.log("the event target id: " + e.target.id);
console.log("this state target type is: " + e.target.type);
console.log("the value is: " + e.target.value)
console.log("change Object is: ");
console.log(changeObject);
let finalChange = this.state.temporal;
......
......@@ -23,7 +23,6 @@ import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Rnd } from 'react-rnd';
import { Menu } from 'react-contexify';
class EditableWidgetContainer extends React.Component {
constructor(props) {
......
Markdown is supported
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