From 81968ac3909cd9add7e4c099dca70af9e70e9dcc Mon Sep 17 00:00:00 2001 From: Alexander Pace <alexander.pace@ligo.org> Date: Sat, 11 Jan 2025 21:42:39 +0000 Subject: [PATCH] Visual fixes --- config/settings/base.py | 2 +- docs/user_docs/source/queries.rst | 7 +++-- gracedb/events/templatetags/timeutil.py | 4 +-- gracedb/search/constants.py | 6 +++- gracedb/search/tests/test_queries.py | 3 +- gracedb/superevents/views.py | 4 +-- .../templates/gracedb/log_entry_details.html | 24 ++++++++++++-- gracedb/templates/navbar_frag.html | 1 + .../superevents/log_entry_details.html | 31 +++++++++++++++++-- .../superevents/superevent_info_table.html | 6 ++-- .../superevent_info_table_public.html | 4 +-- 11 files changed, 74 insertions(+), 18 deletions(-) diff --git a/config/settings/base.py b/config/settings/base.py index 5d8b42386..72494dd79 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -716,7 +716,7 @@ EVENT_SUPEREVENT_WINDOW_AFTER = 100 # Define which observation periods to show on the public events page: # TODO: Group O4b and O4a under O4, once implemented. -PUBLIC_PAGE_RUNS = ['O4', 'O4b', 'O4a', 'ER16', 'ER15', 'O3'] +PUBLIC_PAGE_RUNS = ['O4', 'O4c', 'O4b', 'O4a', 'ER16', 'ER15', 'O3'] # Define how long to cache the public page: PUBLIC_PAGE_CACHING = int(get_from_env('DJANGO_PUBLIC_PAGE_CACHING', diff --git a/docs/user_docs/source/queries.rst b/docs/user_docs/source/queries.rst index 9daaa0db0..5a3254dc5 100644 --- a/docs/user_docs/source/queries.rst +++ b/docs/user_docs/source/queries.rst @@ -188,10 +188,13 @@ Examples and available options are below: - gpstime/t_0 range * - ``O4`` - - (1368975618, 1389456018), (1396796418, 1423238418) + - (1422118818, 1433516418), (1396796418, 1422118818), (1396796418, 1423238418) + + * - ``O4c`` + - (1422118818, 1433516418) * - ``O4b`` - - (1396796418, 1423238418) + - (1396796418, 1422118818) * - ``O4a`` - (1368975618, 1389456018) diff --git a/gracedb/events/templatetags/timeutil.py b/gracedb/events/templatetags/timeutil.py index 3ee7685d9..3b2991184 100644 --- a/gracedb/events/templatetags/timeutil.py +++ b/gracedb/events/templatetags/timeutil.py @@ -80,9 +80,9 @@ def get_multitime_value(t, label, autoescape, format): if isinstance(t, datetime.datetime): display_time = utc_time else: - display_time = gps_time + display_time = str(gps_time) + ' (GPS time)' - rv = '<time utc="%s" gps="%14.3f" llo="%s" lho="%s" virgo="%s" jsparsable="%s"%s>%s</time>' % \ + rv = '<time utc="%s" gps="%14.3f (GPS time)" llo="%s" lho="%s" virgo="%s" jsparsable="%s"%s>%s</time>' % \ (utc_time, gps_time, llo_time, lho_time, virgo_time, js_parsable_time, label_attr, display_time) return mark_safe(rv) diff --git a/gracedb/search/constants.py b/gracedb/search/constants.py index 1bf5225b6..427cf72a1 100644 --- a/gracedb/search/constants.py +++ b/gracedb/search/constants.py @@ -18,11 +18,15 @@ ExpressionOperator.setParseAction(lambda toks: EXPR_OPERATORS[toks[0]]) # Dict of LIGO run names (keys) and GPS time range tuples (values) RUN_MAP = { "O4": { + # https://wiki.ligo.org/Operations/Agenda250109 + # O4b -> O4c transition will happen on Tuesday Jan. 28th at 1700 UTC + # (GPS: 1422118818) + "O4c": (1422118818, 1433516418), # https://observing.docs.ligo.org/plan/ # The LIGO Hanford (LHO), LIGO Livingston (LLO), and Virgo detectors transitioned # to the regular observing run O4b at 15:00 UTC on 10 April 2024. O4b will run # until 9 June 2025 (assuming 15:00 UTC but FIXME later). - "O4b": (1396796418, 1433516418), + "O4b": (1396796418, 1422118818), # O4a started May 24, 2023 1500UTC and ended Jan 16, 2024 1600UTC "O4a": (1368975618, 1389456018), }, diff --git a/gracedb/search/tests/test_queries.py b/gracedb/search/tests/test_queries.py index 31ea1ed1f..d91be8d69 100644 --- a/gracedb/search/tests/test_queries.py +++ b/gracedb/search/tests/test_queries.py @@ -306,7 +306,8 @@ EVENT_QUERY_TEST_DATA = [ ("O4", run_map_search_filter("O4", "gpstime") & DEFAULT_EVENT_Q), # Manually test O4: ("O4", (Q(gpstime__range=RUN_MAP_FLAT["O4"][0]) | - Q(gpstime__range=RUN_MAP_FLAT["O4"][1])) & DEFAULT_EVENT_Q), + Q(gpstime__range=RUN_MAP_FLAT["O4"][1]) | + Q(gpstime__range=RUN_MAP_FLAT["O4"][2])) & DEFAULT_EVENT_Q), # test one of O4's subranges: ("O4a", run_map_search_filter("O4a", "gpstime") & DEFAULT_EVENT_Q), # and manually: diff --git a/gracedb/superevents/views.py b/gracedb/superevents/views.py index 42c7b7fa7..e1dfdb8cc 100644 --- a/gracedb/superevents/views.py +++ b/gracedb/superevents/views.py @@ -312,7 +312,7 @@ class SupereventPublic(DisplayFarMixin, ListView): # https://git.ligo.org/computing/gracedb/server/-/issues/303#note_725082 # So use Q filters for these: significant_filter = Q() - if self.obsrun in ['ER15', 'ER16', 'O4a', 'O4b', 'O4']: + if self.obsrun in ['ER15', 'ER16', 'O4a', 'O4b', 'O4c', 'O4']: significant_filter = Q(labels__name='ADVREQ') | \ Q(labels__name='ADVOK') | \ Q(labels__name='ADVNO') @@ -330,7 +330,7 @@ class SupereventPublic(DisplayFarMixin, ListView): # Note: this value is also used as a trigger to show the significance # button and bullet. def insignificant_docs(self, run): - if run in ['ER15', 'ER16', 'O4a', 'O4b', 'O4']: + if run in ['ER15', 'ER16', 'O4a', 'O4b', 'O4c', 'O4']: return 'https://emfollow.docs.ligo.org/userguide/content.html#significance' else: return None diff --git a/gracedb/templates/gracedb/log_entry_details.html b/gracedb/templates/gracedb/log_entry_details.html index 926142a0a..8efdaba9b 100644 --- a/gracedb/templates/gracedb/log_entry_details.html +++ b/gracedb/templates/gracedb/log_entry_details.html @@ -111,10 +111,10 @@ server_action="removed from" log_num="{{ log.N }}" tag_name="{{ tag.name }}"> - <a href="javascript:$('#deleteTag-{{ log.N}}-{{ tag.name }}').submit();" data-toggle="tooltip" title="Delete tag">❌</a></form></span> + <a href="#" data-target="#deleteTag-{{ log.N}}-{{ tag.name }}" class="deleteTagObject" data-toggle="tooltip" title="Delete tag">❌</a></form></span> {% endfor %} <div style="float: right"> - <a href="javascript:$('#addTag-{{ log.N }}').modal()" class="badge badge-info" data-toggle="tooltip" title="Add tag for log #{{ log.N }}">+</a> + <a href="#" data-target="#addTag-{{ log.N }}" class="badge badge-info openModal" data-toggle="tooltip" title="Add tag for log #{{ log.N }}">+</a> </div> </td> </tr> @@ -201,3 +201,23 @@ $('.trumbowyg-editor').prev(".trumbowyg-editor").css("min-height", "100px"); }); }); </script> + +<script> +document.querySelectorAll('.openModal').forEach(function(element) { + element.addEventListener('click', function(event) { + event.preventDefault(); + var target = this.getAttribute('data-target'); + $(target).modal('show'); + }); +}); +</script> + +<script> +document.querySelectorAll('.deleteTagObject').forEach(function(element) { + element.addEventListener('click', function(event) { + event.preventDefault(); + var target = this.getAttribute('data-target'); + $(target).submit(); + }); +}); +</script> diff --git a/gracedb/templates/navbar_frag.html b/gracedb/templates/navbar_frag.html index 57bc15d9d..6b2992e80 100644 --- a/gracedb/templates/navbar_frag.html +++ b/gracedb/templates/navbar_frag.html @@ -44,6 +44,7 @@ $( document ).ready( function () { <ul class="dropdown-menu"> <li> <div class="dropdown-item dropdown-toggle"><a href="{% url "superevents:public-alerts" "O4" %}" style="color: black; text-decoration: none;">O4</a></div> <ul class="dropdown-menu dropdown-submenu"> + <li> <a class="dropdown-item" href="{% url "superevents:public-alerts" "O4c" %}">O4c</a> </li> <li> <a class="dropdown-item" href="{% url "superevents:public-alerts" "O4b" %}">O4b</a> </li> <li> <a class="dropdown-item" href="{% url "superevents:public-alerts" "O4a" %}">O4a</a> </li> </ul></li> diff --git a/gracedb/templates/superevents/log_entry_details.html b/gracedb/templates/superevents/log_entry_details.html index 03901511d..37ffea424 100644 --- a/gracedb/templates/superevents/log_entry_details.html +++ b/gracedb/templates/superevents/log_entry_details.html @@ -57,6 +57,13 @@ <div class="form-group"> <label for="tagSelect" class="col-form-label">Log Message Tag</label> {{ tag_selecter_tagname }} + {% if user.is_authenticated and am_group_authorized %} + <div class="form-check"> + <input class="form-check-input" type="checkbox" value="public" name="tagname" id="publicCheck"> + <label class="form-check-label" for="publicCheck"> Make log message public </label> + </div> + {% endif %} + </div> <div class="form-group"> <label for="fileInput">(Optional) Upload File with Log Message</label> @@ -109,7 +116,7 @@ server_action="removed from" log_num="{{ log.N }}" tag_name="{{ tag.name }}"> - <a href="javascript:$('#deleteTag-{{ log.N}}-{{ tag.name }}').submit();" data-toggle="tooltip" title="Delete tag">❌</a></form> + <a href="#" data-target="#deleteTag-{{ log.N}}-{{ tag.name }}" class="deleteTagObject" data-toggle="tooltip" title="Delete tag">❌</a></form> {% endif %} </span> @@ -117,7 +124,7 @@ {% if user.is_authenticated %} <!--only show add button for authorized users --> <div style="float: right"> - <a href="javascript:$('#addTag-{{ log.N }}').modal()" class="badge badge-info" data-toggle="tooltip" title="Add tag for log #{{ log.N }}">+</a> + <a href="#" data-target='#addTag-{{ log.N }}' class="badge badge-info openModal" data-toggle="tooltip" title="Add tag for log #{{ log.N }}">+</a> </div> {% endif %} </td> @@ -228,3 +235,23 @@ $('.trumbowyg-editor').prev(".trumbowyg-editor").css("min-height", "100px"); }); }); </script> + +<script> +document.querySelectorAll('.openModal').forEach(function(element) { + element.addEventListener('click', function(event) { + event.preventDefault(); + var target = this.getAttribute('data-target'); + $(target).modal('show'); + }); +}); +</script> + +<script> +document.querySelectorAll('.deleteTagObject').forEach(function(element) { + element.addEventListener('click', function(event) { + event.preventDefault(); + var target = this.getAttribute('data-target'); + $(target).submit(); + }); +}); +</script> diff --git a/gracedb/templates/superevents/superevent_info_table.html b/gracedb/templates/superevents/superevent_info_table.html index ea197d7d0..2166b6588 100644 --- a/gracedb/templates/superevents/superevent_info_table.html +++ b/gracedb/templates/superevents/superevent_info_table.html @@ -83,17 +83,17 @@ </tr> <tr> - <td> t<sub>start</sub> </td> + <td> t<sub>start</sub> (GPS time)</td> <td> {{ superevent.t_start|floatformat:2 }} </td> </tr> <tr> - <td> t<sub>0</sub> </td> + <td> t<sub>0</sub> (GPS time)</td> <td> {{ superevent.t_0|floatformat:2 }} </td> </tr> <tr> - <td> t<sub>end</sub> </td> + <td> t<sub>end</sub> (GPS time)</td> <td> {{ superevent.t_end|floatformat:2 }} </td> </tr> diff --git a/gracedb/templates/superevents/superevent_info_table_public.html b/gracedb/templates/superevents/superevent_info_table_public.html index da460b979..0449de55e 100644 --- a/gracedb/templates/superevents/superevent_info_table_public.html +++ b/gracedb/templates/superevents/superevent_info_table_public.html @@ -41,12 +41,12 @@ </tr> <tr> - <td> t<sub>0</sub> </td> + <td> t<sub>0</sub> (GPS time)</td> <td> {{ superevent.t_0|floatformat:2 }} </td> </tr> <tr> - <td> t<sub>end</sub> </td> + <td> t<sub>end</sub> (GPS time)</td> <td> {{ superevent.t_end|floatformat:2 }} </td> </tr> -- GitLab