Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Side by Side Diff: tracing/tracing/value/ui/diagnostic_map_table.html

Issue 3002973002: Refactor diagnostic spans to share a polymer behavior. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/base/table.html"> 8 <link rel="import" href="/tracing/ui/base/table.html">
9 <link rel="import" href="/tracing/value/ui/diagnostic_span.html"> 9 <link rel="import" href="/tracing/value/ui/diagnostic_span.html">
10 10
11 <dom-module id="tr-v-ui-diagnostic-map-table"> 11 <dom-module id="tr-v-ui-diagnostic-map-table">
12 <template> 12 <template>
13 <tr-ui-b-table id="table"></tr-ui-b-table> 13 <tr-ui-b-table id="table"></tr-ui-b-table>
14 </template> 14 </template>
15 </dom-module> 15 </dom-module>
16 16
17 <script> 17 <script>
18 'use strict'; 18 'use strict';
19 19
20 tr.exportTo('tr.v.ui', function() { 20 tr.exportTo('tr.v.ui', function() {
21 function makeColumn(title, histogram) { 21 function makeColumn(title, histogram) {
22 return { 22 return {
23 title, 23 title,
24 value(map) { 24 value(map) {
25 const diagnostic = map.get(title); 25 const diagnostic = map.get(title);
26 if (!diagnostic) return ''; 26 if (!diagnostic) return '';
27 return tr.v.ui.createDiagnosticSpan(diagnostic, histogram); 27 return tr.v.ui.createDiagnosticSpan(diagnostic, title, histogram);
28 } 28 }
29 }; 29 };
30 } 30 }
31 31
32 Polymer({ 32 Polymer({
33 is: 'tr-v-ui-diagnostic-map-table', 33 is: 'tr-v-ui-diagnostic-map-table',
34 34
35 created() { 35 created() {
36 this.diagnosticMaps_ = undefined; 36 this.diagnosticMaps_ = undefined;
37 this.histogram_ = undefined; 37 this.histogram_ = undefined;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 this.$.table.tableColumns = [ 95 this.$.table.tableColumns = [
96 { 96 {
97 value(name) { 97 value(name) {
98 return name.name; 98 return name.name;
99 } 99 }
100 }, 100 },
101 { 101 {
102 value(name) { 102 value(name) {
103 const diagnostic = diagnosticMap.get(name.name); 103 const diagnostic = diagnosticMap.get(name.name);
104 if (!diagnostic) return ''; 104 if (!diagnostic) return '';
105 return tr.v.ui.createDiagnosticSpan(diagnostic, histogram); 105 return tr.v.ui.createDiagnosticSpan(diagnostic, name, histogram);
106 } 106 }
107 }, 107 },
108 ]; 108 ];
109 this.$.table.tableRows = names.map(name => { 109 this.$.table.tableRows = names.map(name => {
110 // tr-ui-b-table requires rows to be objects. 110 // tr-ui-b-table requires rows to be objects.
111 return {name}; 111 return {name};
112 }); 112 });
113 } else { 113 } else {
114 this.$.table.tableColumns = names.map( 114 this.$.table.tableColumns = names.map(
115 name => makeColumn(name, histogram)); 115 name => makeColumn(name, histogram));
116 this.$.table.tableRows = this.diagnosticMaps_; 116 this.$.table.tableRows = this.diagnosticMaps_;
117 } 117 }
118 118
119 this.$.table.rebuild(); 119 this.$.table.rebuild();
120 } 120 }
121 }); 121 });
122 122
123 return {}; 123 return {};
124 }); 124 });
125 </script> 125 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698