Fixed overall status not displaying on instance lists

This commit is contained in:
Jonathan Montineri 2014-08-01 15:31:02 +01:00 committed by David Buxton
parent e604cf673f
commit 06adb3bc3f
3 changed files with 11 additions and 9 deletions

View File

@ -100,6 +100,10 @@ class CheckGroupMixin(models.Model):
blank=True,
help_text='Users who should receive alerts.',
)
alerts_enabled = models.BooleanField(
default=True,
help_text='Alert when this service is not healthy.',
)
status_checks = models.ManyToManyField(
'StatusCheck',
blank=True,
@ -235,11 +239,6 @@ class Service(CheckGroupMixin):
help_text='Instances this service is running on.',
)
alerts_enabled = models.BooleanField(
default=True,
help_text='Alert when this service is not healthy.',
)
url = models.TextField(
blank=True,
help_text="URL of service."
@ -271,6 +270,9 @@ class Instance(CheckGroupMixin):
if not (self.overall_status == Service.PASSING_STATUS and self.old_overall_status == Service.PASSING_STATUS):
self.alert()
def alert():
return
#We don't want alerts for instances
class Meta:
ordering = ['name']

View File

@ -264,10 +264,6 @@ class InstanceForm(SymmetricalForm):
'users_to_notify',
'status_checks',
'service_set',
'email_alert',
'hipchat_alert',
'sms_alert',
'telephone_alert',
)
widgets = {
'name': forms.TextInput(attrs={'style': 'width: 30%;'}),

View File

@ -10,6 +10,7 @@
</tr>
{% else %}
<th>Name</th>
<th>Overall</th>
<th>Active checks</th>
<th>Disabled checks</th>
<th></th>
@ -21,6 +22,9 @@
<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 instance.overall_status == instance.PASSING_STATUS %}success{% else %}danger{% endif %}">{{ instance.overall_status|lower|capfirst }}</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>