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

Side by Side Diff: appengine/swarming/elements/res/imp/tasklist/task-list.html

Issue 2249143002: Make TaskList use Dynamic List (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Document that filters is a stub Created 4 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
(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 <task-list>
10
11 task-list creats a dynamic table for viewing swarming tasks. Columns can be
12 dynamically filtered and it supports client-side filtering.
13
14 This is a top-level element.
15
16 Properties:
17 client_id: String, will be set by server-side template evaluation.
jcgregorio 2016/08/16 16:07:36 Comment should explain what the value is. How it i
kjlubick 2016/08/16 16:47:41 Done. How to set it is documented at https://gith
18
19 Methods:
20 None.
21
22 Events:
23 None.
24 -->
25
26 <link rel="import" href="/res/imp/bower_components/iron-flex-layout/iron-flex-la yout-classes.html">
27 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html">
28
29 <link rel="import" href="/res/imp/common/dynamic-table.html">
30 <link rel="import" href="/res/imp/common/sort-toggle.html">
31 <link rel="import" href="/res/imp/common/swarming-app.html">
32 <link rel="import" href="/res/imp/common/url-param.html">
33
34 <link rel="import" href="task-filters.html">
35 <link rel="import" href="task-list-data.html">
36
37 <dom-module id="task-list">
38 <template>
39 <style include="iron-flex iron-flex-alignment iron-positioning swarming-app- style dynamic-table-style">
40
41 .task-list th > span {
42 /* Leave space for sort-toggle*/
43 padding-right: 30px;
44 }
45 </style>
46
47 <url-param name="sort"
48 value="{{_sortstr}}"
49 default_value="id:asc">
50 </url-param>
51
52 <swarming-app
53 client_id="[[client_id]]"
54 auth_headers="{{_auth_headers}}"
55 signed_in="{{_signed_in}}"
56
jcgregorio 2016/08/16 16:07:36 no blank line here.
kjlubick 2016/08/16 16:47:42 Done.
57 busy="[[_busy]]"
58 name="Swarming Task List">
59
60 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2>
61
62 <div hidden$="[[_not(_signed_in)]]">
63 <task-list-data
64 auth_headers="[[_auth_headers]]"
65 query_params="[[_query_params]]"
66
jcgregorio 2016/08/16 16:07:36 no blank line here.
kjlubick 2016/08/16 16:47:41 Done.
67 tasks="{{_items}}"
68 busy="{{_busy}}">
69 </task-list-data>
70
71 <div class="horizontal layout">
72
73 <task-filters
74
jcgregorio 2016/08/16 16:07:36 No blank line here.
kjlubick 2016/08/16 16:47:42 Done.
75 columns="{{_columns}}"
76 query_params="{{_query_params}}"
77 filter="{{_filter}}"
78 verbose="{{_verbose}}">
79 </task-filters>
80
81 </div>
82
83 <table class="task-list">
84 <thead on-sort_change="_sortChange">
85 <!-- To allow for dynamic columns without having a lot of copy-pasted
86 code, we break columns up into "special" and "plain" columns. Special
87 columns require some sort of HTML output (e.g. anchor tags) and plain
88 columns just output text. The plain columns use Polymer functions to
89 insert their text [_header(), _column(), _deviceColumn()]. Polymer
90 functions do not allow HTML (to avoid XSS), so special columns, like i d
91 and task are inserted in a fixed order.
92 -->
93 <tr>
94 <th>
95 <span>Task Name</span>
96 <sort-toggle
97 name="name"
98 current="[[_sort]]">
99 </sort-toggle>
100 </th>
101 <!-- This wonky syntax is the proper way to listen to changes on a n
102 array (we are listening to all subproperties). The element returne d is
103 not of much use, so we'll ignore it in _hide() and use this._colum ns.
104 -->
105 <th hidden$="[[_hide('state', _columns.*)]]">
106 <span>Status</span>
107 <sort-toggle
108 name="state"
109 current="[[_sort]]">
110 </sort-toggle>
111 </th>
112
113 <template is="dom-repeat"
jcgregorio 2016/08/16 16:07:36 If you are going to break the element across lines
kjlubick 2016/08/16 16:47:42 Done. Also in bot-list.html
114 items="[[_plainColumns]]"
115 as="c">
116 <th hidden$="[[_hide(c)]]">
117 <span>[[_header(c)]]</span>
118 <sort-toggle
119 name="[[c]]"
120 current="[[_sort]]">
121 </sort-toggle>
122 </th>
123 </template>
124 </tr>
125 </thead>
126 <tbody>
127 <template id="tasks_table" is="dom-repeat"
128 items="[[_filteredSortedItems]]"
129 as="task"
130 initial-count=50>
131
132 <tr class$="[[_taskClass(task)]]">
133 <td>
134 <a class="center"
135 href$="[[_taskLink(task)]]"
136 target="_blank">
137 [[task.name]]
138 </a>
139 </td>
140 <td hidden$="[[_hide('state', _columns.*)]]">
141 [[_column('state', task, _verbose)]]
142 <!-- TODO(kjlubick): Add button to stop pending.-->
143 </td>
144
145 <template is="dom-repeat"
146 items="[[_plainColumns]]"
147 as="c">
148 <td hidden$="[[_hide(c)]]">
149 [[_column(c, task, _verbose)]]
150 </td>
151 </template>
152
153 </tr>
154 </template> <!--tasks_table repeat-->
155 </tbody>
156 </table>
157 </div>
158
159 </swarming-app>
160
161 </template>
162 <script>
163 (function(){
164 var specialColumns = ["name", "state"];
165 var columnMap = {};
166 var headerMap = {
167 "user": "Requesting User",
168 };
169 var specialSort = {};
170
171 Polymer({
172 is: 'task-list',
173 behaviors: [SwarmingBehaviors.SwarmingBehavior,
jcgregorio 2016/08/16 16:07:36 behaviors: [ SwarmingBehaviors.SwarmingBehavi
kjlubick 2016/08/16 16:47:41 Done.
174 SwarmingBehaviors.DynamicTableBehavior],
175
176 properties: {
177 // input
178 client_id: {
179 type: String,
180 },
181
182 // for dynamic table
jcgregorio 2016/08/16 16:07:36 Comments are sentences, or at least sentence-ish.
kjlubick 2016/08/16 16:47:41 Done.
183 _columnMap: {
184 type: Object,
185 value: columnMap,
186 },
187 _headerMap: {
188 type: Object,
189 value: headerMap,
190 },
191 _specialColumns: {
192 type: Array,
193 value: specialColumns,
194 },
195 _specialSort: {
196 type: Object,
197 value: specialSort,
198 },
199
jcgregorio 2016/08/16 16:07:36 no blank line here.
kjlubick 2016/08/16 16:47:41 Done.
200 },
201
202 _attribute: function(task, col, def) {
203 var retVal = task[col] || [def];
204 if (!Array.isArray(retVal)) {
205 return [retVal];
206 }
207 return retVal;
208 },
209
210 _taskLink: function(task) {
211 // TODO(kjlubick) Make this point to /newui/ when appropriate.
212 return "/restricted/task/"+task.task_id;
213 },
214
215 _taskClass: function(task) {
216 // TODO(kjlubick): Color tasks?
217 return "";
218 }
219
220 });
221 })();
222 </script>
223 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698