# HG changeset patch # User sean # Date 1438771053 -7200 # Node ID 63b9f41c3008d8cb725fd2571fec2bc11c379f1d # Parent 50f4c64834cbb08a55b69387fc77391d2496317c made the charts a bit more modular - can now define the div_name and the script name in the .conf data diff -r 50f4c64834cb -r 63b9f41c3008 dash.conf --- a/dash.conf Tue Aug 04 16:00:07 2015 +0200 +++ b/dash.conf Wed Aug 05 12:37:33 2015 +0200 @@ -44,6 +44,12 @@ # status: (up / down) [required] # ONLY FOR DEBUGGING PURPOSE - WILL BE REMOVED LATER # simulates up and down events for mon-type-tiles +# +# div_name: (identifier) [required for d3js-types] +# +# script: (name of a script without extension) [required for d3js-types0] +# + [tile1] type=mon @@ -62,4 +68,5 @@ [tile4] type=d3js -status=display_issues_techintern +div_name=techintern +script=display_issues_techintern diff -r 50f4c64834cb -r 63b9f41c3008 modules/roundup_cc/__init__.py --- a/modules/roundup_cc/__init__.py Tue Aug 04 16:00:07 2015 +0200 +++ b/modules/roundup_cc/__init__.py Wed Aug 05 12:37:33 2015 +0200 @@ -23,10 +23,10 @@ # PATH = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) -def make_chart(chart_data_file): +def make_chart(chart_data_file, target_div_name): + mod = importlib.import_module("roundup_cc." + chart_data_file) - mod = importlib.import_module("roundup_cc." + chart_data_file) - return mod.get_chart() + return mod.get_chart(target_div_name) # test = exec(open(PATH + "/" + chart_data_file+'.py').read()) diff -r 50f4c64834cb -r 63b9f41c3008 modules/roundup_cc/graph.html --- a/modules/roundup_cc/graph.html Tue Aug 04 16:00:07 2015 +0200 +++ b/modules/roundup_cc/graph.html Wed Aug 05 12:37:33 2015 +0200 @@ -95,6 +95,8 @@ // makeChart(); // }; + var d3jsInjectionTarget="X"; + var critical=[]; var urgent=[]; var bug=[]; @@ -264,7 +266,7 @@ //draw the chart - function makeChart(){ + function makeChart(div_name){ //declaration var sizeOfSystemBorders = 20; @@ -320,7 +322,7 @@ .orient("left"); - var svg = d3.select(".chart") + var svg = d3.select("." + d3jsInjectionTarget) .append("svg") .attr("class", "svg") // .attr("width", width) diff -r 50f4c64834cb -r 63b9f41c3008 views/hello_template.tpl --- a/views/hello_template.tpl Tue Aug 04 16:00:07 2015 +0200 +++ b/views/hello_template.tpl Wed Aug 05 12:37:33 2015 +0200 @@ -182,11 +182,11 @@ <% for tile in tiles : type = "" - text = "" + tile_content = "" status = "" if tile["type"] == "mon" : type = "statusmon" - text = tile["source"] + tile_content = tile["source"] if tile["status"] == "up" : status = "active" elif tile["status"] == "down" : @@ -194,13 +194,13 @@ end elif tile["type"] == "d3js" : type = "chart" - status = "" - text = roundup_cc.make_chart(tile["status"]) + status = "techintern" + tile_content = roundup_cc.make_chart(tile["script"], tile["div_name"]) end %>
- {{!text}} + {{!tile_content}}
% end