Removed instance "Alerts Disabled" icon, cleaned up templates

This commit is contained in:
Jonathan Montineri 2014-08-01 15:12:20 +01:00 committed by David Buxton
parent b1d730103e
commit e604cf673f
8 changed files with 16 additions and 322 deletions

View File

@ -10,7 +10,6 @@
</tr>
{% else %}
<th>Name</th>
<th>Overall</th>
<th>Active checks</th>
<th>Disabled checks</th>
<th></th>
@ -18,13 +17,10 @@
</thead>
<tbody>
{% for instance in instances %}
<tr class="{% if instance.alerts_enabled %}enabled{% else %}warning{% endif %}">
<tr class="enabled">
<td>
<a href="{% url instance pk=instance.id %}" title="Alerts {% if instance.alerts_enabled %}enabled{% else %}disabled{% endif %}">{{instance.name}} </a>
</td>
<td>
<span class="label label-{% if not instance.alerts_enabled %}warning{% else %}{% if instance.overall_status == instance.PASSING_STATUS %}success{% else %}danger{% endif %}{% endif %}">{% if instance.alerts_enabled %}{{ instance.overall_status|lower|capfirst }}{% else %}Disabled{% endif %}</span>
</td>
<td>
<span class="label label-{% if instance.active_status_checks.all.count > 0 %}{% if instance.overall_status != instance.PASSING_STATUS %}danger{% else %}success{% endif %}{% else %}default{% endif %}">{{ instance.active_status_checks.all.count }}</span>
</td>

View File

@ -2,21 +2,21 @@
<div class="row">
<div class="col-xs-12">
<div class="col-xs-1"><h3><i class="{% if checks_type == "All" %}fa fa-cog{% else %}glyphicon glyphicon-{% if checks_type == "Http" %}arrow-up{% elif checks_type == "Jenkins" %}ok{% else %}signal{% endif %}{% endif %}"></i></h3></div>
<div class="col-xs-1"><h3><i class="{% if checks_type == "All" %}fa fa-cog{% else %}glyphicon glyphicon-{% if checks_type == "Http" %}arrow-up{% elif checks_type == "Jenkins" %}ok{% elif checks_type == "ICMP" %}transfer{% else %}signal{% endif %}{% endif %}"></i></h3></div>
<div class="col-xs-8"><h3>{{ checks_type }} checks</h3></div>
<div class="col-xs-3 text-right">
<h3>
&nbsp;{% if checks_type == "All" or checks_type == "Graphite" %}
<a href="{% url create-check %}?service={{ service.id }}" class=""><i class="glyphicon glyphicon-plus" title="Add new metric check"></i><i class="glyphicon glyphicon-signal" title="Add new metric check"></i></a>
<a href="{% url create-check %}?instance={{ instance.id }}&service={{ service.id }}" class=""><i class="glyphicon glyphicon-plus" title="Add new metric check"></i><i class="glyphicon glyphicon-signal" title="Add new metric check"></i></a>
{% endif %}
{% if checks_type == "All" or checks_type == "Http" %}
&nbsp;<a href="{% url create-http-check %}?service={{ service.id }}" class="" title="Add new Http check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-arrow-up"></i></a>
&nbsp;<a href="{% url create-http-check %}?instance={{ instance.id }}&service={{ service.id }}" class="" title="Add new Http check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-arrow-up"></i></a>
{% endif %}
{% if checks_type == "All" or checks_type == "Jenkins" %}
&nbsp;<a href="{% url create-jenkins-check %}?service={{ service.id }}" class="" title="Add new Jenkins check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-ok"></i></a>
&nbsp;<a href="{% url create-jenkins-check %}?instance={{ instance.id }}&service={{ service.id }}" class="" title="Add new Jenkins check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-ok"></i></a>
{% endif %}
{% if checks_type == "All" or checks_type == "ICMP" %}
&nbsp;<a href="{% url create-icmp-check %}?service={{ service.id }}" class="" title="Add new ICMP check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-transfer"></i></a>
&nbsp;<a href="{% url create-icmp-check %}?instance={{ instance.id }}&service={{ service.id }}" class="" title="Add new ICMP check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-transfer"></i></a>
{% endif %}
</h3>
</div>

View File

