OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/ui/analysis/analysis_link.html"> | 8 <link rel="import" href="/tracing/ui/analysis/analysis_link.html"> |
9 <link rel="import" href="/tracing/ui/base/table.html"> | 9 <link rel="import" href="/tracing/ui/base/table.html"> |
| 10 <link rel="import" href="/tracing/value/ui/diagnostic_span_behavior.html"> |
10 <link rel="import" href="/tracing/value/ui/scalar_span.html"> | 11 <link rel="import" href="/tracing/value/ui/scalar_span.html"> |
11 | 12 |
12 <dom-module id="tr-v-ui-related-histogram-map-span"> | 13 <dom-module id="tr-v-ui-related-histogram-map-span"> |
13 <template> | 14 <template> |
14 <tr-ui-b-table id="table"></tr-ui-b-table> | 15 <tr-ui-b-table id="table"></tr-ui-b-table> |
15 </template> | 16 </template> |
16 </dom-module> | 17 </dom-module> |
| 18 |
17 <script> | 19 <script> |
18 'use strict'; | 20 'use strict'; |
19 Polymer({ | 21 tr.exportTo('tr.v.ui', function() { |
20 is: 'tr-v-ui-related-histogram-map-span', | 22 Polymer({ |
| 23 is: 'tr-v-ui-related-histogram-map-span', |
| 24 behaviors: [tr.v.ui.DIAGNOSTIC_SPAN_BEHAVIOR], |
21 | 25 |
22 ready() { | 26 ready() { |
23 this.diagnostic_ = undefined; | 27 this.$.table.showHeader = false; |
24 this.$.table.showHeader = false; | 28 this.$.table.tableColumns = [ |
25 this.$.table.tableColumns = [ | 29 {value: row => row[0]}, |
26 {value: row => row[0]}, | 30 {value: row => row[1]}, |
27 {value: row => row[1]}, | 31 ]; |
28 ]; | 32 }, |
29 }, | |
30 | 33 |
31 get diagnostic() { | 34 updateContents_() { |
32 return this.diagnostic_; | 35 Polymer.dom(this).textContent = ''; |
33 }, | |
34 | 36 |
35 set diagnostic(d) { | 37 const rows = []; |
36 this.diagnostic_ = d; | |
37 this.updateContents_(); | |
38 }, | |
39 | 38 |
40 updateContents_() { | 39 const histogramNames = new Set(); |
41 Polymer.dom(this).textContent = ''; | 40 for (const [name, hist] of this.diagnostic) { |
| 41 histogramNames.add(hist.name); |
| 42 } |
| 43 if (histogramNames.size > 1) { |
| 44 const link = document.createElement('tr-ui-a-analysis-link'); |
| 45 link.setSelectionAndContent(Array.from(histogramNames), 'Select All'); |
| 46 rows.push([link, '']); |
| 47 } |
42 | 48 |
43 const rows = []; | 49 for (const [name, hist] of this.diagnostic) { |
| 50 const link = document.createElement('tr-ui-a-analysis-link'); |
| 51 link.setSelectionAndContent([hist.name], name); |
| 52 const scalarSpan = tr.v.ui.createScalarSpan(hist); |
| 53 rows.push([link, scalarSpan]); |
| 54 } |
| 55 this.$.table.tableRows = rows; |
| 56 this.$.table.rebuild(); |
| 57 } |
| 58 }); |
44 | 59 |
45 const histogramNames = new Set(); | 60 return {}; |
46 for (const [name, hist] of this.diagnostic) { | |
47 histogramNames.add(hist.name); | |
48 } | |
49 if (histogramNames.size > 1) { | |
50 const link = document.createElement('tr-ui-a-analysis-link'); | |
51 link.setSelectionAndContent(Array.from(histogramNames), 'Select All'); | |
52 rows.push([link, '']); | |
53 } | |
54 | |
55 for (const [name, hist] of this.diagnostic) { | |
56 const link = document.createElement('tr-ui-a-analysis-link'); | |
57 link.setSelectionAndContent([hist.name], name); | |
58 const scalarSpan = tr.v.ui.createScalarSpan(hist); | |
59 rows.push([link, scalarSpan]); | |
60 } | |
61 this.$.table.tableRows = rows; | |
62 this.$.table.rebuild(); | |
63 } | |
64 }); | 61 }); |
65 </script> | 62 </script> |
OLD | NEW |