From 3cdc427b65617c14199e4fc9328ad48600119efb Mon Sep 17 00:00:00 2001 From: "Harris.Chu" <1726587+HarrisChu@users.noreply.github.com> Date: Fri, 21 Jun 2024 16:47:34 +0800 Subject: [PATCH] support comparison (#98) --- nebula_bench/controller.py | 29 ++- templates/comparison.html.j2 | 338 +++++++++++++++++++++++++++++++++++ 2 files changed, 366 insertions(+), 1 deletion(-) create mode 100644 templates/comparison.html.j2 diff --git a/nebula_bench/controller.py b/nebula_bench/controller.py index 22b3874..3e2e66c 100644 --- a/nebula_bench/controller.py +++ b/nebula_bench/controller.py @@ -171,7 +171,34 @@ def index(): outputs=outputs_name, current_output=current_output_name, ) - + @app.route("/comparison", methods=["GET"]) + def comparison(): + src = flask.request.args.get("src", "") + dst = flask.request.args.get("dst", "") + if src == "" : + src = self.get_latest_output() + if dst == "": + dst = self.get_latest_output() + if src == "" or dst == "": + return "No src or dst output" + src_data = self.get_data( + (setting.WORKSPACE_PATH / "output" / src).absolute() + ) + dst_data = self.get_data( + (setting.WORKSPACE_PATH / "output" / dst).absolute() + ) + outputs_name = [Path(output).name for output in self.get_all_output()] + + return flask.render_template( + "comparison.html.j2", + src_data=src_data, + dst_data=dst_data, + outputs=outputs_name, + server=True, + src_output=src, + dst_output=dst, + ) + app.run(host="0.0.0.0", port=port) def get_all_output(self): diff --git a/templates/comparison.html.j2 b/templates/comparison.html.j2 new file mode 100644 index 0000000..2ad9d7a --- /dev/null +++ b/templates/comparison.html.j2 @@ -0,0 +1,338 @@ + + + +
+ + +