| OLD | NEW |
| 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 |
| 11 task-list creats a dynamic table for viewing swarming tasks. Columns can be | 11 task-list creats a dynamic table for viewing swarming tasks. Columns can be |
| 12 dynamically filtered and it supports client-side filtering. | 12 dynamically filtered and it supports client-side filtering. |
| 13 | 13 |
| 14 This is a top-level element. | 14 This is a top-level element. |
| 15 | 15 |
| 16 Properties: | 16 Properties: |
| 17 client_id: String, Oauth 2.0 client id. It will be set by server-side | 17 client_id: String, Oauth 2.0 client id. It will be set by server-side |
| 18 template evaluation. | 18 template evaluation. |
| 19 | 19 |
| 20 Methods: | 20 Methods: |
| 21 None. | 21 None. |
| 22 | 22 |
| 23 Events: | 23 Events: |
| 24 None. | 24 None. |
| 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-dialog/paper-dialog.htm
l"> | 29 <link rel="import" href="/res/imp/bower_components/paper-dialog/paper-dialog.htm
l"> |
| 30 <link rel="import" href="/res/imp/bower_components/paper-time-picker/paper-time-
picker.html"> |
| 31 <link rel="import" href="/res/imp/bower_components/polymer-paper-date-picker/pap
er-date-picker.html"> |
| 30 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html"> | 32 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html"> |
| 31 | 33 |
| 32 <link rel="import" href="/res/imp/common/dynamic-table-behavior.html"> | 34 <link rel="import" href="/res/imp/common/dynamic-table-behavior.html"> |
| 33 <link rel="import" href="/res/imp/common/pageable-data.html"> | 35 <link rel="import" href="/res/imp/common/pageable-data.html"> |
| 34 <link rel="import" href="/res/imp/common/sort-toggle.html"> | 36 <link rel="import" href="/res/imp/common/sort-toggle.html"> |
| 35 <link rel="import" href="/res/imp/common/swarming-app.html"> | 37 <link rel="import" href="/res/imp/common/swarming-app.html"> |
| 36 <link rel="import" href="/res/imp/common/task-behavior.html"> | 38 <link rel="import" href="/res/imp/common/task-behavior.html"> |
| 37 <link rel="import" href="/res/imp/common/url-param.html"> | 39 <link rel="import" href="/res/imp/common/url-param.html"> |
| 38 | 40 |
| 39 <link rel="import" href="task-filters.html"> | 41 <link rel="import" href="task-filters.html"> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 query_params="[[_query_params]]" | 78 query_params="[[_query_params]]" |
| 77 tasks="[[_items]]" | 79 tasks="[[_items]]" |
| 78 busy="{{_busy1)}}" | 80 busy="{{_busy1)}}" |
| 79 dimensions="{{_dimensions}}" | 81 dimensions="{{_dimensions}}" |
| 80 primary_map="{{_primary_map}}" | 82 primary_map="{{_primary_map}}" |
| 81 primary_arr="{{_primary_arr}}"> | 83 primary_arr="{{_primary_arr}}"> |
| 82 </task-list-data> | 84 </task-list-data> |
| 83 | 85 |
| 84 <div class="horizontal layout"> | 86 <div class="horizontal layout"> |
| 85 <task-filters | 87 <task-filters |
| 88 id="task_filters" |
| 86 dimensions="[[_dimensions]]" | 89 dimensions="[[_dimensions]]" |
| 87 permissions="[[_permissions]]" | 90 permissions="[[_permissions]]" |
| 88 primary_map="[[_primary_map]]" | 91 primary_map="[[_primary_map]]" |
| 89 primary_arr="[[_primary_arr]]" | 92 primary_arr="[[_primary_arr]]" |
| 90 special_columns="[[_specialColumns]]" | 93 special_columns="[[_specialColumns]]" |
| 91 | 94 |
| 92 columns="{{_columns}}" | 95 columns="{{_columns}}" |
| 93 query_params="{{_query_params}}" | 96 query_params="{{_query_params}}" |
| 94 filter="{{_filter}}" | 97 filter="{{_filter}}" |
| 95 | 98 |
| 96 on-cancel-all="_promptCancelAll"> | 99 on-cancel-all="_promptCancelAll" |
| 100 on-prompt-date="_promptDate" |
| 101 on-prompt-time="_promptTime"> |
| 97 </task-filters> | 102 </task-filters> |
| 98 | 103 |
| 99 <task-list-summary | 104 <task-list-summary |
| 100 auth_headers="[[_auth_headers]]" | 105 auth_headers="[[_auth_headers]]" |
| 101 busy="{{_busy3}}" | 106 busy="{{_busy3}}" |
| 102 columns="[[_columns]]" | 107 columns="[[_columns]]" |
| 103 count_params="[[_query_params]]" | 108 count_params="[[_query_params]]" |
| 104 num_tasks="[[_filteredSortedItems.length]]" | 109 num_tasks="[[_filteredSortedItems.length]]" |
| 105 sort="[[_sortstr]]"> | 110 sort="[[_sortstr]]"> |
| 106 </task-list-summary> | 111 </task-list-summary> |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 <div class="buttons" > | 275 <div class="buttons" > |
| 271 <paper-button dialog-dismiss autofocus hidden$="[[_started_canceling]]"> | 276 <paper-button dialog-dismiss autofocus hidden$="[[_started_canceling]]"> |
| 272 Go Back - Don't Cancel Anything | 277 Go Back - Don't Cancel Anything |
| 273 </paper-button> | 278 </paper-button> |
| 274 <paper-button dialog-dismiss autofocus hidden$="[[!_finished_canceling]]
"> | 279 <paper-button dialog-dismiss autofocus hidden$="[[!_finished_canceling]]
"> |
| 275 Done | 280 Done |
| 276 </paper-button> | 281 </paper-button> |
| 277 </div> | 282 </div> |
| 278 </paper-dialog> | 283 </paper-dialog> |
| 279 | 284 |
| 285 <paper-dialog id="date_picker_dialog" modal on-iron-overlay-closed="_setDate
"> |
| 286 <paper-date-picker id="date_picker"></paper-date-picker> |
| 287 <div class="buttons"> |
| 288 <paper-button dialog-dismiss>Cancel</paper-button> |
| 289 <paper-button dialog-confirm>OK</paper-button> |
| 290 </div> |
| 291 </paper-dialog> |
| 292 |
| 293 <paper-dialog id="time_picker_dialog" modal on-iron-overlay-closed="_setTime
"> |
| 294 <paper-time-picker id="time_picker"></paper-time-picker> |
| 295 <div class="buttons"> |
| 296 <paper-button dialog-dismiss>Cancel</paper-button> |
| 297 <paper-button dialog-confirm>OK</paper-button> |
| 298 </div> |
| 299 </paper-dialog> |
| 300 |
| 280 </template> | 301 </template> |
| 281 <script> | 302 <script> |
| 282 (function(){ | 303 (function(){ |
| 283 var specialColumns = ["deduped_from", "name", "state", "bot", "source_revisi
on"]; | 304 var specialColumns = ["deduped_from", "name", "state", "bot", "source_revisi
on"]; |
| 284 | 305 |
| 285 // Given a time attribute like "abandoned_ts", humanTime returns a function | 306 // Given a time attribute like "abandoned_ts", humanTime returns a function |
| 286 // that returns the human-friendly version of that attribute. The human | 307 // that returns the human-friendly version of that attribute. The human |
| 287 // friendly time was created in task-list-data. | 308 // friendly time was created in task-list-data. |
| 288 function humanTime(attr) { | 309 function humanTime(attr) { |
| 289 return function(task) { | 310 return function(task) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 _promptCancelAll: function(e) { | 476 _promptCancelAll: function(e) { |
| 456 this.$.mass_cancel.tags = e.detail.tags; | 477 this.$.mass_cancel.tags = e.detail.tags; |
| 457 this.$.mass_cancel.prompt(); | 478 this.$.mass_cancel.prompt(); |
| 458 this.$.cancel_all_dialog.open(); | 479 this.$.cancel_all_dialog.open(); |
| 459 }, | 480 }, |
| 460 | 481 |
| 461 _closeCancelAll: function() { | 482 _closeCancelAll: function() { |
| 462 this.$.cancel_all_dialog.close(); | 483 this.$.cancel_all_dialog.close(); |
| 463 }, | 484 }, |
| 464 | 485 |
| 486 _promptDate: function(e) { |
| 487 this.$.date_picker.date = e.detail.date; |
| 488 this.$.date_picker.name = e.detail.name; |
| 489 this.$.date_picker_dialog.open(); |
| 490 }, |
| 491 |
| 492 _setDate: function(e) { |
| 493 if (!e.detail.confirmed) { |
| 494 return; |
| 495 } |
| 496 var date = this.$.date_picker.date; |
| 497 var y = date.getFullYear(); |
| 498 var m = date.getMonth(); |
| 499 var d = date.getDate(); |
| 500 if ("start" === this.$.date_picker.name) { |
| 501 this.$.task_filters.setStartDate(y,m,d); |
| 502 } else { |
| 503 this.$.task_filters.setEndDate(y,m,d); |
| 504 } |
| 505 }, |
| 506 |
| 507 _promptTime: function(e) { |
| 508 this.$.time_picker.date = e.detail.date; |
| 509 this.$.time_picker.hour = e.detail.date.getHours(); |
| 510 this.$.time_picker.minute = e.detail.date.getMinutes(); |
| 511 this.$.time_picker.name = e.detail.name; |
| 512 this.$.time_picker_dialog.open(); |
| 513 }, |
| 514 |
| 515 _setTime: function(e) { |
| 516 if (!e.detail.confirmed) { |
| 517 return; |
| 518 } |
| 519 var h = this.$.time_picker.hour; |
| 520 var m = this.$.time_picker.minute; |
| 521 if ("start" === this.$.time_picker.name) { |
| 522 this.$.task_filters.setStartTime(h,m,0); |
| 523 } else { |
| 524 this.$.task_filters.setEndTime(h,m,0); |
| 525 } |
| 526 }, |
| 527 |
| 465 reload: function() { | 528 reload: function() { |
| 466 if (!this._auth_headers || !this._query_params) { | 529 if (!this._auth_headers || !this._query_params) { |
| 467 return; | 530 return; |
| 468 } | 531 } |
| 469 var url = "/api/swarming/v1/tasks/list?" + sk.query.fromParamSet(this._q
uery_params); | 532 var url = "/api/swarming/v1/tasks/list?" + sk.query.fromParamSet(this._q
uery_params); |
| 470 this.$.page_tasks.load(url,this._auth_headers); | 533 this.$.page_tasks.load(url,this._auth_headers); |
| 471 }, | 534 }, |
| 472 | 535 |
| 473 _sourceLink: function(task) { | 536 _sourceLink: function(task) { |
| 474 var rev = this._attribute(task, "source_revision")[0]; | 537 var rev = this._attribute(task, "source_revision")[0]; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 486 return task.tagMap[col]; | 549 return task.tagMap[col]; |
| 487 }, | 550 }, |
| 488 | 551 |
| 489 _taskClass: function(task) { | 552 _taskClass: function(task) { |
| 490 return this.stateClass(this._column("state", task)); | 553 return this.stateClass(this._column("state", task)); |
| 491 } | 554 } |
| 492 }); | 555 }); |
| 493 })(); | 556 })(); |
| 494 </script> | 557 </script> |
| 495 </dom-module> | 558 </dom-module> |
| OLD | NEW |