Chromium Code Reviews| Index: Tools/GardeningServer/ui/ct-trooper-card.html |
| diff --git a/Tools/GardeningServer/ui/ct-trooper-card.html b/Tools/GardeningServer/ui/ct-trooper-card.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2433dd34dddd8a8930f0d3750edb0a53ac94c95f |
| --- /dev/null |
| +++ b/Tools/GardeningServer/ui/ct-trooper-card.html |
| @@ -0,0 +1,109 @@ |
| +<!-- |
| +Copyright 2014 The Chromium Authors. All rights reserved. |
| +Use of this source code is governed by a BSD-style license that can be |
| +found in the LICENSE file. |
| +--> |
| + |
| +<link rel="import" href="ct-chart.html"> |
| + |
| +<polymer-element name="ct-trooper-card" attributes="group"> |
| + <template> |
| + <style> |
| + #failure { |
| + flex: 1; |
| + margin-left: 10px; |
| + } |
| + |
| + #details { |
| + font-weight: bold; |
| + } |
| + |
| + ::shadow #chart { |
| + height: 100px; |
| + width: 400px; |
| + } |
| + </style> |
| + <div id="failure"> |
| + <div id="details"> |
| + {{ group.tree }}: {{ group.details }} |
| + </div> |
| + <ct-chart table={{table}} options={{options}} width=400 height=100></ct-chart> |
|
ojan
2014/09/05 00:24:47
Put spaces inside the curlies.
shans
2014/09/05 01:44:00
Done.
|
| + </div> |
| + </template> |
| + <script> |
| + Polymer({ |
| + group: null, |
| + table: null, |
| + options: null, |
| + fromPercent: function(v) { |
| + return Number(v.substring(0, v.length - 1)); |
| + }, |
| + groupChanged: function() { |
| + if (!this.group) { |
| + return; |
| + } |
| + switch (this.group.type) { |
| + case 'cq_latency': |
| + this.table = { |
| + labels: ["50th Percentile", "90th Percentile"], |
| + datasets: [ |
| + { |
| + title: 'Limit', |
| + fillColor: 'grey', |
| + data: [60, 180] |
| + }, |
| + { |
| + title: 'Actual', |
| + fillColor: [this.group.data.p50 > 60 ? 'red' : 'green', |
| + this.group.data.p90 > 180 ? 'red' : 'green'], |
| + data: [this.group.data.p50, this.group.data.p90] |
| + } |
| + ]}; |
| + break; |
| + case 'tree_status': |
| + this.table = { |
| + labels: ["Tree Status"], |
| + datasets: [ |
| + { |
| + title: 'Minimum', |
| + fillColor: 'grey', |
| + data: [80] |
| + }, |
| + { |
| + title: 'Actual', |
| + fillColor: 'red', |
| + data: [this.group.data.percent_open] |
| + } |
| + ]}; |
| + break; |
| + case 'cycle_time': |
| + this.table = { |
| + labels: ["Percent of Builds"], |
| + datasets: [ |
| + { |
| + title: 'Median', |
| + fillColor: 'orange', |
| + data: [this.fromPercent(this.group.data.percent_over_median_slo)] |
| + }, |
| + { |
| + title: 'Max', |
| + fillColor: 'red', |
| + data: [this.fromPercent(this.group.data.percent_over_max_slo)] |
| + } |
| + ]}; |
| + break; |
| + default: |
| + console.error('unknown trooper error type'); |
| + return; |
| + } |
| + |
| + this.options = { |
| + scaleBeginAtZero: true, |
| + legend: false, |
| + annotateLabel: '<%=v1%>: <%=Math.round(v3)%>', |
| + annotateDisplay: true |
| + } |
| + }, |
| + }); |
| + </script> |
| +</polymer-element> |