From dc2010eafcc395308016cb5525db525585997e40 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 25 Mar 2016 13:24:43 +0100 Subject: [PATCH] Fix rendering of metrics with dots in their name --- src/root/common.tt | 14 ++++++++------ src/root/job.tt | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/root/common.tt b/src/root/common.tt index 40708567..f7593e02 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -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; diff --git a/src/root/job.tt b/src/root/job.tt index a9e1ca77..0a621e44 100644 --- a/src/root/job.tt +++ b/src/root/job.tt @@ -102,7 +102,9 @@ removed or had an evaluation error.

Metric: [%HTML.escape(metric.name)%]

- [% 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 %]