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

replaced table with signal list to bootstrap buttons

This commit is contained in:
Ricardo Hernandez-Montoya 2017-03-28 11:55:29 +02:00
parent 002a4cb1b5
commit fb34f809f8
2 changed files with 10 additions and 7 deletions

View file

@ -10,8 +10,7 @@
import React, { Component } from 'react';
import { LineChart } from 'rd3';
import Table from './table';
import TableColumn from './table-column';
import { ButtonGroup, Button } from 'react-bootstrap';
class WidgetPlotTable extends Component {
constructor(props) {
@ -81,17 +80,21 @@ class WidgetPlotTable extends Component {
this.setState({ values: values, firstTimestamp: firstTimestamp, latestTimestamp: latestTimestamp, sequence: nextProps.data[simulator].sequence, rows: rows });
}
render() {
console.log("Signal: " + this.state.signal);
return (
<div className="plot-table-widget" style={{ width: '100%', height: '100%' }} ref="wrapper">
<h4>{this.props.widget.name}</h4>
<div className="content">
<div className="widget-table">
<Table data={this.state.rows}>
<TableColumn title="Signal" dataKey="name" clickable onClick={(index) => this.setState({ signal: index }) } />
</Table>
<ButtonGroup vertical>
{ this.state.rows.map( (row, index) => (
<Button key={index} active={ index === this.state.signal } disabled={ this.props.editing } onClick={() => this.setState({ signal: Number(index) }) } > { row.name } </Button>
))
}
</ButtonGroup>
</div>
<div className="widget-plot">

View file

@ -105,7 +105,7 @@ class Widget extends Component {
} else if (widget.type === 'Label') {
element = <WidgetLabel widget={widget} />
} else if (widget.type === 'PlotTable') {
element = <WidgetPlotTable widget={widget} data={this.state.simulatorData} dummy={this.state.sequence} simulation={this.props.simulation} />
element = <WidgetPlotTable widget={widget} data={this.state.simulatorData} dummy={this.state.sequence} simulation={this.props.simulation} editing={this.props.editing} />
} else if (widget.type === 'Image') {
element = <WidgetImage widget={widget} files={this.state.files} />
}