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

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: remove obsolete functions 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
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('&');
11 for (var i = 0; i < vals.length; i++) { 11 for (var i = 0; i < vals.length; i++) {
12 var pair = vals[i].split('='); 12 var pair = vals[i].split('=');
13 args[pair[0]] = pair[1]; 13 args[pair[0]] = pair[1];
14 } 14 }
15 } 15 }
16 return args; 16 return args;
17 } 17 }
18 18
19 function showSuiteTable(show_the_table) { 19 function showSuiteTable(show_the_table) {
20 document.getElementById('suite-table').style.display = ( 20 document.getElementById('suite-table').style.display = (
21 show_the_table ? 'table' : 'none'); 21 show_the_table ? 'table' : 'none');
22 } 22 }
23 23
24 function showTestTable(show_the_table) { 24 function showTestTable(show_the_table) {
25 document.getElementById('test-table').style.display = ( 25 document.getElementById('test-table').style.display = (
26 show_the_table ? 'table' : 'none'); 26 show_the_table ? 'table' : 'none');
27 } 27 }
28 28
29 function showBackButtons(show_buttons) {
30 buttons = document.getElementsByClassName('back_button')
31 Array.prototype.slice.call(buttons)
32 .forEach(function(button) {
33 if (!show_buttons) {
34 button.style.display = 'none';
35 } else {
36 button.style.display = 'inline';
37 }
38 });
39 }
40
29 function showTestsOfOneSuiteOnly(suite_name) { 41 function showTestsOfOneSuiteOnly(suite_name) {
30 setTitle('Test Results of Suite: ' + suite_name) 42 setTitle('Test Results of Suite: ' + suite_name)
31 show_all = (suite_name == 'TOTAL') 43 show_all = (suite_name == 'TOTAL')
32 var testTableBlocks = document.getElementById('test-table') 44 var testTableBlocks = document.getElementById('test-table')
33 .getElementsByClassName('row_block'); 45 .getElementsByClassName('row_block');
34 Array.prototype.slice.call(testTableBlocks) 46 Array.prototype.slice.call(testTableBlocks)
35 .forEach(function(testTableBlock) { 47 .forEach(function(testTableBlock) {
36 if (!show_all) { 48 if (!show_all) {
37 var table_block_in_suite = (testTableBlock.firstElementChild 49 var table_block_in_suite = (testTableBlock.firstElementChild
38 .firstElementChild.firstElementChild.innerHTML) 50 .firstElementChild.firstElementChild.innerHTML)
39 .startsWith(suite_name); 51 .startsWith(suite_name);
40 if (!table_block_in_suite) { 52 if (!table_block_in_suite) {
41 testTableBlock.style.display = 'none'; 53 testTableBlock.style.display = 'none';
42 return; 54 return;
43 } 55 }
44 } 56 }
45 testTableBlock.style.display = 'table-row-group'; 57 testTableBlock.style.display = 'table-row-group';
46 }); 58 });
47 showTestTable(true); 59 showTestTable(true);
48 showSuiteTable(false); 60 showSuiteTable(false);
61 showBackButtons(true);
62 window.scrollTo(0, 0);
49 } 63 }
50 64
51 function showSuiteTableOnly() { 65 function showSuiteTableOnly() {
52 setTitle('Suites Summary') 66 setTitle('Suites Summary')
53 showTestTable(false); 67 showTestTable(false);
54 showSuiteTable(true); 68 showSuiteTable(true);
69 showBackButtons(false);
70 window.scrollTo(0, 0);
55 } 71 }
56 72
57 function setTitle(title) { 73 function setTitle(title) {
58 document.getElementById('summary-header').textContent = title; 74 document.getElementById('summary-header').textContent = title;
59 } 75 }
60 76
61 function sortByColumn(head) { 77 function sortByColumn(head) {
62 var table = head.parentNode.parentNode.parentNode; 78 var table = head.parentNode.parentNode.parentNode;
63 var rowBlocks = Array.prototype.slice.call( 79 var rowBlocks = Array.prototype.slice.call(
64 table.getElementsByTagName('tbody')); 80 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); 175 (b_rows.length - b_success_or_skipped) / btotal_minus_skipped);
160 } 176 }
161 return asc * (avalue - bvalue); 177 return asc * (avalue - bvalue);
162 }); 178 });
163 179
164 for (var i = 0; i < rowBlocks.length; i++) { 180 for (var i = 0; i < rowBlocks.length; i++) {
165 table.appendChild(rowBlocks[i]); 181 table.appendChild(rowBlocks[i]);
166 } 182 }
167 } 183 }
168 184
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() { 185 function reportIssues() {
181 var url = 'https://bugs.chromium.org/p/chromium/issues/entry?' + 186 var url = 'https://bugs.chromium.org/p/chromium/issues/entry?' +
182 'labels=Pri-2,Type-Bug,Restrict-View-Google&' + 187 'labels=Pri-2,Type-Bug,Restrict-View-Google&' +
183 'summary=Result Details Feedback:&' + 188 'summary=Result Details Feedback:&' +
184 'comment=Please check out: ' + window.location; 189 'comment=Please check out: ' + window.location;
185 var newWindow = window.open(url, '_blank'); 190 var newWindow = window.open(url, '_blank');
186 newWindow.focus(); 191 newWindow.focus();
187 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698