fix problems with rendering data

This commit is contained in:
Eric Hulburd
2016-02-21 18:40:55 -06:00
parent a84df34b55
commit c1fddd944e
28 changed files with 456 additions and 158 deletions

View File

@@ -22,7 +22,7 @@ var Energy = React.createClass({
var energy = this,
house = energy.props.house;
energy.graph_title = 'Daily Consumption';
house.ensureEnergyData().then(()=>{
house.setEnergyData().then(()=>{
energy.setState({loading_data: false});
if (energy.props.view === 'graph') energy.initGraph();
});
@@ -32,7 +32,7 @@ var Energy = React.createClass({
var energy = this;
if (new_props.house !== energy.state.house){
energy.setState({loading_data: true});
new_props.house.ensureEnergyData().then(()=>{
new_props.house.setEnergyData().then(()=>{
energy.setState({loading_data: false});
if (energy.props.view === 'graph') energy.initGraph();
});

View File

@@ -27,7 +27,7 @@
</tr>
</thead>
<tbody>
<tr rt-repeat="energy_datum in this.props.house.energy_data" key="{energy_datum.react_key}">
<tr rt-repeat="energy_datum in this.props.house.energy_data" key="{energy_datum.scoped_id}">
<td></td>
<td>{energy_datum.day_to_s}</td>
<td>{energy_datum.consumption_to_s}</td>

View File

@@ -1,7 +1,7 @@
import React from 'react';
import _ from 'lodash';
function repeatEnergy_datum1(energy_datum, energy_datumIndex) {
return React.createElement('tr', { 'key': energy_datum.react_key }, React.createElement('td', {}), React.createElement('td', {}, energy_datum.day_to_s), React.createElement('td', {}, energy_datum.consumption_to_s), React.createElement('td', {}, energy_datum.production_to_s));
return React.createElement('tr', { 'key': energy_datum.scoped_id }, React.createElement('td', {}), React.createElement('td', {}, energy_datum.day_to_s), React.createElement('td', {}, energy_datum.consumption_to_s), React.createElement('td', {}, energy_datum.production_to_s));
}
export default function () {
return React.createElement('div', { 'id': 'energy_view' }, this.state.loading_data ? React.createElement('div', { 'className': 'alert alert-warning' }, '\n Retrieving energy data for the ', this.props.house.name, ' household...\n ') : null, this.props.view === 'graph' ? React.createElement('div', {}, React.createElement('h4', {}, 'Select Data'), React.createElement('div', {