| 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 <swarming-index> | 9 <swarming-index> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 border-radius: 4px; | 44 border-radius: 4px; |
| 45 } | 45 } |
| 46 </style> | 46 </style> |
| 47 | 47 |
| 48 <swarming-app | 48 <swarming-app |
| 49 client_id="[[client_id]]" | 49 client_id="[[client_id]]" |
| 50 auth_headers="{{_auth_headers}}" | 50 auth_headers="{{_auth_headers}}" |
| 51 permissions="{{_permissions}}" | 51 permissions="{{_permissions}}" |
| 52 server_version="{{_server_version}}" | 52 server_version="{{_server_version}}" |
| 53 name="Swarming Server" | 53 name="Swarming Server" |
| 54 busy="[[_busy]]"> | 54 busy="[[_or(_busy1,busy2)]]"> |
| 55 | 55 |
| 56 <h2>Service Status</h2> | 56 <h2>Service Status</h2> |
| 57 <div>Server Version: [[_server_version.server_version]]</div> | 57 <div>Server Version: [[_server_version.server_version]]</div> |
| 58 <div>Bot Version: [[_server_version.bot_version]]</div> | 58 <div>Bot Version: [[_server_version.bot_version]]</div> |
| 59 <ul> | 59 <ul> |
| 60 <li> | 60 <li> |
| 61 <!-- TODO(kjlubick) convert these linked pages to Polymer--> | 61 <!-- TODO(kjlubick) convert these linked pages to Polymer--> |
| 62 <a href="/stats">Usage statistics</a> | 62 <a href="/stats">Usage statistics</a> |
| 63 </li> | 63 </li> |
| 64 <li> | 64 <li> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 </li> | 106 </li> |
| 107 <li> | 107 <li> |
| 108 Manually: | 108 Manually: |
| 109 <pre class="command" style="margin-bottom:0">mkdir bot; cd bot | 109 <pre class="command" style="margin-bottom:0">mkdir bot; cd bot |
| 110 rm -f swarming_bot.zip; curl -sSLOJ [[_host_url]]/bot_code?tok=[[_bootstrap_to
ken]] | 110 rm -f swarming_bot.zip; curl -sSLOJ [[_host_url]]/bot_code?tok=[[_bootstrap_to
ken]] |
| 111 python swarming_bot.zip</pre> | 111 python swarming_bot.zip</pre> |
| 112 </li> | 112 </li> |
| 113 </ol> | 113 </ol> |
| 114 </div> | 114 </div> |
| 115 | 115 |
| 116 <!-- TODO(kjlubick): Enable this when the stats endpoint uses oauth |
| 116 <h2>Stats</h2> | 117 <h2>Stats</h2> |
| 117 <div>TODO(kjlubick) add these in</div> | 118 <div class="stats"> |
| 118 | 119 <stats-overview |
| 119 | 120 auth_headers=[[_auth_headers]] |
| 121 busy="{{_busy2}}"> |
| 122 </stats-overview> |
| 123 </div> |
| 124 --> |
| 120 </swarming-app> | 125 </swarming-app> |
| 121 | 126 |
| 122 </template> | 127 </template> |
| 123 <script> | 128 <script> |
| 124 Polymer({ | 129 Polymer({ |
| 125 is: 'swarming-index', | 130 is: 'swarming-index', |
| 126 | 131 |
| 127 behaviors: [ | 132 behaviors: [ |
| 128 SwarmingBehaviors.CommonBehavior, | 133 SwarmingBehaviors.CommonBehavior, |
| 129 ], | 134 ], |
| 130 | 135 |
| 131 properties: { | 136 properties: { |
| 132 client_id: { | 137 client_id: { |
| 133 type: String, | 138 type: String, |
| 134 }, | 139 }, |
| 135 | 140 |
| 136 | 141 |
| 137 _auth_headers: { | 142 _auth_headers: { |
| 138 type: String, | 143 type: String, |
| 139 }, | 144 }, |
| 140 _bootstrap_token: { | 145 _bootstrap_token: { |
| 141 type: String, | 146 type: String, |
| 142 value: "...", | 147 value: "...", |
| 143 }, | 148 }, |
| 144 _busy: { | 149 _busy1: { |
| 145 type: Boolean, | 150 type: Boolean, |
| 146 value: false, | 151 value: false, |
| 147 }, | 152 }, |
| 153 _busy2: { |
| 154 type: Boolean, |
| 155 value: false, |
| 156 }, |
| 148 _host_url: { | 157 _host_url: { |
| 149 type: String, | 158 type: String, |
| 150 value: function() { | 159 value: function() { |
| 151 return location.origin; | 160 return location.origin; |
| 152 }, | 161 }, |
| 153 }, | 162 }, |
| 154 _permissions: { | 163 _permissions: { |
| 155 type: Object, | 164 type: Object, |
| 156 }, | 165 }, |
| 157 _project_id: { | 166 _project_id: { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 170 | 179 |
| 171 | 180 |
| 172 _cannotBootstrap: function(permissions) { | 181 _cannotBootstrap: function(permissions) { |
| 173 return !(permissions && permissions.get_bootstrap_token); | 182 return !(permissions && permissions.get_bootstrap_token); |
| 174 }, | 183 }, |
| 175 | 184 |
| 176 _fetchBootstrap: function(permissions, auth_headers) { | 185 _fetchBootstrap: function(permissions, auth_headers) { |
| 177 if (!auth_headers || !permissions || this._cannotBootstrap(permissions))
{ | 186 if (!auth_headers || !permissions || this._cannotBootstrap(permissions))
{ |
| 178 return; | 187 return; |
| 179 } | 188 } |
| 180 this.set("_busy", true); | 189 this.set("_busy1", true); |
| 181 | 190 |
| 182 sk.request("POST", "/_ah/api/swarming/v1/server/token", undefined, auth_
headers).then(JSON.parse).then(function(t) { | 191 sk.request("POST", "/_ah/api/swarming/v1/server/token", undefined, auth_
headers).then(JSON.parse).then(function(t) { |
| 183 this.set("_bootstrap_token", t.bootstrap_token); | 192 this.set("_bootstrap_token", t.bootstrap_token); |
| 184 this.set("_busy", false); | 193 this.set("_busy1", false); |
| 185 }.bind(this)).catch(function(reason) { | 194 }.bind(this)).catch(function(reason) { |
| 186 console.log("Could not get token", reason); | 195 console.log("Could not get token", reason); |
| 187 this.set("_busy", false); | 196 this.set("_busy1", false); |
| 188 }.bind(this)); | 197 }.bind(this)); |
| 189 }, | 198 }, |
| 190 | 199 |
| 191 _makeInstancesUrl: function(details, project_id) { | 200 _makeInstancesUrl: function(details, project_id) { |
| 192 return "https://console.cloud.google.com/appengine/instances?project="+ | 201 return "https://console.cloud.google.com/appengine/instances?project="+ |
| 193 project_id+"&versionId="+details.server_version; | 202 project_id+"&versionId="+details.server_version; |
| 194 }, | 203 }, |
| 195 | 204 |
| 196 _makeErrorUrl: function(project_id) { | 205 _makeErrorUrl: function(project_id) { |
| 197 return "https://console.cloud.google.com/errors?project="+ | 206 return "https://console.cloud.google.com/errors?project="+ |
| 198 project_id; | 207 project_id; |
| 199 }, | 208 }, |
| 200 | 209 |
| 201 _makeLogUrl: function(project_id) { | 210 _makeLogUrl: function(project_id) { |
| 202 return "https://pantheon.corp.google.com/logs/viewer?filters=text:status
:500..599&project="+ | 211 return "https://pantheon.corp.google.com/logs/viewer?filters=text:status
:500..599&project="+ |
| 203 project_id; | 212 project_id; |
| 204 }, | 213 }, |
| 205 | 214 |
| 206 }); | 215 }); |
| 207 </script> | 216 </script> |
| 208 </dom-module> | 217 </dom-module> |
| OLD | NEW |