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/analysis/analysis_link.html"> | |
9 | |
10 <dom-module id="tr-v-ui-related-histogram-set-span"> | |
11 <script> | |
12 'use strict'; | |
13 Polymer({ | |
14 is: 'tr-v-ui-related-histogram-set-span', | |
15 | |
16 ready() { | |
17 this.diagnostic_ = undefined; | |
18 }, | |
19 | |
20 get diagnostic() { | |
21 return this.diagnostic_; | |
22 }, | |
23 | |
24 set diagnostic(d) { | |
25 this.diagnostic_ = d; | |
26 this.updateContents_(); | |
27 }, | |
28 | |
29 addLink_(selection, content) { | |
30 const link = document.createElement('tr-ui-a-analysis-link'); | |
31 link.setSelectionAndContent(selection, content); | |
32 Polymer.dom(this).appendChild(link); | |
33 Polymer.dom(this).appendChild(document.createElement('br')); | |
34 }, | |
35 | |
36 updateContents_() { | |
37 Polymer.dom(this).textContent = ''; | |
38 | |
39 const histogramNames = new Set(); | |
40 for (const hist of this.diagnostic) { | |
41 histogramNames.add(hist.name); | |
42 } | |
43 if (histogramNames.size > 1) { | |
44 this.addLink_(Array.from(histogramNames), 'Select All'); | |
45 } | |
46 | |
47 for (const hist of this.diagnostic) { | |
48 this.addLink_([hist.name], hist.name); | |
49 } | |
50 } | |
51 }); | |
52 </script> | |
53 </dom-module> | |
OLD | NEW |