[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH 3/5] Use two different refresh frequencies on th
From: |
Maxime Petazzoni |
Subject: |
[Maposmatic-dev] [PATCH 3/5] Use two different refresh frequencies on the job page |
Date: |
Mon, 11 Jan 2010 11:02:54 +0100 |
---
www/maposmatic/views.py | 8 +++++++-
www/settings.py | 6 ++++++
www/templates/maposmatic/job-page.html | 9 ++++-----
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/www/maposmatic/views.py b/www/maposmatic/views.py
index 9c358e5..452212a 100644
--- a/www/maposmatic/views.py
+++ b/www/maposmatic/views.py
@@ -238,9 +238,15 @@ def job(request, job_id):
del request.session['redirected']
else:
isredirected = False
+
+ refresh = www.settings.REFRESH_JOB_WAITING
+ if job.is_rendering():
+ refresh = www.settings.REFRESH_JOB_RENDERING
+
return render_to_response('maposmatic/job-page.html',
{ 'job' : job, 'single': True,
- 'redirected' : isredirected },
+ 'redirected' : isredirected,
+ 'refresh': refresh, 'refresh_ms':
(refresh*1000) },
context_instance=RequestContext(request))
def all_jobs(request):
diff --git a/www/settings.py b/www/settings.py
index 3d8dc1a..85cd9cd 100644
--- a/www/settings.py
+++ b/www/settings.py
@@ -167,3 +167,9 @@ LOG.info("log restarted.")
def has_gis_database():
return GIS_DATABASE_NAME and GIS_DATABASE_NAME != ''
+
+# Job page refresh frequency, in seconds, for when the job is waiting in queue
+# and when the job is currently being rendered.
+REFRESH_JOB_WAITING = 10
+REFRESH_JOB_RENDERING = 20
+
diff --git a/www/templates/maposmatic/job-page.html
b/www/templates/maposmatic/job-page.html
index e444b39..ff3bf5b 100644
--- a/www/templates/maposmatic/job-page.html
+++ b/www/templates/maposmatic/job-page.html
@@ -30,9 +30,7 @@
{% load extratags %}
-{% block menu-jobs %}
-class="activelink"
-{% endblock %}
+{% block menu-jobs %}class="activelink"{% endblock %}
{% block page %}
<h1>{{ job.maptitle }}</h1>
@@ -48,10 +46,11 @@ class="activelink"
{% if not job.is_done %}
<p>
-» <a href="/jobs/{{job.id}}">{% trans "Refresh the status" %}</a> {%
trans "(the page will refresh automatically every 5 seconds until the rendering
is completed)." %}
+» <a href="{% url job-by-id job.id %}">{% trans "Refresh the status"
%}</a> {% blocktrans %}(the page will refresh automatically every {{ refresh }}
seconds until the rendering is completed).{% endblocktrans %}
</p>
+
<script type="text/javascript">
- setTimeout("location.reload(true);", 5000);
+ setTimeout("location.reload(true);", {{ refresh_ms }});
</script>
{% endif %}
--
1.6.3.3.261.g85c6
Re: [Maposmatic-dev] [PATCH 1/5] Fix jobinfo table width, Thomas Petazzoni, 2010/01/11