@ -1,122 +0,0 @@
{% load extra %}
<div class="row">
<div class="col-xs-12">
<div class="col-xs-1"><h3><i class="{% if checks_type == "All" %}fa fa-cog{% else %}glyphicon glyphicon-{% if checks_type == "Http" %}arrow-up{% elif checks_type == "Jenkins" %}ok{% elif checks_type == "ICMP" %}transfer{% else %}signal{% endif %}{% endif %}"></i></h3></div>
<div class="col-xs-8"><h3>{{ checks_type }} checks</h3></div>
<div class="col-xs-3 text-right">
<h3>
&nbsp;{% if checks_type == "All" or checks_type == "Graphite" %}
<a href="{% url create-check %}?instance={{ instance.id }}" class=""><i class="glyphicon glyphicon-plus" title="Add new metric check"></i><i class="glyphicon glyphicon-signal" title="Add new metric check"></i></a>
{% endif %}
{% if checks_type == "All" or checks_type == "Http" %}
&nbsp;<a href="{% url create-http-check %}?instance={{ instance.id }}" class="" title="Add new Http check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-arrow-up"></i></a>
{% endif %}
{% if checks_type == "All" or checks_type == "Jenkins" %}
&nbsp;<a href="{% url create-jenkins-check %}?instance={{ instance.id }}" class="" title="Add new Jenkins check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-ok"></i></a>
{% endif %}
{% if checks_type == "All" or checks_type == "ICMP" %}
&nbsp;<a href="{% url create-icmp-check %}?instance={{ instance.id }}" class="" title="Add new ICMP check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-transfer"></i></a>
{% endif %}
</h3>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-xs-12">
{% if not checks %}
<div class="col-xs-11 col-xs-offset-1">No checks configured</div>
{% else %}
<table class="table bootstrap-datatable datatable">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th></th>
{% if checks_type == "All" %}
<th class="text-center">Type</th>
{% endif %}
<th>Test description</th>
<th>Importance</th>
<th>Service(s)</th>
<th>Instance(s)</th>
<th></th>
</tr>
</thead>
<tbody>
{% for check in checks %}
<tr class="{% if check.active %}enabled{% else %}warning{% endif %}">
<td title="{{ check.name }} - alerts {% if check.active %}enabled{% else %}disabled{% endif %}">
<a href="{% url check pk=check.id %}">{{check.name}}</a>
</td>
<td title="{{ check.calculated_status }}">
{% if check.active %}
<span class="label label-{% if check.calculated_status == 'passing' %}success{% else %}danger{% endif %}">
{{ check.calculated_status|capfirst }}
</span>
{% else %}
<span class="label label-warning">Disabled</span>
{% endif %}
</td>
<td title="Last result from {{ check.last_run|timesince }} ago (rightmost is newest)" class="sparktristate" values="{{ check.cached_health }}">
{% if not check.recent_results %}
No results available
{% endif %}
</td>
{% if checks_type == "All" %}
<td class="text-center">
<i class="glyphicon glyphicon-{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}signal{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}arrow-up{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}ok{% endif %}"></i>
</td>
{% endif %}
<td title="">
{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}{{ check.metric|truncatechars:70 }} {{ check.check_type }} {{ check.value }}{% if check.expected_num_hosts %} (from {{ check.expected_num_hosts }} hosts){% endif %}{% elif check.polymorphic_ctype.model == 'icmpstatuscheck' %}ICMP Reply from {{ check.instance_set.all.0.address }}{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}Status code {{ check.status_code }} from {{ check.endpoint }}{% if check.text_match %}; match text /{{ check.text_match }}/{% endif %}{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}Monitor job {{ check.name }}{% if check.max_queued_build_time %}; check no build waiting for >{{ check.max_queued_build_time }} minutes{% endif %}{% endif %}
</td>
<td>{{ check.get_importance_display }}</td>
<td>
{% for service in check.service_set.all %}
<a href="{% url service pk=service.id %}">{{ service.name }}</a>
{% if forloop.last %}
{% else %}
/
{% endif %}
{% endfor %}
{% if not check.service_set.all %}
<span class="label label-warning">No service</span>
{% endif %}
</td>
<td>
{% for instance in check.instance_set.all %}
<a href="{% url instance pk=instance.id %}">{{ instance.name }}</a>
{% if forloop.last %}
{% else %}
/
{% endif %}
{% endfor %}
{% if not check.instance_set.all %}
<span class="label label-warning">No instance</span>
{% endif %}
</td>
<td class="text-right">
<a class="btn btn-xs" href="{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}{% url update-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}{% url update-http-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'icmpstatuscheck' %}{% url update-icmp-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}{% url update-jenkins-check pk=check.id %}{% endif %}">
<i class="glyphicon glyphicon-edit"></i><span class="break"></span>
</a>
<a class="btn btn-xs" href="{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}{% url duplicate-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}{% url duplicate-http-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'icmpstatuscheck' %}{% url duplicate-icmp-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}{% url duplicate-jenkins-check pk=check.id %}{% endif %}">
<i class="fa fa-copy"></i><span class="break"></span>
</a>
<a class="btn btn-xs" href="{% url run-check pk=check.id %}">
<i class="glyphicon glyphicon-refresh"></i><span class="break"></span>
</a>
{% if checks_type == "Jenkins" %}
<a class="btn btn-xs" href="{% jenkins_human_url check.name %}">
<i class="glyphicon glyphicon-link"></i><span class="break"></span>
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>

