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

Side by Side Diff: appengine/swarming/elements/res/imp/common/swarming-app.html

Issue 2279903002: Make the new index page more useful (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@whoami3
Patch Set: Fix names Created 4 years, 3 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 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 auth_headers: Object, Use this in iron-ajax to set oauth2 headers.
23 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
24 template evaluation.
24 name: String, the name of the app to be displayed. 25 name: String, the name of the app to be displayed.
25 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 signed_in: Boolean, if the user is signed in.
26 Methods: 31 Methods:
27 None. 32 None.
28 33
29 Events: 34 Events:
30 None. 35 None.
31 --> 36 -->
32 37
33 <link rel="import" href="/res/imp/bower_components/app-layout/app-layout.html"> 38 <link rel="import" href="/res/imp/bower_components/app-layout/app-layout.html">
34 <link rel="import" href="/res/imp/bower_components/iron-flex-layout/iron-flex-la yout-classes.html"> 39 <link rel="import" href="/res/imp/bower_components/iron-flex-layout/iron-flex-la yout-classes.html">
35 <link rel="import" href="/res/imp/bower_components/paper-spinner/paper-spinner-l ite.html"> 40 <link rel="import" href="/res/imp/bower_components/paper-spinner/paper-spinner-l ite.html">
36 41
37 <link rel="import" href="auth-signin.html"> 42 <link rel="import" href="auth-signin.html">
43 <link rel="import" href="common-behavior.html">
38 44
39 <dom-module id="swarming-app"> 45 <dom-module id="swarming-app">
40 <template> 46 <template>
41 <style include="iron-flex"> 47 <style include="iron-flex">
42 :host { 48 :host {
43 position: absolute; 49 position: absolute;
44 top: 0; 50 top: 0;
45 bottom: 0; 51 bottom: 0;
46 left: 0; 52 left: 0;
47 right: 0; 53 right: 0;
(...skipping 22 matching lines...) Expand all
70 } 76 }
71 77
72 paper-spinner-lite { 78 paper-spinner-lite {
73 --paper-spinner-color: var(--google-yellow-500); 79 --paper-spinner-color: var(--google-yellow-500);
74 } 80 }
75 </style> 81 </style>
76 <app-header-layout> 82 <app-header-layout>
77 <app-header fixed> 83 <app-header fixed>
78 <app-toolbar> 84 <app-toolbar>
79 <div class="title left">[[name]]</div> 85 <div class="title left">[[name]]</div>
80 <paper-spinner-lite class="left" active="[[busy]]"></paper-spinner-lit e> 86 <paper-spinner-lite class="left" active="[[_or(busy,_busy)]]"></paper- spinner-lite>
81 87
82 <a class="left" href="/newui/">Home</a> 88 <a class="left" href="/newui/">Home</a>
83 <a class="left" href="/newui/botlist">Bot List</a> 89 <a class="left" href="/newui/botlist">Bot List</a>
84 <a class="left" href="/newui/tasklist">Task List</a> 90 <a class="left" href="/newui/tasklist">Task List</a>
85 <div class="flex"></div> 91 <div class="flex"></div>
86 <auth-signin 92 <auth-signin
87 class="right" 93 class="right"
88 client-id="[[client_id]]" 94 client_id="[[client_id]]"
89 auth-headers="{{auth_headers}}" 95 auth_headers="{{auth_headers}}"
90 signed-in="{{signed_in}}"> 96 signed_in="{{signed_in}}">
91 </auth-signin> 97 </auth-signin>
92 </app-toolbar> 98 </app-toolbar>
93 </app-header> 99 </app-header>
94 <div class="main-content"> 100 <div class="main-content">
95 <content></content> 101 <content></content>
96 </div> 102 </div>
97 </app-header-layout> 103 </app-header-layout>
98 104
99 </template> 105 </template>
100 <script> 106 <script>
101 Polymer({ 107 Polymer({
102 is: 'swarming-app', 108 is: 'swarming-app',
109
110 behaviors: [
111 SwarmingBehaviors.CommonBehavior,
112 ],
113
103 properties: { 114 properties: {
115 // input
116 busy: {
117 type: Boolean,
118 },
104 client_id: { 119 client_id: {
105 type: String, 120 type: String,
106 }, 121 },
122 name: {
123 type: String,
124 },
125 // outputs
107 auth_headers: { 126 auth_headers: {
108 type: Object, 127 type: Object,
109 notify: true, 128 notify: true,
129 observer: "_loadPermissions"
110 }, 130 },
131
132 permissions: {
133 type: Object,
134 value: function() {
135 // If we aren't logged in, default to no permissions.
136 return {};
137 },
138 notify: true,
139 },
140
111 signed_in: { 141 signed_in: {
112 type: Boolean, 142 type: Boolean,
113 value: false, 143 value: false,
114 notify:true, 144 notify:true,
115 }, 145 },
116 permissions: {
117 type: Object,
118 value: function() {
119 // TODO(kjlubick): Make this call the whoami endpoint after signing in.
120 return {
121 can_cancel_task: true,
122 }
123 },
124 notify: true,
125 },
126 146
127 busy: { 147 // private
148 _busy: {
128 type: Boolean, 149 type: Boolean,
129 }, 150 value: false,
130 name: { 151 }
131 type: String, 152
132 }, 153 },
154
155 _loadPermissions: function() {
156 this._getJsonAsync("permissions", "/_ah/api/swarming/v1/server/permissio ns",
157 "_busy", this.auth_headers);
133 }, 158 },
134 159
135 }); 160 });
136 </script> 161 </script>
137 </dom-module> 162 </dom-module>
138 163
139 <dom-module id="swarming-app-style"> 164 <dom-module id="swarming-app-style">
140 <style> 165 <style>
141 * { 166 * {
142 font-family: sans-serif; 167 font-family: sans-serif;
143 } 168 }
144 /* Only style anchor tags that are actually linking somewhere.*/ 169 /* Only style anchor tags that are actually linking somewhere.*/
145 a[href] { 170 a[href] {
146 color: #1F78B4; 171 color: #1F78B4;
147 } 172 }
148 </style> 173 </style>
149 </dom-module> 174 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698