From 10bb5c263fdc9415c229f01944b2a60b392a8584 Mon Sep 17 00:00:00 2001 From: Laura Fuentes Grau Date: Tue, 21 Jan 2020 13:46:28 +0100 Subject: [PATCH] fixed edit bug --- src/dashboard/dashboard.js | 8 +++----- src/widget/edit-widget-control-creator.js | 2 +- src/widget/edit-widget-orientation.js | 2 +- src/widget/edit-widget-simulation-control.js | 8 +++++--- src/widget/edit-widget.js | 12 ------------ src/widget/editable-widget-container.js | 1 - 6 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/dashboard/dashboard.js b/src/dashboard/dashboard.js index 899a355..47b7602 100644 --- a/src/dashboard/dashboard.js +++ b/src/dashboard/dashboard.js @@ -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, diff --git a/src/widget/edit-widget-control-creator.js b/src/widget/edit-widget-control-creator.js index c0b853c..f435085 100644 --- a/src/widget/edit-widget-control-creator.js +++ b/src/widget/edit-widget-control-creator.js @@ -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 = []; diff --git a/src/widget/edit-widget-orientation.js b/src/widget/edit-widget-orientation.js index 2da449d..1cb612b 100644 --- a/src/widget/edit-widget-orientation.js +++ b/src/widget/edit-widget-orientation.js @@ -60,7 +60,7 @@ class EditWidgetOrientation extends Component { let name = WidgetSlider.OrientationTypes[type].name; return ( - this.handleOrientationChange(value)}> + this.handleOrientationChange(value)}> ) }) } diff --git a/src/widget/edit-widget-simulation-control.js b/src/widget/edit-widget-simulation-control.js index ffeb212..50ad8bf 100644 --- a/src/widget/edit-widget-simulation-control.js +++ b/src/widget/edit-widget-simulation-control.js @@ -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 ( Simulation Model diff --git a/src/widget/edit-widget.js b/src/widget/edit-widget.js index 021fcd7..621dc03 100644 --- a/src/widget/edit-widget.js +++ b/src/widget/edit-widget.js @@ -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; diff --git a/src/widget/editable-widget-container.js b/src/widget/editable-widget-container.js index 29140a0..9b4c3bf 100644 --- a/src/widget/editable-widget-container.js +++ b/src/widget/editable-widget-container.js @@ -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) {