Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!-- | |
| 2 This in an HTML Import-able file that contains the definition | |
| 3 of the following elements: | |
| 4 | |
| 5 <bot-list-summary> | |
| 6 | |
| 7 | |
| 8 Usage: | |
| 9 | |
| 10 <bot-list-summary></bot-list-summary> | |
| 11 | |
| 12 This element summarizes and displays the results of the current query. | |
| 13 | |
| 14 Properties: | |
| 15 filtered_bots: Array<Object>, The bot list that is currently being shown | |
| 16 (after filtering). The alive, dead, etc bots in this will be counted up | |
| 17 for the summary. | |
| 18 fleet: Object, counts of all bots in the fleet. Contains "alive", "busy", | |
| 19 "idle", "dead", and "quarantined". | |
| 20 Methods: | |
| 21 None. | |
| 22 | |
| 23 Events: | |
| 24 None. | |
| 25 --> | |
| 26 | |
| 27 | |
| 28 <link rel="import" href="/res/imp/common/swarming-app.html"> | |
| 29 | |
| 30 <link rel="import" href="bot-list-shared.html"> | |
| 31 | |
| 32 <dom-module id="bot-list-summary"> | |
| 33 <template> | |
| 34 <style include="swarming-app-style"> | |
| 35 :host { | |
| 36 display: block; | |
| 37 border-left: 1px solid black; | |
| 38 padding: 1px 5px; | |
| 39 font-family: sans-serif; | |
| 40 } | |
| 41 .header { | |
| 42 font-size: 1.2em; | |
| 43 font-weight: bold; | |
| 44 } | |
| 45 ul { | |
| 46 list-style-type: none; | |
| 47 } | |
| 48 </style> | |
| 49 | |
| 50 <div class="header">Fleet</div> | |
| 51 <!-- TODO(kjlubick) Once url params have been implemented, have these | |
|
jcgregorio
2016/08/03 13:11:50
Yeah, look at https://github.com/google/skia-build
kjlubick
2016/08/03 14:23:20
Acknowledged. I also like https://github.com/goog
| |
| 52 properly link to the botlist with the given features preloaded.--> | |
| 53 <ul> | |
| 54 <li><a href="/newui/botlist?alive">Bots Alive</a>: [[fleet.alive]]</li> | |
| 55 <li><a href="/newui/botlist?busy">Bots Busy</a>: [[fleet.busy]]</li> | |
| 56 <li><a href="/newui/botlist?idle">Bots Idle</a>: [[fleet.idle]]</li> | |
| 57 <li><a href="/newui/botlist?dead">Bots Dead</a>: [[fleet.dead]]</li> | |
| 58 <li><a href="/newui/botlist?quaren">Bots Quarantined</a>: [[fleet.quaranti ned]]</li> | |
| 59 </ul> | |
| 60 | |
| 61 <div class="header">Currently Showing</div> | |
| 62 <ul> | |
| 63 <li><a href="/newui/botlist?alive2">Bots Alive</a>: [[_currently_showing.a live]]</li> | |
| 64 <li><a href="/newui/botlist?busy2">Bots Busy</a>: [[_currently_showing.bus y]]</li> | |
| 65 <li><a href="/newui/botlist?idle2">Bots Idle</a>: [[_currently_showing.idl e]]</li> | |
| 66 <li><a href="/newui/botlist?dead2">Bots Dead</a>: [[_currently_showing.dea d]]</li> | |
| 67 <li><a href="/newui/botlist?quaren2">Bots Quarantined</a>: [[_currently_sh owing.quarantined]]</li> | |
| 68 </ul> | |
| 69 | |
| 70 </template> | |
| 71 <script> | |
| 72 Polymer({ | |
| 73 is: 'bot-list-summary', | |
| 74 | |
| 75 behaviors: [SwarmingBehaviors.BotListBehavior], | |
| 76 | |
| 77 properties: { | |
| 78 filtered_bots: { | |
| 79 type: Array, | |
| 80 }, | |
| 81 fleet: { | |
| 82 type: Object, | |
| 83 }, | |
| 84 | |
| 85 _currently_showing: { | |
| 86 type: Object, | |
| 87 value: function() { | |
| 88 return { | |
| 89 alive: -1, | |
| 90 busy: -1, | |
| 91 idle: -1, | |
| 92 dead: -1, | |
| 93 quarantined: -1, | |
| 94 }; | |
| 95 }, | |
| 96 }, | |
| 97 }, | |
| 98 | |
| 99 // Do this because Array changes in Polymer don't always trigger normal | |
| 100 // property observers | |
| 101 observers: ["_recount(filtered_bots.*)"], | |
| 102 | |
| 103 _recount: function() { | |
| 104 var curr = { | |
| 105 alive: 0, | |
| 106 busy: 0, | |
| 107 idle: 0, | |
| 108 dead: 0, | |
| 109 quarantined: 0, | |
| 110 }; | |
| 111 if (!this.filtered_bots) { | |
| 112 return curr; | |
| 113 } | |
| 114 this.filtered_bots.forEach(function(bot) { | |
| 115 if (this._taskId(bot) === "idle") { | |
| 116 curr.idle++; | |
| 117 } else { | |
| 118 curr.busy++; | |
| 119 } | |
| 120 if (bot.quarantined) { | |
| 121 curr.quarantined++; | |
| 122 } | |
| 123 if (bot.is_dead) { | |
| 124 curr.dead++; | |
| 125 } else { | |
| 126 curr.alive++; | |
| 127 } | |
| 128 }.bind(this)); | |
| 129 this.set("_currently_showing", curr); | |
| 130 } | |
| 131 }); | |
| 132 </script> | |
| 133 </dom-module> | |
| OLD | NEW |