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/base/utils.html"> |
8 <link rel="import" href="/tracing/ui/analysis/generic_object_view.html"> | 9 <link rel="import" href="/tracing/ui/analysis/generic_object_view.html"> |
9 <link rel="import" href="/tracing/value/ui/diagnostic_span_behavior.html"> | 10 <link rel="import" href="/tracing/value/ui/diagnostic_span_behavior.html"> |
10 | 11 |
11 <dom-module id="tr-v-ui-generic-set-span"> | 12 <dom-module id="tr-v-ui-generic-set-span"> |
12 <template> | 13 <template> |
| 14 <style> |
| 15 a { |
| 16 display: block; |
| 17 } |
| 18 </style> |
| 19 |
13 <tr-ui-a-generic-object-view id="generic"></tr-ui-a-generic-object-view> | 20 <tr-ui-a-generic-object-view id="generic"></tr-ui-a-generic-object-view> |
14 <template is="dom-repeat" items="{{strings_}}">[[item]]<br></template> | 21 |
| 22 <template is="dom-repeat" items="{{strings_}}"> |
| 23 <template is="dom-if" if="[[isUrl_(item)]]"> |
| 24 <a href="[[item]]">[[item]]</a> |
| 25 </template> |
| 26 |
| 27 <template is="dom-if" if="[[!isUrl_(item)]]"> |
| 28 <div>[[item]]</div> |
| 29 </template> |
| 30 </template> |
15 </template> | 31 </template> |
16 </dom-module> | 32 </dom-module> |
17 | 33 |
18 <script> | 34 <script> |
19 'use strict'; | 35 'use strict'; |
20 tr.exportTo('tr.v.ui', function() { | 36 tr.exportTo('tr.v.ui', function() { |
21 Polymer({ | 37 Polymer({ |
22 is: 'tr-v-ui-generic-set-span', | 38 is: 'tr-v-ui-generic-set-span', |
23 behaviors: [tr.v.ui.DIAGNOSTIC_SPAN_BEHAVIOR], | 39 behaviors: [tr.v.ui.DIAGNOSTIC_SPAN_BEHAVIOR], |
24 | 40 |
25 properties: { | 41 properties: { |
26 strings_: { | 42 strings_: { |
27 type: Array, | 43 type: Array, |
28 }, | 44 }, |
29 }, | 45 }, |
30 | 46 |
| 47 isUrl_(s) { |
| 48 return tr.b.isUrl(s); |
| 49 }, |
| 50 |
31 updateContents_() { | 51 updateContents_() { |
32 if (this.diagnostic === undefined) { | 52 if (this.diagnostic === undefined) { |
33 this.$.generic.object = undefined; | 53 this.$.generic.object = undefined; |
34 return; | 54 return; |
35 } | 55 } |
36 const values = Array.from(this.diagnostic); | 56 const values = Array.from(this.diagnostic); |
37 | 57 |
38 let areAllStrings = true; | 58 let areAllStrings = true; |
39 let areAllNumbers = true; | 59 let areAllNumbers = true; |
40 for (const value of values) { | 60 for (const value of values) { |
(...skipping 16 matching lines...) Expand all Loading... |
57 } else { | 77 } else { |
58 this.$.generic.object = values; | 78 this.$.generic.object = values; |
59 } | 79 } |
60 } | 80 } |
61 }); | 81 }); |
62 | 82 |
63 return { | 83 return { |
64 }; | 84 }; |
65 }); | 85 }); |
66 </script> | 86 </script> |
OLD | NEW |