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="../model/ct-builder.html"> | 7 <link rel="import" href="../model/ct-builder.html"> |
8 <link rel="import" href="ct-builder.html"> | 8 <link rel="import" href="ct-builder.html"> |
9 | 9 |
10 <polymer-element name="ct-builder-grid" attributes="failures"> | 10 <polymer-element name="ct-builder-grid" attributes="failures"> |
11 <template> | 11 <template> |
12 <style> | 12 <style> |
13 ct-builder { | 13 ct-builder { |
14 display: block; | 14 display: block; |
15 } | 15 } |
16 </style> | 16 </style> |
17 <template repeat="{{ builder in _builders }}"> | 17 <template repeat="{{ builder in builders }}"> |
18 <ct-builder builder="{{ builder }}"></ct-builder> | 18 <ct-builder builder="{{ builder }}"></ct-builder> |
19 </template> | 19 </template> |
20 </template> | 20 </template> |
21 <script> | 21 <script> |
22 Polymer({ | 22 Polymer({ |
23 failures: null, | 23 failures: null, |
24 _builders: null, | 24 builders: null, |
ojan
2014/08/26 03:14:17
This really wants to be a model class. Can you cre
cbiesinger
2014/09/11 06:24:34
Done in the other CLs you reviewed.
| |
25 | 25 |
26 failuresChanged: function() { | 26 failuresChanged: function() { |
27 var builderMap = {}; | 27 var builderMap = {}; |
28 this.failures.forEach(function(failure) { | 28 this.failures.forEach(function(failure) { |
29 var results = failure.resultNodesByBuilder; | 29 var results = failure.resultNodesByBuilder; |
30 Object.keys(results, (function(builder, result) { | 30 Object.keys(results, (function(builder, result) { |
31 if (!builderMap[builder]) | 31 if (!builderMap[builder]) |
32 builderMap[builder] = {}; | 32 builderMap[builder] = {}; |
33 // This assumes that duplicate builder/master pairs all have the sam e | 33 // This assumes that duplicate builder/master pairs all have the sam e |
34 // earliestFailingBuild. | 34 // earliestFailingBuild. |
35 builderMap[builder][result.masterUrl] = { | 35 builderMap[builder][result.masterUrl] = { |
36 earliestFailingBuild: result.earliestFailingBuild, | 36 earliestFailingBuild: result.earliestFailingBuild, |
37 failingBuildCount: result.failingBuildCount, | 37 failingBuildCount: result.failingBuildCount, |
38 }; | 38 }; |
39 }).bind(this)); | 39 }).bind(this)); |
40 }, this); | 40 }, this); |
41 | 41 |
42 this._builders = []; | 42 this.builders = []; |
43 | 43 |
44 Object.keys(builderMap).sort().forEach(function(builder) { | 44 Object.keys(builderMap).sort().forEach(function(builder) { |
45 Object.keys(builderMap[builder]).sort().forEach(function(masterUrl) { | 45 Object.keys(builderMap[builder]).sort().forEach(function(masterUrl) { |
46 var result = builderMap[builder][masterUrl]; | 46 var result = builderMap[builder][masterUrl]; |
47 this._builders.push(new CTBuilder(masterUrl, builder, | 47 this.builders.push(new CTBuilder(masterUrl, builder, |
48 result.earliestFailingBuild, result.failingBuildCount)); | 48 result.earliestFailingBuild, result.failingBuildCount)); |
49 }, this); | 49 }, this); |
50 }, this); | 50 }, this); |
51 }, | 51 }, |
52 }); | 52 }); |
53 </script> | 53 </script> |
54 </polymer-element> | 54 </polymer-element> |
OLD | NEW |