Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <!-- | |
| 3 Copyright 2017 The Chromium Authors. All rights reserved. | |
| 4 Use of this source code is governed by a BSD-style license that can be | |
| 5 found in the LICENSE file. | |
| 6 --> | |
| 7 <link rel="import" href="/components/polymer/polymer.html"> | |
| 8 | |
| 9 <link rel="import" href="/dashboard/elements/alerts-table.html"> | |
| 10 <link rel="import" href="/dashboard/static/simple_xhr.html"> | |
| 11 | |
| 12 <dom-module id="benchmark-quality-report-details"> | |
| 13 <style> | |
| 14 .error { | |
| 15 color: #dd4b39; | |
| 16 font-weight: bold; | |
| 17 } | |
| 18 | |
| 19 #loading-spinner { | |
| 20 width: 100%; | |
| 21 display: flex; | |
| 22 justify-content: center; | |
| 23 } | |
| 24 </style> | |
| 25 <template> | |
| 26 <template is="dom-if" if="{{loading}}"> | |
| 27 <div id="loading-spinner"><img src="//www.google.com/images/loading.gif">< /div> | |
| 28 </template> | |
| 29 <template is="dom-if" if="{{error}}"> | |
| 30 <div class="error">{{error}}</div> | |
| 31 </template> | |
| 32 <template is="dom-if" if="{{computeSuccessfulLoad(loading, error)}}"> | |
| 33 <h1>Report for {{benchmark}} on {{master}}</h1> | |
| 34 <h2>{{benchmark}} is on {{bots.length}} bots:</h2> | |
| 35 <ul> | |
| 36 <template is="dom-repeat" items="{{bots}}"> | |
| 37 <li>{{item}} | |
| 38 </template> | |
| 39 </ul> | |
| 40 | |
| 41 <h2>{{alerts.length}} alerts for {{benchmark}} in the last {{numDays}} day s</h2> | |
| 42 <h3>{{computeNumValid(alerts)}} valid and {{computeNumInvalid(alerts)}} in valid and {{computeNumUntriaged(alerts)}} untriaged</h3> | |
| 43 <alerts-table id="alerts-table" | |
| 44 alert-list="{{alerts}}" | |
| 45 extra-columns="{{extraColumns}}"></alerts-table> | |
|
sullivan
2017/02/17 16:30:13
This element does the XHR and fills in details for
| |
| 46 </template> | |
| 47 | |
| 48 </template> | |
| 49 <script> | |
| 50 'use strict'; | |
| 51 Polymer({ | |
| 52 is: 'benchmark-quality-report-details', | |
| 53 properties: { | |
| 54 alerts: { | |
| 55 notify: true, | |
| 56 type: Array | |
| 57 }, | |
| 58 benchmark: { | |
| 59 notify: true, | |
| 60 type: String | |
| 61 }, | |
| 62 bots: { | |
| 63 notify: true, | |
| 64 type: Array | |
| 65 }, | |
| 66 extraColumns: { | |
|
sullivan
2017/02/17 16:30:13
This makes alerts show as performance regression a
| |
| 67 type: Array, | |
| 68 notify: true, | |
| 69 value: () => ([ | |
| 70 { | |
| 71 'key': 'percent_changed', | |
| 72 'label': 'Delta %' | |
| 73 }, | |
| 74 { | |
| 75 'key': 'absolute_delta', | |
| 76 'label': 'Abs Delta' | |
| 77 }, | |
| 78 { | |
| 79 'key': 'units', | |
| 80 'label': 'Units' | |
| 81 } | |
| 82 ]) | |
| 83 }, | |
| 84 error: { | |
| 85 notify: true, | |
| 86 type: Boolean, | |
| 87 value: false | |
| 88 }, | |
| 89 loading: { | |
| 90 notify: true, | |
| 91 type: Boolean, | |
| 92 value: true | |
| 93 }, | |
| 94 master: { | |
| 95 notify: true, | |
| 96 type: String | |
| 97 }, | |
| 98 monitored: { | |
| 99 notify: true, | |
| 100 type: Boolean | |
| 101 }, | |
| 102 numDays: { | |
| 103 notify: true, | |
| 104 type: Number | |
| 105 } | |
| 106 }, | |
| 107 | |
| 108 countAlerts: function(bugCheck, alerts) { | |
| 109 return alerts.map(a => a.bug_id).reduce(function(acc, val) { | |
| 110 if (bugCheck(val)) { | |
| 111 acc = acc + 1; | |
| 112 } | |
| 113 return acc; | |
| 114 }, 0); | |
| 115 }, | |
| 116 | |
| 117 computeSuccessfulLoad: (loading, error) => !(loading || error), | |
| 118 | |
| 119 computeNumInvalid: function(alerts) { | |
| 120 return this.countAlerts(this.isInvalidAlert, alerts); | |
| 121 }, | |
| 122 | |
| 123 computeNumValid: function(alerts) { | |
| 124 return this.countAlerts(this.isValidAlert, alerts); | |
| 125 }, | |
| 126 | |
| 127 computeNumUntriaged: function(alerts) { | |
| 128 return this.countAlerts(this.isUntriagedAlert, alerts); | |
| 129 }, | |
| 130 | |
| 131 // Using != and == here and below since bugId could be null or undefined | |
| 132 isValidAlert: bugId => (bugId != null && bugId >= 0), | |
| 133 | |
| 134 isInvalidAlert: bugId => (bugId != null && bugId < 0), | |
| 135 | |
| 136 isUntriagedAlert: bugId => (bugId == null), | |
| 137 | |
| 138 /** | |
| 139 * The url params determine what data to request from | |
| 140 * /group_report. sid is a hash of a group of keys. | |
| 141 */ | |
| 142 ready: function() { | |
| 143 var params = { | |
| 144 'master': this.master, | |
| 145 'benchmark': this.benchmark, | |
| 146 'num_days': this.numDays | |
| 147 }; | |
| 148 simple_xhr.send('/benchmark_quality_report', params, | |
| 149 function(response) { | |
| 150 this.alerts = response['alerts']; | |
| 151 this.bots = response['bots']; | |
| 152 this.monitored = response['monitored']; | |
| 153 this.loading = false; | |
| 154 }.bind(this), | |
| 155 function(msg) { | |
| 156 this.error = msg; | |
| 157 this.loading = false; | |
| 158 }.bind(this)); | |
| 159 } | |
| 160 }); | |
| 161 </script> | |
| 162 </dom-module> | |
| OLD | NEW |