From e28eb5027d3e72b9f5eb80fc1768c930156613e8 Mon Sep 17 00:00:00 2001 From: Mike Terzo Date: Tue, 31 Jan 2017 03:00:01 -0500 Subject: [PATCH] Adding configuration option to specify the bar chart --- README.rst | 4 ++++ puppetboard/default_settings.py | 1 + puppetboard/docker_settings.py | 2 ++ puppetboard/templates/fact.html | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 4137c42..f936eb1 100644 --- a/README.rst +++ b/README.rst @@ -219,6 +219,9 @@ Other settings that might be interesting in no particular order: * ``ENABLE_QUERY``: Defaults to ``True`` causing a Query tab to show up in the web interface allowing users to write and execute arbitrary queries against a set of endpoints in PuppetDB. Change this to ``False`` to disable this. +* ``GRAPH_TYPE```: Specify the type of graph to display. Default is + pie, other good option is donut. Other choices can be found here: + `_C3JS_documentation` * ``GRAPH_FACTS``: A list of fact names to tell PuppetBoard to generate a pie-chart on the fact page. With some fact values being unique per node, like ipaddress, uuid, and serial number, as well as structured facts it was @@ -241,6 +244,7 @@ Other settings that might be interesting in no particular order: .. _pypuppetdb documentation: http://pypuppetdb.readthedocs.org/en/v0.1.0/quickstart.html#ssl .. _Flask documentation: http://flask.pocoo.org/docs/0.10/quickstart/#sessions +.. _C3JS_documentation: http://c3js.org/examples.html#chart Puppet Enterprise ----------------- diff --git a/puppetboard/default_settings.py b/puppetboard/default_settings.py index 9019488..717925b 100644 --- a/puppetboard/default_settings.py +++ b/puppetboard/default_settings.py @@ -21,6 +21,7 @@ TABLE_COUNT_SELECTOR = [10, 20, 50, 100, 500] OFFLINE_MODE = False ENABLE_CATALOG = False OVERVIEW_FILTER = None +GRAPH_TYPE = 'pie' GRAPH_FACTS = ['architecture', 'clientversion', 'domain', diff --git a/puppetboard/docker_settings.py b/puppetboard/docker_settings.py index fa0055c..e32ac2a 100644 --- a/puppetboard/docker_settings.py +++ b/puppetboard/docker_settings.py @@ -47,6 +47,8 @@ GRAPH_FACTS = [x.strip() for x in os.getenv('GRAPH_FACTS', GRAPH_FACTS_DEFAULT).split(',')] +GRAPH_TYPE = os.getenv('GRAPH_TYPE', 'pie') + # Tuples are hard to express as an environment variable, so here # the tupple can be listed as a list of items # export INVENTORY_FACTS="Hostname, fqdn, IP Address, ipaddress,.. etc" diff --git a/puppetboard/templates/fact.html b/puppetboard/templates/fact.html index e9a4b83..2e3380f 100644 --- a/puppetboard/templates/fact.html +++ b/puppetboard/templates/fact.html @@ -30,7 +30,7 @@ if (otherdata.length > 0) { bindto: '#factChart', data: { columns: realdata, - type : 'donut', + type : '{{config.GRAPH_TYPE|default('pie')}}', } }); {% endblock onload_script %}