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