View File

@ -1,106 +0,0 @@
{% load extra %}
<div class="row">
<div class="col-xs-12">
<div class="col-xs-1"><h3><i class="{% if checks_type == "All" %}fa fa-cog{% else %}glyphicon glyphicon-{% if checks_type == "Http" %}arrow-up{% elif checks_type == "Jenkins" %}ok{% else %}signal{% endif %}{% endif %}"></i></h3></div>
<div class="col-xs-8"><h3>{{ checks_type }} checks</h3></div>
<div class="col-xs-3 text-right">
<h3>
&nbsp;{% if checks_type == "All" or checks_type == "Graphite" %}
<a href="{% url create-check %}?service={{ service.id }}" class=""><i class="glyphicon glyphicon-plus" title="Add new metric check"></i><i class="glyphicon glyphicon-signal" title="Add new metric check"></i></a>
{% endif %}
{% if checks_type == "All" or checks_type == "Http" %}
&nbsp;<a href="{% url create-http-check %}?service={{ service.id }}" class="" title="Add new Http check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-arrow-up"></i></a>
{% endif %}
{% if checks_type == "All" or checks_type == "Jenkins" %}
&nbsp;<a href="{% url create-jenkins-check %}?service={{ service.id }}" class="" title="Add new Jenkins check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-ok"></i></a>
{% endif %}
</h3>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-xs-12">
{% if not checks %}
<div class="col-xs-11 col-xs-offset-1">No checks configured</div>
{% else %}
<table class="table bootstrap-datatable datatable">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th></th>
{% if checks_type == "All" %}
<th class="text-center">Type</th>
{% endif %}
<th>Test description</th>
<th>Importance</th>
<th>Service(s)</th>
<th></th>
</tr>
</thead>
<tbody>
{% for check in checks %}
<tr class="{% if check.active %}enabled{% else %}warning{% endif %}">
<td title="{{ check.name }} - alerts {% if check.active %}enabled{% else %}disabled{% endif %}">
<a href="{% url check pk=check.id %}">{{check.name}}</a>
</td>
<td title="{{ check.calculated_status }}">
{% if check.active %}
<span class="label label-{% if check.calculated_status == 'passing' %}success{% else %}danger{% endif %}">
{{ check.calculated_status|capfirst }}
</span>
{% else %}
<span class="label label-warning">Disabled</span>
{% endif %}
</td>
<td title="Last result from {{ check.last_run|timesince }} ago (rightmost is newest)" class="sparktristate" values="{{ check.cached_health }}">
{% if not check.recent_results %}
No results available
{% endif %}
</td>
{% if checks_type == "All" %}
<td class="text-center">
<i class="glyphicon glyphicon-{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}signal{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}arrow-up{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}ok{% endif %}"></i>
</td>
{% endif %}
<td title="">
{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}{{ check.metric|truncatechars:70 }} {{ check.check_type }} {{ check.value }}{% if check.expected_num_hosts %} (from {{ check.expected_num_hosts }} hosts){% endif %}{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}Status code {{ check.status_code }} from {{ check.endpoint }}{% if check.text_match %}; match text /{{ check.text_match }}/{% endif %}{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}Monitor job {{ check.name }}{% if check.max_queued_build_time %}; check no build waiting for >{{ check.max_queued_build_time }} minutes{% endif %}{% endif %}
</td>
<td>{{ check.get_importance_display }}</td>
<td>
{% for service in check.service_set.all %}
<a href="{% url service pk=service.id %}">{{ service.name }}</a>
{% if forloop.last %}
{% else %}
/
{% endif %}
{% endfor %}
{% if not check.service_set.all %}
<span class="label label-warning">No service</span>
{% endif %}
</td>
<td class="text-right">
<a class="btn btn-xs" href="{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}{% url update-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}{% url update-http-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}{% url update-jenkins-check pk=check.id %}{% endif %}">
<i class="glyphicon glyphicon-edit"></i><span class="break"></span>
</a>
<a class="btn btn-xs" href="{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}{% url duplicate-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}{% url duplicate-http-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'icmpstatuscheck' %}{% url duplicate-icmp-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}{% url duplicate-jenkins-check pk=check.id %}{% endif %}">
<i class="fa fa-copy"></i><span class="break"></span>
</a>
<a class="btn btn-xs" href="{% url run-check pk=check.id %}">
<i class="glyphicon glyphicon-refresh"></i><span class="break"></span>
</a>
{% if checks_type == "Jenkins" %}
<a class="btn btn-xs" href="{% jenkins_human_url check.name %}">
<i class="glyphicon glyphicon-link"></i><span class="break"></span>
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>

