Chromium Code Reviews| Index: appengine/swarming/elements/res/imp/common/swarming-app.html |
| diff --git a/appengine/swarming/elements/res/imp/common/swarming-app.html b/appengine/swarming/elements/res/imp/common/swarming-app.html |
| index e487a6c05a5a02501d4eb9eacf250292bb31e30c..5e861875eaeddfb8ab00d3f960c05ad692fb5b27 100644 |
| --- a/appengine/swarming/elements/res/imp/common/swarming-app.html |
| +++ b/appengine/swarming/elements/res/imp/common/swarming-app.html |
| @@ -19,10 +19,15 @@ |
| apps, such as colors. |
| Properties: |
| - auth_headers: Object, Use this in iron-ajax to set oauth2 headers. |
| busy: Boolean, If the busy spinner should be active. |
| + client_id: String, Oauth 2.0 client id. It will be set by server-side |
|
jcgregorio
2016/08/26 18:29:08
Looks like it's currently hard-coded, is that inte
kjlubick
2016/08/26 18:39:26
It's hardcoded in the demos (unless I missed it so
|
| + template evaluation. |
| name: String, the name of the app to be displayed. |
| + authHeaders: Object, Use this as an argument to sk.request to set oauth2 headers. |
|
jcgregorio
2016/08/26 18:29:08
Sorry, I missed this in previous reviews, don't us
kjlubick
2016/08/26 18:39:26
This was actually a typo of sorts. I fixed the na
|
| + permissions: Object, {String:Boolean} of permissions to perform various |
| + behaviors, such as terminate_bot. |
| + signed_in: Boolean, if the user is signed in. |
| Methods: |
| None. |
| @@ -35,6 +40,7 @@ |
| <link rel="import" href="/res/imp/bower_components/paper-spinner/paper-spinner-lite.html"> |
| <link rel="import" href="auth-signin.html"> |
| +<link rel="import" href="common-behavior.html"> |
| <dom-module id="swarming-app"> |
| <template> |
| @@ -77,7 +83,7 @@ |
| <app-header fixed> |
| <app-toolbar> |
| <div class="title left">[[name]]</div> |
| - <paper-spinner-lite class="left" active="[[busy]]"></paper-spinner-lite> |
| + <paper-spinner-lite class="left" active="[[_or(busy,_busy)]]"></paper-spinner-lite> |
| <a class="left" href="/newui/">Home</a> |
| <a class="left" href="/newui/botlist">Bot List</a> |
| @@ -100,36 +106,55 @@ |
| <script> |
| Polymer({ |
| is: 'swarming-app', |
| + |
| + behaviors: [ |
| + SwarmingBehaviors.CommonBehavior, |
| + ], |
| + |
| properties: { |
| + // input |
| + busy: { |
| + type: Boolean, |
| + }, |
| client_id: { |
| type: String, |
| }, |
| + name: { |
| + type: String, |
| + }, |
| + // outputs |
| auth_headers: { |
| type: Object, |
| notify: true, |
| + observer: "_loadPermissions" |
| }, |
| - signed_in: { |
| - type: Boolean, |
| - value: false, |
| - notify:true, |
| - }, |
| + |
| permissions: { |
| type: Object, |
| value: function() { |
| - // TODO(kjlubick): Make this call the whoami endpoint after signing in. |
| - return { |
| - can_cancel_task: true, |
| - } |
| + // If we aren't logged in, default to no permissions. |
| + return {}; |
| }, |
| notify: true, |
| }, |
| - busy: { |
| + signed_in: { |
| type: Boolean, |
| + value: false, |
| + notify:true, |
| }, |
| - name: { |
| - type: String, |
| - }, |
| + |
| + // private |
| + _busy: { |
| + type: Boolean, |
| + value: false, |
| + } |
| + |
| + }, |
| + |
| + _loadPermissions: function() { |
| + this._getJsonAsync("permissions", "/_ah/api/swarming/v1/server/permissions", |
| + "_busy", this.auth_headers); |
| }, |
| }); |