OLD | NEW |
(Empty) | |
| 1 <!-- |
| 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 |
| 4 found in the LICENSE file. |
| 5 --> |
| 6 |
| 7 <link rel="import" href="ct-chart.html"> |
| 8 |
| 9 <polymer-element name="ct-trooper-card" attributes="group"> |
| 10 <template> |
| 11 <style> |
| 12 #failure { |
| 13 flex: 1; |
| 14 margin-left: 10px; |
| 15 } |
| 16 |
| 17 #details { |
| 18 font-weight: bold; |
| 19 } |
| 20 |
| 21 ::shadow #chart { |
| 22 height: 100px; |
| 23 width: 400px; |
| 24 } |
| 25 </style> |
| 26 <div id="failure"> |
| 27 <div id="details"> |
| 28 {{ group.tree }}: {{ group.details }} |
| 29 </div> |
| 30 <ct-chart table="{{ table }}" options="{{ options }}" width=400 height=100
></ct-chart> |
| 31 </div> |
| 32 </template> |
| 33 <script> |
| 34 Polymer({ |
| 35 group: null, |
| 36 table: null, |
| 37 options: null, |
| 38 fromPercent: function(v) { |
| 39 return Number(v.substring(0, v.length - 1)); |
| 40 }, |
| 41 groupChanged: function() { |
| 42 if (!this.group) { |
| 43 return; |
| 44 } |
| 45 switch (this.group.type) { |
| 46 case 'cq_latency': |
| 47 this.table = { |
| 48 labels: ["50th Percentile", "90th Percentile"], |
| 49 datasets: [ |
| 50 { |
| 51 title: 'Limit', |
| 52 fillColor: 'grey', |
| 53 data: [60, 180] |
| 54 }, |
| 55 { |
| 56 title: 'Actual', |
| 57 fillColor: [this.group.data.p50 > 60 ? 'red' : 'green', |
| 58 this.group.data.p90 > 180 ? 'red' : 'green'], |
| 59 data: [this.group.data.p50, this.group.data.p90] |
| 60 } |
| 61 ]}; |
| 62 break; |
| 63 case 'tree_status': |
| 64 this.table = { |
| 65 labels: ["Tree Status"], |
| 66 datasets: [ |
| 67 { |
| 68 title: 'Minimum', |
| 69 fillColor: 'grey', |
| 70 data: [80] |
| 71 }, |
| 72 { |
| 73 title: 'Actual', |
| 74 fillColor: 'red', |
| 75 data: [this.group.data.percent_open] |
| 76 } |
| 77 ]}; |
| 78 break; |
| 79 case 'cycle_time': |
| 80 this.table = { |
| 81 labels: ["Percent of Builds"], |
| 82 datasets: [ |
| 83 { |
| 84 title: 'Median', |
| 85 fillColor: 'orange', |
| 86 data: [this.fromPercent(this.group.data.percent_over_median_slo)
] |
| 87 }, |
| 88 { |
| 89 title: 'Max', |
| 90 fillColor: 'red', |
| 91 data: [this.fromPercent(this.group.data.percent_over_max_slo)] |
| 92 } |
| 93 ]}; |
| 94 break; |
| 95 default: |
| 96 console.error('unknown trooper error type'); |
| 97 return; |
| 98 } |
| 99 |
| 100 this.options = { |
| 101 scaleBeginAtZero: true, |
| 102 legend: false, |
| 103 annotateLabel: '<%=v1%>: <%=Math.round(v3)%>', |
| 104 annotateDisplay: true |
| 105 } |
| 106 }, |
| 107 }); |
| 108 </script> |
| 109 </polymer-element> |
OLD | NEW |