diff --git a/puppetboard/app.py b/puppetboard/app.py index ed1a52f..d613d14 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 + ten_reports, limit_reports, jsonprint ) @@ -173,12 +173,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') diff --git a/puppetboard/default_settings.py b/puppetboard/default_settings.py index 12f9e20..82f85ba 100644 --- a/puppetboard/default_settings.py +++ b/puppetboard/default_settings.py @@ -9,3 +9,4 @@ DEV_LISTEN_PORT = 5000 UNRESPONSIVE_HOURS = 2 ENABLE_QUERY = 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) -%}