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/static/simple_xhr.html"> |
| 10 |
| 11 <dom-module id="benchmark-health-report-list"> |
| 12 <style> |
| 13 .error { |
| 14 color: #dd4b39; |
| 15 font-weight: bold; |
| 16 } |
| 17 |
| 18 #loading-spinner { |
| 19 width: 100%; |
| 20 display: flex; |
| 21 justify-content: center; |
| 22 } |
| 23 |
| 24 .content { |
| 25 min-width: 1000px; |
| 26 } |
| 27 </style> |
| 28 <template> |
| 29 <template is="dom-if" if="{{loading}}"> |
| 30 <div id="loading-spinner"><img src="//www.google.com/images/loading.gif"><
/div> |
| 31 </template> |
| 32 <template is="dom-if" if="{{error}}"> |
| 33 <div class="error">{{error}}</div> |
| 34 </template> |
| 35 <template is="dom-if" if="{{computeSuccessfulLoad(loading, error)}}"> |
| 36 <div class="content"> |
| 37 <h2>{{benchmarkList.length}} benchmarks on {{master}}</h2> |
| 38 <ul> |
| 39 <template is="dom-repeat" items="{{benchmarkList}}"> |
| 40 <li><a href="/benchmark_health_report?benchmark={{item}}&master={{
master}}&num_days={{numDays}}">{{item}}</a><br> |
| 41 </template> |
| 42 </ul> |
| 43 </div> |
| 44 </template> |
| 45 |
| 46 </template> |
| 47 <script> |
| 48 'use strict'; |
| 49 Polymer({ |
| 50 is: 'benchmark-health-report-list', |
| 51 properties: { |
| 52 benchmarkList: { |
| 53 notify: true, |
| 54 type: Array |
| 55 }, |
| 56 error: { |
| 57 notify: true, |
| 58 type: Boolean, |
| 59 value: false |
| 60 }, |
| 61 loading: { |
| 62 notify: true, |
| 63 type: Boolean, |
| 64 value: true |
| 65 }, |
| 66 master: { |
| 67 notify: true, |
| 68 type: String |
| 69 }, |
| 70 numDays: { |
| 71 notify: true, |
| 72 type: Number |
| 73 } |
| 74 }, |
| 75 |
| 76 computeSuccessfulLoad: (loading, error) => !(loading || error), |
| 77 |
| 78 ready: function() { |
| 79 var params = { |
| 80 'master': this.master |
| 81 }; |
| 82 simple_xhr.send('/benchmark_health_report', params, |
| 83 response => { |
| 84 this.benchmarkList = response['benchmarks']; |
| 85 this.error = false; |
| 86 this.loading = false; |
| 87 }, |
| 88 errorMsg => { |
| 89 this.error = errorMsg; |
| 90 this.loading = false; |
| 91 }); |
| 92 } |
| 93 }); |
| 94 </script> |
| 95 </dom-module> |
OLD | NEW |