summaryrefslogtreecommitdiffstats
path: root/reporting/docker/src/app.py
diff options
context:
space:
mode:
authorsaksham115 <saksham.agrawal@research.iiit.ac.in>2017-07-06 19:46:28 +0530
committersaksham115 <saksham.agrawal@research.iiit.ac.in>2017-07-06 19:48:09 +0530
commit99dd390e16ec256232def1c09b0ea23a570807d0 (patch)
tree66d0d377ede38f3bbfbafaf7a48a77f91771097b /reporting/docker/src/app.py
parent1d026b94b60937e4bfaad201d8104267efc3fe04 (diff)
Demo Code
Enter the URL of the json file available at testresults.opnfv.org. It presents the data in the tabular and plots the chart for the series. Data validation and some UI changes are yet to be made Change-Id: I90ceed4e8a3240face479539f127d5c922d19d0c JIRA: STORPERF-162 Signed-off-by: saksham115 <saksham.agrawal@research.iiit.ac.in>
Diffstat (limited to 'reporting/docker/src/app.py')
-rw-r--r--reporting/docker/src/app.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/reporting/docker/src/app.py b/reporting/docker/src/app.py
new file mode 100644
index 0000000..98bb3c6
--- /dev/null
+++ b/reporting/docker/src/app.py
@@ -0,0 +1,28 @@
+from flask import Flask, redirect, url_for, request, render_template,jsonify, session
+import requests, json
+import urllib, json
+app = Flask(__name__)
+app.secret_key = 'storperf_graphing_module'
+#global url
+
+@app.route('/success/')
+def success():
+ header = {'x-requested-with': 'XMLHttpRequest'}
+ data = urllib.urlopen(session["url"]).read()
+ data = json.loads(data)
+ return render_template('plot_tables.html', data = data)
+
+@app.route('/url',methods = ['POST', 'GET'])
+def url():
+ if request.method == 'POST':
+# global url
+ url = request.form['url']
+ session["url"] = url
+ return redirect(url_for('success'))
+
+@app.route('/')
+def index():
+ return render_template('index.html')
+
+if __name__ == '__main__':
+ app.run(host="0.0.0.0", debug = True, threaded=True) \ No newline at end of file