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="ct-commit-list.html"> | 7 <link rel="import" href="ct-commit-list.html"> |
8 | 8 |
9 <script> | 9 <script> |
10 function CTFailureGroup(key, data) { | 10 function CTFailureGroup(key, data) { |
(...skipping 27 matching lines...) Expand all Loading... |
38 }); | 38 }); |
39 }; | 39 }; |
40 | 40 |
41 CTFailureGroup.prototype.clearBug = function(bug) { | 41 CTFailureGroup.prototype.clearBug = function(bug) { |
42 return this._annotate({ | 42 return this._annotate({ |
43 bug: undefined, | 43 bug: undefined, |
44 }); | 44 }); |
45 }; | 45 }; |
46 | 46 |
47 CTFailureGroup.prototype._failedOnce = function() { | 47 CTFailureGroup.prototype._failedOnce = function() { |
48 var totalFailures = 0; | 48 return this.data.failedOnce && this.data.failedOnce(); |
49 for (var i = 0; i < this.data.dataToExamine().length; i++) { | |
50 var resultNodes = this.data.dataToExamine()[i].resultNodesByBuilder; | |
51 Object.keys(resultNodes, function(r) { | |
52 totalFailures += resultNodes[r].failingBuildCount; | |
53 if (totalFailures > 1) | |
54 return false; | |
55 }.bind(this)); | |
56 } | |
57 return totalFailures == 1; | |
58 } | 49 } |
59 | 50 |
60 CTFailureGroup.prototype._computeProperties = function() { | 51 CTFailureGroup.prototype._computeProperties = function() { |
61 this.isSnoozed = Date.now() < this._annotation.snoozeTime; | 52 this.isSnoozed = Date.now() < this._annotation.snoozeTime; |
62 if (this.isSnoozed) { | 53 if (this.isSnoozed) { |
63 this.category = 'snoozed'; | 54 this.category = 'snoozed'; |
64 } else { | 55 } else { |
65 if (this._failedOnce()) { | 56 if (this._failedOnce()) { |
66 this.category = 'failedOnce'; | 57 this.category = 'failedOnce'; |
67 } else { | 58 } else { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 }.bind(this)); | 117 }.bind(this)); |
127 }; | 118 }; |
128 | 119 |
129 CTFailureGroup.fetchAnnotations = function() { | 120 CTFailureGroup.fetchAnnotations = function() { |
130 // FIXME: Fetch annotations from frontend. | 121 // FIXME: Fetch annotations from frontend. |
131 var stored = localStorage.CTFailureGroupAnnotations; | 122 var stored = localStorage.CTFailureGroupAnnotations; |
132 var annotations = stored ? JSON.parse(stored) : {}; | 123 var annotations = stored ? JSON.parse(stored) : {}; |
133 return Promise.resolve(annotations); | 124 return Promise.resolve(annotations); |
134 }; | 125 }; |
135 </script> | 126 </script> |
OLD | NEW |