View File

@ -8,7 +8,7 @@
<div class="col-xs-12">
<div class="col-xs-1"><h2><i class="fa fa-desktop"></i></h2></div>
<div class="col-xs-5"><h2><span class="break"></span>{{ instance.name }}</h2></div>
<div class="col-xs-4 text-right"><h2><span class="label label-{% if instance.overall_status == instance.PASSING_STATUS %}success{% else %}danger{% endif %}">{{ instance.overall_status|lower|capfirst }}</span> <span class="label label-{% if instance.alerts_enabled %}success{% else %}warning{% endif %}">{% if instance.alerts_enabled %}Alerts enabled{%else %}Alerts disabled{% endif %}</span></h2></div>
<div class="col-xs-4 text-right"><h2><span class="label label-{% if instance.overall_status == instance.PASSING_STATUS %}success{% else %}danger{% endif %}">{{ instance.overall_status|lower|capfirst }}</span> </h2></div>
<div class="col-xs-2 text-right"><h2><a href="{% url update-instance instance.id %}"><i class="glyphicon glyphicon-edit"></i></a></h2></div>
</div>
</div>
@ -67,19 +67,19 @@
<hr>
{% include 'cabotapp/_statuscheck_list_instance.html' with checks=instance.graphite_status_checks.all instance=instance checks_type="Graphite" %}
{% include 'cabotapp/_statuscheck_list.html' with checks=instance.graphite_status_checks.all instance=instance checks_type="Graphite" %}
<hr>
{% include 'cabotapp/_statuscheck_list_instance.html' with checks=instance.http_status_checks.all instance=instance checks_type="Http" %}
{% include 'cabotapp/_statuscheck_list.html' with checks=instance.http_status_checks.all instance=instance checks_type="Http" %}
<hr>
{% include 'cabotapp/_statuscheck_list_instance.html' with checks=instance.jenkins_status_checks.all instance=instance checks_type="Jenkins" %}
{% include 'cabotapp/_statuscheck_list.html' with checks=instance.jenkins_status_checks.all instance=instance checks_type="Jenkins" %}
<hr>
{% include 'cabotapp/_statuscheck_list_instance.html' with checks=instance.icmp_status_checks.all instance=instance checks_type="ICMP" %}
{% include 'cabotapp/_statuscheck_list.html' with checks=instance.icmp_status_checks.all instance=instance checks_type="ICMP" %}
<hr>

View File

