Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
bug 719928 - extract config.js from common/dashboard, patch by Ryosuk…
Browse files Browse the repository at this point in the history
…e Niwa
  • Loading branch information
rhelmer committed Jan 21, 2012
1 parent 5028e19 commit c6476a7
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 109 deletions.
1 change: 1 addition & 0 deletions embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<script type="text/javascript" src="jq/flot-0.7/jquery.flot.min.js"></script>
<script type="text/javascript" src="jq/flot-0.7/jquery.flot.selection.min.js"></script>
<script type="text/javascript" src="jq/flot-0.7/jquery.flot.crosshair.min.js"></script>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/embed.js"></script>

Expand Down
1 change: 1 addition & 0 deletions graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ <h2>Add Test Data</h2>
<script type="text/javascript" src="jq/flot-0.7/jquery.flot.min.js"></script>
<script type="text/javascript" src="jq/flot-0.7/jquery.flot.selection.min.js"></script>
<script type="text/javascript" src="jq/flot-0.7/jquery.flot.crosshair.min.js"></script>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/graph-2.js"></script>

Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ <h1>
<script type="text/javascript" src="jq/flot-0.7/jquery.flot.min.js"></script>
<script type="text/javascript" src="jq/flot-0.7/jquery.flot.selection.min.js"></script>
<script type="text/javascript" src="jq/flot-0.7/jquery.flot.crosshair.min.js"></script>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/dashboard.js"></script>

Expand Down
88 changes: 0 additions & 88 deletions js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,94 +11,6 @@ var prevSeriesIndex = -1,
prevDataIndex = -1;
var allSeries = {};

var USE_GENERATED_IMAGES_IN_DASHBOARD = true;
var MAX_GRAPHS = 6;
var MAX_CSETS = 100;
var DAY = 86400000;

var COLORS = ['#e7454c', '#6dba4b', '#4986cf', '#f5983d', '#884e9f',
'#bf5c41'];

var SERVER = 'http://graphs-new.mozilla.org';
//var SERVER = 'http://localhost';

var LIGHT_COLORS = $.map(COLORS, function(color) {
return $.color.parse(color).add('a', -.5).toString();
});

// FIXME get this from the server instead of hardcoding
var HGWEB = 'http://hg.mozilla.org';
function repoMap(branch)
{
branch = branch.toLowerCase();

var map = {
'firefox': 'mozilla-central',
'tracemonkey': 'tracemonkey',
'seamonkey': 'comm-central',
'thunderbird': 'comm-central',
'mozilla-inbound': 'integration/mozilla-inbound',
'try': 'try',
'mobile': 'mozilla-central'
};

if (branch.indexOf('-non-pgo') != -1) {
branch = branch.split('-non-pgo')[0];
}

if (branch in map) {
return HGWEB + '/' + map[branch];
} else {
return HGWEB + '/projects/' + branch;
}
}

function urlForChangeset(branch, changeset)
{
return repoMap(branch) + '/rev/' + changeset;
}

function urlForChangesetList(branch, csets)
{
return repoMap(branch) + '/pushloghtml?changeset=' +
csets.join('&changeset=');
}

var PLOT_OPTIONS = {
xaxis: { mode: 'time' },
yaxis: { min: 0 },
selection: { mode: 'x', color: '#97c6e5' },
/* crosshair: { mode: 'xy', color: '#cdd6df', lineWidth: 1 }, */
series: { shadowSize: 0 },
lines: { show: false },
points: { show: true },
grid: {
color: '#cdd6df',
borderWidth: 2,
backgroundColor: '#fff',
hoverable: true,
clickable: true,
autoHighlight: false
}
};


var OVERVIEW_OPTIONS = {
xaxis: { mode: 'time' },
yaxis: { min: 0 },
selection: { mode: 'x', color: '#97c6e5' },
series: {
lines: { show: true, lineWidth: 1 },
shadowSize: 0
},
grid: {
color: '#cdd6df',
borderWidth: 2,
backgroundColor: '#fff',
tickColor: 'rgba(0,0,0,0)'
}
};

