| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. | 2 Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 Use of this source code is governed under the Apache License, Version 2.0 | 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. | 4 that can be found in the LICENSE file. |
| 5 | 5 |
| 6 This in an HTML Import-able file that contains the definition | 6 This in an HTML Import-able file that contains the definition |
| 7 of the following elements: | 7 of the following elements: |
| 8 | 8 |
| 9 <bot-page-data> | 9 <bot-page-data> |
| 10 | 10 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 }, BOT_ID_DEBOUNCE_MS); | 135 }, BOT_ID_DEBOUNCE_MS); |
| 136 | 136 |
| 137 }, | 137 }, |
| 138 | 138 |
| 139 _parseBot: function(bot) { | 139 _parseBot: function(bot) { |
| 140 if (!bot) { | 140 if (!bot) { |
| 141 return {}; | 141 return {}; |
| 142 } | 142 } |
| 143 // Do any preprocessing here | 143 // Do any preprocessing here |
| 144 bot.state = bot.state || "{}"; | 144 bot.state = bot.state || "{}"; |
| 145 bot.state = JSON.parse(bot.state); | 145 bot.state = JSON.parse(bot.state) || {}; |
| 146 | 146 |
| 147 // get the disks in an easier to deal with format, sorted by size. | 147 // get the disks in an easier to deal with format, sorted by size. |
| 148 var disks = bot.state.disks || {}; | 148 var disks = bot.state.disks || {}; |
| 149 var keys = Object.keys(disks); | 149 var keys = Object.keys(disks); |
| 150 if (!keys.length) { | 150 if (!keys.length) { |
| 151 bot.disks = [{"id": "unknown", "mb": 0}]; | 151 bot.disks = [{"id": "unknown", "mb": 0}]; |
| 152 } else { | 152 } else { |
| 153 bot.disks = []; | 153 bot.disks = []; |
| 154 for (var i = 0; i < keys.length; i++) { | 154 for (var i = 0; i < keys.length; i++) { |
| 155 bot.disks.push({"id":keys[i], "mb":disks[keys[i]].free_mb}); | 155 bot.disks.push({"id":keys[i], "mb":disks[keys[i]].free_mb}); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 return b.started_ts - a.started_ts; | 238 return b.started_ts - a.started_ts; |
| 239 }); | 239 }); |
| 240 | 240 |
| 241 return tasks; | 241 return tasks; |
| 242 } | 242 } |
| 243 | 243 |
| 244 }); | 244 }); |
| 245 })(); | 245 })(); |
| 246 </script> | 246 </script> |
| 247 </dom-module> | 247 </dom-module> |
| OLD | NEW |