Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2146)

Unified Diff: appengine/swarming/ui/build/elements.html

Issue 2778773002: Fix device summary when state not fully formed (Closed)
Patch Set: Fix device summary when state not fully formed: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/swarming/ui/res/imp/botpage/device-summary.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/ui/build/elements.html
diff --git a/appengine/swarming/ui/build/elements.html b/appengine/swarming/ui/build/elements.html
index 1ad41a323e2c937a7c2b5404fac082fe3ec57d8e..f21a21d37edafea9c43a7f048346548eac9fe418 100644
--- a/appengine/swarming/ui/build/elements.html
+++ b/appengine/swarming/ui/build/elements.html
@@ -927,11 +927,12 @@ weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六"
var d = this.state.devices[id];
var device = {
id: id,
- battery: d.battery.level,
- state: d.state,
+ state: d.state || "???",
};
+ device.battery = (d.battery && d.battery.level) || "???"
var count = 0;
var totalTemp = 0;
+ d.temp = d.temp || [];
for (var t in d.temp) {
totalTemp += parseFloat(d.temp[t]);
count++;
@@ -939,6 +940,8 @@ weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六"
// Report the average temperature of all sensors.
if (count) {
device.temp = (totalTemp/count).toFixed(1);
+ } else {
+ device.temp == "???";
}
arr.push(device);
}
« no previous file with comments | « no previous file | appengine/swarming/ui/res/imp/botpage/device-summary.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698