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

Side by Side Diff: dashboard/dashboard/elements/report-page.html

Issue 2881193003: Add a button to chart-title to populate the test-picker. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <link rel="import" href="/dashboard/elements/chart-container.html"> 7 <link rel="import" href="/dashboard/elements/chart-container.html">
8 <link rel="import" href="/dashboard/elements/test-picker.html"> 8 <link rel="import" href="/dashboard/elements/test-picker.html">
9 <link rel="import" href="/dashboard/static/events.html"> 9 <link rel="import" href="/dashboard/static/events.html">
10 <link rel="import" href="/dashboard/static/series_group.html"> 10 <link rel="import" href="/dashboard/static/series_group.html">
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 events.addEventListener(window, 'pagestaterequest', 112 events.addEventListener(window, 'pagestaterequest',
113 this.onPageStateRequest.bind(this)); 113 this.onPageStateRequest.bind(this));
114 114
115 this.testPicker = this.$['test-picker']; 115 this.testPicker = this.$['test-picker'];
116 this.testPicker.addEventListener( 116 this.testPicker.addEventListener(
117 'add', this.onAddChartButtonClicked.bind(this)); 117 'add', this.onAddChartButtonClicked.bind(this));
118 118
119 events.addEventListener(window, 'uriload', this.onUriLoad.bind(this)); 119 events.addEventListener(window, 'uriload', this.onUriLoad.bind(this));
120 this.uriController = new uri.Controller(this.getPageState.bind(this)); 120 this.uriController = new uri.Controller(this.getPageState.bind(this));
121 this.uriController.load(); 121 this.uriController.load();
122
123 this.addEventListener('click', this.onClick_.bind(this));
124 },
125
126 async onClick_(event) {
127 // When the user clicks anywhere in any chart-title, populate the
128 // testPicker.
129 let chartTitle = event.target;
130 while (chartTitle !== this && chartTitle.tagName !== 'CHART-TITLE') {
131 chartTitle = chartTitle.parentNode;
132 }
133 if (chartTitle.tagName !== 'CHART-TITLE') return;
sullivan 2017/05/16 13:35:13 The event handling here is really different than t
benjhayden 2017/05/16 21:17:45 Done.
134
135 const testPaths = chartTitle.getTestPaths();
eakuefner 2017/05/16 02:08:53 Can you write some comments that explain why this
benjhayden 2017/05/16 21:17:45 Changed to use event.titleParts.
136 let testPath = testPaths.shift().split('/');
137 for (const newPath of testPaths) {
138 for (let i = 0; i < Math.min(newPath.length, testPath.length); ++i) {
139 if (testPath[i] !== newPath[i]) {
140 testPath = testPath.slice(0, i);
141 }
142 }
143 }
144
145 const suiteMenu = this.testPicker.getSelectionMenu(0);
146 const suiteName = testPath[2];
147 for (let itemIndex = 0; itemIndex < suiteMenu.items.length; ++itemIndex) {
eakuefner 2017/05/16 02:08:52 Could you write this as a for..of loop?
benjhayden 2017/05/16 21:17:45 Done.
148 if (suiteMenu.items[itemIndex].name === suiteName) {
149 suiteMenu.selectedItem = suiteMenu.items[itemIndex];
150 break;
151 }
152 }
153
154 this.testPicker.updateTestSuiteDescription();
155 await this.testPicker.updateBotMenu();
156
157 const botName = testPath[1];
158 const botMenu = this.testPicker.getSelectionMenu(1);
159 for (let itemIndex = 0; itemIndex < botMenu.items.length; ++itemIndex) {
160 if (botMenu.items[itemIndex].name === botName) {
161 botMenu.selectedItem = botMenu.items[itemIndex];
162 break;
163 }
164 }
165 await this.testPicker.updateSubtestMenus(2);
166
167 for (let i = 3; i < testPath.length; ++i) {
168 const name = testPath[i];
169 const menu = this.testPicker.getSelectionMenu(i - 1);
170
171 for (let itemIndex = 0; itemIndex < menu.items.length; ++itemIndex) {
172 if (menu.items[itemIndex].name === testPath[i]) {
173 menu.selectedItem = menu.items[itemIndex];
174 break;
175 }
176 }
177 await this.testPicker.updateSubtestMenus(i);
178 }
122 }, 179 },
123 180
124 /** 181 /**
125 * On 'uriload' event, adds charts from the current query parameters. 182 * On 'uriload' event, adds charts from the current query parameters.
126 * @param {Object} event Event object. 183 * @param {Object} event Event object.
127 */ 184 */
128 onUriLoad(event) { 185 onUriLoad(event) {
129 const params = event.detail.params; 186 const params = event.detail.params;
130 const pageState = event.detail.state; 187 const pageState = event.detail.state;
131 if (!pageState) { 188 if (!pageState) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } else if (status == 'error') { 357 } else if (status == 'error') {
301 this.fire('display-toast', { 358 this.fire('display-toast', {
302 'text': 'Failed to save report.', 359 'text': 'Failed to save report.',
303 'error': true 360 'error': true
304 }); 361 });
305 } 362 }
306 } 363 }
307 }); 364 });
308 </script> 365 </script>
309 </dom-module> 366 </dom-module>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698