Add basic support for node status by using the most recent report

The following frontend features are implemented
- Number of failures, successes, noops/skips in overview
- Show latest reports with 1 or more events in overview
- Direct links to latest Report
- Number and types of events in nodes list
This commit is contained in:
Julius Härtl
2013-10-25 15:43:14 +02:00
parent efae19dc6d
commit 7c027dd97d
6 changed files with 110 additions and 14 deletions

View File

@@ -1,11 +1,27 @@
{% extends 'layout.html' %}
{% block row_fluid %}
<div class="span12">
<div class='alert alert-info'>
We need something fancy here.
</div>
</div>
<div class="container" style="margin-bottom:55px;">
<div class="row">
<h2>Statistics</h2>
<hr />
</div>
<div class="row">
<div class="span12">
<div class="span4 stat">
<h1 class="error">{{latest_event_count['failures']}} Failures</h1>
<span>in the latest node reports</span>
</div>
<div class="span4 stat">
<h1 class="success">{{latest_event_count['successes']}} Successes</h1>
<span>in the latest node reports</span>
</div>
<div class="span4 stat">
<h1 class="noop">{{latest_event_count['noopskip']}} Noop/Skip</h1>
<span>in the latest node reports</span>
</div>
</div>
</div>
<div class="row">
<div class="span12">
<div class="span4 stat">
@@ -34,5 +50,25 @@
</div>
</div>
</div>
<div class="row">
<div class="span12">
<h2>Latest Reports with events</h2>
<hr />
<table class='nodes table table-striped table-condensed'>
<tbody class="searchable">
{% for event in latest_events %}
<tr>
<td>{% if event['failures'] %}<span class="label label-important numtag">{{event['failures']}}</span>{% endif%}</td>
<td>{% if event['successes'] %}<span class="label label-success numtag">{{event['successes']}}</span>{% endif%}</td>
<td style="width:730px;"><a href="{{url_for('node', node_name=event['subject']['title'])}}">{{event['subject']['title']}}</a></td>
<td><a class="btn btn-small btn-primary" href="{{url_for('report_latest', node_name=event['subject']['title'])}}">Latest Report</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock row_fluid %}

View File

@@ -18,6 +18,7 @@
<table class='nodes table table-striped table-condensed'>
<thead>
<tr>
<th width>Status</th>
<th>Hostname</th>
<th>Catalog compiled at</th>
{% if config.PUPPETDB_API > 2 %}
@@ -29,6 +30,16 @@
<tbody class="searchable">
{% for node in nodes %}
<tr>
<td><a href="{{url_for('report_latest', node_name=node.name)}}">
{% if node.status %}
{% if node.status['failures'] %}<span class="label label-important">{{node.status['failures']}}</span>{% endif %}
{% if node.status['successes'] %}<span class="label label-success">{{node.status['successes']}}</span>{% endif %}
{% if node.status['noops'] or node.status['skips'] %}<span class="label">{{node.status['skips']+node.status['noops']}}</span>{% endif %}
{% else %}
<span class="label">0</span>
{% endif %}
</a>
</td>
<td><a href="{{url_for('node', node_name=node.name)}}">{{node.name}}</a></td>
<td rel="utctimestamp">{{node.catalog_timestamp}}</td>
{% if config.PUPPETDB_API > 2 %}