Skip to content
Snippets Groups Projects
Commit bc0c9724 authored by Brian Moe's avatar Brian Moe
Browse files

Formatting updates. Expose labels on web pages.

parent 1d8f4ba9
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,3 @@ class EventSearchForm(forms.Form):
gpsEnd = forms.IntegerField(min_value=0, required=False, label="GPS End")
submitter = forms.ChoiceField(choices=submitterChoices, required=False)
ligoApproved = forms.BooleanField(initial=False, required=False, label="LIGO Approved Only")
virgoApproved = forms.BooleanField(initial=False, required=False, label="Virgo Approved Only")
......@@ -6,6 +6,13 @@ import os
from gracedb.ligolw.models import CoincEvent
from gracedb.gracedb.templatetags.timeutil import posixToGpsTime
from django.conf import settings
import pytz, time
SERVER_TZ = pytz.timezone(settings.TIME_ZONE)
class User(models.Model):
name = models.CharField(max_length=100)
......@@ -93,6 +100,15 @@ class Event(models.Model):
def virgoApproved(self):
return self.approval_set.filter(approvingCollaboration='V').count()
def reportingLatency(self):
if self.gpstime:
dt = self.created
if not dt.tzinfo:
dt = SERVER_TZ.localize(dt)
posix_time = time.mktime(dt.timetuple())
gps_time = int(posixToGpsTime(posix_time))
return gps_time - self.gpstime
@classmethod
def getByGraceid(cls, id):
if id[0] == "G":
......
......@@ -49,7 +49,7 @@ def multiTime(t, label, autoescape=None):
dt = t
if not dt.tzinfo:
dt = SERVER_TZ.localize(dt)
dt = dt.astimezone(pytz.utc)
#dt = dt.astimezone(pytz.utc)
posix_time = time.mktime(dt.timetuple())
gps_time = int(posixToGpsTime(posix_time))
elif isinstance(t, int) or isinstance(t, long):
......@@ -66,7 +66,7 @@ def multiTime(t, label, autoescape=None):
lho_time = esc(dateformat.format(dt.astimezone(LHO_TZ), format))
llo_time = esc(dateformat.format(dt.astimezone(LLO_TZ), format))
virgo_time = esc(dateformat.format(dt.astimezone(VIRGO_TZ), format))
utc_time = esc(dateformat.format(dt, format))
utc_time = esc(dateformat.format(dt.astimezone(pytz.utc), format))
if isinstance(t, datetime.datetime):
display_time = utc_time
......
......@@ -398,10 +398,6 @@ def search(request):
objects = objects.filter(group=group)
if typename:
objects = objects.filter(analysisType=typename)
if form.cleaned_data['ligoApproved']:
objects = objects.filter(approval__approvingCollaboration='L')
if form.cleaned_data['virgoApproved']:
objects = objects.filter(approval__approvingCollaboration='V')
return object_list(request, objects, extra_context={'title':"Query Results"})
......
......@@ -7,6 +7,9 @@ html, body {
padding: 0;
}
table.event th {padding:3px;border:none;text-align:center;vertical-align:bottom;}
table.event {border-bottom:1px solid gray;}
td, th {padding:3px;border:none;}
tr th {text-align:left;background-color:#f0f0f0;color:#333;}
tr.odd td {background-color:#edf3fe;}
......
......@@ -2,43 +2,56 @@
{% load timeutil %}
{% block title %}View {{ object.graceid }}{% endblock %}
{% block heading %}View {{ object.graceid }}{% endblock %}
{% block heading %}{% endblock %}
{% block content %}
<p>{{ message }}</p>
<table>
<tr><th>ID</th><td>{{ object.graceid }}</td></tr>
<tr><th>Group</th><td>{{ object.group.name }}</td></tr>
<tr><th>Type</th><td>{{ object.get_analysisType_display }}</td></tr>
{% if object.gpstime %}
<tr><th>Event Time {{ "gps"|timeselect:"gps" }}</th>
<!-- <td><span title="{{ object.gpstime|gpsdate }}">{{ object.gpstime }}</span></td> -->
<td>{{ object.gpstime|multiTime:"gps" }}</td>
</tr>
{% endif %}
<tr><th>Data</th><td>
<a href="{{ object.weburl }}">{{ object.weburl }}</a>
</td></tr>
<tr><th>TWiki</th><td>
<a href="{{ object.wikiurl }}">{{ object.wikiurl }}</a>
</td></tr>
<tr><th>Sumitter</th><td>{{ object.submitter.name }}</td></tr>
<tr><th>Created{{ "created"|timeselect:"utc" }}</th><td>{{ object.created|multiTime:"created" }}
</td></tr>
<tr><th>Labels</th><td>
{% for labelling in object.labelling_set.all %}
<span title="{{labelling.creator.name}} {{labelling.created|utc}}" style="color: {{labelling.label.defaultColor}}">{{ labelling.label.name }}</span>
{% endfor %}
</td></tr>
<table class="event">
<tr>
<th valign="top">UID</th>
<th>Labels</th>
<th>Type</th>
<th>
{{ "gps"|timeselect:"gps" }}
Event Time
</th>
<th colspan="2">Links</th>
<th>
{{"created"|timeselect:"utc" }}
Submitted
</th>
</tr>
<tr>
<td>{{ object.graceid }}</td>
<td>
{% for labelling in object.labelling_set.all %}
<span title="{{labelling.creator.name}} {{labelling.created|utc}}" style="color: {{labelling.label.defaultColor}}">{{ labelling.label.name }}</span>
{% endfor %}
</td>
<td>{{ object.get_analysisType_display }} </td>
<td>{% if object.gpstime%}
<!-- <span title="{{ object.gpstime|gpsdate }}">{{ object.gpstime }}</span> -->
{{ object.gpstime|multiTime:"gps" }}
{% endif %}</td>
<td><a href="{{ object.weburl }}">Data</a></td>
<td><a href="{{ object.wikiurl }}">Wiki</a></td>
<td>{{ object.created|multiTime:"created" }}</td>
</tr>
</table>
{% if object.eventlog_set.count %}
<h3>Log Entries:</h3>
<table>
<p/>
<table class="event">
<tr>
<th>Date {{ "logtime"|timeselect:"utc" }}</th>
<th>
{{ "logtime"|timeselect:"utc" }}
Log Entry Created
</th>
<th>Submitter</th>
<th>File</th>
<th>Comment</th>
......
......@@ -9,51 +9,39 @@
<p>{{ message }}</p>
{% if object_list.count %}
<table>
<tr> <th colspan="2">Approvals</th>
</tr>
<table class="event">
<tr>
<th>LIGO</th>
<th>Virgo</th>
<th>UID</th>
<th>Submitter</th>
<th>Group</th>
<th>Labels</th>
<th>Type</th>
<th>Event Time {{ "gps"|timeselect:"gps" }}</th>
<th>Web</th>
<th>Wiki</th>
<th>
{{ "gps"|timeselect:"gps" }}
Event Time
</th>
<th colspan="2">Links</th>
<th>
{{"created"|timeselect:"utc" }}
Submitted
</th>
</tr>
{% for obj in object_list %}
<tr class={% cycle 'odd' 'even' %}>
<!--
https://archie.phys.uwm.edu/media/img/admin/icon-no.gif
https://archie.phys.uwm.edu/media/img/admin/icon-yes.gif
-->
<td align="center">
{% if obj.ligoApproved %}
<img src="/media/img/admin/icon-yes.gif"/>
{% else %}
<img src="/media/img/admin/icon-no.gif"/>
{% endif %}
</td>
<td align="center">
{% if obj.virgoApproved %}
<img src="/media/img/admin/icon-yes.gif"/>
{% else %}
<img src="/media/img/admin/icon-no.gif"/>
{% endif %}
</td>
<td><a href="{% url view obj.graceid %}">{{ obj.graceid }}</a></td>
<td>{{ obj.submitter }} </td>
<td>{{ obj.group }} </td>
<td>
{% for labelling in obj.labelling_set.all %}
<span title="{{labelling.creator.name}} {{labelling.created|utc}}" style="color: {{labelling.label.defaultColor}}">{{ labelling.label.name }}</span>
{% endfor %}
</td>
<td>{{ obj.get_analysisType_display }} </td>
<td>{% if obj.gpstime%}
<!-- <span title="{{ obj.gpstime|gpsdate }}">{{ obj.gpstime }}</span> -->
{{ obj.gpstime|multiTime:"gps" }}
{% endif %}</td>
<td><a href="{{ obj.weburl }}">Web: {{ obj.graceid }}</a></td>
<td><a href="{{ obj.wikiurl }}">Wiki: {{ obj.graceid }}</a></td>
{% endif %}
</td>
<td><a href="{{ obj.weburl }}">Data</a></td>
<td><a href="{{ obj.wikiurl }}">Wiki</a></td>
<td>{{ obj.created|multiTime:"created" }}</td>
</tr>
{% endfor %}
</table>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment