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

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
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 23 matching lines...) Expand all
34 bug #{{warningBug}}.</a> 34 bug #{{warningBug}}.</a>
35 </template> 35 </template>
36 </div> 36 </div>
37 </div> 37 </div>
38 38
39 </template> 39 </template>
40 40
41 <script> 41 <script>
42 'use strict'; 42 'use strict';
43 Polymer({ 43 Polymer({
44 is: 'report-page',
44 45
45 is: 'report-page', 46 listeners: {
47 populateTestPicker: 'populateTestPicker_',
48 },
49
46 properties: { 50 properties: {
47 charts: { 51 charts: {
48 type: Array, 52 type: Array,
49 value: () => [], 53 value: () => [],
50 notify: true 54 notify: true
51 }, 55 },
52 hasChart: { notify: true }, 56 hasChart: { notify: true },
53 onRevisionRange: { observer: 'onRevisionRangeChanged' }, 57 onRevisionRange: { observer: 'onRevisionRangeChanged' },
54 graphParams: { 58 graphParams: {
55 type: Object, 59 type: Object,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 118
115 this.testPicker = this.$['test-picker']; 119 this.testPicker = this.$['test-picker'];
116 this.testPicker.addEventListener( 120 this.testPicker.addEventListener(
117 'add', this.onAddChartButtonClicked.bind(this)); 121 'add', this.onAddChartButtonClicked.bind(this));
118 122
119 events.addEventListener(window, 'uriload', this.onUriLoad.bind(this)); 123 events.addEventListener(window, 'uriload', this.onUriLoad.bind(this));
120 this.uriController = new uri.Controller(this.getPageState.bind(this)); 124 this.uriController = new uri.Controller(this.getPageState.bind(this));
121 this.uriController.load(); 125 this.uriController.load();
122 }, 126 },
123 127
128 async populateTestPicker_(event) {
shatch 2017/05/19 19:43:53 I think it'd be cleaner if you just had chart-titl
129 // chart-title's testPaths have a different structure from test-picker's
130 // testPaths.
131 let testPath = [];
132 for (const part of event.detail.titleParts) {
133 testPath.push.apply(testPath, part.split('/'));
134 }
135
136 // chart-title's testPaths are in a different order from test-picker's
137 // testPaths.
138 testPath = [testPath[2], testPath[1]].concat(testPath.slice(3));
139
140 this.testPicker.scrollIntoViewIfNeeded();
141 await this.testPicker.setCurrentSelectedPath(testPath);
142 },
143
124 /** 144 /**
125 * On 'uriload' event, adds charts from the current query parameters. 145 * On 'uriload' event, adds charts from the current query parameters.
126 * @param {Object} event Event object. 146 * @param {Object} event Event object.
127 */ 147 */
128 onUriLoad(event) { 148 onUriLoad(event) {
129 const params = event.detail.params; 149 const params = event.detail.params;
130 const pageState = event.detail.state; 150 const pageState = event.detail.state;
131 if (!pageState) { 151 if (!pageState) {
132 return; 152 return;
133 } 153 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } else if (status == 'error') { 320 } else if (status == 'error') {
301 this.fire('display-toast', { 321 this.fire('display-toast', {
302 'text': 'Failed to save report.', 322 'text': 'Failed to save report.',
303 'error': true 323 'error': true
304 }); 324 });
305 } 325 }
306 } 326 }
307 }); 327 });
308 </script> 328 </script>
309 </dom-module> 329 </dom-module>
OLDNEW
« no previous file with comments | « dashboard/dashboard/elements/chart-title.html ('k') | dashboard/dashboard/elements/test-picker.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698