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

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

Issue 2375963003: Move bot-list and task-list to use pageable-data (Closed) Base URL: git@github.com:luci/luci-py@limit-tasks
Patch Set: rename Created 4 years, 2 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 <task-list> 9 <task-list>
10 10
(...skipping 14 matching lines...) Expand all
25 --> 25 -->
26 26
27 <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/iron-flex-layout/iron-flex-la yout-classes.html">
28 <link rel="import" href="/res/imp/bower_components/paper-button/paper-button.htm l"> 28 <link rel="import" href="/res/imp/bower_components/paper-button/paper-button.htm l">
29 <link rel="import" href="/res/imp/bower_components/paper-button/paper-button.htm l"> 29 <link rel="import" href="/res/imp/bower_components/paper-button/paper-button.htm l">
30 <link rel="import" href="/res/imp/bower_components/paper-dialog/paper-dialog.htm l"> 30 <link rel="import" href="/res/imp/bower_components/paper-dialog/paper-dialog.htm l">
31 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html"> 31 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html">
32 32
33 <link rel="import" href="/res/imp/common/dynamic-table-behavior.html"> 33 <link rel="import" href="/res/imp/common/dynamic-table-behavior.html">
34 <link rel="import" href="/res/imp/common/error-toast.html"> 34 <link rel="import" href="/res/imp/common/error-toast.html">
35 <link rel="import" href="/res/imp/common/pageable-data.html">
35 <link rel="import" href="/res/imp/common/sort-toggle.html"> 36 <link rel="import" href="/res/imp/common/sort-toggle.html">
36 <link rel="import" href="/res/imp/common/swarming-app.html"> 37 <link rel="import" href="/res/imp/common/swarming-app.html">
37 <link rel="import" href="/res/imp/common/task-behavior.html"> 38 <link rel="import" href="/res/imp/common/task-behavior.html">
38 <link rel="import" href="/res/imp/common/url-param.html"> 39 <link rel="import" href="/res/imp/common/url-param.html">
39 40
40 <link rel="import" href="task-filters.html"> 41 <link rel="import" href="task-filters.html">
41 <link rel="import" href="task-list-data.html"> 42 <link rel="import" href="task-list-data.html">
42 43
43 <dom-module id="task-list"> 44 <dom-module id="task-list">
44 <template> 45 <template>
(...skipping 11 matching lines...) Expand all
56 <url-param name="s" 57 <url-param name="s"
57 value="{{_sortstr}}" 58 value="{{_sortstr}}"
58 default_value="created_ts:desc"> 59 default_value="created_ts:desc">
59 </url-param> 60 </url-param>
60 61
61 <swarming-app 62 <swarming-app
62 client_id="[[client_id]]" 63 client_id="[[client_id]]"
63 auth_headers="{{_auth_headers}}" 64 auth_headers="{{_auth_headers}}"
64 permissions="{{_permissions}}" 65 permissions="{{_permissions}}"
65 signed_in="{{_signed_in}}" 66 signed_in="{{_signed_in}}"
66 busy="[[_busy]]" 67 busy="[[_or(_busy1,_busy2)]]"
67 name="Swarming Task List"> 68 name="Swarming Task List">
68 69
69 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> 70 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2>
70 71
71 <div hidden$="[[_not(_signed_in)]]"> 72 <div hidden$="[[_not(_signed_in)]]">
72 <task-list-data 73 <task-list-data
74 id="data"
73 auth_headers="[[_auth_headers]]" 75 auth_headers="[[_auth_headers]]"
74 query_params="[[_query_params]]" 76 query_params="[[_query_params]]"
75 tasks="{{_items}}" 77 tasks="[[_items]]"
76 busy="{{_busy}}" 78 busy="{{_busy1)}}"
77 primary_map="{{_primary_map}}" 79 primary_map="{{_primary_map}}"
78 primary_arr="{{_primary_arr}}"> 80 primary_arr="{{_primary_arr}}">
79 </task-list-data> 81 </task-list-data>
80 82
81 <div class="horizontal layout"> 83 <div class="horizontal layout">
82
83 <task-filters 84 <task-filters
84 primary_map="[[_primary_map]]" 85 primary_map="[[_primary_map]]"
85 primary_arr="[[_primary_arr]]" 86 primary_arr="[[_primary_arr]]"
86 columns="{{_columns}}" 87 columns="{{_columns}}"
87 query_params="{{_query_params}}" 88 query_params="{{_query_params}}"
88 filter="{{_filter}}"> 89 filter="{{_filter}}">
89 </task-filters> 90 </task-filters>
90
91 </div> 91 </div>
92 92
93 <table class="task-list"> 93 <table class="task-list">
94 <thead on-sort_change="_sortChange"> 94 <thead on-sort_change="_sortChange">
95 <!-- To allow for dynamic columns without having a lot of copy-pasted 95 <!-- To allow for dynamic columns without having a lot of copy-pasted
96 code, we break columns up into "special" and "plain" columns. Special 96 code, we break columns up into "special" and "plain" columns. Special
97 columns require some sort of HTML output (e.g. anchor tags) and plain 97 columns require some sort of HTML output (e.g. anchor tags) and plain
98 columns just output text. The plain columns use Polymer functions to 98 columns just output text. The plain columns use Polymer functions to
99 insert their text [_header(), _column(), _deviceColumn()]. Polymer 99 insert their text [_header(), _column(), _deviceColumn()]. Polymer
100 functions do not allow HTML (to avoid XSS), so special columns, like i d 100 functions do not allow HTML (to avoid XSS), so special columns, like i d
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 as="c"> 199 as="c">
200 <td hidden$="[[_hide(c)]]"> 200 <td hidden$="[[_hide(c)]]">
201 [[_column(c, task)]] 201 [[_column(c, task)]]
202 </td> 202 </td>
203 </template> 203 </template>
204 204
205 </tr> 205 </tr>
206 </template> <!--tasks_table repeat--> 206 </template> <!--tasks_table repeat-->
207 </tbody> 207 </tbody>
208 </table> 208 </table>
209
210 <pageable-data
211 id="page_tasks"
212 busy="{{_busy2}}"
213 label="Show more tasks"
214 output="{{_items}}"
215 parse="[[_parseTasks]]">
216 </pageable-data>
209 </div> 217 </div>
210
211 </swarming-app> 218 </swarming-app>
212 219
213 <paper-dialog id="prompt" modal on-iron-overlay-closed="_promptClosed"> 220 <paper-dialog id="prompt" modal on-iron-overlay-closed="_promptClosed">
214 <h2>Are you sure?</h2> 221 <h2>Are you sure?</h2>
215 <div>Are you sure you want to [[_dialogPrompt]]?</div> 222 <div>Are you sure you want to [[_dialogPrompt]]?</div>
216 <div class="buttons"> 223 <div class="buttons">
217 <paper-button dialog-dismiss autofocus>No</paper-button> 224 <paper-button dialog-dismiss autofocus>No</paper-button>
218 <paper-button dialog-confirm>Yes</paper-button> 225 <paper-button dialog-confirm>Yes</paper-button>
219 </div> 226 </div>
220 </paper-dialog> 227 </paper-dialog>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 behaviors: [ 301 behaviors: [
295 SwarmingBehaviors.DynamicTableBehavior, 302 SwarmingBehaviors.DynamicTableBehavior,
296 SwarmingBehaviors.TaskBehavior, 303 SwarmingBehaviors.TaskBehavior,
297 ], 304 ],
298 305
299 properties: { 306 properties: {
300 client_id: { 307 client_id: {
301 type: String, 308 type: String,
302 }, 309 },
303 310
311 _busy1: {
312 type: Boolean,
313 value: false
314 },
315 _busy2: {
316 type: Boolean,
317 value: false
318 },
319 _parseTasks: {
320 type: Function,
321 value: function() {
322 return this.$.data.parseTasks.bind(this);
323 }
324 },
304 // The task id to cancel if the prompt is accepted. 325 // The task id to cancel if the prompt is accepted.
305 _toCancel: { 326 _toCancel: {
306 type: String, 327 type: String,
307 }, 328 },
308 329
309 // For dynamic table. 330 // For dynamic table.
310 _columnMap: { 331 _columnMap: {
311 type: Object, 332 type: Object,
312 value: function() { 333 value: function() {
313 var base = this._commonColumns(); 334 var base = this._commonColumns();
(...skipping 10 matching lines...) Expand all
324 _specialColumns: { 345 _specialColumns: {
325 type: Array, 346 type: Array,
326 value: specialColumns, 347 value: specialColumns,
327 }, 348 },
328 _specialSort: { 349 _specialSort: {
329 type: Object, 350 type: Object,
330 value: specialSort, 351 value: specialSort,
331 }, 352 },
332 }, 353 },
333 354
355 observers:["reload(_query_params,_auth_headers)"],
356
334 _attribute: function(task, col, def) { 357 _attribute: function(task, col, def) {
335 if (def === undefined) { 358 if (def === undefined) {
336 def = "none"; 359 def = "none";
337 } 360 }
338 var retVal = this._tag(task, col) || task[col] || [def]; 361 var retVal = this._tag(task, col) || task[col] || [def];
339 if (!Array.isArray(retVal)) { 362 if (!Array.isArray(retVal)) {
340 return [retVal]; 363 return [retVal];
341 } 364 }
342 return retVal; 365 return retVal;
343 }, 366 },
(...skipping 19 matching lines...) Expand all
363 var task = e.model.task; 386 var task = e.model.task;
364 if (!task || !task.task_id) { 387 if (!task || !task.task_id) {
365 console.log("Missing task info", task); 388 console.log("Missing task info", task);
366 return 389 return
367 } 390 }
368 this.set("_toCancel", task.task_id); 391 this.set("_toCancel", task.task_id);
369 this.set("_dialogPrompt", 'cancel task "'+ task.name +'"'); 392 this.set("_dialogPrompt", 'cancel task "'+ task.name +'"');
370 this.$.prompt.open(); 393 this.$.prompt.open();
371 }, 394 },
372 395
396 reload: function() {
397 if (!this._auth_headers || !this._query_params) {
398 return;
399 }
400 var url = "/_ah/api/swarming/v1/tasks/list?" + sk.query.fromParamSet(thi s._query_params);
401 this.$.page_tasks.load(url,this._auth_headers);
402 },
403
373 _tag: function(task, col) { 404 _tag: function(task, col) {
374 if (!task || !task.tagMap) { 405 if (!task || !task.tagMap) {
375 return undefined; 406 return undefined;
376 } 407 }
377 return task.tagMap[col]; 408 return task.tagMap[col];
378 }, 409 },
379 410
380 _taskClass: function(task) { 411 _taskClass: function(task) {
381 return this.stateClass(this._column("state", task)); 412 return this.stateClass(this._column("state", task));
382 } 413 }
383 }); 414 });
384 })(); 415 })();
385 </script> 416 </script>
386 </dom-module> 417 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698