Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: dashboard/dashboard/elements/benchmark-health-report-details.html

Issue 2704663003: First version of benchmark health report. (Closed)
Patch Set: addressed review comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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-health-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>
46 </template>
47
48 </template>
49 <script>
50 'use strict';
51 Polymer({
52 is: 'benchmark-health-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: {
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) {
eakuefner 2017/02/17 19:11:06 I think this would be slightly more readable if yo
sullivan 2017/02/17 21:29:44 Done.
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
eakuefner 2017/02/17 19:11:06 Does it worry us that bugId could be null _or_ und
sullivan 2017/02/17 20:30:11 So basically we do an XHR to /benchmark_health_rep
132 isValidAlert: bugId => (bugId != null && bugId >= 0),
133
134 isInvalidAlert: bugId => (bugId != null && bugId < 0),
135
136 isUntriagedAlert: bugId => (bugId == null),
137
138 ready: function() {
139 var params = {
140 'master': this.master,
141 'benchmark': this.benchmark,
142 'num_days': this.numDays
143 };
144 simple_xhr.send('/benchmark_health_report', params,
145 function(response) {
eakuefner 2017/02/17 19:11:06 nit: i think you might be able to avoid the whole
sullivan 2017/02/17 21:29:44 Thanks! Done!
146 this.alerts = response['alerts'];
147 this.bots = response['bots'];
148 this.monitored = response['monitored'];
149 this.loading = false;
150 }.bind(this),
151 function(msg) {
152 this.error = msg;
153 this.loading = false;
154 }.bind(this));
155 }
156 });
157 </script>
158 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698