Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: appengine/isolate/ui/res/imp/common/isolate-app.html

Issue 2991303002: Add in OAuth authentication to Isolate Polymer UI (Closed)
Patch Set: Fix GET request for server_details Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 Copyright 2016 The LUCI Authors. All rights reserved. 2 Copyright 2017 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 <isolate-app>
10 10
11 <swarming-app> is meant to be used in top level elements to provide the header 11 <isolate-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 isolate-app-style
17 17
18 <style include="shared-style"> contains styles to be shared among all 18 <style include="isolate-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 server_details: Object, containing multiple Strings including:
29 behaviors, such as terminate_bot.
30 server_details: Object, containing mutliple Strings including:
31 server_version: what git revision the server is using. 29 server_version: what git revision the server is using.
32 bot_version: A hash of the bot code being distributed. Isn't associated 30 bot_version: A hash of the bot code being distributed. Isn't associated
33 with any git revisions 31 with any git revisions
34 signed_in: Boolean, if the user is signed in. 32 signed_in: Boolean, if the user is signed in.
35 Methods: 33 Methods:
36 None. 34 None.
37 35
38 Events: 36 Events:
39 None. 37 None.
40 --> 38 -->
41 39
42 <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">
43 <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">
44 <link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html"> 42 <link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html">
45 <link rel="import" href="/res/imp/bower_components/iron-media-query/iron-media-q uery.html"> 43 <link rel="import" href="/res/imp/bower_components/iron-media-query/iron-media-q uery.html">
46 <link rel="import" href="/res/imp/bower_components/paper-fab/paper-fab.html"> 44 <link rel="import" href="/res/imp/bower_components/paper-fab/paper-fab.html">
47 <link rel="import" href="/res/imp/bower_components/paper-icon-button/paper-icon- button.html"> 45 <link rel="import" href="/res/imp/bower_components/paper-icon-button/paper-icon- button.html">
48 <link rel="import" href="/res/imp/bower_components/paper-item/paper-item.html"> 46 <link rel="import" href="/res/imp/bower_components/paper-item/paper-item.html">
49 <link rel="import" href="/res/imp/bower_components/paper-menu/paper-menu.html"> 47 <link rel="import" href="/res/imp/bower_components/paper-menu/paper-menu.html">
50 <link rel="import" href="/res/imp/bower_components/paper-spinner/paper-spinner-l ite.html"> 48 <link rel="import" href="/res/imp/bower_components/paper-spinner/paper-spinner-l ite.html">
51 49
52 <link rel="import" href="auth-signin.html"> 50 <link rel="import" href="/res/imp/shared/auth-signin.html">
51 <link rel="import" href="/res/imp/shared/error-toast.html">
52
53 <link rel="import" href="common-behavior.html"> 53 <link rel="import" href="common-behavior.html">
54 <link rel="import" href="error-toast.html">
55 54
56 <dom-module id="swarming-app"> 55 <dom-module id="isolate-app">
57 <template> 56 <template>
58 <style include="iron-flex"> 57 <style include="iron-flex">
59 :host { 58 :host {
60 position: absolute; 59 position: absolute;
61 top: 0; 60 top: 0;
62 bottom: 0; 61 bottom: 0;
63 left: 0; 62 left: 0;
64 right: 0; 63 right: 0;
65 } 64 }
66 65
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 122 }
124 123
125 paper-spinner-lite { 124 paper-spinner-lite {
126 --paper-spinner-color: var(--google-yellow-500); 125 --paper-spinner-color: var(--google-yellow-500);
127 } 126 }
128 </style> 127 </style>
129 128
130 <app-header-layout> 129 <app-header-layout>
131 <app-drawer id="mobile_menu"> 130 <app-drawer id="mobile_menu">
132 <div class="menu-item"><a class="left" href="/">Home</a></div> 131 <div class="menu-item"><a class="left" href="/">Home</a></div>
133 <div class="menu-item"><a class="left" href="/botlist">Bot List</a></d iv>
134 <div class="menu-item"><a class="left" href="/tasklist">Task List</a>< /div>
135 <div class="menu-item"><a class="left" href="/oldui">Old UI</a></div>
136 </app-drawer> 132 </app-drawer>
137 <app-header fixed> 133 <app-header fixed>
138 <app-toolbar class$="[[_toolbarClass(client_id)]]"> 134 <app-toolbar class$="[[_toolbarClass(client_id)]]">
139 <paper-icon-button 135 <paper-icon-button
140 class="menu-button" 136 class="menu-button"
141 icon="icons:menu" 137 icon="icons:menu"
142 on-tap="_toggleMobileMenu" 138 on-tap="_toggleMobileMenu"
143 hidden$="[[wide_layout]]"> 139 hidden$="[[wide_layout]]">
144 </paper-icon-button> 140 </paper-icon-button>
145 <div class="title left">[[name]]</div> 141 <div class="title left">[[name]]</div>
146 <paper-spinner-lite class="left" active="[[_or(busy,_busy1,_busy2)]]"> </paper-spinner-lite> 142 <paper-spinner-lite class="left" active="[[_or(busy,_busy1,_busy2)]]"> </paper-spinner-lite>
147 143
148 <a class="left" href="/" hidden$="[[!wide_layout]]">Home</a> 144 <a class="left" href="/" hidden$="[[!wide_layout]]">Home</a>
149 <a class="left" href="/botlist" hidden$="[[!wide_layout]]">Bot List</a >
150 <a class="left" href="/tasklist" hidden$="[[!wide_layout]]">Task List< /a>
151 <div class="flex" hidden$="[[!wide_layout]]"></div> 145 <div class="flex" hidden$="[[!wide_layout]]"></div>
152 <template is="dom-if" if="[[client_id]]"> 146 <template is="dom-if" if="[[client_id]]">
153 <div class="small right"> 147 <div class="small right">
154 Server: 148 Server:
155 <a href$="[[_versionLink(server_details)]]"> 149 <a href$="[[_versionLink(server_details)]]">
156 [[server_details.server_version]] 150 [[server_details.server_version]]
157 </a> 151 </a>
158 </div> 152 </div>
159 <auth-signin 153 <auth-signin
160 class="right" 154 class="right"
(...skipping 15 matching lines...) Expand all
176 <a target="_blank" rel="noopener" href="https://bugs.chromium.org/p/chromi um/issues/entry?components=Infra%3EPlatform%3ESwarming%3EWebUI&owner=kjlubick@ch romium.org&status=Assigned"> 170 <a target="_blank" rel="noopener" href="https://bugs.chromium.org/p/chromi um/issues/entry?components=Infra%3EPlatform%3ESwarming%3EWebUI&owner=kjlubick@ch romium.org&status=Assigned">
177 <paper-fab mini icon="icons:bug-report"></paper-fab> 171 <paper-fab mini icon="icons:bug-report"></paper-fab>
178 </a> 172 </a>
179 </app-header-layout> 173 </app-header-layout>
180 174
181 <iron-media-query query="min-width: 600px" query-matches="{{wide_layout}}">< /iron-media-query> 175 <iron-media-query query="min-width: 600px" query-matches="{{wide_layout}}">< /iron-media-query>
182 176
183 </template> 177 </template>
184 <script> 178 <script>
185 Polymer({ 179 Polymer({
186 is: 'swarming-app', 180 is: 'isolate-app',
187 181
188 behaviors: [ 182 behaviors: [
189 SwarmingBehaviors.CommonBehavior, 183 IsolateBehaviors.CommonBehavior,
190 ], 184 ],
191 185
192 properties: { 186 properties: {
193 // input 187 // input
194 busy: { 188 busy: {
195 type: Boolean, 189 type: Boolean,
196 }, 190 },
197 client_id: { 191 client_id: {
198 type: String, 192 type: String,
199 }, 193 },
200 name: { 194 name: {
201 type: String, 195 type: String,
202 }, 196 },
203 // outputs 197 // outputs
204 auth_headers: { 198 auth_headers: {
205 type: Object, 199 type: Object,
206 notify: true, 200 notify: true,
207 observer: "_load" 201 observer: "_load"
208 }, 202 },
209 203
210 permissions: {
211 type: Object,
212 value: function() {
213 // If we aren't logged in, default to no permissions.
214 return {};
215 },
216 notify: true,
217 },
218 profile: { 204 profile: {
219 type: Object, 205 type: Object,
220 notify: true, 206 notify: true,
221 }, 207 },
222 208
223 server_details: { 209 server_details: {
224 type: Object, 210 type: Object,
225 notify: true, 211 notify: true,
226 }, 212 },
227 213
228 signed_in: { 214 signed_in: {
229 type: Boolean, 215 type: Boolean,
230 value: false, 216 value: false,
231 notify: true, 217 notify: true,
232 }, 218 },
233 219
234 // private 220 // private
235 _busy1: { 221 _busy1: {
236 type: Boolean, 222 type: Boolean,
237 value: false, 223 value: false,
238 }, 224 },
239 _busy2: { 225 _busy2: {
240 type: Boolean, 226 type: Boolean,
241 value: false, 227 value: false,
242 } 228 }
243 229
244 }, 230 },
245 231
246 _load: function() { 232 _load: function() {
247 this._getJsonAsync("permissions", "/api/swarming/v1/server/permissions", 233 this._getJsonAsync("server_details", "/_ah/api/isolateservice/v1/server_ details",
248 "_busy1", this.auth_headers);
249 this._getJsonAsync("server_details", "/api/swarming/v1/server/details",
250 "_busy2", this.auth_headers).catch(function(r){ 234 "_busy2", this.auth_headers).catch(function(r){
251 sk.errorMessage("Http response: "+ (r.status || " ") + " " + r.respo nse); 235 sk.errorMessage("Http response: "+ (r.status || " ") + " " + r.respo nse);
252 }); 236 });
253 }, 237 },
254 238
255 _toggleMobileMenu: function() { 239 _toggleMobileMenu: function() {
256 this.$.mobile_menu.toggle(); 240 this.$.mobile_menu.toggle();
257 }, 241 },
258 242
259 _toolbarClass: function(client_id) { 243 _toolbarClass: function(client_id) {
(...skipping 11 matching lines...) Expand all
271 if (split.length !== 2) { 255 if (split.length !== 2) {
272 return undefined; 256 return undefined;
273 } 257 }
274 return "https://github.com/luci/luci-py/commit/"+split[1]; 258 return "https://github.com/luci/luci-py/commit/"+split[1];
275 } 259 }
276 260
277 }); 261 });
278 </script> 262 </script>
279 </dom-module> 263 </dom-module>
280 264
281 <dom-module id="swarming-app-style"> 265 <dom-module id="isolate-app-style">
282 <style> 266 <style>
283 * { 267 * {
284 font-family: sans-serif; 268 font-family: sans-serif;
285 } 269 }
286 /* Only style anchor tags that are actually linking somewhere.*/ 270 /* Only style anchor tags that are actually linking somewhere.*/
287 a[href] { 271 a[href] {
288 color: #1F78B4; 272 color: #1F78B4;
289 } 273 }
290 274
291 /* 275 /*
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 border: none; 347 border: none;
364 line-height: 20px; 348 line-height: 20px;
365 vertical-align: middle; 349 vertical-align: middle;
366 } 350 }
367 351
368 select { 352 select {
369 overflow-y: auto; 353 overflow-y: auto;
370 } 354 }
371 </style> 355 </style>
372 </dom-module> 356 </dom-module>
OLDNEW
« no previous file with comments | « appengine/isolate/ui/res/imp/common/common-behavior.html ('k') | appengine/isolate/ui/res/imp/index/isolate-index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698