Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
234 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
""" | ||
Overseer | ||
~~~~~~~~ | ||
""" | ||
|
||
try: | ||
VERSION = __import__('pkg_resources') \ | ||
.get_distribution('overseer').version | ||
except Exception, e: | ||
VERSION = 'unknown' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,54 @@ | ||
{% extends "overseer/base.html" %} | ||
|
||
{% block content %} | ||
{% load overseer_helpers %} | ||
|
||
<div class="latest-update"> | ||
<strong>This is the latest status update for any service on the network</strong> | ||
<time>3 hours ago</time> | ||
</div> | ||
{% block content %} | ||
{% if latest_event %} | ||
<div class="latest-event event status-{{ latest_event.status }}"> | ||
<p>{{ latest_event.description }}</p> | ||
<time>{{ latest_event.date_updated|timesince }} (lasted {{ latest_event.get_duration|duration }})</time> | ||
<span class="affects">affects {{ latest_event.get_service_names|join:", "}}</span> | ||
</div> | ||
{% endif %} | ||
|
||
<div class="service-list"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th class="status">Status</th> | ||
<th>Service</th> | ||
<th>Last Event</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for service in service_list %} | ||
<div class="service-list"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<td class="status status-{{ service.status }}">{{ service.get_status_display }}</td> | ||
<td class="service"> | ||
<h2><a href="{% url overseer:service service.slug %}">{{ service.name }}</a></h2> | ||
{% if service.description %} | ||
<p>{{ service.description }}</p> | ||
{% endif %} | ||
</td> | ||
<td><a href="{% url overseer:last_event service.slug %}">{{ service.date_updated|timesince }}</a></td> | ||
<th class="status">Status</th> | ||
<th class="service">Service</th> | ||
<th class="last-event">Last Event</th> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
</thead> | ||
<tbody> | ||
{% for service in service_list %} | ||
<tr> | ||
<td class="status status-{{ service.status }}">{{ service.get_status_display }}</td> | ||
<td class="service"> | ||
<h2><a href="{% url overseer:service service.slug %}">{{ service.name }}</a></h2> | ||
{% if service.description %} | ||
<p>{{ service.description }}</p> | ||
{% endif %} | ||
</td> | ||
<td class="last-event"><a href="{% url overseer:last_event service.slug %}">{{ service.date_updated|timesince }}</a></td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<div class="update-list"> | ||
<ul> | ||
<li> | ||
<strong>This is an update.</strong> | ||
<time>3 hours ago</time> | ||
<span>affects API, Embed</span> | ||
</li> | ||
</ul> | ||
</div> | ||
{% if event_list %} | ||
<div class="event-list"> | ||
<h3>Recent Events</h3> | ||
<ul> | ||
{% for event in event_list %} | ||
<li class="event status-{{ event.status }}"> | ||
<p>{{ event.description }}</p> | ||
<time>{{ event.date_updated|timesince }}</time> | ||
<span class="affects">affects {{ event.get_service_names|join:", "}}</span> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import datetime | ||
|
||
from django import template | ||
from django.template.defaultfilters import stringfilter | ||
|
||
register = template.Library() | ||
|
||
@register.filter | ||
def timesince(value): | ||
from django.template.defaultfilters import timesince | ||
if not value: | ||
return 'Never' | ||
if value < datetime.datetime.now() - datetime.timedelta(days=5): | ||
return value.date() | ||
value = (' '.join(timesince(value).split(' ')[0:2])).strip(',') | ||
if value == '0 minutes': | ||
return 'Just now' | ||
if value == '1 day': | ||
return 'Yesterday' | ||
return value + ' ago' | ||
|
||
@register.filter(name='truncatechars') | ||
@stringfilter | ||
def truncatechars(value, arg): | ||
""" | ||
Truncates a string after a certain number of chars. | ||
Argument: Number of chars to truncate after. | ||
""" | ||
try: | ||
length = int(arg) | ||
except ValueError: # Invalid literal for int(). | ||
return value # Fail silently. | ||
if len(value) > length: | ||
return value[:length] + '...' | ||
return value | ||
truncatechars.is_safe = True | ||
|
||
@register.filter | ||
def duration(value): | ||
if isinstance(value, datetime.timedelta): | ||
value = value.days * 24 * 3600 + value.seconds | ||
hours, minutes, seconds = 0, 0, 0 | ||
if value > 3600: | ||
hours = value / 3600 | ||
value = value % 3600 | ||
if value > 60: | ||
minutes = value / 60 | ||
value = value % 60 | ||
seconds = value | ||
if hours: | ||
return '%s hours' % (hours,) | ||
if minutes: | ||
return '%s minutes' % (minutes,) | ||
if seconds: | ||
return '%s seconds' % (seconds,) | ||
return 'n/a' |
Oops, something went wrong.