Aufgrund eines Security Updates wird GitLab heute zwischen 14:00 und 14:30 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to a security update GitLab will be temporarily unavailable between 2 and 2:30 today.

Commit d954941d authored by Laura Fuentes Grau's avatar Laura Fuentes Grau

most widgets now editable again

parent 95c7a865
...@@ -56,6 +56,7 @@ class Dashboard extends Component { ...@@ -56,6 +56,7 @@ class Dashboard extends Component {
if (prevState == null) { if (prevState == null) {
prevState = {}; prevState = {};
} }
const sessionToken = LoginStore.getState().token; const sessionToken = LoginStore.getState().token;
let maxHeight = null; let maxHeight = null;
let dashboard = Map(); let dashboard = Map();
...@@ -163,7 +164,7 @@ class Dashboard extends Component { ...@@ -163,7 +164,7 @@ class Dashboard extends Component {
modalData: null, modalData: null,
modalIndex: null, modalIndex: null,
widgetChangeData: [], widgetChangeData: [],
widgetAddData:[], widgetAddData:prevState.widgetAddData || [],
maxWidgetHeight: maxHeight || null, maxWidgetHeight: maxHeight || null,
dropZoneHeight: maxHeight +80 || null, dropZoneHeight: maxHeight +80 || null,
...@@ -298,6 +299,12 @@ class Dashboard extends Component { ...@@ -298,6 +299,12 @@ class Dashboard extends Component {
handleDrop(widget) { handleDrop(widget) {
widget.dashboardID = this.state.dashboard.get('id'); widget.dashboardID = this.state.dashboard.get('id');
console.log(widget); console.log(widget);
let tempChanges = this.state.widgetAddData;
tempChanges.push(widget);
console.log("handle drop. the temp changes: ");
console.log(tempChanges);
this.setState({ widgetAddData: tempChanges})
AppDispatcher.dispatch({ AppDispatcher.dispatch({
type: 'widgets/start-add', type: 'widgets/start-add',
...@@ -305,10 +312,7 @@ class Dashboard extends Component { ...@@ -305,10 +312,7 @@ class Dashboard extends Component {
data: widget data: widget
}); });
let tempChanges = this.state.widgetAddData;
tempChanges.push(widget);
this.setState({ widgetAddData: tempChanges})
/*let widgets = []; /*let widgets = [];
widgets = this.state.dashboard.get('widgets'); widgets = this.state.dashboard.get('widgets');
...@@ -428,15 +432,17 @@ class Dashboard extends Component { ...@@ -428,15 +432,17 @@ class Dashboard extends Component {
} }
cancelEditing() { cancelEditing() {
console.log("cancelEditing the add data: "); //raw widget has no id -> cannot be deleted in its original form
console.log(this.state.widgetAddData); /*
this.state.widgetAddData.forEach( widget => { this.state.widgetAddData.forEach( widget => {
AppDispatcher.dispatch({ AppDispatcher.dispatch({
type: 'widgets/start-remove', type: 'widgets/start-remove',
data: widget, data: widget,
token: this.state.sessionToken token: this.state.sessionToken
}); });
}); }); */
AppDispatcher.dispatch({ AppDispatcher.dispatch({
type: 'widgets/start-load', type: 'widgets/start-load',
token: this.state.sessionToken, token: this.state.sessionToken,
...@@ -462,6 +468,7 @@ class Dashboard extends Component { ...@@ -462,6 +468,7 @@ class Dashboard extends Component {
render() { render() {
const widgets = this.state.dashboard.get('widgets'); const widgets = this.state.dashboard.get('widgets');
const grid = this.state.dashboard.get('grid'); const grid = this.state.dashboard.get('grid');
const boxClasses = classNames('section', 'box', { 'fullscreen-padding': this.props.isFullscreen }); const boxClasses = classNames('section', 'box', { 'fullscreen-padding': this.props.isFullscreen });
......
...@@ -113,7 +113,7 @@ class WidgetContextMenu extends React.Component { ...@@ -113,7 +113,7 @@ class WidgetContextMenu extends React.Component {
); );
return <div> return <div>
<MenuProvider id={'widgetMenu'+ this.props.index} style={{ border: '1px solid purple', display: 'inline-block' }}> <MenuProvider id={'widgetMenu'+ this.props.index}>
<Widget <Widget
data={this.props.widget} data={this.props.widget}
simulation={this.props.simulation} simulation={this.props.simulation}
......
...@@ -44,7 +44,7 @@ class EditWidgetColorControl extends Component { ...@@ -44,7 +44,7 @@ class EditWidgetColorControl extends Component {
this.state = { this.state = {
widget: { widget: {
customProperties:{}
} }
}; };
} }
......
...@@ -77,7 +77,7 @@ class EditImageWidgetControl extends React.Component { ...@@ -77,7 +77,7 @@ class EditImageWidgetControl extends React.Component {
return <div> return <div>
<FormGroup controlId="file"> <FormGroup controlId="file">
<FormLabel>Image</FormLabel> <FormLabel>Image</FormLabel>
<FormControl componentClass="select" value={this.state.widget.customProperties.file} onChange={(e) => this.props.handleChange(e)}> <FormControl className="select" value={this.state.widget.customProperties.file} onChange={(e) => this.props.handleChange(e)}>
{this.props.files.length === 0 ? ( {this.props.files.length === 0 ? (
<option disabled value style={{ display: 'none' }}>No images found, please upload one first.</option> <option disabled value style={{ display: 'none' }}>No images found, please upload one first.</option>
) : ( ) : (
...@@ -96,8 +96,8 @@ class EditImageWidgetControl extends React.Component { ...@@ -96,8 +96,8 @@ class EditImageWidgetControl extends React.Component {
<FormControl type="file" onChange={(e) => this.setState({ fileList: e.target.files }) } /> <FormControl type="file" onChange={(e) => this.setState({ fileList: e.target.files }) } />
</FormGroup> </FormGroup>
<ProgressBar striped active now={this.state.progress} label={`${this.state.progress}%`} /> <ProgressBar striped active={'true'} now={this.state.progress} label={`${this.state.progress}%`} />
<Button bsSize="small" onClick={this.startFileUpload}>Upload</Button> <Button size='sm' onClick={this.startFileUpload}>Upload</Button>
</div>; </div>;
} }
} }
......
...@@ -43,6 +43,12 @@ class EditWidgetDialog extends React.Component { ...@@ -43,6 +43,12 @@ class EditWidgetDialog extends React.Component {
}; };
} }
static getDerivedStateFromProps(props, state){
return {
temporal: props.widget
};
}
onClose(canceled) { onClose(canceled) {
......
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