Skip to content

Commit 26e7ed3

Browse files
georges-armTamarChristinaArm
authored andcommitted
Remove unused key suffix in graphs.
As far as I can tell this suffix is completely unused, serving only to distinguish request args with the same name. Flask already has the ability to deal with such cases, so just do that instead. Change-Id: I8e8b5514c2ece5b3e53d9b85b4d2476cab6d989f
1 parent aa22cff commit 26e7ed3

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

lnt/server/ui/templates/v4_graph.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,9 @@
257257
</table>
258258

259259
{# Add all the hidden fields. #}
260-
{% for name,value in request.args.items() %}
261-
{% if name.startswith('plot.') %}
260+
{% for name,values in request.args.to_dict(flat=False).items() %}
261+
{% for value in values %}
262+
{% if name == 'plot' %}
262263
<input type="hidden" name="{{name}}" value="{{value}}"/>
263264
{% endif %}
264265
{% if name.startswith('baseline.') %}
@@ -268,6 +269,7 @@
268269
<input type="hidden" name="{{name}}" value="{{value}}"/>
269270
{% endif %}
270271
{% endfor %}
272+
{% endfor %}
271273

272274
<input class="btn btn-primary" style="clear: left; width: 100%"
273275
type="submit" name="submit" value="Update" />

lnt/server/ui/templates/v4_run.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
$('.profile-but-no-prev').tooltip();
3434
$('.profile-prev-only').tooltip();
3535
{% endblock %}
36-
36+
3737
{% block title %}Run Results{% endblock %}
3838

3939
{% macro get_cell_value(cr, field) %}
@@ -345,9 +345,9 @@ <h4>Parameters</h4>
345345
<tbody class="searchable">
346346
{% for test_name,test_id,cr in tests %}
347347
<tr>
348-
<td><input type="checkbox" name="plot.{{test_id}}" value="{{machine.id}}.{{test_id}}.{{field_index}}"/></td>
348+
<td><input type="checkbox" name="plot" value="{{machine.id}}.{{test_id}}.{{field_index}}"/></td>
349349
<td class="benchmark-name">
350-
<a href="{{graph_base}}&amp;plot.{{test_id}}={{ machine.id}}.{{test_id}}.{{field_index}}">
350+
<a href="{{graph_base}}&amp;plot={{machine.id}}.{{test_id}}.{{field_index}}">
351351
{{ test_name }}
352352
</a>
353353
{{ utils.render_profile_link(cr.cur_profile, cr.prev_profile, run.id, compare_to.id, test_id) }}

lnt/server/ui/views.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,7 @@ def v4_run_graph(id):
694694
abort(404, "Invalid run id {}".format(id))
695695

696696
# Convert the old style test parameters encoding.
697-
args = {'highlight_run': id}
698-
plot_number = 0
697+
args = {'highlight_run': id, 'plot': []}
699698
for name, value in request.args.items():
700699
# If this isn't a test specification, just forward it.
701700
if not name.startswith('test.'):
@@ -708,11 +707,10 @@ def v4_run_graph(id):
708707
#
709708
# into the new style of::
710709
#
711-
# plot.<number>=<machine id>.<test id>.<sample field index>
710+
# plot=<machine id>.<test id>.<sample field index>
712711
test_id = name.split('.', 1)[1]
713-
args['plot.%d' % (plot_number,)] = '%d.%s.%s' % (
714-
run.machine.id, test_id, value)
715-
plot_number += 1
712+
args['plot'].append('%d.%s.%s' % (
713+
run.machine.id, test_id, value))
716714

717715
return v4_redirect(v4_url_for(".v4_graph", **args))
718716

@@ -750,7 +748,7 @@ def v4_graph_for_sample(sample_id, field_name):
750748
if field_index is None:
751749
abort(400, "Could not find field {}".format(field_name))
752750

753-
kwargs = {'plot.0': '{machine_id}.{test_id}.{field_index}'.format(
751+
kwargs = {'plot': '{machine_id}.{test_id}.{field_index}'.format(
754752
machine_id=target_sample.run.machine.id,
755753
test_id=target_sample.test_id,
756754
field_index=field_index)}
@@ -1760,10 +1758,8 @@ def v4_matrix():
17601758
"""A table view for Run sample data, because *some* people really
17611759
like to be able to see results textually.
17621760
request.args.limit limits the number of samples.
1763-
for each dataset to add, there will be a "plot.n=.m.b.f" where m is machine
1764-
ID, b is benchmark ID and f os field kind offset. "n" is used to unique
1765-
the paramters, and is ignored.
1766-
1761+
for each dataset to add, there will be a "plot=.m.b.f" where m is machine
1762+
ID, b is benchmark ID and f os field kind offset.
17671763
"""
17681764
session = request.session
17691765
ts = request.get_testsuite()

0 commit comments

Comments
 (0)