OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <!-- | |
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 | |
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-telemetry-info-span"> | |
11 <template> | |
12 <tr-ui-b-table id="table"></tr-ui-b-table> | |
13 </template> | |
14 </dom-module> | |
15 <script> | |
16 'use strict'; | |
17 Polymer({ | |
18 is: 'tr-v-ui-telemetry-info-span', | |
19 | |
20 ready() { | |
21 this.diagnostic_ = undefined; | |
22 this.$.table.showHeader = false; | |
23 this.$.table.tableColumns = [ | |
24 {value: row => row[0]}, | |
25 {value: row => row[1]}, | |
26 ]; | |
27 }, | |
28 | |
29 get diagnostic() { | |
30 return this.diagnostic_; | |
31 }, | |
32 | |
33 set diagnostic(d) { | |
34 this.diagnostic_ = d; | |
35 this.updateContents_(); | |
36 }, | |
37 | |
38 updateContents_() { | |
39 if (this.diagnostic === undefined) { | |
40 this.$.table.tableRows = []; | |
41 return; | |
42 } | |
43 | |
44 const rows = []; | |
45 | |
46 if (this.diagnostic.benchmarkName) { | |
47 rows.push(['benchmark name', this.diagnostic.benchmarkName]); | |
48 } | |
49 if (this.diagnostic.benchmarkStart) { | |
50 rows.push(['benchmark start', this.diagnostic.benchmarkStartString]); | |
51 } | |
52 if (this.diagnostic.storyDisplayName) { | |
53 rows.push(['story', this.diagnostic.storyDisplayName]); | |
54 } | |
55 if (this.diagnostic.storysetRepeatCounter !== undefined) { | |
56 rows.push(['storyset repeat', this.diagnostic.storysetRepeatCounter]); | |
57 } | |
58 if (this.diagnostic.label) { | |
59 rows.push(['label', this.diagnostic.label]); | |
60 } | |
61 if (this.diagnostic.storyGroupingKeys.size) { | |
62 const gov = document.createElement('tr-ui-a-generic-object-view'); | |
63 const obj = {}; | |
64 for (const [key, value] of this.diagnostic.storyGroupingKeys) { | |
65 obj[key] = value; | |
66 } | |
67 gov.object = obj; | |
68 rows.push(['grouping keys', gov]); | |
69 } | |
70 this.$.table.tableRows = rows; | |
71 } | |
72 }); | |
73 </script> | |
OLD | NEW |