Added inventory page along with a navbar link.

Added inventory page showing a table similar to the "Nodes" one,
but containing any customizable set of facts.

A setting INVENTORY_FACTS has been added. It controls the list
of facts to be displayed along with a description for the header
of the table.
This commit is contained in:
Stoyan Stoyanov
2015-05-07 14:30:00 -07:00
parent a1160d2c1f
commit d75d5007a3
5 changed files with 103 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
{% extends 'layout.html' %}
{% block content %}
<div class="alert alert-info">
PuppetDB currently only returns active nodes.
</div>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{category}}">
{{message}}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div class="hide" style="margin-bottom:20px">
<input autofocus="autofocus" style="width:100%" type="text" class="filter-table input-medium search-query" placeholder="Type here to filter">
</div>
<table class='inventory table table-striped table-condensed'>
<thead>
<tr>
{% for description in fact_desc %}
<th>{{description}}</th>
{% endfor %}
</tr>
</thead>
<tbody class="searchable">
{% for nodename in nodedata %}
<tr>
{% for item in nodedata[nodename] %}
<td>{{item}}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endblock content %}

View File

@@ -33,6 +33,7 @@
('facts', 'Facts'),
('reports', 'Reports'),
('metrics', 'Metrics'),
('inventory', 'Inventory'),
('query', 'Query'),
] %}
<a {% if endpoint == request.endpoint %} class="active item" {% else %} class="item" {% endif %}