applications: list jobs on version page (#69655)
This commit is contained in:
parent
6fc211c7ca
commit
736e3e3df6
|
@ -19,6 +19,17 @@
|
|||
<h3>{{ version.number }}</h3>
|
||||
<p><span>{% blocktrans with cdate=version.creation_timestamp|date:"DATETIME_FORMAT" udate=version.last_update_timestamp|date:"DATETIME_FORMAT" %}created at {{ cdate }}, updated at {{ udate }}{% endblocktrans %}</span></p>
|
||||
<p>{{ version.notes|default:""|linebreaksbr }}</p>
|
||||
{% if version.asyncjob_set.all %}
|
||||
<ul>
|
||||
{% for job in version.asyncjob_set.all %}
|
||||
<li>
|
||||
{{ job.label }}
|
||||
({% blocktrans with sdate=job.creation_timestamp|date:"DATETIME_FORMAT" edate=job.completion_timestamp|date:"DATETIME_FORMAT" %}started at {{ sdate }}, ended at {{ edate }}{% endblocktrans %})
|
||||
- {% trans "status:" %} {{ job.get_status_display }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
<div class="buttons">
|
||||
<a class="button" download href="{% url 'application-download' app_slug=app.slug version_pk=version.pk %}"
|
||||
>{% trans "Download" %}</a>
|
||||
|
|
|
@ -21,6 +21,7 @@ import urllib.parse
|
|||
|
||||
from django.conf import settings
|
||||
from django.core.files.base import ContentFile
|
||||
from django.db.models import Prefetch
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse, reverse_lazy
|
||||
|
@ -117,7 +118,9 @@ class VersionsView(ListView):
|
|||
|
||||
def get_queryset(self):
|
||||
self.app = Application.objects.get(slug=self.kwargs['app_slug'])
|
||||
return self.app.version_set.order_by('-last_update_timestamp')
|
||||
return self.app.version_set.order_by('-last_update_timestamp').prefetch_related(
|
||||
Prefetch('asyncjob_set', queryset=AsyncJob.objects.order_by('-creation_timestamp'))
|
||||
)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs['app'] = self.app
|
||||
|
|
|
@ -227,6 +227,8 @@ def test_create_application(app, admin_user, settings, analyze):
|
|||
assert b'"version_notes": "Foo bar blah."' in resp.content
|
||||
|
||||
resp = app.get('/applications/manifest/test/versions/')
|
||||
assert resp.text.count('1.0') == 1
|
||||
assert resp.text.count('Creating application bundle') == 1
|
||||
resp = resp.click(href='/applications/manifest/test/download/%s/' % version.pk)
|
||||
assert resp.content_type == 'application/x-tar'
|
||||
assert b'"version_number": "1.0"' in resp.content
|
||||
|
@ -247,6 +249,8 @@ def test_create_application(app, admin_user, settings, analyze):
|
|||
assert b'"version_notes": "Foo bar blahha."' in resp.content
|
||||
|
||||
resp = app.get('/applications/manifest/test/versions/')
|
||||
assert resp.text.count('1.0') == 1
|
||||
assert resp.text.count('Creating application bundle') == 2
|
||||
resp = resp.click(href='/applications/manifest/test/download/%s/' % same_version.pk)
|
||||
assert resp.content_type == 'application/x-tar'
|
||||
assert b'"version_number": "1.0"' in resp.content
|
||||
|
@ -294,6 +298,9 @@ def test_create_application(app, admin_user, settings, analyze):
|
|||
assert version.pk != same_version.pk
|
||||
|
||||
resp = app.get('/applications/manifest/test/versions/')
|
||||
assert resp.text.count('1.0') == 1
|
||||
assert resp.text.count('2.0') == 1
|
||||
assert resp.text.count('Creating application bundle') == 3
|
||||
resp = resp.click(href='/applications/manifest/test/download/%s/' % same_version.pk)
|
||||
assert resp.content_type == 'application/x-tar'
|
||||
assert b'"version_number": "1.0"' in resp.content
|
||||
|
@ -311,6 +318,10 @@ def test_create_application(app, admin_user, settings, analyze):
|
|||
assert new_version.number == '1.0'
|
||||
assert new_version.notes == 'Foo bar blah. But with an icon.'
|
||||
assert new_version.pk != version.pk # new version created
|
||||
resp = app.get('/applications/manifest/test/versions/')
|
||||
assert resp.text.count('1.0') == 2
|
||||
assert resp.text.count('2.0') == 1
|
||||
assert resp.text.count('Creating application bundle') == 4
|
||||
|
||||
# non editable app
|
||||
application.editable = False
|
||||
|
@ -518,6 +529,10 @@ def test_deploy_application(app, admin_user, settings, app_bundle, app_bundle_wi
|
|||
assert version3.pk != version4.pk
|
||||
assert version3.creation_timestamp < version4.creation_timestamp
|
||||
assert version3.last_update_timestamp < version4.last_update_timestamp
|
||||
resp = app.get('/applications/manifest/test/versions/')
|
||||
assert resp.text.count('42.0') == 2
|
||||
assert resp.text.count('43.0') == 1
|
||||
assert resp.text.count('Deploying application bundle') == 4
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
Loading…
Reference in New Issue