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 <dom-module id="chart-title"> | 8 <dom-module id="chart-title"> |
9 <template> | 9 <template> |
10 <style> | 10 <style> |
11 .title { | 11 .title { |
12 color: #424242; | 12 color: #424242; |
13 text-decoration: none; | 13 text-decoration: none; |
14 } | 14 } |
15 | 15 |
16 .title:hover { | 16 .title:hover { |
17 color: #4184f3; | 17 color: #4184f3; |
18 text-decoration: underline; | 18 text-decoration: underline; |
19 } | 19 } |
20 | 20 |
21 .title[disabled] { | 21 .title[disabled] { |
22 color: #8d8d8d; | 22 color: #8d8d8d; |
23 text-decoration: none; | 23 text-decoration: none; |
24 cursor: default; | 24 cursor: default; |
25 } | 25 } |
| 26 paper-button { |
| 27 color: white; |
| 28 font-weight: bold; |
| 29 min-width: initial; |
| 30 padding: 5px; |
| 31 margin: 0; |
| 32 background: #4285f4; |
| 33 font-size: 18px; |
| 34 } |
| 35 h3 { |
| 36 display: inline-block; |
| 37 } |
26 </style> | 38 </style> |
27 | 39 |
| 40 <paper-button raised on-click="populateTestPicker_">↸</paper-button> |
| 41 |
28 <h3> | 42 <h3> |
29 <template is="dom-repeat" items="{{titleParts}}"> | 43 <template is="dom-repeat" items="{{titleParts}}"> |
30 <a class="title disabled" href="javascript:void(0);" | 44 <a class="title disabled" href="javascript:void(0);" |
31 on-click="onClicked" disabled$="{{computeStrictEqual(index, currentIn
dex)}}" | 45 on-click="onClicked" disabled$="{{computeStrictEqual(index, currentIn
dex)}}" |
32 class="title"> | 46 class="title"> |
33 {{item}} | 47 {{item}} |
34 </a> | 48 </a> |
35 <span hidden$="{{computeIsLast(index, titleParts)}}">/</span> | 49 <span hidden$="{{computeIsLast(index, titleParts)}}">/</span> |
36 </template> | 50 </template> |
37 </h3> | 51 </h3> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // selection. | 104 // selection. |
91 if (selectedSeries) { | 105 if (selectedSeries) { |
92 this.titleParts.push(selectedSeries); | 106 this.titleParts.push(selectedSeries); |
93 this.currentIndex = this.titleParts.length - 2; | 107 this.currentIndex = this.titleParts.length - 2; |
94 } else { | 108 } else { |
95 this.currentIndex = this.titleParts.length - 1; | 109 this.currentIndex = this.titleParts.length - 1; |
96 } | 110 } |
97 this.suiteDescriptions = this.getSuitesAndDescriptions(); | 111 this.suiteDescriptions = this.getSuitesAndDescriptions(); |
98 }, | 112 }, |
99 | 113 |
| 114 populateTestPicker_(event) { |
| 115 // chart-title's testPaths have a different structure from test-picker's |
| 116 // testPaths. |
| 117 let testPath = []; |
| 118 for (const part of this.titleParts) { |
| 119 testPath.push.apply(testPath, part.split('/')); |
| 120 } |
| 121 |
| 122 // chart-title's testPaths are in a different order from test-picker's |
| 123 // testPaths. |
| 124 testPath = [testPath[2], testPath[1]].concat(testPath.slice(3)); |
| 125 |
| 126 this.fire('populateTestPicker', {testPath}); |
| 127 }, |
| 128 |
100 onClicked(event) { | 129 onClicked(event) { |
101 const index = event.model.index; | 130 const index = event.model.index; |
102 if (index == this.currentIndex) { | 131 if (index == this.currentIndex) { |
103 return; | 132 return; |
104 } | 133 } |
105 this.fire('titleclicked', { | 134 this.fire('titleclicked', { |
106 titleParts: this.titleParts, | 135 titleParts: this.titleParts, |
107 partIndex: index | 136 partIndex: index |
108 }); | 137 }); |
109 | 138 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (arrays[i][prefixLength] != value) { | 236 if (arrays[i][prefixLength] != value) { |
208 return arrays[0].slice(0, prefixLength); | 237 return arrays[0].slice(0, prefixLength); |
209 } | 238 } |
210 } | 239 } |
211 } | 240 } |
212 return arrays[0].slice(0, shortestLength); | 241 return arrays[0].slice(0, shortestLength); |
213 } | 242 } |
214 }); | 243 }); |
215 </script> | 244 </script> |
216 </dom-module> | 245 </dom-module> |
OLD | NEW |