From 30c35a1afe667c25ef4c5efe037f28b0409109a8 Mon Sep 17 00:00:00 2001 From: chenxu <424024687@qq.com> Date: Tue, 18 Jul 2017 00:00:40 -0700 Subject: [PATCH] Add loading local static files option of template.html when rendering template.html, static files can be loaded from local path '/libs' by using include_libs args. Change-Id: I36d3457d36e5b831343409748e2e97b377e0cc92 --- osprofiler/cmd/commands.py | 6 ++++++ osprofiler/cmd/template.html | 31 ++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/osprofiler/cmd/commands.py b/osprofiler/cmd/commands.py index 6181a64..094dd5d 100644 --- a/osprofiler/cmd/commands.py +++ b/osprofiler/cmd/commands.py @@ -41,6 +41,8 @@ class TraceCommands(BaseCommand): help="show trace in JSON") @cliutils.arg("--html", dest="use_html", action="store_true", help="show trace in HTML") + @cliutils.arg("--local-libs", dest="local_libs", action="store_true", + help="use local static files of html in /libs/") @cliutils.arg("--dot", dest="use_dot", action="store_true", help="show trace in DOT language") @cliutils.arg("--render-dot", dest="render_dot_filename", @@ -87,6 +89,10 @@ class TraceCommands(BaseCommand): "$DATA", json.dumps(trace, indent=4, separators=(",", ": "), default=datetime_json_serialize)) + if args.local_libs: + output = output.replace("$LOCAL", "true") + else: + output = output.replace("$LOCAL", "false") elif args.use_dot: dot_graph = self._create_dot_graph(trace) output = dot_graph.source diff --git a/osprofiler/cmd/template.html b/osprofiler/cmd/template.html index ac31fc7..35cda50 100644 --- a/osprofiler/cmd/template.html +++ b/osprofiler/cmd/template.html @@ -2,12 +2,6 @@ - - - - - - + + + + - - -