From 5426fce354b0e53d8a00e7cdfce422bb8dc5f0f9 Mon Sep 17 00:00:00 2001 From: William Lachance Date: Sat, 5 Oct 2013 13:08:32 -0400 Subject: [PATCH] Bug 923358 - Fix missing graph in framediff view for startup tests;r=davehunt --- src/dashboard/js/index.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/dashboard/js/index.js b/src/dashboard/js/index.js index c9aeaa6..9d7b1d2 100644 --- a/src/dashboard/js/index.js +++ b/src/dashboard/js/index.js @@ -1,6 +1,13 @@ "use strict"; var serverPrefix = ""; // set this to e.g. `http://eideticker.mozilla.org/` to serve remote data to a local server +function getResourceURL(path) { + if (!path) + return null; + + return serverPrefix + path; +} + function parseDate(datestr) { var parsed = datestr.split("-"); @@ -25,7 +32,7 @@ var measures = { } function updateContent(testInfo, deviceId, testId, measureId) { - $.getJSON(serverPrefix + deviceId + '/' + testId + '.json', function(dict) { + $.getJSON(getResourceURL(deviceId + '/' + testId + '.json'), function(dict) { if (!dict || !dict['testdata']) { $('#content').html("

No data for that device/test combination. :(

"); return; @@ -106,7 +113,7 @@ function updateGraph(title, rawdata, measure) { sourceRepo = "http://hg.mozilla.org/mozilla-central"; } metadataHash[seriesIndex].push({ - 'videoURL': serverPrefix + sample.video, + 'videoURL': getResourceURL(sample.video), 'dateStr': datestr, 'appDate': sample.appdate, 'sourceRepo': sourceRepo, @@ -115,10 +122,10 @@ function updateGraph(title, rawdata, measure) { 'gaiaRevision': sample.gaiaRevision, 'prevRevision': prevRevision, 'buildId': sample.buildid, - 'profileURL': serverPrefix + sample.profile, - 'frameDiff': serverPrefix + sample.frameDiff, - 'actionLog': serverPrefix + sample.actionLog, - 'httpLog': serverPrefix + sample.httpLog + 'profileURL': getResourceURL(sample.profile), + 'frameDiff': getResourceURL(sample.frameDiff), + 'actionLog': getResourceURL(sample.actionLog), + 'httpLog': getResourceURL(sample.httpLog) }); } }); @@ -269,15 +276,16 @@ function updateGraph(title, rawdata, measure) { $(function() { var graphData = {}; - $.getJSON(serverPrefix + 'devices.json', function(deviceData) { + $.getJSON(getResourceURL('devices.json'), function(deviceData) { var devices = deviceData['devices']; var deviceIds = Object.keys(devices); $.when.apply($, deviceIds.map(function(deviceId) { - return $.getJSON(serverPrefix + [deviceId, 'tests.json'].join('/'), function(testData) { - var tests = testData['tests']; - devices[deviceId]['tests'] = tests; - }); + return $.getJSON(getResourceURL([deviceId, 'tests.json'].join('/')), + function(testData) { + var tests = testData['tests']; + devices[deviceId]['tests'] = tests; + }); })).done(function() { // initialize device chooser