1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

fixed edit bug

This commit is contained in:
Laura Fuentes Grau 2020-01-21 13:46:28 +01:00
parent d40d5b2901
commit 10bb5c263f
6 changed files with 10 additions and 23 deletions

View file

@ -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,

View file

@ -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 = [];

View file

@ -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>)
})
}

View file

@ -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>

View file

@ -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;

View file

@ -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) {