mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Polymer .9: Fix history in more info dialogs
This commit is contained in:
parent
eb0584d466
commit
e5f0e57980
@ -36,16 +36,16 @@
|
||||
}
|
||||
|
||||
var root = Polymer.dom(this);
|
||||
var data = this.data;
|
||||
var stateHistory = this.data;
|
||||
|
||||
while (root.lastChild) {
|
||||
root.removeChild(root.lastChild);
|
||||
}
|
||||
|
||||
if (data.length === 0) {
|
||||
if (!stateHistory || stateHistory.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// debugger;
|
||||
var chart = new google.visualization.Timeline(this);
|
||||
var dataTable = new google.visualization.DataTable();
|
||||
|
||||
@ -60,13 +60,13 @@
|
||||
};
|
||||
|
||||
// people can pass in history of 1 entityId or a collection.
|
||||
var stateHistory;
|
||||
if (_.isArray(data[0])) {
|
||||
stateHistory = data;
|
||||
} else {
|
||||
stateHistory = [data];
|
||||
isSingleDevice = true;
|
||||
}
|
||||
// var stateHistory;
|
||||
// if (_.isArray(data[0])) {
|
||||
// stateHistory = data;
|
||||
// } else {
|
||||
// stateHistory = [data];
|
||||
// isSingleDevice = true;
|
||||
// }
|
||||
|
||||
var numTimelines = 0;
|
||||
// stateHistory is a list of lists of sorted state objects
|
||||
|
@ -79,13 +79,17 @@
|
||||
},
|
||||
|
||||
computeIsSingleDevice: function(stateHistory) {
|
||||
return stateHistory.length == 1;
|
||||
return stateHistory && stateHistory.length == 1;
|
||||
},
|
||||
|
||||
computeGroupedStateHistory: function(stateHistory) {
|
||||
var lineChartDevices = {};
|
||||
var timelineDevices = [];
|
||||
|
||||
if (!stateHistory) {
|
||||
return {line: unitStates, timeline: timelineDevices};
|
||||
}
|
||||
|
||||
stateHistory.forEach(function(stateInfo) {
|
||||
if (!stateInfo || stateInfo.length === 0) {
|
||||
return;
|
||||
|
@ -20,8 +20,8 @@
|
||||
<div>
|
||||
<state-card-content state-obj="[[stateObj]]"></state-card-content>
|
||||
<template is='dom-if' if="[[hasHistoryComponent]]">
|
||||
<state-history-charts stateHistory="[[stateHistory]]"
|
||||
isLoadingData="[[isLoadingHistoryData]]"></state-history-charts>
|
||||
<state-history-charts state-history="[[stateHistory]]"
|
||||
is-loading-data="[[isLoadingHistoryData]]"></state-history-charts>
|
||||
</template>
|
||||
<paper-dialog-scrollable>
|
||||
<more-info-content state-obj="[[stateObj]]"
|
||||
@ -89,7 +89,7 @@
|
||||
var newHistory;
|
||||
|
||||
if (this.hasHistoryComponent && this.entityId) {
|
||||
newHistory = stateHistoryStore.get(this.entityId);
|
||||
newHistory = [stateHistoryStore.get(this.entityId)];
|
||||
} else {
|
||||
newHistory = null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user