diff --git a/README.rst b/README.rst index a0809a3..997e904 100644 --- a/README.rst +++ b/README.rst @@ -630,12 +630,6 @@ Screenshots :height: 700 :align: center -.. image:: https://raw.github.com/nedap/puppetboard/master/screenshots/report_message.png - :alt: Report view with message - :width: 1024 - :height: 700 - :align: center - .. image:: https://raw.github.com/nedap/puppetboard/master/screenshots/facts.png :alt: Facts view :width: 1024 diff --git a/puppetboard/app.py b/puppetboard/app.py index c203b6f..11b1ccd 100644 --- a/puppetboard/app.py +++ b/puppetboard/app.py @@ -21,7 +21,7 @@ from pypuppetdb import connect from puppetboard.forms import QueryForm from puppetboard.utils import ( get_or_abort, yield_or_stop, - ten_reports, jsonprint + limit_reports, jsonprint ) @@ -176,12 +176,13 @@ def node(node_name): """ node = get_or_abort(puppetdb.node, node_name) facts = node.facts() - reports = ten_reports(node.reports()) + reports = limit_reports(node.reports(), app.config['REPORTS_COUNT']) return render_template( 'node.html', node=node, facts=yield_or_stop(facts), - reports=yield_or_stop(reports)) + reports=yield_or_stop(reports), + reports_count=app.config['REPORTS_COUNT']) @app.route('/reports') @@ -195,12 +196,13 @@ def reports(): def reports_node(node): """Fetches all reports for a node and processes them eventually rendering a table displaying those reports.""" - reports = ten_reports(yield_or_stop( - puppetdb.reports('["=", "certname", "{0}"]'.format(node)))) + reports = limit_reports(yield_or_stop( + puppetdb.reports('["=", "certname", "{0}"]'.format(node))), app.config['REPORTS_COUNT']) return render_template( 'reports_node.html', reports=reports, - nodename=node) + nodename=node, + reports_count=app.config['REPORTS_COUNT']) @app.route('/report/latest/') diff --git a/puppetboard/default_settings.py b/puppetboard/default_settings.py index a48bfc7..1333957 100644 --- a/puppetboard/default_settings.py +++ b/puppetboard/default_settings.py @@ -10,3 +10,4 @@ UNRESPONSIVE_HOURS = 2 ENABLE_QUERY = True LOCALISE_TIMESTAMP = True LOGLEVEL = 'info' +REPORTS_COUNT = 10 diff --git a/puppetboard/templates/_macros.html b/puppetboard/templates/_macros.html index 3c0bad5..c0be9a5 100644 --- a/puppetboard/templates/_macros.html +++ b/puppetboard/templates/_macros.html @@ -95,9 +95,13 @@ {%- endmacro %} -{% macro reports_table(reports, nodename, condensed=False, hash_truncate=False, show_conf_col=True, show_agent_col=True, show_host_col=True) -%} + + +{% macro reports_table(reports, nodename, reports_count, condensed=False, hash_truncate=False, show_conf_col=True, show_agent_col=True, show_host_col=True) -%}
- Only showing the last ten reports. + + Only showing the last {{reports_count}} reports. +
diff --git a/puppetboard/templates/node.html b/puppetboard/templates/node.html index b5b4519..b0e83c9 100644 --- a/puppetboard/templates/node.html +++ b/puppetboard/templates/node.html @@ -28,7 +28,7 @@

Reports

- {{ macros.reports_table(reports, node.name, condensed=True, hash_truncate=True, show_conf_col=False, show_agent_col=False, show_host_col=False)}} + {{ macros.reports_table(reports, node.name, reports_count, condensed=True, hash_truncate=True, show_conf_col=False, show_agent_col=False, show_host_col=False)}}
diff --git a/puppetboard/templates/reports_node.html b/puppetboard/templates/reports_node.html index 028911d..885b357 100644 --- a/puppetboard/templates/reports_node.html +++ b/puppetboard/templates/reports_node.html @@ -1,5 +1,5 @@ {% extends 'layout.html' %} {% import '_macros.html' as macros %} {% block content %} -{{ macros.reports_table(reports, nodename, condensed=False, hash_truncate=False, show_conf_col=True, show_agent_col=True, show_host_col=True)}} +{{ macros.reports_table(reports, nodename, reports_count, condensed=False, hash_truncate=False, show_conf_col=True, show_agent_col=True, show_host_col=True)}} {% endblock content %} diff --git a/puppetboard/utils.py b/puppetboard/utils.py index 608fbae..0699345 100644 --- a/puppetboard/utils.py +++ b/puppetboard/utils.py @@ -28,17 +28,16 @@ def get_or_abort(func, *args, **kwargs): abort(204) -def ten_reports(reports): - """Helper to yield the first then reports from the reports generator. +def limit_reports(reports, limit): + """Helper to yield a number of from the reports generator. This is an ugly solution at best... """ for count, report in enumerate(reports): - if count == 10: + if count == limit: raise StopIteration yield report - def yield_or_stop(generator): """Similar in intent to get_or_abort this helper will iterate over our generators and handle certain errors. diff --git a/screenshots/broken.png b/screenshots/broken.png index 5167a8d..3ae2ba4 100644 Binary files a/screenshots/broken.png and b/screenshots/broken.png differ diff --git a/screenshots/fact.png b/screenshots/fact.png index 0fff917..2e5311a 100644 Binary files a/screenshots/fact.png and b/screenshots/fact.png differ diff --git a/screenshots/fact_value.png b/screenshots/fact_value.png index ad42e69..0af2377 100644 Binary files a/screenshots/fact_value.png and b/screenshots/fact_value.png differ diff --git a/screenshots/facts.png b/screenshots/facts.png index b3a9336..b9ca2ec 100644 Binary files a/screenshots/facts.png and b/screenshots/facts.png differ diff --git a/screenshots/metric.png b/screenshots/metric.png index 3759e0d..f6e8b2c 100644 Binary files a/screenshots/metric.png and b/screenshots/metric.png differ diff --git a/screenshots/metrics.png b/screenshots/metrics.png index b64f034..b030d3b 100644 Binary files a/screenshots/metrics.png and b/screenshots/metrics.png differ diff --git a/screenshots/node.png b/screenshots/node.png index 1ea35b4..06095bd 100644 Binary files a/screenshots/node.png and b/screenshots/node.png differ diff --git a/screenshots/nodes.png b/screenshots/nodes.png index 947201f..9c2fa64 100644 Binary files a/screenshots/nodes.png and b/screenshots/nodes.png differ diff --git a/screenshots/overview.png b/screenshots/overview.png index 9bcaa59..69b92d7 100644 Binary files a/screenshots/overview.png and b/screenshots/overview.png differ diff --git a/screenshots/query.png b/screenshots/query.png index b56c27f..23b361a 100644 Binary files a/screenshots/query.png and b/screenshots/query.png differ diff --git a/screenshots/report.png b/screenshots/report.png index 88dc934..23b4180 100644 Binary files a/screenshots/report.png and b/screenshots/report.png differ diff --git a/screenshots/report_message.png b/screenshots/report_message.png deleted file mode 100644 index cfaaf7a..0000000 Binary files a/screenshots/report_message.png and /dev/null differ