| 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-toast/paper-toast.html"
> | |
| 30 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html"> | 29 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html"> |
| 31 | 30 |
| 32 <link rel="import" href="/res/imp/common/dynamic-table-behavior.html"> | 31 <link rel="import" href="/res/imp/common/dynamic-table-behavior.html"> |
| 32 <link rel="import" href="/res/imp/common/error-toast.html"> |
| 33 <link rel="import" href="/res/imp/common/sort-toggle.html"> | 33 <link rel="import" href="/res/imp/common/sort-toggle.html"> |
| 34 <link rel="import" href="/res/imp/common/swarming-app.html"> | 34 <link rel="import" href="/res/imp/common/swarming-app.html"> |
| 35 <link rel="import" href="/res/imp/common/url-param.html"> | 35 <link rel="import" href="/res/imp/common/url-param.html"> |
| 36 | 36 |
| 37 <link rel="import" href="task-filters.html"> | 37 <link rel="import" href="task-filters.html"> |
| 38 <link rel="import" href="task-list-data.html"> | 38 <link rel="import" href="task-list-data.html"> |
| 39 | 39 |
| 40 <dom-module id="task-list"> | 40 <dom-module id="task-list"> |
| 41 <template> | 41 <template> |
| 42 <style include="iron-flex iron-flex-alignment iron-positioning swarming-app-
style dynamic-table-style"> | 42 <style include="iron-flex iron-flex-alignment iron-positioning swarming-app-
style dynamic-table-style"> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 <div hidden$="[[_not(_signed_in)]]"> | 82 <div hidden$="[[_not(_signed_in)]]"> |
| 83 <task-list-data | 83 <task-list-data |
| 84 auth_headers="[[_auth_headers]]" | 84 auth_headers="[[_auth_headers]]" |
| 85 query_params="[[_query_params]]" | 85 query_params="[[_query_params]]" |
| 86 tasks="{{_items}}" | 86 tasks="{{_items}}" |
| 87 busy="{{_busy}}" | 87 busy="{{_busy}}" |
| 88 primary_map="{{_primary_map}}" | 88 primary_map="{{_primary_map}}" |
| 89 primary_arr="{{_primary_arr}}"> | 89 primary_arr="{{_primary_arr}}"> |
| 90 </task-list-data> | 90 </task-list-data> |
| 91 | 91 |
| 92 <paper-toast id="toast"></paper-toast> | 92 <error-toast></error-toast> |
| 93 | 93 |
| 94 <div class="horizontal layout"> | 94 <div class="horizontal layout"> |
| 95 | 95 |
| 96 <task-filters | 96 <task-filters |
| 97 primary_map="[[_primary_map]]" | 97 primary_map="[[_primary_map]]" |
| 98 primary_arr="[[_primary_arr]]" | 98 primary_arr="[[_primary_arr]]" |
| 99 columns="{{_columns}}" | 99 columns="{{_columns}}" |
| 100 query_params="{{_query_params}}" | 100 query_params="{{_query_params}}" |
| 101 filter="{{_filter}}"> | 101 filter="{{_filter}}"> |
| 102 </task-filters> | 102 </task-filters> |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 }, | 325 }, |
| 326 | 326 |
| 327 _cancelTask: function(e) { | 327 _cancelTask: function(e) { |
| 328 var task = e.model.task; | 328 var task = e.model.task; |
| 329 if (!task || !task.task_id) { | 329 if (!task || !task.task_id) { |
| 330 console.log("Missing task info", task); | 330 console.log("Missing task info", task); |
| 331 return | 331 return |
| 332 } | 332 } |
| 333 var id = task.task_id | 333 var id = task.task_id |
| 334 | 334 |
| 335 // Keep toast displayed until we hear back from the cancel. | |
| 336 this.$.toast.duration = 0; | |
| 337 this.$.toast.text="Canceling task " + id; | |
| 338 this.$.toast.open(); | |
| 339 var url = "/_ah/api/swarming/v1/task/" + id +"/cancel"; | 335 var url = "/_ah/api/swarming/v1/task/" + id +"/cancel"; |
| 340 sk.request("POST", url, undefined, this._auth_headers).then(function(res
ponse) { | 336 swarming.postWithToast(url, "Canceling task " + id, this._auth_headers); |
| 341 this.$.toast.close(); | |
| 342 this.$.toast.show({ | |
| 343 text: "Request sent. Response: "+response, | |
| 344 duration: 3000, | |
| 345 }); | |
| 346 }.bind(this)).catch(function(reason) { | |
| 347 console.log("Cancellation failed", reason); | |
| 348 this.$.toast.close(); | |
| 349 this.$.toast.show({ | |
| 350 text: "Request failed. Reason: "+reason, | |
| 351 duration: 3000, | |
| 352 }); | |
| 353 }.bind(this)); | |
| 354 }, | 337 }, |
| 355 | 338 |
| 356 _tag: function(task, col) { | 339 _tag: function(task, col) { |
| 357 if (!task || !task.tagMap) { | 340 if (!task || !task.tagMap) { |
| 358 return undefined; | 341 return undefined; |
| 359 } | 342 } |
| 360 return task.tagMap[col]; | 343 return task.tagMap[col]; |
| 361 }, | 344 }, |
| 362 | 345 |
| 363 _taskLink: function(taskId) { | 346 _taskLink: function(taskId) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 382 if (state === "RUNNING" || state === "PENDING") { | 365 if (state === "RUNNING" || state === "PENDING") { |
| 383 return "pending"; | 366 return "pending"; |
| 384 } | 367 } |
| 385 return ""; | 368 return ""; |
| 386 } | 369 } |
| 387 | 370 |
| 388 }); | 371 }); |
| 389 })(); | 372 })(); |
| 390 </script> | 373 </script> |
| 391 </dom-module> | 374 </dom-module> |
| OLD | NEW |