| 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-app> | 9 <swarming-app> |
| 10 | 10 |
| 11 <swarming-app> is meant to be used in top level elements to provide the header | 11 <swarming-app> is meant to be used in top level elements to provide the header |
| 12 toolbar and authentication. | 12 toolbar and authentication. |
| 13 | 13 |
| 14 It contains the definition of the following style modules: | 14 It contains the definition of the following style modules: |
| 15 | 15 |
| 16 swarming-app-style | 16 swarming-app-style |
| 17 | 17 |
| 18 <style include="shared-style"> contains styles to be shared among all | 18 <style include="shared-style"> contains styles to be shared among all |
| 19 apps, such as colors. | 19 apps, such as colors. |
| 20 | 20 |
| 21 Properties: | 21 Properties: |
| 22 busy: Boolean, If the busy spinner should be active. | 22 busy: Boolean, If the busy spinner should be active. |
| 23 client_id: String, Oauth 2.0 client id. It will be set by server-side | 23 client_id: String, Oauth 2.0 client id. It will be set by server-side |
| 24 template evaluation. | 24 template evaluation. |
| 25 name: String, the name of the app to be displayed. | 25 name: String, the name of the app to be displayed. |
| 26 | 26 |
| 27 auth_headers: Object, Use this as an argument to sk.request to set oauth2 he
aders. | 27 auth_headers: Object, Use this as an argument to sk.request to set oauth2 he
aders. |
| 28 permissions: Object, {String:Boolean} of permissions to perform various | 28 permissions: Object, {String:Boolean} of permissions to perform various |
| 29 behaviors, such as terminate_bot. | 29 behaviors, such as terminate_bot. |
| 30 server_version: Object, containing String server_version. server_version |
| 31 represents what git revision the server is using. |
| 30 signed_in: Boolean, if the user is signed in. | 32 signed_in: Boolean, if the user is signed in. |
| 31 Methods: | 33 Methods: |
| 32 None. | 34 None. |
| 33 | 35 |
| 34 Events: | 36 Events: |
| 35 None. | 37 None. |
| 36 --> | 38 --> |
| 37 | 39 |
| 38 <link rel="import" href="/res/imp/bower_components/app-layout/app-layout.html"> | 40 <link rel="import" href="/res/imp/bower_components/app-layout/app-layout.html"> |
| 39 <link rel="import" href="/res/imp/bower_components/iron-flex-layout/iron-flex-la
yout-classes.html"> | 41 <link rel="import" href="/res/imp/bower_components/iron-flex-layout/iron-flex-la
yout-classes.html"> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 margin-left:15px; | 73 margin-left:15px; |
| 72 } | 74 } |
| 73 .main-content { | 75 .main-content { |
| 74 padding: 3px; | 76 padding: 3px; |
| 75 } | 77 } |
| 76 | 78 |
| 77 .main-content a { | 79 .main-content a { |
| 78 color: #1F78B4; | 80 color: #1F78B4; |
| 79 } | 81 } |
| 80 | 82 |
| 83 auth-signin, .small { |
| 84 font-size: .7em; |
| 85 } |
| 86 |
| 81 paper-fab { | 87 paper-fab { |
| 82 position: fixed; | 88 position: fixed; |
| 83 bottom: 5px; | 89 bottom: 5px; |
| 84 right: 5px; | 90 right: 5px; |
| 85 background-color: #1F78B4; | 91 background-color: #1F78B4; |
| 86 } | 92 } |
| 87 | 93 |
| 88 paper-spinner-lite { | 94 paper-spinner-lite { |
| 89 --paper-spinner-color: var(--google-yellow-500); | 95 --paper-spinner-color: var(--google-yellow-500); |
| 90 } | 96 } |
| 91 </style> | 97 </style> |
| 92 <app-header-layout> | 98 <app-header-layout> |
| 93 <app-header fixed> | 99 <app-header fixed> |
| 94 <app-toolbar> | 100 <app-toolbar> |
| 95 <div class="title left">[[name]]</div> | 101 <div class="title left">[[name]]</div> |
| 96 <paper-spinner-lite class="left" active="[[_or(busy,_busy)]]"></paper-
spinner-lite> | 102 <paper-spinner-lite class="left" active="[[_or(busy,_busy1,_busy2)]]">
</paper-spinner-lite> |
| 97 | 103 |
| 98 <a class="left" href="/newui/">Home</a> | 104 <a class="left" href="/newui/">Home</a> |
| 99 <a class="left" href="/newui/botlist">Bot List</a> | 105 <a class="left" href="/newui/botlist">Bot List</a> |
| 100 <a class="left" href="/newui/tasklist">Task List</a> | 106 <a class="left" href="/newui/tasklist">Task List</a> |
| 101 <div class="flex"></div> | 107 <div class="flex"></div> |
| 108 <div class="small right"> |
| 109 Server: |
| 110 <a href$="[[_versionLink(server_version)]]"> |
| 111 [[server_version.server_version]] |
| 112 </a> |
| 113 </div> |
| 102 <auth-signin | 114 <auth-signin |
| 103 class="right" | 115 class="right" |
| 104 client_id="[[client_id]]" | 116 client_id="[[client_id]]" |
| 105 auth_headers="{{auth_headers}}" | 117 auth_headers="{{auth_headers}}" |
| 106 signed_in="{{signed_in}}"> | 118 signed_in="{{signed_in}}"> |
| 107 </auth-signin> | 119 </auth-signin> |
| 108 </app-toolbar> | 120 </app-toolbar> |
| 109 </app-header> | 121 </app-header> |
| 110 <div class="main-content"> | 122 <div class="main-content"> |
| 111 <content></content> | 123 <content></content> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 132 client_id: { | 144 client_id: { |
| 133 type: String, | 145 type: String, |
| 134 }, | 146 }, |
| 135 name: { | 147 name: { |
| 136 type: String, | 148 type: String, |
| 137 }, | 149 }, |
| 138 // outputs | 150 // outputs |
| 139 auth_headers: { | 151 auth_headers: { |
| 140 type: Object, | 152 type: Object, |
| 141 notify: true, | 153 notify: true, |
| 142 observer: "_loadPermissions" | 154 observer: "_load" |
| 143 }, | 155 }, |
| 144 | 156 |
| 145 permissions: { | 157 permissions: { |
| 146 type: Object, | 158 type: Object, |
| 147 value: function() { | 159 value: function() { |
| 148 // If we aren't logged in, default to no permissions. | 160 // If we aren't logged in, default to no permissions. |
| 149 return {}; | 161 return {}; |
| 150 }, | 162 }, |
| 151 notify: true, | 163 notify: true, |
| 152 }, | 164 }, |
| 153 | 165 |
| 166 server_version: { |
| 167 type: Object, |
| 168 notify: true, |
| 169 }, |
| 170 |
| 154 signed_in: { | 171 signed_in: { |
| 155 type: Boolean, | 172 type: Boolean, |
| 156 value: false, | 173 value: false, |
| 157 notify:true, | 174 notify: true, |
| 158 }, | 175 }, |
| 159 | 176 |
| 160 // private | 177 // private |
| 161 _busy: { | 178 _busy1: { |
| 179 type: Boolean, |
| 180 value: false, |
| 181 }, |
| 182 _busy2: { |
| 162 type: Boolean, | 183 type: Boolean, |
| 163 value: false, | 184 value: false, |
| 164 } | 185 } |
| 165 | 186 |
| 166 }, | 187 }, |
| 167 | 188 |
| 168 _loadPermissions: function() { | 189 _load: function() { |
| 169 this._getJsonAsync("permissions", "/_ah/api/swarming/v1/server/permissio
ns", | 190 this._getJsonAsync("permissions", "/_ah/api/swarming/v1/server/permissio
ns", |
| 170 "_busy", this.auth_headers); | 191 "_busy1", this.auth_headers); |
| 192 this._getJsonAsync("server_version", "/_ah/api/swarming/v1/server/detail
s", |
| 193 "_busy2", this.auth_headers) |
| 171 }, | 194 }, |
| 172 | 195 |
| 196 _versionLink: function(version) { |
| 197 if (!version || !version.server_version) { |
| 198 return undefined; |
| 199 } |
| 200 var split = version.server_version.split("-"); |
| 201 if (split.length !== 2) { |
| 202 return undefined; |
| 203 } |
| 204 return "https://github.com/luci/luci-py/commit/"+split[1]; |
| 205 } |
| 206 |
| 173 }); | 207 }); |
| 174 </script> | 208 </script> |
| 175 </dom-module> | 209 </dom-module> |
| 176 | 210 |
| 177 <dom-module id="swarming-app-style"> | 211 <dom-module id="swarming-app-style"> |
| 178 <style> | 212 <style> |
| 179 * { | 213 * { |
| 180 font-family: sans-serif; | 214 font-family: sans-serif; |
| 181 } | 215 } |
| 182 /* Only style anchor tags that are actually linking somewhere.*/ | 216 /* Only style anchor tags that are actually linking somewhere.*/ |
| 183 a[href] { | 217 a[href] { |
| 184 color: #1F78B4; | 218 color: #1F78B4; |
| 185 } | 219 } |
| 186 </style> | 220 </style> |
| 187 </dom-module> | 221 </dom-module> |
| OLD | NEW |