[LNT] r204366 - Enable json export of graph data
Chris Matthews
cmatthews5 at apple.com
Thu Mar 20 11:21:49 PDT 2014
Author: cmatthews
Date: Thu Mar 20 13:21:49 2014
New Revision: 204366
URL: http://llvm.org/viewvc/llvm-project?rev=204366&view=rev
Log:
Enable json export of graph data
If passing json=true to the graphing page, export the graph data as json instead of HTML.
Modified:
lnt/trunk/lnt/server/ui/views.py
Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=204366&r1=204365&r2=204366&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Thu Mar 20 13:21:49 2014
@@ -693,6 +693,26 @@ def v4_graph():
"data" : moving_median_data,
"color" : util.toColorString(col) })
+ if bool(request.args.get('json')):
+ json_obj = dict()
+ json_obj['data'] = graph_plots
+ # Flatten ORM machine objects to their string names.
+ simple_type_legend = []
+ for machine, test, unit, color in legend:
+ # Flatten name, make color a dict.
+ new_entry = {'name':machine.name,
+ 'test':test,
+ 'unit': unit,
+ 'color': {'r': color[0],
+ 'g': color[1],
+ 'b': color[2]}}
+ simple_type_legend.append(new_entry)
+ json_obj['legend'] = simple_type_legend
+ json_obj['revision_range'] = revision_range
+ json_obj['current_options'] = options
+ json_obj['test_suite_name'] = ts.name
+ return flask.jsonify(**json_obj)
+
return render_template("v4_graph.html", ts=ts, options=options,
revision_range=revision_range,
graph_plots=graph_plots,
More information about the llvm-commits
mailing list