| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 This in an HTML Import-able file that contains the definition | 2 This in an HTML Import-able file that contains the definition |
| 3 of the following elements: | 3 of the following elements: |
| 4 | 4 |
| 5 <bot-list-summary> | 5 <bot-list-summary> |
| 6 | 6 |
| 7 | 7 |
| 8 Usage: | 8 Usage: |
| 9 | 9 |
| 10 <bot-list-summary></bot-list-summary> | 10 <bot-list-summary></bot-list-summary> |
| 11 | 11 |
| 12 This element summarizes and displays the results of the current query. | 12 This element summarizes and displays the results of the current query. |
| 13 It links to some global queries (e.g. all quarantined bots) and some |
| 14 sub queries (e.g. all quarantined bots that match the rest of the |
| 15 specified dimensions.) |
| 13 | 16 |
| 14 Properties: | 17 Properties: |
| 15 filtered_bots: Array<Object>, The bot list that is currently being shown | 18 // inputs |
| 16 (after filtering). The alive, dead, etc bots in this will be counted up | 19 auth_headers: Object, the OAuth2 header to include in the request. This |
| 17 for the summary. See bot-list-data for a description of this data type. | 20 should come from swarming-app. |
| 21 columns: Array<String>, the columns the user has selected. Used to create |
| 22 the links. |
| 23 count_params: Object, representing the query params sent to the server based |
| 24 on all the filterable items (e.g. dimensions). See bot-filters for the |
| 25 schema. |
| 18 fleet: Object, counts of all bots in the fleet. Contains "alive", "busy", | 26 fleet: Object, counts of all bots in the fleet. Contains "alive", "busy", |
| 19 "idle", "dead", and "quarantined". | 27 "idle", "dead", and "quarantined". |
| 28 num_bots: Number, The number of bots shown (after filtering). |
| 29 sort: String, the user's current sort string. Used to create the links. |
| 30 verbose: Boolean, the users current verbosity selection. Used to create |
| 31 the links. |
| 32 |
| 33 // outputs |
| 34 busy: Boolean, if there are any network requests pending. |
| 20 Methods: | 35 Methods: |
| 21 None. | 36 None. |
| 22 | 37 |
| 23 Events: | 38 Events: |
| 24 None. | 39 None. |
| 25 --> | 40 --> |
| 26 | 41 |
| 27 | 42 |
| 28 <link rel="import" href="/res/imp/common/swarming-app.html"> | 43 <link rel="import" href="/res/imp/common/swarming-app.html"> |
| 29 | 44 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 50 } | 65 } |
| 51 .left { | 66 .left { |
| 52 text-align: left; | 67 text-align: left; |
| 53 } | 68 } |
| 54 </style> | 69 </style> |
| 55 | 70 |
| 56 <div class="header">Fleet</div> | 71 <div class="header">Fleet</div> |
| 57 <table> | 72 <table> |
| 58 <tr> | 73 <tr> |
| 59 <td class="right"> | 74 <td class="right"> |
| 60 <a href$="[[_makeURL('','',columns.*,filtered_bots.*,sort,verbose)]]">
All</a>: | 75 <a href$="[[_makeURL('','',columns.*,sort,verbose)]]">All</a>: |
| 61 </td> | 76 </td> |
| 62 <td class="left">[[fleet.all]]</td> | 77 <td class="left">[[fleet.all]]</td> |
| 63 </tr> | 78 </tr> |
| 64 <tr> | 79 <tr> |
| 65 <td class="right"> | 80 <td class="right"> |
| 66 <a href$="[[_makeURL('alive','',columns.*,filtered_bots.*,sort,verbose
)]]">Alive</a>: | 81 <a href$="[[_makeURL('alive','',columns.*,sort,verbose)]]">Alive</a>: |
| 67 </td> | 82 </td> |
| 68 <td class="left">[[fleet.alive]]</td> | 83 <td class="left">[[fleet.alive]]</td> |
| 69 </tr> | 84 </tr> |
| 70 <tr> | 85 <tr> |
| 71 <td class="right"> | 86 <td class="right"> |
| 72 <a href$="[[_makeURL('busy','',columns.*,filtered_bots.*,sort,verbose)
]]">Busy</a>: | 87 <a href$="[[_makeURL('busy','',columns.*,sort,verbose)]]">Busy</a>: |
| 73 </td> | 88 </td> |
| 74 <td class="left">[[fleet.busy]]</td> | 89 <td class="left">[[fleet.busy]]</td> |
| 75 </tr> | 90 </tr> |
| 76 <tr> | 91 <tr> |
| 77 <td class="right"> | 92 <td class="right"> |
| 78 <a href$="[[_makeURL('idle','',columns.*,filtered_bots.*,sort,verbose)
]]">Idle</a>: | 93 <a href$="[[_makeURL('idle','',columns.*,sort,verbose)]]">Idle</a>: |
| 79 </td> | 94 </td> |
| 80 <td class="left">[[fleet.idle]]</td> | 95 <td class="left">[[fleet.idle]]</td> |
| 81 </tr> | 96 </tr> |
| 82 <tr> | 97 <tr> |
| 83 <td class="right"> | 98 <td class="right"> |
| 84 <a href$="[[_makeURL('dead','',columns.*,filtered_bots.*,sort,verbose)
]]">Dead</a>: | 99 <a href$="[[_makeURL('dead','',columns.*,sort,verbose)]]">Dead</a>: |
| 85 </td> | 100 </td> |
| 86 <td class="left">[[fleet.dead]]</td> | 101 <td class="left">[[fleet.dead]]</td> |
| 87 </tr> | 102 </tr> |
| 88 <tr> | 103 <tr> |
| 89 <td class="right"> | 104 <td class="right"> |
| 90 <a href$="[[_makeURL('quarantined','',columns.*,filtered_bots.*,sort,v
erbose)]]">Quarantined</a>: | 105 <a href$="[[_makeURL('quarantined','',columns.*,sort,verbose)]]">Quara
ntined</a>: |
| 91 </td> | 106 </td> |
| 92 <td class="left">[[fleet.quarantined]]</td> | 107 <td class="left">[[fleet.quarantined]]</td> |
| 93 </tr> | 108 </tr> |
| 94 </table> | 109 </table> |
| 95 | 110 |
| 96 <div class="header buffer">Selected</div> | 111 <div class="header buffer">Selected</div> |
| 97 <table> | 112 <table> |
| 98 <tr> | 113 <tr> |
| 99 <td class="right"> | 114 <td class="right"> |
| 100 Displayed: | 115 Displayed: |
| 101 </td> | 116 </td> |
| 102 <td class="left">[[_currentlyDisplayed(filtered_bots.*)]]</td> | 117 <td class="left">[[num_bots]]</td> |
| 103 </tr> | 118 </tr> |
| 104 <tr> | 119 <tr> |
| 105 <td class="right"> | 120 <td class="right"> |
| 106 All: | 121 All: |
| 107 </td> | 122 </td> |
| 108 <td class="left">[[_count_query.count]]</td> | 123 <td class="left">[[_count_query.count]]</td> |
| 109 </tr> | 124 </tr> |
| 110 <tr> | 125 <tr> |
| 111 <td class="right"> | 126 <td class="right"> |
| 112 <a href$="[[_makeURL('alive','true',columns.*,filtered_bots.*,sort,ver
bose)]]">Alive</a>: | 127 <a href$="[[_makeURL('alive','true',columns.*,sort,verbose)]]">Alive</
a>: |
| 113 </td> | 128 </td> |
| 114 <td class="left">[[_computeAlive(_count_query.*)]]</td> | 129 <td class="left">[[_computeAlive(_count_query.*)]]</td> |
| 115 </tr> | 130 </tr> |
| 116 <tr> | 131 <tr> |
| 117 <td class="right"> | 132 <td class="right"> |
| 118 <a href$="[[_makeURL('busy','true',columns.*,filtered_bots.*,sort,verb
ose)]]">Busy</a>: | 133 <a href$="[[_makeURL('busy','true',columns.*,sort,verbose)]]">Busy</a>
: |
| 119 </td> | 134 </td> |
| 120 <td class="left">[[_count_query.busy]]</td> | 135 <td class="left">[[_count_query.busy]]</td> |
| 121 </tr> | 136 </tr> |
| 122 <tr> | 137 <tr> |
| 123 <td class="right"> | 138 <td class="right"> |
| 124 <a href$="[[_makeURL('idle','true',columns.*,filtered_bots.*,sort,verb
ose)]]">Idle</a>: | 139 <a href$="[[_makeURL('idle','true',columns.*,sort,verbose)]]">Idle</a>
: |
| 125 </td> | 140 </td> |
| 126 <td class="left">[[_computeIdle(_count_query.*)]]</td> | 141 <td class="left">[[_computeIdle(_count_query.*)]]</td> |
| 127 </tr> | 142 </tr> |
| 128 <tr> | 143 <tr> |
| 129 <td class="right"> | 144 <td class="right"> |
| 130 <a href$="[[_makeURL('dead','true',columns.*,filtered_bots.*,sort,verb
ose)]]">Dead</a>: | 145 <a href$="[[_makeURL('dead','true',columns.*,sort,verbose)]]">Dead</a>
: |
| 131 </td> | 146 </td> |
| 132 <td class="left">[[_count_query.dead]]</td> | 147 <td class="left">[[_count_query.dead]]</td> |
| 133 </tr> | 148 </tr> |
| 134 <tr> | 149 <tr> |
| 135 <td class="right"> | 150 <td class="right"> |
| 136 <a href$="[[_makeURL('quarantined','true',columns.*,filtered_bots.*,so
rt,verbose)]]">Quarantined</a>: | 151 <a href$="[[_makeURL('quarantined','true',columns.*,sort,verbose)]]">Q
uarantined</a>: |
| 137 </td> | 152 </td> |
| 138 <td class="left">[[_count_query.quarantined]]</td> | 153 <td class="left">[[_count_query.quarantined]]</td> |
| 139 </tr> | 154 </tr> |
| 140 </table> | 155 </table> |
| 141 | 156 |
| 142 </template> | 157 </template> |
| 143 <script> | 158 <script> |
| 144 Polymer({ | 159 Polymer({ |
| 145 is: 'bot-list-summary', | 160 is: 'bot-list-summary', |
| 146 | 161 |
| 147 behaviors: [SwarmingBehaviors.BotListBehavior], | 162 behaviors: [SwarmingBehaviors.BotListBehavior], |
| 148 | 163 |
| 149 properties: { | 164 properties: { |
| 150 auth_headers: { | 165 auth_headers: { |
| 151 type: Object, | 166 type: Object, |
| 152 }, | 167 }, |
| 153 busy: { | |
| 154 type: Boolean, | |
| 155 value: false, | |
| 156 notify: true, | |
| 157 }, | |
| 158 columns: { | 168 columns: { |
| 159 type: Array, | 169 type: Array, |
| 160 }, | 170 }, |
| 161 count_params: { | 171 count_params: { |
| 162 type: Object, | 172 type: Object, |
| 163 }, | 173 }, |
| 164 filtered_bots: { | |
| 165 type: Array, | |
| 166 }, | |
| 167 fleet: { | 174 fleet: { |
| 168 type: Object, | 175 type: Object, |
| 169 }, | 176 }, |
| 177 num_bots: { |
| 178 type: Number, |
| 179 }, |
| 170 sort: { | 180 sort: { |
| 171 type: String, | 181 type: String, |
| 172 }, | 182 }, |
| 173 verbose: { | 183 verbose: { |
| 174 type: Boolean, | 184 type: Boolean, |
| 175 }, | 185 }, |
| 176 | 186 |
| 187 busy: { |
| 188 type: Boolean, |
| 189 value: false, |
| 190 notify: true, |
| 191 }, |
| 192 |
| 177 _count_query: { | 193 _count_query: { |
| 178 type: Object, | 194 type: Object, |
| 179 } | 195 } |
| 180 }, | 196 }, |
| 181 | 197 |
| 182 // Do this because Array changes in Polymer don't always trigger normal | 198 // Do this because Array changes in Polymer don't always trigger normal |
| 183 // property observers | 199 // property observers |
| 184 observers: [ | 200 observers: [ |
| 185 "_recountTotal(auth_headers.*,count_params.*)" | 201 "_recountTotal(auth_headers.*,count_params.*)" |
| 186 ], | 202 ], |
| 187 | 203 |
| 188 _computeAlive: function() { | 204 _computeAlive: function() { |
| 189 return this._count_query.count - this._count_query.dead; | 205 return this._count_query.count - this._count_query.dead; |
| 190 }, | 206 }, |
| 191 | 207 |
| 192 _computeIdle: function() { | 208 _computeIdle: function() { |
| 193 return this._count_query.count - this._count_query.busy; | 209 return this._count_query.count - this._count_query.busy; |
| 194 }, | 210 }, |
| 195 | 211 |
| 196 _currentlyDisplayed: function(){ | |
| 197 return this.filtered_bots && this.filtered_bots.length; | |
| 198 }, | |
| 199 | |
| 200 _getFilterStr: function(filter) { | 212 _getFilterStr: function(filter) { |
| 201 if (!filter) { | 213 if (!filter) { |
| 202 return ""; | 214 return ""; |
| 203 } | 215 } |
| 204 if (filter === "alive" || filter === "dead" || | 216 if (filter === "alive" || filter === "dead" || |
| 205 filter === "quarantined") { | 217 filter === "quarantined") { |
| 206 return "status:" + filter; | 218 return "status:" + filter; |
| 207 } else { | 219 } else { |
| 208 return "task:" + filter; | 220 return "task:" + filter; |
| 209 } | 221 } |
| 210 }, | 222 }, |
| 211 | 223 |
| 224 // _makeURL creates a bot-list url that keeps the columns and sort require
ments the same |
| 225 // while changing which state is represented. The preserveOthers signifies
if other |
| 226 // filtering parameters (e.g. dimensions) should be kept as well. |
| 212 _makeURL: function(filter, preserveOthers) { | 227 _makeURL: function(filter, preserveOthers) { |
| 213 if (preserveOthers) { | 228 if (preserveOthers) { |
| 214 var fstr = encodeURIComponent(this._getFilterStr(filter)); | 229 var fstr = encodeURIComponent(this._getFilterStr(filter)); |
| 215 if (window.location.href.indexOf(fstr) === -1) { | 230 if (window.location.href.indexOf(fstr) === -1) { |
| 216 return window.location.href + "&f=" + fstr; | 231 return window.location.href + "&f=" + fstr; |
| 217 } | 232 } |
| 218 // The filter is already on the list. | 233 // The filter is already on the list. |
| 219 return undefined; | 234 return undefined; |
| 220 } | 235 } |
| 221 var params = { | 236 var params = { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 233 _recountTotal: function() { | 248 _recountTotal: function() { |
| 234 if (!this.auth_headers || !this.count_params) { | 249 if (!this.auth_headers || !this.count_params) { |
| 235 return; | 250 return; |
| 236 } | 251 } |
| 237 this._getJsonAsync("_count_query","/api/swarming/v1/bots/count","busy", | 252 this._getJsonAsync("_count_query","/api/swarming/v1/bots/count","busy", |
| 238 this.auth_headers, this.count_params); | 253 this.auth_headers, this.count_params); |
| 239 } | 254 } |
| 240 }); | 255 }); |
| 241 </script> | 256 </script> |
| 242 </dom-module> | 257 </dom-module> |
| OLD | NEW |