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

Side by Side Diff: appengine/trooper_o_matic/model/patch-summary.html

Issue 845963005: trooper-o-matic: Add patch attempt timeline view to CQ graphs (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@+addAlternateBuildViews
Patch Set: Review changes Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 2 Copyright 2014 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be 3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file. 4 found in the LICENSE file.
5 --> 5 -->
6 6
7 <link rel="import" href="./patch-summary-list.html"> 7 <link rel="import" href="./patch-summary-list.html">
8 <link rel="import" href="../lib/cqstats-util.html"> 8 <link rel="import" href="../lib/cqstats-util.html">
9 <link rel="import" href="../lib/log.html"> 9 <link rel="import" href="../lib/log.html">
10 <link rel="import" href="../lib/net.html"> 10 <link rel="import" href="../lib/net.html">
11 <link rel="import" href="../lib/sugar.html"> 11 <link rel="import" href="../lib/sugar.html">
12 12
13 <script> 13 <script>
14 (function(){ 14 (function(){
15 15
16 this.PatchSummary = function PatchSummary(value, unit, issue, patchset, alertThr eshold) { 16 this.PatchSummary = function PatchSummary(value, unit, issue, patchset, alertThr eshold) {
17 this.value = value; 17 this.value = value;
18 this.unit = unit; 18 this.unit = unit;
19 this.issue = issue; 19 this.issue = issue;
20 this.patchset = patchset; 20 this.patchset = patchset;
21 this.alertThreshold = alertThreshold; 21 this.alertThreshold = alertThreshold;
22 this.list = null;
22 23
23 var reviewHost = 'https://codereview.chromium.org'; 24 var reviewHost = 'https://codereview.chromium.org';
24 this._patchURL = '{1}/{2}#ps{3}'.assign(reviewHost, this.issue, this.patchset) ; 25 this._patchURL = '{1}/{2}#ps{3}'.assign(reviewHost, this.issue, this.patchset) ;
25 this._issueTitle = null; 26 this._issueTitle = null;
26 this._summary = null; 27 var logHost = '//chromium-cq-status.appspot.com';
28 this._statusURL = '{1}/patch-status/{2}/{3}'.assign(
29 logHost, this.issue, this.patchset);
30 this._recentURL = '{1}/recent#issue={2},patchset={3}'.assign(
31 logHost, this.issue, this.patchset);
27 this._columnValues = []; 32 this._columnValues = [];
28 this._jobViewBuilderBuilds = {}; 33 this._jobViewBuilderBuilds = {};
34 this._summaryPromise = cqStatsUtil.loadPatchSummary(issue, patchset);
35 this._summary = null;
29 36
30 var self = this; 37 var self = this;
31 var issueURL = '{1}/api/{2}'.assign(reviewHost, this.issue); 38 var issueURL = '{1}/api/{2}'.assign(reviewHost, this.issue);
32 net.json({url: issueURL, cache: true}).then(function(json) { 39 net.json({url: issueURL, cache: true}).then(function(json) {
33 self._issueTitle = json.subject; 40 self._issueTitle = json.subject;
34 }).catch(log); 41 }).catch(log);
35 cqStatsUtil.loadPatchSummary(issue, patchset).then(function(summary) { 42 self._summaryPromise.then(function(summary) {
36 self._summary = summary; 43 self._summary = summary;
37 44
45 summary.attempts.forEach(function(attempt, i) {
46 attempt.number = summary.attempts.length - i;
47 attempt.summaryText = getAttemptSummaryText(attempt);
48 });
49
38 self._columnValues = PatchSummary.summaryColumns.map(function(column) { 50 self._columnValues = PatchSummary.summaryColumns.map(function(column) {
39 return column.getter(summary); 51 return column.getter(summary);
40 }); 52 });
41 53
42 var jobViews = PatchSummaryList.viewMenu.getSubMenu('jobs').getSubNames(); 54 var jobViews = PatchSummaryList.viewMenu.getSubMenu('jobs').getSubNames();
43 for (var jobView of jobViews) { 55 for (var jobView of jobViews) {
44 self._jobViewBuilderBuilds[jobView] = getBuilderBuilds(summary, jobView); 56 self._jobViewBuilderBuilds[jobView] = getBuilderBuilds(summary, jobView);
45 }; 57 };
46 }).catch(log); 58 }).catch(log);
47 }; 59 };
48 60
61 PatchSummary.prototype.getSummary = function() {
62 return this._summaryPromise;
63 }
64
49 function getJobs(summary, jobView) { 65 function getJobs(summary, jobView) {
50 switch (jobView) { 66 switch (jobView) {
51 case 'flaky': 67 case 'flaky':
52 return summary.flaky_jobs; 68 return summary.flaky_jobs;
53 case 'all': 69 case 'all':
54 return summary.attempts.map(function(attempt) { 70 return summary.attempts.map(function(attempt) {
55 return Object.values(attempt.jobs).flatten(); 71 return Object.values(attempt.jobs).flatten();
56 }).flatten(); 72 }).flatten();
57 default: 73 default:
58 return summary.attempts.map(function(attempt) { 74 return summary.attempts.map(function(attempt) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 builders.push(builder); 113 builders.push(builder);
98 }); 114 });
99 sortBy(builders, 'name'); 115 sortBy(builders, 'name');
100 return builders; 116 return builders;
101 } 117 }
102 118
103 function secondsToMinutes(seconds) { 119 function secondsToMinutes(seconds) {
104 return (seconds / 60).toFixed(0); 120 return (seconds / 60).toFixed(0);
105 } 121 }
106 122
123 function getAttemptSummaryText(attempt) {
124 var successText = (function(){
125 switch (attempt.success) {
126 case true:
127 return 'Success';
128 case null:
129 return 'Running';
130 default:
131 var text = 'Fail';
132 var reason = attempt.fail_reason;
133 if (reason && reason.fail_type) {
134 text += ': ';
135 if (reason.fail_type === 'failed_jobs') {
136 var getBuilder = function(detail) { return detail.builder };
137 text += reason.fail_details.map(getBuilder).join(' ');
138 } else {
139 text += reason.fail_type;
140 }
141 }
142 return text;
143 }
144 })();
145 return '{1} ({2}min)'.assign(
146 successText, secondsToMinutes(attempt.durations.total));
147 }
148
107 PatchSummary.summaryColumns = [ 149 PatchSummary.summaryColumns = [
108 { 150 {
109 header: 'False rejects', 151 header: 'False rejects',
110 getter: function(summary) { 152 getter: function(summary) {
111 return summary.success ? summary.attempt_fail_count : 0; 153 return summary.success ? summary.attempt_fail_count : 0;
112 }, 154 },
113 }, 155 },
114 { 156 {
115 header: 'Total minutes', 157 header: 'Total minutes',
116 getter: function(summary) { 158 getter: function(summary) {
(...skipping 28 matching lines...) Expand all
145 builders.add(job.master + ':' + job.builder); 187 builders.add(job.master + ':' + job.builder);
146 } 188 }
147 } 189 }
148 return builders.size; 190 return builders.size;
149 }, 191 },
150 }, 192 },
151 ]; 193 ];
152 194
153 })(); 195 })();
154 </script> 196 </script>
OLDNEW
« no previous file with comments | « appengine/trooper_o_matic/model/cqstats-ratio-graph-data.html ('k') | appengine/trooper_o_matic/model/patch-summary-list.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698