| OLD | NEW |
| 1 <!DOCTYPE html><html><head><!-- | 1 <!DOCTYPE html><html><head><!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2016 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2016 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --><!-- | 9 --><!-- |
| 10 @license | 10 @license |
| (...skipping 23576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23587 var dims = []; | 23587 var dims = []; |
| 23588 this._filters.forEach(function(f) { | 23588 this._filters.forEach(function(f) { |
| 23589 var split = f.split(this.FILTER_SEP, 1) | 23589 var split = f.split(this.FILTER_SEP, 1) |
| 23590 var col = split[0]; | 23590 var col = split[0]; |
| 23591 if (this.dimensions.indexOf(col) !== -1) { | 23591 if (this.dimensions.indexOf(col) !== -1) { |
| 23592 var rest = f.substring(col.length + this.FILTER_SEP.length); | 23592 var rest = f.substring(col.length + this.FILTER_SEP.length); |
| 23593 dims.push(col + this.FILTER_SEP + swarming.alias.unapply(rest)) | 23593 dims.push(col + this.FILTER_SEP + swarming.alias.unapply(rest)) |
| 23594 } else if (col === "status") { | 23594 } else if (col === "status") { |
| 23595 var rest = f.substring(col.length + this.FILTER_SEP.length); | 23595 var rest = f.substring(col.length + this.FILTER_SEP.length); |
| 23596 if (rest === "alive") { | 23596 if (rest === "alive") { |
| 23597 params["is_dead"] = "FALSE"; | 23597 params["is_dead"] = ["FALSE"]; |
| 23598 params["quarantined"] = "FALSE"; | 23598 params["quarantined"] = ["FALSE"]; |
| 23599 } else if (rest === "quarantined") { | 23599 } else if (rest === "quarantined") { |
| 23600 params["quarantined"] = "TRUE"; | 23600 params["quarantined"] = ["TRUE"]; |
| 23601 } else if (rest === "dead") { | 23601 } else if (rest === "dead") { |
| 23602 params["is_dead"] = "TRUE"; | 23602 params["is_dead"] = ["TRUE"]; |
| 23603 } | 23603 } |
| 23604 } | 23604 } |
| 23605 }.bind(this)); | 23605 }.bind(this)); |
| 23606 params["dimensions"] = dims; | 23606 params["dimensions"] = dims; |
| 23607 var lim = Math.floor(this.limit) | 23607 var lim = Math.floor(this.limit) |
| 23608 if (Number.isInteger(lim)) { | 23608 if (Number.isInteger(lim)) { |
| 23609 // Clamp the limit | 23609 // Clamp the limit |
| 23610 lim = Math.max(lim, 1); | 23610 lim = Math.max(lim, 1); |
| 23611 lim = Math.min(1000, lim); | 23611 lim = Math.min(1000, lim); |
| 23612 params["limit"] = lim; | 23612 params["limit"] = [lim]; |
| 23613 // not !== because limit could be a string, e.g. "900" | 23613 // not !== because limit could be a string, e.g. "900" |
| 23614 if (this.limit != lim) { | 23614 if (this.limit != lim) { |
| 23615 this.set("limit", lim); | 23615 this.set("limit", lim); |
| 23616 } | 23616 } |
| 23617 } | 23617 } |
| 23618 return params; | 23618 return params; |
| 23619 } | 23619 } |
| 23620 | 23620 |
| 23621 }); | 23621 }); |
| 23622 })(); | 23622 })(); |
| 23623 </script> | 23623 </script> |
| 23624 </dom-module><dom-module id="bot-list-data" assetpath="/res/imp/botlist/"> | 23624 </dom-module><dom-module id="bot-list-data" assetpath="/res/imp/botlist/"> |
| 23625 <template> | |
| 23626 <iron-ajax id="botlist" url="/_ah/api/swarming/v1/bots/list" headers="[[auth
_headers]]" params="[[query_params]]" handle-as="json" last-response="{{_list}}"
loading="{{_busy1}}"> | |
| 23627 </iron-ajax> | |
| 23628 | 23625 |
| 23629 <iron-ajax id="dimensions" url="/_ah/api/swarming/v1/bots/dimensions" header
s="[[auth_headers]]" handle-as="json" last-response="{{_dimensions}}" loading="{
{_busy2}}"> | |
| 23630 </iron-ajax> | |
| 23631 | |
| 23632 <iron-ajax id="fleet" url="/_ah/api/swarming/v1/bots/count" headers="[[auth_
headers]]" handle-as="json" last-response="{{_count}}" loading="{{_busy3}}"> | |
| 23633 </iron-ajax> | |
| 23634 </template> | |
| 23635 <script> | 23626 <script> |
| 23636 (function(){ | 23627 (function(){ |
| 23637 var BLACKLIST_DIMENSIONS = ["quarantined", "error"]; | 23628 var BLACKLIST_DIMENSIONS = ["quarantined", "error"]; |
| 23638 | 23629 |
| 23639 Polymer({ | 23630 Polymer({ |
| 23640 is: 'bot-list-data', | 23631 is: 'bot-list-data', |
| 23641 | 23632 |
| 23642 behaviors: [ | 23633 behaviors: [ |
| 23643 SwarmingBehaviors.BotListBehavior, | 23634 SwarmingBehaviors.BotListBehavior, |
| 23644 ], | 23635 ], |
| 23645 | 23636 |
| 23646 properties: { | 23637 properties: { |
| 23647 // inputs | 23638 // inputs |
| 23648 auth_headers: { | 23639 auth_headers: { |
| 23649 type: Object, | 23640 type: Object, |
| 23650 observer: "signIn", | 23641 observer: "signIn", |
| 23651 }, | 23642 }, |
| 23652 query_params: { | 23643 query_params: { |
| 23653 type: Object, | 23644 type: Object, |
| 23645 observer: "_request", |
| 23654 }, | 23646 }, |
| 23655 | 23647 |
| 23656 //outputs | 23648 //outputs |
| 23657 bots: { | 23649 bots: { |
| 23658 type: Array, | 23650 type: Array, |
| 23659 computed: "_bots(_list)", | 23651 computed: "_bots(_list)", |
| 23660 notify: true, | 23652 notify: true, |
| 23661 }, | 23653 }, |
| 23662 busy: { | 23654 busy: { |
| 23663 type: Boolean, | 23655 type: Boolean, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 23680 notify: true, | 23672 notify: true, |
| 23681 }, | 23673 }, |
| 23682 primary_arr: { | 23674 primary_arr: { |
| 23683 type: Array, | 23675 type: Array, |
| 23684 //BOT_PROPERTIES is inherited from BotListBehavior | 23676 //BOT_PROPERTIES is inherited from BotListBehavior |
| 23685 computed: "_primaryArr(dimensions, BOT_PROPERTIES)", | 23677 computed: "_primaryArr(dimensions, BOT_PROPERTIES)", |
| 23686 notify: true, | 23678 notify: true, |
| 23687 }, | 23679 }, |
| 23688 | 23680 |
| 23689 // private | 23681 // private |
| 23682 _busy1: { |
| 23683 type: Boolean, |
| 23684 value: false |
| 23685 }, |
| 23686 _busy2: { |
| 23687 type: Boolean, |
| 23688 value: false |
| 23689 }, |
| 23690 _busy3: { |
| 23691 type: Boolean, |
| 23692 value: false |
| 23693 }, |
| 23690 _count: { | 23694 _count: { |
| 23691 type: Object, | 23695 type: Object, |
| 23692 }, | 23696 }, |
| 23693 _dimensions: { | 23697 _dimensions: { |
| 23694 type: Object, | 23698 type: Object, |
| 23695 }, | 23699 }, |
| 23696 _list: { | 23700 _list: { |
| 23697 type: Object, | 23701 type: Object, |
| 23698 }, | 23702 }, |
| 23699 }, | 23703 }, |
| 23700 | 23704 |
| 23701 signIn: function(){ | 23705 signIn: function(){ |
| 23702 // Auto on iron-ajax means to automatically re-make the request if | 23706 this._getJsonAsync("_count", "/_ah/api/swarming/v1/bots/count", |
| 23703 // the url or the query params change. Auto does not trigger if the | 23707 "_busy2", this.auth_headers); |
| 23704 // [auth] headers change, so we wait until the user is signed in | 23708 this._getJsonAsync("_dimensions","/_ah/api/swarming/v1/bots/dimensions", |
| 23705 // before making any requests. | 23709 "_busy3", this.auth_headers); |
| 23706 this.$.botlist.auto = true; | 23710 |
| 23707 this.$.dimensions.auto = true; | 23711 this._request(); |
| 23708 this.$.fleet.auto = true; | |
| 23709 }, | 23712 }, |
| 23710 | 23713 |
| 23711 _bots: function(){ | 23714 _bots: function(){ |
| 23712 if (!this._list || !this._list.items) { | 23715 if (!this._list || !this._list.items) { |
| 23713 return []; | 23716 return []; |
| 23714 } | 23717 } |
| 23715 // Do any preprocessing here | 23718 // Do any preprocessing here |
| 23716 this._list.items.forEach(function(bot){ | 23719 this._list.items.forEach(function(bot){ |
| 23717 // Parse the state, which is a JSON string. This contains a lot of | 23720 // Parse the state, which is a JSON string. This contains a lot of |
| 23718 // interesting information like details about the devices attached. | 23721 // interesting information like details about the devices attached. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23819 // Create custom filter options | 23822 // Create custom filter options |
| 23820 pMap["disk_space"] = []; | 23823 pMap["disk_space"] = []; |
| 23821 pMap["task"] = ["busy", "idle"]; | 23824 pMap["task"] = ["busy", "idle"]; |
| 23822 pMap["status"] = ["alive", "dead", "quarantined"]; | 23825 pMap["status"] = ["alive", "dead", "quarantined"]; |
| 23823 | 23826 |
| 23824 // No need to sort any of this, bot-filters sorts secondary items | 23827 // No need to sort any of this, bot-filters sorts secondary items |
| 23825 // automatically, especially when the user types a query. | 23828 // automatically, especially when the user types a query. |
| 23826 return pMap; | 23829 return pMap; |
| 23827 }, | 23830 }, |
| 23828 | 23831 |
| 23832 _request: function() { |
| 23833 // wait until the user has logged in and the filters have loaded before
requesting this to avoid double or even triple requests. |
| 23834 if (!this.auth_headers || !this.query_params) { |
| 23835 return; |
| 23836 } |
| 23837 this._getJsonAsync("_list", "/_ah/api/swarming/v1/bots/list", |
| 23838 "_busy1", this.auth_headers, this.query_params); |
| 23839 }, |
| 23840 |
| 23829 }); | 23841 }); |
| 23830 })(); | 23842 })(); |
| 23831 </script> | 23843 </script> |
| 23832 </dom-module><dom-module id="bot-list-summary" assetpath="/res/imp/botlist/"> | 23844 </dom-module><dom-module id="bot-list-summary" assetpath="/res/imp/botlist/"> |
| 23833 <template> | 23845 <template> |
| 23834 <style include="swarming-app-style"> | 23846 <style include="swarming-app-style"> |
| 23835 :host { | 23847 :host { |
| 23836 display: block; | 23848 display: block; |
| 23837 border-left: 1px solid black; | 23849 border-left: 1px solid black; |
| 23838 padding: 5px 5px; | 23850 padding: 5px 5px; |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24994 pMap["deduped_from"] = []; | 25006 pMap["deduped_from"] = []; |
| 24995 pMap["duration"] = []; | 25007 pMap["duration"] = []; |
| 24996 pMap["modified_ts"] = []; | 25008 pMap["modified_ts"] = []; |
| 24997 pMap["server_versions"] = []; | 25009 pMap["server_versions"] = []; |
| 24998 pMap["started_ts"] = []; | 25010 pMap["started_ts"] = []; |
| 24999 | 25011 |
| 25000 return pMap; | 25012 return pMap; |
| 25001 }, | 25013 }, |
| 25002 | 25014 |
| 25003 _request: function() { | 25015 _request: function() { |
| 25004 // wait until the user has logged in before requesting this. | 25016 // wait until the user has logged in and the filters have loaded before
requesting this to avoid double or even triple requests. |
| 25005 if (!this.auth_headers) { | 25017 if (!this.auth_headers || !this.query_params) { |
| 25006 return; | 25018 return; |
| 25007 } | 25019 } |
| 25008 this._getJsonAsync("_list", "/_ah/api/swarming/v1/tasks/list", | 25020 this._getJsonAsync("_list", "/_ah/api/swarming/v1/tasks/list", |
| 25009 "_busy1", this.auth_headers, this.query_params); | 25021 "_busy1", this.auth_headers, this.query_params); |
| 25010 }, | 25022 }, |
| 25011 | 25023 |
| 25012 _tasks: function() { | 25024 _tasks: function() { |
| 25013 if (!this._list || !this._list.items) { | 25025 if (!this._list || !this._list.items) { |
| 25014 return []; | 25026 return []; |
| 25015 } | 25027 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 25050 background-color: #cccccc; | 25062 background-color: #cccccc; |
| 25051 } | 25063 } |
| 25052 .exception { | 25064 .exception { |
| 25053 background-color: #edd2ff; | 25065 background-color: #edd2ff; |
| 25054 } | 25066 } |
| 25055 .pending { | 25067 .pending { |
| 25056 background-color: #fffc6c; | 25068 background-color: #fffc6c; |
| 25057 } | 25069 } |
| 25058 </style> | 25070 </style> |
| 25059 | 25071 |
| 25060 <url-param name="sort" value="{{_sortstr}}" default_value="id:asc"> | 25072 <url-param name="sort" value="{{_sortstr}}" default_value="created_ts:desc"> |
| 25061 </url-param> | 25073 </url-param> |
| 25062 | 25074 |
| 25063 <swarming-app client_id="[[client_id]]" auth_headers="{{_auth_headers}}" per
missions="{{_permissions}}" signed_in="{{_signed_in}}" busy="[[_busy]]" name="Sw
arming Task List"> | 25075 <swarming-app client_id="[[client_id]]" auth_headers="{{_auth_headers}}" per
missions="{{_permissions}}" signed_in="{{_signed_in}}" busy="[[_busy]]" name="Sw
arming Task List"> |
| 25064 | 25076 |
| 25065 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> | 25077 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> |
| 25066 | 25078 |
| 25067 <div hidden$="[[_not(_signed_in)]]"> | 25079 <div hidden$="[[_not(_signed_in)]]"> |
| 25068 <task-list-data auth_headers="[[_auth_headers]]" query_params="[[_query_
params]]" tasks="{{_items}}" busy="{{_busy}}" primary_map="{{_primary_map}}" pri
mary_arr="{{_primary_arr}}"> | 25080 <task-list-data auth_headers="[[_auth_headers]]" query_params="[[_query_
params]]" tasks="{{_items}}" busy="{{_busy}}" primary_map="{{_primary_map}}" pri
mary_arr="{{_primary_arr}}"> |
| 25069 </task-list-data> | 25081 </task-list-data> |
| 25070 | 25082 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 25282 if (state === "RUNNING" || state === "PENDING") { | 25294 if (state === "RUNNING" || state === "PENDING") { |
| 25283 return "pending"; | 25295 return "pending"; |
| 25284 } | 25296 } |
| 25285 return ""; | 25297 return ""; |
| 25286 } | 25298 } |
| 25287 | 25299 |
| 25288 }); | 25300 }); |
| 25289 })(); | 25301 })(); |
| 25290 </script> | 25302 </script> |
| 25291 </dom-module></div></body></html> | 25303 </dom-module></div></body></html> |
| OLD | NEW |