Skip to content

Commit

Permalink
See CHANGELOG v1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnavarro committed Nov 11, 2022
1 parent 5189d65 commit fa0b562
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v1.2.1 20221111 JP
- Fix link form saving bug
- Make metrics entry dates Central time aware since log entries do have a UTC timzeone
- When log entries are display, make it clear they are in UTC
- Display APP_VERSION / GitHub tag in header
- Show (username) in logout link

v1.2.0 20221107 JP
- More opsres to serviceindex changes
- Convert to use ModelForms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

ALLOWED_HOSTS = CONF['ALLOWED_HOSTS']

APP_VERSION = CONF['APP_VERSION']

# Application definition

Expand Down
14 changes: 9 additions & 5 deletions Operations_ServiceIndex_Django/services/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from django.template.loader import get_template
from django.template import Context
from django.utils import timezone
from datetime import datetime, timedelta
from datetime import datetime, timedelta, time
from zoneinfo import ZoneInfo

from django.contrib.auth.decorators import login_required, user_passes_test
from django.conf import settings
Expand Down Expand Up @@ -186,6 +187,9 @@ def update_service(request):
# initial=[{'service': service_id, 'service_id': service_id}])
for link_form in link_formset:
link_form.instance.service_id = service_id
if link_form.has_changed():
if link_form.is_valid():
link_form.save()
# if link_form.has_changed():
## and link_form.changed_data != ['service']:
## link_form.service = service
Expand Down Expand Up @@ -319,8 +323,8 @@ def export(request):
# render plain text listing
response = http.HttpResponse(content_type='text/plain')
t = get_template('services/export.txt')
context = Context({'services':services})
response.write(t.render(context))
context = {'services':services}
response.write(t.render(context, request))
return response

else:
Expand Down Expand Up @@ -529,9 +533,9 @@ def metrics(request):
form = MetricsForm(request.POST)
if form.is_valid():
if form.cleaned_data['start_date']:
start = form.cleaned_data['start_date']
start = datetime.combine(form.cleaned_data['start_date'], time.min, tzinfo=ZoneInfo("US/Central"))
if form.cleaned_data['end_date']:
end = form.cleaned_data['end_date']
end = datetime.combine(form.cleaned_data['end_date'], time.max, tzinfo=ZoneInfo("US/Central"))
else:
end = timezone.now()
week = timedelta(days=7)
Expand Down
5 changes: 3 additions & 2 deletions Operations_ServiceIndex_Django/templates/services/base.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load static %}
{% load get_settings %}
<!DOCTYPE HTML>
<html lang="en">
<head>
Expand All @@ -20,6 +21,7 @@
<td><a href="https://operations.access-ci.org/" title="Operations Home" rel="home">
<img src="/static/services/img/ACCS050322_ACCESS_Brand_Operations-RGB.png" alt="Home"/></a></td>
<td style="vertical-align: top;"><h2 style="text-align: left; margin-top: 1px;">{{ app_name }}</h2></td>
<td>{% settings_value "APP_VERSION" %}</td>
</tr></table>
<ul class="nav nav-pills">
{% if page == 'index' %}<li class="active"><a href="#">
Expand Down Expand Up @@ -56,7 +58,7 @@

{% if page == 'log_out' %}<li class="active"><a href="#">
{% else %}<li><a href="{% url 'services:clear_and_logout' %}">
{% endif %}Log Out</a></li>
{% endif %}Log Out ({{ user.username }})</a></li>
</ul>
</div>

Expand All @@ -71,6 +73,5 @@
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
{% block scripts %}
{% endblock %}

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ <h4 class="text-left" style="margin-left:10px;">
</div> <!-- row -->
{% endif %}

<p>LOG:</p>
<p>LOG (UTC):</p>
<div class="row">
<div class="col-md-10">
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{% block content %}


<p>Timestmaps are in UTC</p>
<ul>
{% for le in log %}
{# format: Jul 01, 2014 4:42 p.m. #}
Expand Down

0 comments on commit fa0b562

Please sign in to comment.