@ -10,44 +10,7 @@
</div>
</div>
<div class="col-xs-12">
{% if not instances %}
No instances
{% else %}
<table class="table bootstrap-datatable datatable">
<thead>
<tr>
<th>Name</th>
<th>Overall</th>
<th>Active checks</th>
<th>Disabled checks</th>
<th></th>
</tr>
</thead>
<tbody>
{% for instance in instances %}
<tr class="{% if instance.alerts_enabled %}enabled{% else %}warning{% endif %}">
<td>
<a href="{% url instance pk=instance.id %}" title="Alerts {% if instance.alerts_enabled %}enabled{% else %}disabled{% endif %}">{{instance.name}} </a>
</td>
<td>
<span class="label label-{% if not instance.alerts_enabled %}warning{% else %}{% if instance.overall_status == instance.PASSING_STATUS %}success{% else %}danger{% endif %}{% endif %}">{% if instance.alerts_enabled %}{{ instance.overall_status|lower|capfirst }}{% else %}Disabled{% endif %}</span>
</td>
<td>
<span class="label label-{% if instance.active_status_checks.all.count > 0 %}{% if instance.overall_status != instance.PASSING_STATUS %}danger{% else %}success{% endif %}{% else %}default{% endif %}">{{ instance.active_status_checks.all.count }}</span>
</td>
<td>
<span class="label label-{% if instance.inactive_status_checks.all.count > 0 %}warning{% else %}default{% endif %}">{{ instance.inactive_status_checks.all.count }}</span>
</td>
<td class="text-right">
<a class="btn btn-xs" href="{% url update-instance pk=instance.id %}" role="button">
<i class="glyphicon glyphicon-edit"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% include 'cabotapp/_instance_list.html' %}
</div>
</div>
{% endblock content %}

View File

@ -69,15 +69,15 @@
</div>
<hr>
{% include 'cabotapp/_statuscheck_list_service.html' with checks=service.graphite_status_checks.all service=service checks_type="Graphite" %}
{% include 'cabotapp/_statuscheck_list.html' with checks=service.graphite_status_checks.all service=service checks_type="Graphite" %}
<hr>
{% include 'cabotapp/_statuscheck_list_service.html' with checks=service.http_status_checks.all service=service checks_type="Http" %}
{% include 'cabotapp/_statuscheck_list.html' with checks=service.http_status_checks.all service=service checks_type="Http" %}
<hr>
{% include 'cabotapp/_statuscheck_list_service.html' with checks=service.jenkins_status_checks.all service=service checks_type="Jenkins" %}
{% include 'cabotapp/_statuscheck_list.html' with checks=service.jenkins_status_checks.all service=service checks_type="Jenkins" %}
<hr>

View File

@ -10,44 +10,7 @@
</div>
</div>
<div class="col-xs-12">
{% if not services %}
No services
{% else %}
<table class="table bootstrap-datatable datatable">
<thead>
<tr>
<th>Name</th>
<th>Overall</th>
<th>Active checks</th>
<th>Disabled checks</th>
<th></th>
</tr>
</thead>
<tbody>
{% for service in services %}
<tr class="{% if service.alerts_enabled %}enabled{% else %}warning{% endif %}">
<td>
<a href="{% url service pk=service.id %}" title="Alerts {% if service.alerts_enabled %}enabled{% else %}disabled{% endif %}">{{service.name}} </a>
</td>
<td>
<span class="label label-{% if not service.alerts_enabled %}warning{% else %}{% if service.overall_status == service.PASSING_STATUS %}success{% else %}danger{% endif %}{% endif %}">{% if service.alerts_enabled %}{{ service.overall_status|lower|capfirst }}{% else %}Disabled{% endif %}</span>
</td>
<td>
<span class="label label-{% if service.active_status_checks.all.count > 0 %}{% if service.overall_status != service.PASSING_STATUS %}danger{% else %}success{% endif %}{% else %}default{% endif %}">{{ service.active_status_checks.all.count }}</span>
</td>
<td>
<span class="label label-{% if service.inactive_status_checks.all.count > 0 %}warning{% else %}default{% endif %}">{{ service.inactive_status_checks.all.count }}</span>
</td>
<td class="text-right">
<a class="btn btn-xs" href="{% url update-service pk=service.id %}" role="button">
<i class="glyphicon glyphicon-edit"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% include 'cabotapp/_service_list.html' %}
</div>
</div>
{% endblock content %}