| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 var statsViewerModule = (function(){ | 5 var statsViewerModule = (function(){ |
| 6 | 6 |
| 7 var container = null; | 7 var container = null; |
| 8 var indexDiv = null; | 8 var indexDiv = null; |
| 9 // Provide access to imported DOM in tests. | 9 // Provide access to imported DOM in tests. |
| 10 // In production, currentDocument == document. | 10 // In production, currentDocument == document. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 function main() { | 30 function main() { |
| 31 loadCQStatsList(displayStats); | 31 loadCQStatsList(displayStats); |
| 32 } | 32 } |
| 33 | 33 |
| 34 function displayStats(cqStatsList) { | 34 function displayStats(cqStatsList) { |
| 35 container.textContent = ''; | 35 container.textContent = ''; |
| 36 drawGraphs(buildGraphs(cqStatsList)); | 36 drawGraphs(buildGraphs(cqStatsList)); |
| 37 } | 37 } |
| 38 | 38 |
| 39 function loadCQStatsList(callback) { | 39 function loadCQStatsList(callback) { |
| 40 var url = '//chromium-cq-status.appspot.com/stats/query?project=' + project +
'&interval_minutes=' + intervalMinutes; | 40 var url = '//' + window.location.host + '/stats/query?project=' + project + |
| 41 '&interval_minutes=' + intervalMinutes; |
| 41 var cqStatsList = []; | 42 var cqStatsList = []; |
| 42 var defaultCount = null; | 43 var defaultCount = null; |
| 43 function queryCQStatsList(cursor) { | 44 function queryCQStatsList(cursor) { |
| 44 var queryURL = url; | 45 var queryURL = url; |
| 45 if (cursor !== null) { | 46 if (cursor !== null) { |
| 46 queryURL += '&cursor=' + encodeURIComponent(cursor); | 47 queryURL += '&cursor=' + encodeURIComponent(cursor); |
| 47 } | 48 } |
| 48 if (defaultCount !== null) { | 49 if (defaultCount !== null) { |
| 49 queryURL += '&count=' + Math.min(defaultCount, dataPoints - cqStatsList.le
ngth); | 50 queryURL += '&count=' + Math.min(defaultCount, dataPoints - cqStatsList.le
ngth); |
| 50 } | 51 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 } | 212 } |
| 212 | 213 |
| 213 return { | 214 return { |
| 214 'main': main, | 215 'main': main, |
| 215 'init': init, | 216 'init': init, |
| 216 'displayStats': displayStats, | 217 'displayStats': displayStats, |
| 217 'document': currentDocument, | 218 'document': currentDocument, |
| 218 }; | 219 }; |
| 219 | 220 |
| 220 })(); | 221 })(); |
| OLD | NEW |