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

Side by Side Diff: appengine/swarming/ui/res/imp/taskpage/task-page.html

Issue 2918353002: Swarming UI: Added piechart for timing information. (Closed)
Patch Set: Created 3 years, 6 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-page> 9 <task-page>
10 10
(...skipping 14 matching lines...) Expand all
25 --> 25 -->
26 26
27 <link rel="import" href="/res/imp/bower_components/iron-icon/iron-icon.html"> 27 <link rel="import" href="/res/imp/bower_components/iron-icon/iron-icon.html">
28 <link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html"> 28 <link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html">
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-checkbox/paper-checkbox .html"> 30 <link rel="import" href="/res/imp/bower_components/paper-checkbox/paper-checkbox .html">
31 <link rel="import" href="/res/imp/bower_components/paper-dialog/paper-dialog.htm l"> 31 <link rel="import" href="/res/imp/bower_components/paper-dialog/paper-dialog.htm l">
32 <link rel="import" href="/res/imp/bower_components/paper-input/paper-input.html" > 32 <link rel="import" href="/res/imp/bower_components/paper-input/paper-input.html" >
33 <link rel="import" href="/res/imp/bower_components/paper-tabs/paper-tabs.html"> 33 <link rel="import" href="/res/imp/bower_components/paper-tabs/paper-tabs.html">
34 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html"> 34 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html">
35 <link rel="import" href="/res/imp/bower_components/svg-piechart/svg-piechart.htm l">
35 36
36 <link rel="import" href="/res/imp/common/common-behavior.html"> 37 <link rel="import" href="/res/imp/common/common-behavior.html">
37 <link rel="import" href="/res/imp/common/interval-timer.html"> 38 <link rel="import" href="/res/imp/common/interval-timer.html">
38 <link rel="import" href="/res/imp/common/single-page-style.html"> 39 <link rel="import" href="/res/imp/common/single-page-style.html">
39 <link rel="import" href="/res/imp/common/swarming-app.html"> 40 <link rel="import" href="/res/imp/common/swarming-app.html">
40 <link rel="import" href="/res/imp/common/task-behavior.html"> 41 <link rel="import" href="/res/imp/common/task-behavior.html">
41 <link rel="import" href="/res/imp/common/url-param.html"> 42 <link rel="import" href="/res/imp/common/url-param.html">
42 43
43 <link rel="import" href="task-page-data.html"> 44 <link rel="import" href="task-page-data.html">
44 <link rel="import" href="task-retry-prompt.html"> 45 <link rel="import" href="task-retry-prompt.html">
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 <a 230 <a
230 title="The list of bots that matches the list of dimensi ons" 231 title="The list of bots that matches the list of dimensi ons"
231 href$="[[_botListLink(_request.properties.dimensions)]]" >bots</a> 232 href$="[[_botListLink(_request.properties.dimensions)]]" >bots</a>
232 can run this task 233 can run this task
233 (<span class$="[[_it(_bots_count.dead)]]">[[_bots_count.dead ]]</span> 234 (<span class$="[[_it(_bots_count.dead)]]">[[_bots_count.dead ]]</span>
234 dead, 235 dead,
235 <span class$="[[_it(_bots_count.dead)]]">[[_bots_count.quara ntined]]</span> 236 <span class$="[[_it(_bots_count.dead)]]">[[_bots_count.quara ntined]]</span>
236 quarantined) 237 quarantined)
237 </td> 238 </td>
238 </tr> 239 </tr>
239 <tr>
240 <td>Created</td>
241 <td title$="[[_request.created_ts]]">[[_request.human_created_ ts]]</td>
242 </tr>
243 <template is="dom-if" if="[[_wasPickedUp(_result)]]">
244 <tr>
245 <td>Started</td>
246 <td title$="[[_result.started_ts]]">[[_result.human_started_ ts]]</td>
247 </tr>
248 </template>
249 <template is="dom-if" if="[[_wasNotPickedUp(_result)]]">
250 <tr>
251 <td>Expires</td>
252 <td>[[_expires(_request)]]</td>
253 </tr>
254 </template>
255 <template is="dom-if" if="[[_result.human_completed_ts]]">
256 <tr>
257 <td>Completed</td>
258 <td title$="[[_result.completed_ts]]">[[_result.human_comple ted_ts]]</td>
259 </tr>
260 </template>
261 <template is="dom-if" if="[[_result.human_abandoned_ts]]">
262 <tr>
263 <td>Abandoned</td>
264 <td title$="[[_result.abandoned_ts]]">[[_result.human_abando ned_ts]]</td>
265 </tr>
266 </template>
267 <tr>
268 <td>Last Updated</td>
269 <td title$="[[_result.modified_ts]]">[[_result.human_modified_ ts]]</td>
270 </tr>
271 <template is="dom-if" if="[[_result.deduped_from]]"> 240 <template is="dom-if" if="[[_result.deduped_from]]">
272 <tr> 241 <tr>
273 <td><b>Deduped from</b></td> 242 <td><b>Deduped from</b></td>
274 <td> 243 <td>
275 <a href$="[[_taskLink(_result.deduped_from)]]"> 244 <a href$="[[_taskLink(_result.deduped_from)]]">
276 [[_result.deduped_from]] 245 [[_result.deduped_from]]
277 </a> 246 </a>
278 </td> 247 </td>
279 </tr> 248 </tr>
280 </template> 249 </template>
281 <tr> 250 <tr>
282 <td>Pending Time</td>
283 <td>[[_pending(_result)]]</td>
284 </tr>
285 <tr>
286 <td>Duration</td>
287 <td>[[_result.human_duration]]</td>
288 </tr>
289 <tr>
290 <td>Priority</td> 251 <td>Priority</td>
291 <td>[[_request.priority]]</td> 252 <td>[[_request.priority]]</td>
292 </tr> 253 </tr>
293 <tr> 254 <tr>
294 <td>User</td> 255 <td>User</td>
295 <td>[[_request.user]]</td> 256 <td>[[_request.user]]</td>
296 </tr> 257 </tr>
297 <tr> 258 <tr>
298 <td>Authenticated</td> 259 <td>Authenticated</td>
299 <td>[[_request.authenticated]]</td> 260 <td>[[_request.authenticated]]</td>
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 </tr> 410 </tr>
450 <template is="dom-repeat" items="[[_request.properties.caches]]" as="cache"> 411 <template is="dom-repeat" items="[[_request.properties.caches]]" as="cache">
451 <tr> 412 <tr>
452 <td><span>[[cache.name]]</span>:<span>[[cache.path]]</span>< /td> 413 <td><span>[[cache.name]]</span>:<span>[[cache.path]]</span>< /td>
453 </tr> 414 </tr>
454 </template> 415 </template>
455 416
456 </tbody> 417 </tbody>
457 </table> 418 </table>
458 419
420 <div class="title" hidden$="[[_not(_task_exists)]]">Task Timing Info rmation</div>
421 <div class="horizontal layout wrap">
422 <div class="left flex">
423 <table class="task-info" hidden$="[[_not(_task_exists)]]">
424 <tbody>
425 <tr>
426 <td>Created</td>
427 <td title$="[[_request.created_ts]]">[[_request.human_crea ted_ts]]</td>
428 </tr>
429 <template is="dom-if" if="[[_wasPickedUp(_result)]]">
430 <tr>
431 <td>Started</td>
432 <td title$="[[_result.started_ts]]">[[_result.human_star ted_ts]]</td>
433 </tr>
434 </template>
435 <template is="dom-if" if="[[_wasNotPickedUp(_result)]]">
436 <tr>
437 <td>Expires</td>
438 <td>[[_expires(_request)]]</td>
439 </tr>
440 </template>
441 <template is="dom-if" if="[[_result.human_completed_ts]]">
442 <tr>
443 <td>Completed</td>
444 <td title$="[[_result.completed_ts]]">[[_result.human_co mpleted_ts]]</td>
445 </tr>
446 </template>
447 <template is="dom-if" if="[[_result.human_abandoned_ts]]">
448 <tr>
449 <td>Abandoned</td>
450 <td title$="[[_result.abandoned_ts]]">[[_result.human_ab andoned_ts]]</td>
451 </tr>
452 </template>
453 <tr>
454 <td>Last updated</td>
455 <td title$="[[_result.modified_ts]]">[[_result.human_modif ied_ts]]</td>
456 </tr>
457 <tr>
458 <td>Pending Time</td>
459 <td>[[_pending(_result)]]</td>
460 </tr>
461 <tr>
462 <td>Duration</td>
463 <td>[[_result.human_duration]]</td>
464 </tr>
465 </tbody>
466 </table>
467 </div>
468 <div class="right flex">
469 <template is="dom-if" if="[[_result.human_completed_ts]]">
470 <center>
471 <svg-piechart data="[[_computePiechartData(_result, _result. human_duration)]]"></svg-piechart>
Sergey Berezin (google) 2017/06/05 22:43:02 I'd use _result.duration, which I believe is alway
472 </center>
473 </template>
474 </div>
475 </div>
476
459 <div class="title" hidden$="[[_not(_task_exists)]]">Task Execution</ div> 477 <div class="title" hidden$="[[_not(_task_exists)]]">Task Execution</ div>
460 <template is="dom-if" if="[[_wasPickedUp(_result)]]"> 478 <template is="dom-if" if="[[_wasPickedUp(_result)]]">
461 <table hidden$="[[_not(_task_exists)]]"> 479 <table hidden$="[[_not(_task_exists)]]">
462 <tr> 480 <tr>
463 <td>Bot assigned to task</td> 481 <td>Bot assigned to task</td>
464 <td><a href$="[[_botLink(_result.bot_id)]]">[[_result.bot_id]] </td> 482 <td><a href$="[[_botLink(_result.bot_id)]]">[[_result.bot_id]] </td>
465 </tr> 483 </tr>
466 <tr> 484 <tr>
467 <td rowspan$="[[_rowspan(_result.bot_dimensions)]]"> 485 <td rowspan$="[[_rowspan(_result.bot_dimensions)]]">
468 <a>Bot Dimensions</a> 486 <a>Bot Dimensions</a>
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 <div class="buttons"> 634 <div class="buttons">
617 <paper-button dialog-dismiss>Cancel</paper-button> 635 <paper-button dialog-dismiss>Cancel</paper-button>
618 <paper-button dialog-confirm>OK</paper-button> 636 <paper-button dialog-confirm>OK</paper-button>
619 </div> 637 </div>
620 </paper-dialog> 638 </paper-dialog>
621 639
622 <interval-timer period="[[_refresh_interval]]" on-trigger="_softRefresh"> 640 <interval-timer period="[[_refresh_interval]]" on-trigger="_softRefresh">
623 </interval-timer> 641 </interval-timer>
624 642
625 </template> 643 </template>
644 <script src="/res/imp/bower_components/webcomponentsjs/webcomponents-lite.js"> </script>
Ryan Tseng 2017/06/05 22:25:48 You're using polymer already, you might not actual
ayanaadylova 2017/06/06 01:25:01 Done.
626 <script> 645 <script>
627 (function(){ 646 (function(){
628 Polymer({ 647 Polymer({
629 is: 'task-page', 648 is: 'task-page',
630 649
631 behaviors: [ 650 behaviors: [
632 SwarmingBehaviors.CommonBehavior, 651 SwarmingBehaviors.CommonBehavior,
633 SwarmingBehaviors.TaskBehavior, 652 SwarmingBehaviors.TaskBehavior,
634 ], 653 ],
635 654
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 value: false, 686 value: false,
668 }, 687 },
669 _busyPendingCount: { 688 _busyPendingCount: {
670 type: Boolean, 689 type: Boolean,
671 value: false, 690 value: false,
672 }, 691 },
673 _busyBotCount: { 692 _busyBotCount: {
674 type: Boolean, 693 type: Boolean,
675 value: false, 694 value: false,
676 }, 695 },
696
677 _dialog_prompt: { 697 _dialog_prompt: {
678 type: String, 698 type: String,
679 value: "", 699 value: "",
680 }, 700 },
681 _host_url: { 701 _host_url: {
682 type: String, 702 type: String,
683 value: function(){ 703 value: function(){
684 return window.location.hostname; 704 return window.location.hostname;
685 } 705 }
686 }, 706 },
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 }, 818 },
799 819
800 _command: function(request) { 820 _command: function(request) {
801 if (!request || !request.properties) { 821 if (!request || !request.properties) {
802 return ""; 822 return "";
803 } 823 }
804 var args = request.properties.command || []; 824 var args = request.properties.command || [];
805 return args.join(" "); 825 return args.join(" ");
806 }, 826 },
807 827
828 _convertToInteger: function(time) {
Ryan Tseng 2017/06/05 22:25:48 I think instead of taking a human duration and con
ayanaadylova 2017/06/06 01:25:02 Done.
829 if (time == "") {
830 return 0;
831 }
832 var args = time.split(" ");
833 var sec = 0;
834 args.forEach(function(element) {
835 if (element.includes("h")){
836 element = element.substring(0, element.length - 1);
837 sec += parseInt(element)*60*60;
838 }
839 if (element.includes("m")){
840 element = element.substring(0, element.length - 1);
841 sec += parseInt(element)*60;
842 }
843 if (element.includes("s")){
844 element = element.substring(0, element.length - 1);
845 sec += parseInt(element);
846 }
847 });
848 return sec;
849 },
850
851 _computePiechartData: function(result, duration) {
852 return [this._convertToInteger(this._pending(result)), this._convertToIn teger(duration)];
Sergey Berezin (google) 2017/06/05 22:43:02 IIUC, this would draw the piechart with no legend.
ayanaadylova 2017/06/06 01:25:01 Done.
853 },
854
808 _cost: function(result) { 855 _cost: function(result) {
809 if (!result || !result.costs_usd || !result.costs_usd.length) { 856 if (!result || !result.costs_usd || !result.costs_usd.length) {
810 return 0; 857 return 0;
811 } 858 }
812 return result.costs_usd[0].toFixed(4); 859 return result.costs_usd[0].toFixed(4);
813 }, 860 },
814 861
815 _disambiguate: function(taskId, result) { 862 _disambiguate: function(taskId, result) {
816 if (!taskId.endsWith("0") || !result) { 863 if (!taskId.endsWith("0") || !result) {
817 return false; 864 return false;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 this._getJsonAsync("_other_running", "/api/swarming/v1/tasks/count", " _busyRunningCount", this._auth_headers, taskCountParams); 1111 this._getJsonAsync("_other_running", "/api/swarming/v1/tasks/count", " _busyRunningCount", this._auth_headers, taskCountParams);
1065 // change running to pending 1112 // change running to pending
1066 taskCountParams.state = ["PENDING"]; 1113 taskCountParams.state = ["PENDING"];
1067 this._getJsonAsync("_other_pending", "/api/swarming/v1/tasks/count", " _busyPendingCount", this._auth_headers, taskCountParams); 1114 this._getJsonAsync("_other_pending", "/api/swarming/v1/tasks/count", " _busyPendingCount", this._auth_headers, taskCountParams);
1068 } 1115 }
1069 } 1116 }
1070 }); 1117 });
1071 })(); 1118 })();
1072 </script> 1119 </script>
1073 </dom-module> 1120 </dom-module>
OLDNEW
« appengine/swarming/ui/package.json ('K') | « appengine/swarming/ui/package.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698