105 lines
3.2 KiB
HTML
105 lines
3.2 KiB
HTML
{% macro facts_table(facts, autofocus=False, condensed=False, show_node=False, margin_top=20, margin_bottom=20) -%}
|
|
<div class="filter" style="margin-bottom:{{margin_bottom}}px;margin-top:{{margin_top}}px;">
|
|
<input {% if autofocus %} autofocus="autofocus" {% endif %} style="width:100%" type="text" class="filter-table input-medium search-query" placeholder="Type here to filter">
|
|
</div>
|
|
<table class="filter-table table table-striped {% if condensed %}table-condensed{% endif%}" style="table-layout:fixed">
|
|
<thead>
|
|
<tr>
|
|
{% if show_node %}
|
|
<th>Node</th>
|
|
{% else %}
|
|
<th>Fact</th>
|
|
{% endif %}
|
|
<th>Value</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="searchable">
|
|
{% for fact in facts %}
|
|
<tr>
|
|
{% if show_node %}
|
|
<td><a href="{{url_for('node', node_name=fact.node)}}">{{fact.node}}</a></td>
|
|
{% else %}
|
|
<td><a href="{{url_for('fact', fact=fact.name)}}">{{fact.name}}</a></td>
|
|
{% endif %}
|
|
<td style="word-wrap:break-word">{{fact.value}}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{%- endmacro %}
|
|
{% macro facts_graph(facts, autofocus=False, condensed=False, show_node=False, margin_top=20, margin_bottom=20) -%}
|
|
<script src="{{url_for('static', filename='js/Chart.js')}}"></script>
|
|
<canvas id="factChart" width="400" height="400"></canvas>
|
|
<script type="text/javascript">
|
|
var data = [
|
|
{% set color_list = ["#F38630", "#E0E4CC", "#69D2E7", "#D11151", "#787BE3", "#B59370", "#B30202"] %}
|
|
{% for fact in facts|groupby('value') %}
|
|
{
|
|
label: "{{ fact.grouper }}",
|
|
color: "{{ color_list|random }}",
|
|
value: {{ fact.list|length }}
|
|
},
|
|
{% endfor %}
|
|
{
|
|
value: 0,
|
|
color: "#000000"
|
|
}
|
|
]
|
|
var ctx = document.getElementById("factChart").getContext("2d");
|
|
var myNewChart = new Chart(ctx).Pie(data);
|
|
new Chart(ctx).Pie(data);
|
|
</script>
|
|
{%- endmacro %}
|
|
|
|
{% macro reports_table(reports, nodename, condensed=False, hash_truncate=False, show_conf_col=True, show_agent_col=True, show_host_col=True) -%}
|
|
<div class="alert alert-info">
|
|
Only showing the last ten reports.
|
|
</div>
|
|
<table class='table table-striped {% if condensed %}table-condensed{% endif %}'>
|
|
<thead>
|
|
<tr>
|
|
<th>Start time</th>
|
|
<th>Run time</th>
|
|
<th>Full report</th>
|
|
{% if show_conf_col %}
|
|
<th>Configuration version</th>
|
|
{% endif %}
|
|
{% if show_agent_col %}
|
|
<th>Agent version</th>
|
|
{% endif %}
|
|
{% if show_host_col %}
|
|
<th>Hostname</th>
|
|
{% endif %}
|
|
<tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for report in reports %}
|
|
{% if hash_truncate %}
|
|
{% set rep_hash = "%s…"|format(report.hash_[0:6])|safe %}
|
|
{% else %}
|
|
{% set rep_hash = report.hash_ %}
|
|
{% endif %}
|
|
{% if report.failed %}
|
|
<tr class="error">
|
|
{% else %}
|
|
<tr>
|
|
{% endif %}
|
|
<td rel="utctimestamp">{{report.start}}</td>
|
|
<td>{{report.run_time}}</td>
|
|
|
|
<td><a href="{{url_for('report', node=nodename, report_id=report.hash_)}}">{{rep_hash}}</a></td>
|
|
{% if show_conf_col %}
|
|
<td>{{report.version}}</td>
|
|
{% endif %}
|
|
{% if show_agent_col %}
|
|
<td>{{report.agent_version}}</td>
|
|
{% endif %}
|
|
{% if show_host_col %}
|
|
<td>{{nodename}}</td>
|
|
{% endif %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{%- endmacro %}
|