| 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 24563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24574 } | 24574 } |
| 24575 if (state === "RUNNING" || state === "PENDING") { | 24575 if (state === "RUNNING" || state === "PENDING") { |
| 24576 return "pending"; | 24576 return "pending"; |
| 24577 } | 24577 } |
| 24578 return ""; | 24578 return ""; |
| 24579 } | 24579 } |
| 24580 | 24580 |
| 24581 }); | 24581 }); |
| 24582 })(); | 24582 })(); |
| 24583 </script> | 24583 </script> |
| 24584 </dom-module><dom-module id="bot-page-data" assetpath="/res/imp/botpage/"> |
| 24585 <script> |
| 24586 (function(){ |
| 24587 |
| 24588 Polymer({ |
| 24589 is: 'bot-page-data', |
| 24590 |
| 24591 behaviors: [ |
| 24592 SwarmingBehaviors.CommonBehavior, |
| 24593 ], |
| 24594 |
| 24595 properties: { |
| 24596 // inputs |
| 24597 auth_headers: { |
| 24598 type: Object, |
| 24599 }, |
| 24600 bot_id: { |
| 24601 type: String, |
| 24602 }, |
| 24603 |
| 24604 // outputs |
| 24605 busy: { |
| 24606 type: Boolean, |
| 24607 computed: "_or(_busy1,_busy2,_busy3)", |
| 24608 notify: true, |
| 24609 }, |
| 24610 bot: { |
| 24611 type: Object, |
| 24612 computed: "_parseBot(_bot)", |
| 24613 notify: true, |
| 24614 }, |
| 24615 events: { |
| 24616 type: Array, |
| 24617 computed: "_parseEvents(_events)", |
| 24618 notify: true, |
| 24619 }, |
| 24620 tasks: { |
| 24621 type: Array, |
| 24622 computed: "_parseTasks(_tasks)", |
| 24623 notify: true, |
| 24624 }, |
| 24625 |
| 24626 // private |
| 24627 _busy1: { |
| 24628 type: Boolean, |
| 24629 value: false |
| 24630 }, |
| 24631 _busy2: { |
| 24632 type: Boolean, |
| 24633 value: false |
| 24634 }, |
| 24635 _busy3: { |
| 24636 type: Boolean, |
| 24637 value: false |
| 24638 }, |
| 24639 _bot: { |
| 24640 type: Object, |
| 24641 }, |
| 24642 _events: { |
| 24643 type: Object, |
| 24644 }, |
| 24645 _tasks: { |
| 24646 type: Object, |
| 24647 }, |
| 24648 }, |
| 24649 |
| 24650 observers: [ |
| 24651 "request(auth_headers,bot_id)", |
| 24652 ], |
| 24653 |
| 24654 request: function(){ |
| 24655 if (!this.bot_id || !this.auth_headers) { |
| 24656 console.log("bot_id and auth_headers can't be empty"); |
| 24657 return; |
| 24658 } |
| 24659 var baseUrl = "/_ah/api/swarming/v1/bot/"+this.bot_id; |
| 24660 this._getJsonAsync("_bot", baseUrl + "/get", |
| 24661 "_busy1", this.auth_headers); |
| 24662 // We limit the fields on these two queries to make them faster. |
| 24663 this._getJsonAsync("_events", |
| 24664 baseUrl + "/events?fields=items(event_type%2Cmessage%2Cquarantined%2Ct
ask_id%2Cts%2Cversion)", |
| 24665 "_busy2", this.auth_headers); |
| 24666 this._getJsonAsync("_tasks", |
| 24667 baseUrl + "/tasks?fields=items(abandoned_ts%2Cbot_version%2Ccompleted_
ts%2Cduration%2Cexit_code%2Cfailure%2Cinternal_failure%2Cmodified_ts%2Cname%2Cst
arted_ts%2Cstate%2Ctask_id%2Ctry_number)", |
| 24668 "_busy3", this.auth_headers); |
| 24669 }, |
| 24670 |
| 24671 _parseBot: function(bot) { |
| 24672 if (!bot) { |
| 24673 return {}; |
| 24674 } |
| 24675 return bot; |
| 24676 }, |
| 24677 |
| 24678 _parseEvents: function(events) { |
| 24679 if (!events || !events.items) { |
| 24680 return []; |
| 24681 } |
| 24682 return events.items; |
| 24683 }, |
| 24684 |
| 24685 _parseTasks: function(tasks) { |
| 24686 if (!tasks || !tasks.items) { |
| 24687 return []; |
| 24688 } |
| 24689 return tasks.items; |
| 24690 } |
| 24691 |
| 24692 }); |
| 24693 })(); |
| 24694 </script> |
| 24695 </dom-module> |
| 24696 <dom-module id="bot-page" assetpath="/res/imp/botpage/"> |
| 24697 <template> |
| 24698 <style include="iron-flex iron-flex-alignment iron-positioning swarming-app-
style"> |
| 24699 |
| 24700 </style> |
| 24701 |
| 24702 <url-param name="id" value="{{bot_id}}"> |
| 24703 </url-param> |
| 24704 |
| 24705 <swarming-app client_id="[[client_id]]" auth_headers="{{_auth_headers}}" sig
ned_in="{{_signed_in}}" busy="[[_busy]]" name="Swarming Bot Page"> |
| 24706 |
| 24707 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> |
| 24708 |
| 24709 <div hidden$="[[_not(_signed_in)]]"> |
| 24710 |
| 24711 <bot-page-data auth_headers="[[_auth_headers]]" bot_id="[[bot_id]]" bot=
"{{_bot}}" busy="{{_busy}}" events="{{_events}}" tasks="{{_tasks}}"> |
| 24712 </bot-page-data> |
| 24713 |
| 24714 <h1> Bot Page Stub </h1> |
| 24715 </div> |
| 24716 |
| 24717 </swarming-app> |
| 24718 |
| 24719 </template> |
| 24720 <script> |
| 24721 (function(){ |
| 24722 |
| 24723 |
| 24724 Polymer({ |
| 24725 is: 'bot-page', |
| 24726 |
| 24727 behaviors: [ |
| 24728 SwarmingBehaviors.CommonBehavior, |
| 24729 ], |
| 24730 |
| 24731 properties: { |
| 24732 bot_id: { |
| 24733 type: String, |
| 24734 }, |
| 24735 client_id: { |
| 24736 type: String, |
| 24737 }, |
| 24738 |
| 24739 }, |
| 24740 |
| 24741 }); |
| 24742 })(); |
| 24743 </script> |
| 24584 </dom-module></div></body></html> | 24744 </dom-module></div></body></html> |
| OLD | NEW |