| OLD | NEW |
| 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 }); |
| 48 |
| 38 self._columnValues = PatchSummary.summaryColumns.map(function(column) { | 49 self._columnValues = PatchSummary.summaryColumns.map(function(column) { |
| 39 return column.getter(summary); | 50 return column.getter(summary); |
| 40 }); | 51 }); |
| 41 | 52 |
| 42 var jobViews = PatchSummaryList.viewMenu.getSubMenu('jobs').getSubNames(); | 53 var jobViews = PatchSummaryList.viewMenu.getSubMenu('jobs').getSubNames(); |
| 43 for (var jobView of jobViews) { | 54 for (var jobView of jobViews) { |
| 44 self._jobViewBuilderBuilds[jobView] = getBuilderBuilds(summary, jobView); | 55 self._jobViewBuilderBuilds[jobView] = getBuilderBuilds(summary, jobView); |
| 45 }; | 56 }; |
| 46 }).catch(log); | 57 }).catch(log); |
| 47 }; | 58 }; |
| 48 | 59 |
| 60 PatchSummary.prototype.getSummary = function() { |
| 61 return this._summaryPromise; |
| 62 } |
| 63 |
| 49 function getJobs(summary, jobView) { | 64 function getJobs(summary, jobView) { |
| 50 switch (jobView) { | 65 switch (jobView) { |
| 51 case 'flaky': | 66 case 'flaky': |
| 52 return summary.flaky_jobs; | 67 return summary.flaky_jobs; |
| 53 case 'all': | 68 case 'all': |
| 54 return summary.attempts.map(function(attempt) { | 69 return summary.attempts.map(function(attempt) { |
| 55 return Object.values(attempt.jobs).flatten(); | 70 return Object.values(attempt.jobs).flatten(); |
| 56 }).flatten(); | 71 }).flatten(); |
| 57 default: | 72 default: |
| 58 return summary.attempts.map(function(attempt) { | 73 return summary.attempts.map(function(attempt) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 builders.add(job.master + ':' + job.builder); | 160 builders.add(job.master + ':' + job.builder); |
| 146 } | 161 } |
| 147 } | 162 } |
| 148 return builders.size; | 163 return builders.size; |
| 149 }, | 164 }, |
| 150 }, | 165 }, |
| 151 ]; | 166 ]; |
| 152 | 167 |
| 153 })(); | 168 })(); |
| 154 </script> | 169 </script> |
| OLD | NEW |