diff options
author | 2017-08-28 17:42:38 +0000 | |
---|---|---|
committer | 2017-08-28 17:42:38 +0000 | |
commit | 6848d519dfa7c8aec38ab6d084df3d08196c0ad3 (patch) | |
tree | 447efed2ade9e2855c7e86f3edaec4135252ac86 /docker/storperf-reporting/src/app.py | |
parent | 71aa00561577cafb28a7f2ae4809d36b0c2b5d55 (diff) | |
parent | 3bd890facc1546fcc1dea2e372937675236af4e8 (diff) |
Merge "Handling multiple data scenario JIRA: STORPERF-163"
Diffstat (limited to 'docker/storperf-reporting/src/app.py')
-rw-r--r-- | docker/storperf-reporting/src/app.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/docker/storperf-reporting/src/app.py b/docker/storperf-reporting/src/app.py index 330edf9..39ea259 100644 --- a/docker/storperf-reporting/src/app.py +++ b/docker/storperf-reporting/src/app.py @@ -19,15 +19,20 @@ app.secret_key = 'storperf_graphing_module' def get_data(data): metrics = {} report_data = {} - temp = data.get("results") or data.get("report") + temp = data.get("results") or data.get("report") or data.get("details") if type(temp) is list: - details = temp[0].get('details') - metrics = details.get('metrics') - report_data = details.get('report_data') + length = len(temp) + if length == 1: + details = temp[0].get('details') + metrics = details.get('metrics') + report_data = details.get('report_data') + return "single", metrics, report_data + else: + return "multi", temp else: metrics = temp.get('metrics') report_data = temp.get('report_data') - return metrics, report_data + return "single", metrics, report_data @app.route('/reporting/success/') @@ -39,9 +44,14 @@ def success(): else: data = open("./static/testdata/" + URL).read() data = json.loads(data) - metrics, report_data = get_data(data) - return render_template('plot_tables.html', - metrics=metrics, report_data=report_data) + response = get_data(data) + if response[0] == "single": + metrics, report_data = response[1], response[2] + return render_template('plot_tables.html', + metrics=metrics, report_data=report_data) + else: + return render_template('plot_multi_data.html', + results=response[1]) except Exception as e: session['server_error'] = e.message + ' ' + repr(e.args) return redirect(url_for('file_not_found')) |