| 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 |
| 11 Usage: | 11 Usage: |
| 12 | 12 |
| 13 <swarming-index></swarming-index> | 13 <swarming-index></swarming-index> |
| 14 | 14 |
| 15 Properties: | 15 Properties: |
| 16 None. | 16 None. This is a top-level element. |
| 17 | 17 |
| 18 Methods: | 18 Methods: |
| 19 None. | 19 None. |
| 20 | 20 |
| 21 Events: | 21 Events: |
| 22 None. | 22 None. |
| 23 --> | 23 --> |
| 24 | 24 |
| 25 <link rel="import" href="../../bower_components/polymer/polymer.html"> | 25 <link rel="import" href="../../bower_components/polymer/polymer.html"> |
| 26 <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> | 26 <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> |
| 27 | 27 |
| 28 <link rel="import" href="../common/auth-signin.html"> | 28 <link rel="import" href="../common/swarming-app.html"> |
| 29 | 29 |
| 30 <dom-module id="swarming-index"> | 30 <dom-module id="swarming-index"> |
| 31 <template> | 31 <template> |
| 32 <style> | 32 <style> |
| 33 :host { | 33 :host { |
| 34 display: block; | 34 display: block; |
| 35 } | 35 } |
| 36 </style> | 36 </style> |
| 37 | 37 |
| 38 <h1>HELLO WORLD<h1> | 38 <swarming-app |
| 39 auth_headers="{{auth_headers}}" |
| 40 name="Swarming" |
| 41 busy="[[busy]]"> |
| 39 | 42 |
| 40 <!-- TODO(kjlubick) Remove this hard-coded client-id.--> | 43 <iron-ajax id="request" |
| 41 <auth-signin | 44 url="/_ah/api/swarming/v1/server/details" |
| 42 auth-headers="{{auth}}" | 45 headers="[[auth_headers]]" |
| 43 client-id="20770472288-t5smpbpjptka4nd888fv0ctd23ftba2o.apps.googleusercon
tent.com" | 46 handle-as="json" |
| 44 on-auth-signin="signIn"> | 47 last-response="{{serverDetails}}" |
| 45 </auth-signin> | 48 loading="{{busy}}"> |
| 49 </iron-ajax> |
| 46 | 50 |
| 47 <iron-ajax id="request" | 51 <h1>HELLO WORLD</h1> |
| 48 url="/_ah/api/swarming/v1/server/details" | 52 |
| 49 headers="[[auth]]" | 53 <div>Server Version: [[serverDetails.server_version]]</div> |
| 50 handle-as="json" | 54 |
| 51 on-response="handleResponse"> | 55 </swarming-app> |
| 52 </iron-ajax> | |
| 53 | 56 |
| 54 </template> | 57 </template> |
| 55 <script> | 58 <script> |
| 56 Polymer({ | 59 Polymer({ |
| 57 is: 'swarming-index', | 60 is: 'swarming-index', |
| 58 | 61 |
| 62 properties: { |
| 63 auth_headers: { |
| 64 type: Object, |
| 65 observer: "signIn", |
| 66 }, |
| 67 |
| 68 serverDetails: { |
| 69 type: String, |
| 70 } |
| 71 }, |
| 72 |
| 59 signIn: function(){ | 73 signIn: function(){ |
| 60 this.$.request.generateRequest(); | 74 this.$.request.generateRequest(); |
| 61 }, | 75 }, |
| 62 | 76 |
| 63 handleResponse: function(a,b){ | |
| 64 console.log(this.$.request.lastResponse); | |
| 65 } | |
| 66 }); | 77 }); |
| 67 </script> | 78 </script> |
| 68 </dom-module> | 79 </dom-module> |
| OLD | NEW |