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

Side by Side Diff: build/android/pylib/results/presentation/javascript/main_html.js

Issue 2799153008: Add back buttons and load new 'pages' by calling javascript. (Closed)
Patch Set: address john's comments Created 3 years, 8 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 | build/android/pylib/results/presentation/template/main.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function getArguments() { 5 function getArguments() {
6 // Returns the URL arguments as a dictionary. 6 // Returns the URL arguments as a dictionary.
7 args = {} 7 args = {}
8 var s = location.search; 8 var s = location.search;
9 if (s) { 9 if (s) {
10 var vals = s.substring(1).split('&'); 10 var vals = s.substring(1).split('&');
(...skipping 28 matching lines...) Expand all
39 .startsWith(suite_name); 39 .startsWith(suite_name);
40 if (!table_block_in_suite) { 40 if (!table_block_in_suite) {
41 testTableBlock.style.display = 'none'; 41 testTableBlock.style.display = 'none';
42 return; 42 return;
43 } 43 }
44 } 44 }
45 testTableBlock.style.display = 'table-row-group'; 45 testTableBlock.style.display = 'table-row-group';
46 }); 46 });
47 showTestTable(true); 47 showTestTable(true);
48 showSuiteTable(false); 48 showSuiteTable(false);
49 window.scrollTo(0, 0);
50 }
51
52 function testTablePage(suite_name, push_state) {
jbudorick 2017/04/11 18:43:02 My motivation w/ this suggestion was to eliminate
53 showTestsOfOneSuiteOnly(suite_name);
54 if (push_state) {
55 history.pushState({suite: suite_name}, suite_name, '');
56 }
49 } 57 }
50 58
51 function showSuiteTableOnly() { 59 function showSuiteTableOnly() {
52 setTitle('Suites Summary') 60 setTitle('Suites Summary')
53 showTestTable(false); 61 showTestTable(false);
54 showSuiteTable(true); 62 showSuiteTable(true);
63 window.scrollTo(0, 0);
64 }
65
66 function suiteTablePage(replace_state) {
67 showSuiteTableOnly();
68 if (replace_state) {
69 history.replaceState({}, 'suite_table', '');
70 }
71 }
72
73 function setBrowserBackButtonLogic() {
74 window.onpopstate = function(event) {
75 if (!event.state || !event.state.suite) {
76 suiteTablePage(false);
77 } else {
78 testTablePage(event.state.suite, false);
79 }
80 };
55 } 81 }
56 82
57 function setTitle(title) { 83 function setTitle(title) {
58 document.getElementById('summary-header').textContent = title; 84 document.getElementById('summary-header').textContent = title;
59 } 85 }
60 86
61 function sortByColumn(head) { 87 function sortByColumn(head) {
62 var table = head.parentNode.parentNode.parentNode; 88 var table = head.parentNode.parentNode.parentNode;
63 var rowBlocks = Array.prototype.slice.call( 89 var rowBlocks = Array.prototype.slice.call(
64 table.getElementsByTagName('tbody')); 90 table.getElementsByTagName('tbody'));
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 (b_rows.length - b_success_or_skipped) / btotal_minus_skipped); 185 (b_rows.length - b_success_or_skipped) / btotal_minus_skipped);
160 } 186 }
161 return asc * (avalue - bvalue); 187 return asc * (avalue - bvalue);
162 }); 188 });
163 189
164 for (var i = 0; i < rowBlocks.length; i++) { 190 for (var i = 0; i < rowBlocks.length; i++) {
165 table.appendChild(rowBlocks[i]); 191 table.appendChild(rowBlocks[i]);
166 } 192 }
167 } 193 }
168 194
169 function loadPage() {
170 var args = getArguments();
171 if ('suite' in args) {
172 // The user wants to visit detailed 'subpage' of that suite.
173 showTestsOfOneSuiteOnly(args['suite']);
174 } else {
175 // The user wants to visit the summary of all suites.
176 showSuiteTableOnly();
177 }
178 }
179
180 function reportIssues() { 195 function reportIssues() {
181 var url = 'https://bugs.chromium.org/p/chromium/issues/entry?' + 196 var url = 'https://bugs.chromium.org/p/chromium/issues/entry?' +
182 'labels=Pri-2,Type-Bug,Restrict-View-Google&' + 197 'labels=Pri-2,Type-Bug,Restrict-View-Google&' +
183 'summary=Result Details Feedback:&' + 198 'summary=Result Details Feedback:&' +
184 'comment=Please check out: ' + window.location; 199 'comment=Please check out: ' + window.location;
185 var newWindow = window.open(url, '_blank'); 200 var newWindow = window.open(url, '_blank');
186 newWindow.focus(); 201 newWindow.focus();
187 } 202 }
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/results/presentation/template/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698