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

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)]]" color s="[&quot;rgb(238,135,136)&quot;, &quot;rgb(30,120,180)&quot;]"></svg-piechart>
Ryan Tseng 2017/06/06 00:22:07 nit: <svg-piechart data="..." colors="..."
ayanaadylova 2017/06/06 01:25:02 Done.
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 value: false, 685 value: false,
668 }, 686 },
669 _busyPendingCount: { 687 _busyPendingCount: {
670 type: Boolean, 688 type: Boolean,
671 value: false, 689 value: false,
672 }, 690 },
673 _busyBotCount: { 691 _busyBotCount: {
674 type: Boolean, 692 type: Boolean,
675 value: false, 693 value: false,
676 }, 694 },
695
677 _dialog_prompt: { 696 _dialog_prompt: {
678 type: String, 697 type: String,
679 value: "", 698 value: "",
680 }, 699 },
681 _host_url: { 700 _host_url: {
682 type: String, 701 type: String,
683 value: function(){ 702 value: function(){
684 return window.location.hostname; 703 return window.location.hostname;
685 } 704 }
686 }, 705 },
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 }, 817 },
799 818
800 _command: function(request) { 819 _command: function(request) {
801 if (!request || !request.properties) { 820 if (!request || !request.properties) {
802 return ""; 821 return "";
803 } 822 }
804 var args = request.properties.command || []; 823 var args = request.properties.command || [];
805 return args.join(" "); 824 return args.join(" ");
806 }, 825 },
807 826
827 _convertToInteger: function(time) {
Sergey Berezin 2017/06/06 00:17:13 Delete this function, it's no longer used.
ayanaadylova 2017/06/06 01:25:02 Done.
828 if (time == "") {
829 return 0;
830 }
831 var args = time.split(" ");
832 var sec = 0;
833 args.forEach(function(element) {
834 if (element.includes("h")){
835 element = element.substring(0, element.length - 1);
836 sec += parseInt(element)*60*60;
837 }
838 if (element.includes("m")){
839 element = element.substring(0, element.length - 1);
840 sec += parseInt(element)*60;
841 }
842 if (element.includes("s")){
843 element = element.substring(0, element.length - 1);
844 sec += parseInt(element);
845 }
846 });
847 return sec;
848 },
849
850 _computePiechartData: function(result) {
851 var created = new Date(result.created_ts);
852 var started = new Date(result.started_ts);
853 var completed = new Date(result.completed_ts);
854 return [
855 this._duration(created, started),
856 this._duration(started, completed)];
857 },
858
808 _cost: function(result) { 859 _cost: function(result) {
809 if (!result || !result.costs_usd || !result.costs_usd.length) { 860 if (!result || !result.costs_usd || !result.costs_usd.length) {
810 return 0; 861 return 0;
811 } 862 }
812 return result.costs_usd[0].toFixed(4); 863 return result.costs_usd[0].toFixed(4);
813 }, 864 },
814 865
815 _disambiguate: function(taskId, result) { 866 _disambiguate: function(taskId, result) {
816 if (!taskId.endsWith("0") || !result) { 867 if (!taskId.endsWith("0") || !result) {
817 return false; 868 return false;
818 } 869 }
819 return result.try_number > 1; 870 return result.try_number > 1;
820 }, 871 },
821 872
873 _duration: function(start, end) {
874 return end.getTime() - start.getTime();
875 },
876
822 _empty: function(array) { 877 _empty: function(array) {
823 return !array || array.length == 0; 878 return !array || array.length == 0;
824 }, 879 },
825 880
826 _eq: function(a,b) { 881 _eq: function(a,b) {
827 return a === b; 882 return a === b;
828 }, 883 },
829 884
830 _expires: function(request) { 885 _expires: function(request) {
831 var delta = parseInt(request.expiration_secs); 886 var delta = parseInt(request.expiration_secs);
(...skipping 232 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); 1119 this._getJsonAsync("_other_running", "/api/swarming/v1/tasks/count", " _busyRunningCount", this._auth_headers, taskCountParams);
1065 // change running to pending 1120 // change running to pending
1066 taskCountParams.state = ["PENDING"]; 1121 taskCountParams.state = ["PENDING"];
1067 this._getJsonAsync("_other_pending", "/api/swarming/v1/tasks/count", " _busyPendingCount", this._auth_headers, taskCountParams); 1122 this._getJsonAsync("_other_pending", "/api/swarming/v1/tasks/count", " _busyPendingCount", this._auth_headers, taskCountParams);
1068 } 1123 }
1069 } 1124 }
1070 }); 1125 });
1071 })(); 1126 })();
1072 </script> 1127 </script>
1073 </dom-module> 1128 </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