| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. | |
| 3 Use of this source code is governed under the Apache License, Version 2.0 | |
| 4 that can be found in the LICENSE file. | |
| 5 | |
| 6 This in an HTML Import-able file that contains the definition | |
| 7 of the following elements: | |
| 8 | |
| 9 <swarming-app> | |
| 10 | |
| 11 <swarming-app> is meant to be used in top level elements to provide the header | |
| 12 toolbar and authentication. | |
| 13 | |
| 14 It contains the definition of the following style modules: | |
| 15 | |
| 16 swarming-app-style | |
| 17 | |
| 18 <style include="shared-style"> contains styles to be shared among all | |
| 19 apps, such as colors. | |
| 20 | |
| 21 Properties: | |
| 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 | |
| 24 template evaluation. | |
| 25 name: String, the name of the app to be displayed. | |
| 26 | |
| 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 | |
| 29 behaviors, such as terminate_bot. | |
| 30 server_details: Object, containing mutliple Strings including: | |
| 31 server_version: what git revision the server is using. | |
| 32 bot_version: A hash of the bot code being distributed. Isn't associated | |
| 33 with any git revisions | |
| 34 signed_in: Boolean, if the user is signed in. | |
| 35 Methods: | |
| 36 None. | |
| 37 | |
| 38 Events: | |
| 39 None. | |
| 40 --> | |
| 41 | |
| 42 <link rel="import" href="/res/imp/bower_components/app-layout/app-layout.html"> | |
| 43 <link rel="import" href="/res/imp/bower_components/iron-flex-layout/iron-flex-la
yout-classes.html"> | |
| 44 <link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html" > | |
| 45 <link rel="import" href="/res/imp/bower_components/paper-fab/paper-fab.html" > | |
| 46 <link rel="import" href="/res/imp/bower_components/paper-spinner/paper-spinner-l
ite.html"> | |
| 47 | |
| 48 | |
| 49 <link rel="import" href="auth-signin.html"> | |
| 50 <link rel="import" href="common-behavior.html"> | |
| 51 | |
| 52 <dom-module id="swarming-app"> | |
| 53 <template> | |
| 54 <style include="iron-flex"> | |
| 55 :host { | |
| 56 position: absolute; | |
| 57 top: 0; | |
| 58 bottom: 0; | |
| 59 left: 0; | |
| 60 right: 0; | |
| 61 } | |
| 62 | |
| 63 app-toolbar { | |
| 64 background-color: #1F78B4; | |
| 65 color: #fff; | |
| 66 } | |
| 67 | |
| 68 app-toolbar a { | |
| 69 color: #fff; | |
| 70 } | |
| 71 .left { | |
| 72 margin-right:15px; | |
| 73 } | |
| 74 .right { | |
| 75 margin-left:15px; | |
| 76 } | |
| 77 .main-content { | |
| 78 padding: 3px; | |
| 79 } | |
| 80 | |
| 81 .main-content a { | |
| 82 color: #1F78B4; | |
| 83 } | |
| 84 | |
| 85 auth-signin, .small { | |
| 86 font-size: .7em; | |
| 87 } | |
| 88 | |
| 89 paper-fab { | |
| 90 position: fixed; | |
| 91 bottom: 5px; | |
| 92 right: 5px; | |
| 93 background-color: #1F78B4; | |
| 94 } | |
| 95 | |
| 96 paper-spinner-lite { | |
| 97 --paper-spinner-color: var(--google-yellow-500); | |
| 98 } | |
| 99 </style> | |
| 100 <app-header-layout> | |
| 101 <app-header fixed> | |
| 102 <app-toolbar> | |
| 103 <div class="title left">[[name]]</div> | |
| 104 <paper-spinner-lite class="left" active="[[_or(busy,_busy1,_busy2)]]">
</paper-spinner-lite> | |
| 105 | |
| 106 <a class="left" href="/newui/">Home</a> | |
| 107 <a class="left" href="/newui/botlist">Bot List</a> | |
| 108 <a class="left" href="/newui/tasklist">Task List</a> | |
| 109 <div class="flex"></div> | |
| 110 <div class="small right"> | |
| 111 Server: | |
| 112 <a href$="[[_versionLink(server_details)]]"> | |
| 113 [[server_details.server_version]] | |
| 114 </a> | |
| 115 </div> | |
| 116 <auth-signin | |
| 117 class="right" | |
| 118 client_id="[[client_id]]" | |
| 119 auth_headers="{{auth_headers}}" | |
| 120 profile="{{profile}}" | |
| 121 signed_in="{{signed_in}}"> | |
| 122 </auth-signin> | |
| 123 </app-toolbar> | |
| 124 </app-header> | |
| 125 <div class="main-content"> | |
| 126 <content></content> | |
| 127 </div> | |
| 128 <a target="_blank" rel="noopener" href="https://bugs.chromium.org/p/chro
mium/issues/entry?components=Infra%3EPlatform%3ESwarming&owner=kjlubick@chromium
.org&status=Assigned"> | |
| 129 <paper-fab mini icon="icons:bug-report"></paper-fab> | |
| 130 </a> | |
| 131 </app-header-layout> | |
| 132 | |
| 133 </template> | |
| 134 <script> | |
| 135 Polymer({ | |
| 136 is: 'swarming-app', | |
| 137 | |
| 138 behaviors: [ | |
| 139 SwarmingBehaviors.CommonBehavior, | |
| 140 ], | |
| 141 | |
| 142 properties: { | |
| 143 // input | |
| 144 busy: { | |
| 145 type: Boolean, | |
| 146 }, | |
| 147 client_id: { | |
| 148 type: String, | |
| 149 }, | |
| 150 name: { | |
| 151 type: String, | |
| 152 }, | |
| 153 // outputs | |
| 154 auth_headers: { | |
| 155 type: Object, | |
| 156 notify: true, | |
| 157 observer: "_load" | |
| 158 }, | |
| 159 | |
| 160 permissions: { | |
| 161 type: Object, | |
| 162 value: function() { | |
| 163 // If we aren't logged in, default to no permissions. | |
| 164 return {}; | |
| 165 }, | |
| 166 notify: true, | |
| 167 }, | |
| 168 profile: { | |
| 169 type: Object, | |
| 170 notify: true, | |
| 171 }, | |
| 172 | |
| 173 server_details: { | |
| 174 type: Object, | |
| 175 notify: true, | |
| 176 }, | |
| 177 | |
| 178 signed_in: { | |
| 179 type: Boolean, | |
| 180 value: false, | |
| 181 notify: true, | |
| 182 }, | |
| 183 | |
| 184 // private | |
| 185 _busy1: { | |
| 186 type: Boolean, | |
| 187 value: false, | |
| 188 }, | |
| 189 _busy2: { | |
| 190 type: Boolean, | |
| 191 value: false, | |
| 192 } | |
| 193 | |
| 194 }, | |
| 195 | |
| 196 _load: function() { | |
| 197 this._getJsonAsync("permissions", "/_ah/api/swarming/v1/server/permissio
ns", | |
| 198 "_busy1", this.auth_headers); | |
| 199 this._getJsonAsync("server_details", "/_ah/api/swarming/v1/server/detail
s", | |
| 200 "_busy2", this.auth_headers) | |
| 201 }, | |
| 202 | |
| 203 _versionLink: function(version) { | |
| 204 if (!version || !version.server_version) { | |
| 205 return undefined; | |
| 206 } | |
| 207 var split = version.server_version.split("-"); | |
| 208 if (split.length !== 2) { | |
| 209 return undefined; | |
| 210 } | |
| 211 return "https://github.com/luci/luci-py/commit/"+split[1]; | |
| 212 } | |
| 213 | |
| 214 }); | |
| 215 </script> | |
| 216 </dom-module> | |
| 217 | |
| 218 <dom-module id="swarming-app-style"> | |
| 219 <style> | |
| 220 * { | |
| 221 font-family: sans-serif; | |
| 222 } | |
| 223 /* Only style anchor tags that are actually linking somewhere.*/ | |
| 224 a[href] { | |
| 225 color: #1F78B4; | |
| 226 } | |
| 227 | |
| 228 /* | |
| 229 * A set of styles to make buttons and select/options look more Material | |
| 230 * Design-ish. | |
| 231 */ | |
| 232 button { | |
| 233 min-width: 5.14em; | |
| 234 background-color: #fff; | |
| 235 color: #1f78b4; | |
| 236 text-align: center; | |
| 237 text-transform: uppercase; | |
| 238 outline: none; | |
| 239 border-radius: 3px; | |
| 240 padding: 0.6em 1.2em; | |
| 241 border: solid lightgray 1px; | |
| 242 margin: 0.6em; | |
| 243 cursor: pointer; | |
| 244 } | |
| 245 | |
| 246 button:hover { | |
| 247 background: #eee; | |
| 248 } | |
| 249 | |
| 250 button:focus { | |
| 251 background-color: #ddd; | |
| 252 transition: background-color 0.1s cubic-bezier(0.4, 0, 0.2, 1); | |
| 253 } | |
| 254 | |
| 255 button:active, | |
| 256 button.raised:active { | |
| 257 background-color: #999; | |
| 258 transition: background-color 0.1s cubic-bezier(0.4, 0, 0.2, 1); | |
| 259 } | |
| 260 | |
| 261 button:disabled { | |
| 262 color: #999; | |
| 263 } | |
| 264 | |
| 265 button:disabled:hover { | |
| 266 background: initial; | |
| 267 cursor: initial; | |
| 268 } | |
| 269 | |
| 270 button.action:active { | |
| 271 background-color: #A6CEE3; | |
| 272 transition: background-color 0.1s color 0.1s cubic-bezier(0.4, 0, 0.2, 1
); | |
| 273 } | |
| 274 | |
| 275 button.action { | |
| 276 color: white; | |
| 277 background: #1f78b4; | |
| 278 border: none; | |
| 279 } | |
| 280 | |
| 281 button.action:disabled { | |
| 282 color: white; | |
| 283 background: #999; | |
| 284 border: none; | |
| 285 } | |
| 286 | |
| 287 button.raised { | |
| 288 transition: box-shadow 0.1s cubic-bezier(0.4, 0, 0.2, 1); | |
| 289 box-shadow: 5px 5px 18px 0 rgba(0, 0, 0, 0.3); | |
| 290 } | |
| 291 | |
| 292 button.raised:active { | |
| 293 box-shadow: 2px 2px 5px 0 rgba(0, 0, 0, 0.1); | |
| 294 } | |
| 295 | |
| 296 select, | |
| 297 option { | |
| 298 padding: 0.4em 1.2em; | |
| 299 background-color: white; | |
| 300 border: none; | |
| 301 line-height: 20px; | |
| 302 vertical-align: middle; | |
| 303 } | |
| 304 | |
| 305 select { | |
| 306 overflow-y: auto; | |
| 307 } | |
| 308 </style> | |
| 309 </dom-module> | |
| OLD | NEW |