=== modified file 'dashboard_app/static/dashboard_app/js/image-report.js'
@@ -236,8 +236,10 @@
if ($.jStorage.get(prefix + "_graph_type")) {
if ($.jStorage.get(prefix + "_graph_type") == "number") {
$('input:radio[name=graph_type][value="number"]').attr("checked", true);
- } else {
+ } else if ($.jStorage.get(prefix + "_graph_type") == "percentage") {
$('input:radio[name=graph_type][value="percentage"]').attr("checked", true);
+ } else { // measurements
+ $('input:radio[name=graph_type][value="measurements"]').attr("checked", true);
}
}
}
@@ -261,8 +263,10 @@
if (parameters[iter][0] == "graph_type" && parameters[iter][1] != "") {
if (parameters[iter][1] == "number") {
$('input:radio[name=graph_type][value="number"]').attr("checked", true);
- } else {
+ } else if (parameters[iter][1] == "percentage") {
$('input:radio[name=graph_type][value="percentage"]').attr("checked", true);
+ } else { // measurements
+ $('input:radio[name=graph_type][value="measurements"]').attr("checked", true);
}
}
}
@@ -280,6 +284,7 @@
// Get the plot data.
data = [];
+ units = "";
for (test in table_data) {
if ($("#test_select").val().indexOf(test) >= 0) {
@@ -292,12 +297,17 @@
if (row[iter]["cls"]) {
if ($('input:radio[name=graph_type]:checked').val() == "number") {
row_data.push([iter, row[iter]["passes"]]);
- } else {
+ } else if ($('input:radio[name=graph_type]:checked').val() == "percentage") {
if (isNaN(row[iter]["passes"]/row[iter]["total"])) {
row_data.push([iter, 0]);
} else {
row_data.push([iter, 100*row[iter]["passes"]/row[iter]["total"]]);
}
+ } else { // measurements
+ if (row[iter]["measurements"] && row[iter]["measurements"].length != 0) {
+ row_data.push([iter, row[iter]["measurements"][0]["measurement"]]);
+ units = row[iter]["measurements"][0]["units"];
+ }
}
}
}
@@ -366,6 +376,14 @@
options["yaxis"]["min"] = 0;
}
+ if (units != "") {
+ options["legend"]["labelFormatter"] = function(label, series) {
+ if (label.length > 20) {
+ return label.substring(0,20) + "...";
+ }
+ return label + " (" + units + ")";
+ }
+ }
$.plot($("#outer-container #inner-container"), data, options);
}
=== modified file 'dashboard_app/templates/dashboard_app/image-report.html'
@@ -76,6 +76,9 @@
<input type="radio" name="graph_type" onclick='update_table(columns, chart_data, test_names)' value="number">
By pass/fail test numbers
</input>
+ <input type="radio" name="graph_type" onclick='update_table(columns, chart_data, test_names)' value="measurements">
+ By measurements
+ </input>
</div>
</div>
=== modified file 'dashboard_app/views/images.py'
@@ -73,7 +73,7 @@
image = Image.objects.get(name=name)
filter_data = image.filter.as_data()
- matches = evaluate_filter(request.user, filter_data, prefetch_related=['launchpad_bugs'])[:50]
+ matches = evaluate_filter(request.user, filter_data, prefetch_related=['launchpad_bugs', 'test_results'])[:50]
build_number_to_cols = {}
@@ -88,6 +88,13 @@
else:
cls = 'present fail'
bug_ids = sorted([b.bug_id for b in test_run.launchpad_bugs.all()])
+
+ measurements = [{'item': str(item.test_case),
+ 'measurement': str(item.measurement),
+ 'units': str(item.units)
+ }
+ for item in test_run.test_results.all()]
+
test_run_data = dict(
present=True,
cls=cls,
@@ -96,6 +103,7 @@
total=denorm.count_pass + denorm.count_fail,
link=test_run.get_permalink(),
bug_ids=bug_ids,
+ measurements=measurements,
)
if (match.tag, test_run.bundle.uploaded_on) not in build_number_to_cols:
build_number_to_cols[(match.tag, test_run.bundle.uploaded_on)] = {