Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Site status message #7659

Merged
merged 31 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d03fd2e
Status WIP
Jun 20, 2024
933f0be
feat: Status
Jul 9, 2024
04ab0ba
Merge branch 'main' into status-message
Jul 9, 2024
175aea5
fix: Status tests
Jul 10, 2024
6408b65
feat: status redirect
Jul 10, 2024
4f47554
chore: Status tests
Jul 10, 2024
cd5f9ae
chore: Status tests
Jul 10, 2024
1a338bb
feat: Status tests
Jul 11, 2024
d6b2eee
chore: Status playwright tests
Jul 15, 2024
7e98341
fix: PR feedback, mostly Vue and copyright dates
Jul 15, 2024
5c10968
fix: Status model migration tidy up
Jul 15, 2024
42ed840
chore: Status - one migration
Jul 16, 2024
5bc8145
feat: status on doc/html pages
Jul 21, 2024
174fdd8
chore: merging main. Resolving conflict in ietf.scss
Jul 21, 2024
7a0c02b
chore: Resetting Status migration
Jul 21, 2024
d207c1d
chore: removing unused FieldError
Jul 22, 2024
b64d267
fix: Update Status test to remove 'by'
Jul 22, 2024
3423355
chore: fixing API test to exclude 'status'
holloway Jul 22, 2024
ad8d265
chore: fixing status_page test
holloway Jul 23, 2024
93c986e
feat: Site Status PR feedback. URL coverage debugging
holloway Jul 25, 2024
7368ae1
Adding ietf.status to Tastypie omitted apps
holloway Jul 25, 2024
09c87c0
feat: Site Status PR feedback
holloway Jul 26, 2024
9db7147
Merge branch 'main' into feat/status-message
holloway Jul 26, 2024
93eb0f0
chore: correct copyright year on newly created files
holloway Jul 30, 2024
2c9c897
Merge branch 'feat/status-message' of gh-ietf:ietf-tools/datatracker …
holloway Jul 30, 2024
dfa3732
Merge branch 'main' into feat/status-message
rjsparks Aug 1, 2024
b21661c
Merge remote-tracking branch 'ietf-tools/main' into feat/status-message
rjsparks Aug 7, 2024
04cef0f
chore: repair merge damage
rjsparks Aug 7, 2024
a7e627f
Merge branch 'main' into feat/status-message
rjsparks Aug 7, 2024
de8a991
chore: repair more merge damage
rjsparks Aug 7, 2024
e7ef7f2
fix: reconcile the api init refactor with ignoring apps
rjsparks Aug 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ietf/status/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def test_status_page(self):
status.save()

r = self.client.get(f'/status/{slug}/')
# with a Status it should redirect
self.assertEqual(r.status_code, 200)

status.delete()
Expand All @@ -115,7 +114,6 @@ def test_status_page(self):
status.save()

r = self.client.get(f'/status/{slug}/')
# with a Status it should redirect
self.assertEqual(r.status_code, 200)
self.assertContains(r, test_string)

Expand Down
14 changes: 7 additions & 7 deletions ietf/status/views.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Copyright The IETF Trust 2016-2024, All Rights Reserved
# -*- coding: utf-8 -*-

import json
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.urls import reverse as urlreverse
from django.http import HttpResponseRedirect, HttpResponseNotFound, JsonResponse
from ietf.utils import markdown
from django.shortcuts import render, get_object_or_404
from ietf.status.models import Status

import debug # pyflakes:ignore

def get_context_data():
def get_last_active_status():
status = Status.objects.filter(active=True).order_by("-date").first()
if status is None:
return { "hasMessage": False }
Expand All @@ -20,13 +20,13 @@ def get_context_data():
"slug": status.slug,
"title": status.title,
"body": status.body,
"url": f"/status/{status.slug}",
"url": urlreverse('ietf.status.views.status_page', kwargs={ 'slug': status.slug }),
jennifer-richards marked this conversation as resolved.
Show resolved Hide resolved
"date": status.date.isoformat()
}
return context

def status_latest_html(request):
return render(request, "status/latest.html", context=get_context_data())
return render(request, "status/latest.html", context=get_last_active_status())

def status_page(request, slug):
sanitised_slug = slug.rstrip("/")
Expand All @@ -37,10 +37,10 @@ def status_page(request, slug):
})

def status_latest_json(request):
return HttpResponse(json.dumps(get_context_data()), status=200, content_type='application/json')
return JsonResponse(get_last_active_status())

def status_latest_redirect(request):
context = get_context_data()
context = get_last_active_status()
if context["hasMessage"] == True:
return HttpResponseRedirect(context["url"])
return HttpResponseNotFound()
8 changes: 8 additions & 0 deletions ietf/utils/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,14 @@ def ignore_pattern(regex, pattern):
covered.add(regex)
break

uncovered = set()
for regex, compiled, obj in patterns:
if regex not in covered:
uncovered.add(regex)

if(len(uncovered) > 0):
print("Uncovered URLs", uncovered)
jennifer-richards marked this conversation as resolved.
Show resolved Hide resolved

self.runner.coverage_data["url"] = {
"coverage": 1.0*len(covered)/len(patterns),
"covered": dict( (k, (o.lookup_str, k in covered)) for k,p,o in patterns ),
Expand Down
Loading