function debug(message)
{
if (typeof(console) !== 'undefined' && console != null) {
Expand Down
110 changes: 110 additions & 0 deletions js/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

var USE_GENERATED_IMAGES_IN_DASHBOARD = true;
var MAX_GRAPHS = 6;
var MAX_CSETS = 100;
var DAY = 86400000;

var COLORS = ['#e7454c', '#6dba4b', '#4986cf', '#f5983d', '#884e9f',
'#bf5c41'];

var SERVER = 'http://graphs-new.mozilla.org';
//var SERVER = 'http://localhost';

var LIGHT_COLORS = $.map(COLORS, function(color) {
return $.color.parse(color).add('a', -.5).toString();
});

var PLOT_OPTIONS = {
xaxis: { mode: 'time' },
yaxis: { min: 0 },
selection: { mode: 'x', color: '#97c6e5' },
/* crosshair: { mode: 'xy', color: '#cdd6df', lineWidth: 1 }, */
series: { shadowSize: 0 },
lines: { show: false },
points: { show: true },
grid: {
color: '#cdd6df',
borderWidth: 2,
backgroundColor: '#fff',
hoverable: true,
clickable: true,
autoHighlight: false
}
};

var OVERVIEW_OPTIONS = {
xaxis: { mode: 'time' },
yaxis: { min: 0 },
selection: { mode: 'x', color: '#97c6e5' },
series: {
lines: { show: true, lineWidth: 1 },
shadowSize: 0
},
grid: {
color: '#cdd6df',
borderWidth: 2,
backgroundColor: '#fff',
tickColor: 'rgba(0,0,0,0)'
}
};

// FIXME get this from the server instead of hardcoding
var HGWEB = 'http://hg.mozilla.org';
function repoMap(branch)
{
branch = branch.toLowerCase();

var map = {
'firefox': 'mozilla-central',
'tracemonkey': 'tracemonkey',
'seamonkey': 'comm-central',
'thunderbird': 'comm-central',
'mozilla-inbound': 'integration/mozilla-inbound',
'try': 'try',
'mobile': 'mozilla-central'
};

if (branch.indexOf('-non-pgo') != -1) {
branch = branch.split('-non-pgo')[0];
}

if (branch in map) {
return HGWEB + '/' + map[branch];
} else {
return HGWEB + '/projects/' + branch;
}
}

function urlForChangeset(branch, changeset)
{
return repoMap(branch) + '/rev/' + changeset;
}

function urlForChangesetList(branch, csets)
{
return repoMap(branch) + '/pushloghtml?changeset=' +
csets.join('&changeset=');
}

// FIXME move this back to dashboard.js once the bug 718925 is fixed
function fetchDashboardManifest()
{
return {
'defaultBranch': 'Firefox',
'branchToId': {'Firefox': 1},
'platformToId': {
'Windows 7': 12,
'Windows XP': 1,
'Mac OS X': 13,
'Linux': 14
},
'testToId': {
'Ts': 83,
'Tp': 115,
'SunSpider': 104
}
};
}
26 changes: 5 additions & 21 deletions js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,14 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
(function($) {

var branchToId;
var platformToId;
var testToId;
var dashboardManifest = fetchDashboardManifest();
var branchToId = dashboardManifest['branchToId'];
var platformToId = dashboardManifest['platformToId'];
var testToId = dashboardManifest['testToId'];

function fetchDashboardManifest()
{
defaultBranch = 'Firefox';
branchToId = {'Firefox': 1};
platformToId = {
'Windows 7': 12,
'Windows XP': 1,
'Mac OS X': 13,
'Linux': 14
};
testToId = {
'Ts': 83,
'Tp': 115,
'SunSpider': 104
};
}
fetchDashboardManifest();

var DEFAULT_DISPLAYDAYS = 7;
var DEFAULT_BRANCH = defaultBranch;
var DEFAULT_BRANCH = dashboardManifest['defaultBranch'];
var DEFAULT_PLATFORM = [];
var DEFAULT_TEST = [];

Expand Down

0 comments on commit c6476a7

Please sign in to comment.