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 | |
8 <link rel="import" href="/tracing/ui/base/table.html"> | |
9 | |
10 <dom-module id="tr-v-ui-merged-telemetry-info-span"> | |
11 <template> | |
12 <style> | |
13 #hide, #table { | |
14 display: none; | |
15 } | |
16 </style> | |
17 <button id="show" on-click="onShow_">Show</button> | |
18 <button id="hide" on-click="onHide_">Hide</button> | |
19 <tr-ui-b-table id="table"></tr-ui-b-table> | |
20 </template> | |
21 </dom-module> | |
22 <script> | |
23 'use strict'; | |
24 Polymer({ | |
25 is: 'tr-v-ui-merged-telemetry-info-span', | |
26 | |
27 ready() { | |
28 this.diagnostic_ = undefined; | |
29 this.$.table.showHeader = false; | |
30 this.$.table.tableColumns = [ | |
31 {value: row => row[0]}, | |
32 {value: row => row[1]}, | |
33 ]; | |
34 }, | |
35 | |
36 onShow_() { | |
37 this.$.show.style.display = 'none'; | |
38 this.$.hide.style.display = 'block'; | |
39 this.$.table.style.display = 'table'; | |
40 }, | |
41 | |
42 onHide_() { | |
43 this.$.show.style.display = 'block'; | |
44 this.$.hide.style.display = 'none'; | |
45 this.$.table.style.display = 'none'; | |
46 }, | |
47 | |
48 get diagnostic() { | |
49 return this.diagnostic_; | |
50 }, | |
51 | |
52 set diagnostic(d) { | |
53 this.diagnostic_ = d; | |
54 this.updateContents_(); | |
55 }, | |
56 | |
57 updateContents_() { | |
58 if (this.diagnostic === undefined) { | |
59 this.$.table.tableRows = []; | |
60 return; | |
61 } | |
62 | |
63 const rows = []; | |
64 | |
65 if (this.diagnostic.benchmarkNames.size) { | |
66 rows.push([ | |
67 'benchmark names', | |
68 Array.from(this.diagnostic.benchmarkNames).join(', ') | |
69 ]); | |
70 } | |
71 if (this.diagnostic.benchmarkStarts.length) { | |
72 rows.push([ | |
73 'benchmark starts', | |
74 this.diagnostic.benchmarkStartStrings.join(', ') | |
75 ]); | |
76 } | |
77 if (this.diagnostic.storyDisplayNames.size) { | |
78 rows.push([ | |
79 'stories', | |
80 Array.from(this.diagnostic.storyDisplayNames).join(', ') | |
81 ]); | |
82 } | |
83 if (this.diagnostic.storysetRepeatCounters.size) { | |
84 rows.push([ | |
85 'storyset repeats', | |
86 Array.from(this.diagnostic.storysetRepeatCounters).join(', ') | |
87 ]); | |
88 } | |
89 if (this.diagnostic.labels.size) { | |
90 rows.push(['label', Array.from(this.diagnostic.labels).join(', ')]); | |
91 } | |
92 if (this.diagnostic.storyGroupingKeys.size) { | |
93 const gov = document.createElement('tr-ui-a-generic-object-view'); | |
94 const obj = {}; | |
95 for (const [key, value] of this.diagnostic.storyGroupingKeys) { | |
96 obj[key] = Array.from(value); | |
97 } | |
98 gov.object = obj; | |
99 rows.push(['grouping keys', gov]); | |
100 } | |
101 this.$.table.tableRows = rows; | |
102 } | |
103 }); | |
104 </script> | |
OLD | NEW |