Fix rendering of metrics with dots in their name

This commit is contained in:
Eelco Dolstra 2016-03-25 13:24:43 +01:00
parent ef63dd77e3
commit dc2010eafc
2 changed files with 11 additions and 7 deletions

View file

@ -574,6 +574,8 @@ BLOCK createChart %]
requestJSON({
url: "[%dataUrl%]",
success: function(data) {
var id = "[%id%]";
var ids = [];
var d = [];
var maxTime = 0;
@ -600,9 +602,9 @@ BLOCK createChart %]
},
};
var plot = $.plot($("#[%id%]-chart"), [d], options);
var plot = $.plot($("#" + id + "-chart"), [d], options);
var overview = $.plot($("#[%id%]-overview"), [d], {
var overview = $.plot($("#" + id + "-overview"), [d], {
series: {
lines: { show: true, lineWidth: 1 },
shadowSize: 0
@ -614,7 +616,7 @@ BLOCK createChart %]
// now connect the two
$("#[%id%]-chart").bind("plotselected", function (event, ranges) {
$("#" + id + "-chart").bind("plotselected", function (event, ranges) {
var ymax = 0;
d.forEach(function(x) {
if (x[0] < ranges.xaxis.from) return;
@ -623,7 +625,7 @@ BLOCK createChart %]
});
// do the zooming
plot = $.plot($("#[%id%]-chart"), [d],
plot = $.plot($("#" + id + "-chart"), [d],
$.extend(true, {}, options, {
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to },
yaxis: { min: 0, max: ymax * 1.1 }
@ -633,11 +635,11 @@ BLOCK createChart %]
overview.setSelection(ranges, true);
});
$("#[%id%]-overview").bind("plotselected", function (event, ranges) {
$("#" + id + "-overview").bind("plotselected", function (event, ranges) {
plot.setSelection(ranges);
});
$("#[%id%]-chart").bind("plotclick", function (e, pos, item) {
$("#" + id + "-chart").bind("plotclick", function (e, pos, item) {
if (item) {
plot.highlight(item.series, item.datapoint);
buildid = data[item.dataIndex].id;

View file

@ -102,7 +102,9 @@ removed or had an evaluation error.</div>
<h3>Metric: <tt>[%HTML.escape(metric.name)%]</tt></h3>
[% INCLUDE createChart id="metric-${metric.name}" dataUrl=c.uri_for('/job' project.name jobset.name job.name 'metric' metric.name) %]
[% id = "metric-" _ metric.name;
id = id.replace('\.', '_');
INCLUDE createChart dataUrl=c.uri_for('/job' project.name jobset.name job.name 'metric' metric.name); %]
[% END %]