Chromium Code Reviews| Index: dashboard/dashboard/elements/benchmark-quality-report-list.html |
| diff --git a/dashboard/dashboard/elements/benchmark-quality-report-list.html b/dashboard/dashboard/elements/benchmark-quality-report-list.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..124359364624217e7240ad26d2e57fb8803adae1 |
| --- /dev/null |
| +++ b/dashboard/dashboard/elements/benchmark-quality-report-list.html |
| @@ -0,0 +1,99 @@ |
| +<!DOCTYPE html> |
| +<!-- |
| +Copyright 2017 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="/components/polymer/polymer.html"> |
| + |
| +<link rel="import" href="/dashboard/static/simple_xhr.html"> |
| + |
| +<dom-module id="benchmark-quality-report-list"> |
| + <style> |
| + .error { |
| + color: #dd4b39; |
| + font-weight: bold; |
| + } |
| + |
| + #loading-spinner { |
| + width: 100%; |
| + display: flex; |
| + justify-content: center; |
| + } |
| + |
| + .content { |
| + min-width: 1000px; |
| + } |
| + </style> |
| + <template> |
| + <template is="dom-if" if="{{loading}}"> |
| + <div id="loading-spinner"><img src="//www.google.com/images/loading.gif"></div> |
| + </template> |
| + <template is="dom-if" if="{{error}}"> |
| + <div class="error">{{error}}</div> |
| + </template> |
| + <template is="dom-if" if="{{computeSuccessfulLoad(loading, error)}}"> |
| + <div class="content"> |
| + <h2>{{benchmarkList.length}} benchmarks on {{master}}</h2> |
| + <ul> |
| + <template is="dom-repeat" items="{{benchmarkList}}"> |
| + <li><a href="/benchmark_quality_report?benchmark={{item}}&master={{master}}&num_days={{numDays}}">{{item}}</a><br> |
| + </template> |
| + </ul> |
|
sullivan
2017/02/17 16:30:13
This element does the XHR and populates the UI for
|
| + </div> |
| + </template> |
| + |
| + </template> |
| + <script> |
| + 'use strict'; |
| + Polymer({ |
| + is: 'benchmark-quality-report-list', |
| + properties: { |
| + benchmarkList: { |
| + notify: true, |
| + type: Array |
| + }, |
| + error: { |
| + notify: true, |
| + type: Boolean, |
| + value: false |
| + }, |
| + loading: { |
| + notify: true, |
| + type: Boolean, |
| + value: true |
| + }, |
| + master: { |
| + notify: true, |
| + type: String |
| + }, |
| + numDays: { |
| + notify: true, |
| + type: Number |
| + } |
| + }, |
| + |
| + computeSuccessfulLoad: (loading, error) => !(loading || error), |
| + |
| + /** |
| + * The url params determine what data to request from |
| + * /group_report. sid is a hash of a group of keys. |
| + */ |
| + ready: function() { |
| + var params = { |
| + 'master': this.master |
| + }; |
| + simple_xhr.send('/benchmark_quality_report', params, |
| + function(response) { |
| + this.benchmarkList = response['benchmarks']; |
| + this.error = false; |
| + this.loading = false; |
| + }.bind(this), |
| + function(msg) { |
| + this.error = msg; |
| + this.loading = false; |
| + }.bind(this)); |
| + } |
| + }); |
| + </script> |
| +</dom-module> |