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

Unified Diff: appengine/swarming/elements/res/imp/botlist/bot-list-data.html

Issue 2247143003: Fix glitch with undefined disks (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Created 4 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/elements/res/imp/botlist/bot-list-data.html
diff --git a/appengine/swarming/elements/res/imp/botlist/bot-list-data.html b/appengine/swarming/elements/res/imp/botlist/bot-list-data.html
index 6036aa5385ddf3049a2f3fb67591c602407cd3b8..51b6254ae9771b5c20cd631c4581ef8d016bf09d 100644
--- a/appengine/swarming/elements/res/imp/botlist/bot-list-data.html
+++ b/appengine/swarming/elements/res/imp/botlist/bot-list-data.html
@@ -173,11 +173,12 @@
this._list.items.forEach(function(bot){
// Parse the state, which is a JSON string. This contains a lot of
// interesting information like details about the devices attached.
+ bot.state = bot.state || "{}";
bot.state = JSON.parse(bot.state);
// get the disks in an easier to deal with format, sorted by size.
- var disks = bot.state["disks"];
+ var disks = bot.state.disks || {};
var keys = Object.keys(disks);
- if (!keys || !keys.length) {
+ if (!keys.length) {
bot.disks = [{"id": "unknown", "mb": 0}];
} else {
bot.disks = [];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698