single job without login details page with refresh
authorCezary Czaplewski <czarek@chem.univ.gda.pl>
Sat, 11 Nov 2017 03:26:18 +0000 (04:26 +0100)
committerCezary Czaplewski <czarek@chem.univ.gda.pl>
Sat, 11 Nov 2017 03:26:18 +0000 (04:26 +0100)
TODO
django_simple/todo/templates/base.html
django_simple/todo/templates/details.html
django_simple/todo/views.py

diff --git a/TODO b/TODO
index b071ca4..237b3d4 100644 (file)
--- a/TODO
+++ b/TODO
@@ -17,7 +17,8 @@ check input for other errors (sequence ?)
 
 add web viewer NGL WebGL
 
-add BOXX BOXY BOXZ in advanced md and mremd
+# add BOXX BOXY BOXZ in advanced md and mremd
+# done
 
 dynamic dissulfides input - all and selected cys
 
@@ -41,24 +42,30 @@ automatic rm of old jobs ?
 include a simple mechanism to try out sample data provided by the authors,
 for example, a button for automatic loading of the data. Sample data must be
 accessible to users so that they can confirm data formatting requirements
+# ?
 
 contain help pages or a tutorial with links to sample output that performs
 interactively in the same way as real output. The help pages must include
 information on how to interpret the results returned by the web server
-
-be primarily web-based and viewable on the website. Use of browser plugins
-for data visualization is encouraged. However, use of Flash plugins is
-discouraged due to security issues and websites that use Java plugins will
-no longer be accepted
-
-provide a web link to the results if the website is not able to return
-results immediately. The link should be provided at the time of data
-submission and allow the user to bookmark and access the results at a later
-time. Ideally, the link will report the status of the job (queued, running,
-or finished). Do not assume that users will provide an email address for
-results notification. Any request for an email must state that it is
-optional. Websites that use a guest login will not be approved
-
-keep every user’s submitted data private and not viewable by anyone other
-than the user or those given permission by the user
-
+# ?
+
+# be primarily web-based and viewable on the website. Use of browser plugins
+# for data visualization is encouraged. However, use of Flash plugins is
+# discouraged due to security issues and websites that use Java plugins will
+# no longer be accepted
+# OK
+
+# provide a web link to the results if the website is not able to return
+# results immediately. The link should be provided at the time of data
+# submission and allow the user to bookmark and access the results at a later
+# time. Ideally, the link will report the status of the job (queued, running,
+# or finished). Do not assume that users will provide an email address for
+# results notification. Any request for an email must state that it is
+# optional. Websites that use a guest login will not be approved
+#
+# OK link uses task.id http://ha1.chem.univ.gda.pl:8001/details/942/
+
+# keep every user’s submitted data private and not viewable by anyone other
+# than the user or those given permission by the user
+#
+# OK ? scramble task.id ? add user.id= 19da81cb0ad5492dac8e4eaefd28949e ?
index d974976..ba424bd 100644 (file)
                        {% endif %}     
                        {% endif %}
                </div>
+<!--
                {% if user|is_lazy_user %}
                 <a href="/convert" title="Convert to save your data">Convert to regular user</a>
                {% endif %}
+-->
        </div>
 
        {% block content %}
index 08738fa..fcfb8d4 100644 (file)
@@ -1,6 +1,39 @@
 {% extends "base.html" %}
 
+{% load i18n lazysignup_tags %}
 {% block content %}
+
+{% if user|is_lazy_user %}
+<ul class="list-group">
+
+<li class="list-group-item new-task-item task-item">
+
+<div class="col-xs-3 form-group">
+<form action="/refresh_done/" method="post">
+{% csrf_token %}
+<input type="submit" class="btn" value="Refresh" name="refreshbtn">
+</form>
+</div>
+
+<div class="col-xs-10 form-group">
+<h5 style="text-align:right;float:right;">
+{% if not task.done %}
+ {% if task.running > 0  %}
+  {% if task.running == 100  %}
+  postprocessing
+  {% else %}
+  running
+  {% endif %}
+ {% else %}
+  waiting in the queue to start
+ {% endif %}
+{% endif %}
+</h5>
+</div>
+</li>
+</ul>
+{% endif %}
+
 <h3> All parameters for task <b>{{ task.name }}</b></h3>
 Created {{ task.created_date  }}
        <ul class="list-group">
@@ -11,7 +44,13 @@ Created {{ task.created_date  }}
                                        {% if task.done %}
                                                <span class="fa fa-check-square-o"></span>
                                        {% else %}
+                                         {% if task.running > 0  %}
+                                               <span class="fa fa-spinner
+                                               fa-spin"></span>
+                                               {{ task.running }}%
+                                         {% else %}
                                                <span class="fa fa-square-o"></span>
+                                         {% endif %}
                                        {% endif %}
 
                                </div>
index 15d9184..de8d085 100644 (file)
@@ -8,6 +8,7 @@ import os
 import subprocess
 import json
 from lazysignup.decorators import allow_lazy_user
+from lazysignup.utils import is_lazy_user
 
 res_codes = [
                 # 20 canonical amino acids
@@ -223,7 +224,10 @@ def add_md(request,task_id):
              task.jobdirname = "_".join([basename, suffix])
              
              task.save()
-             return redirect('/')
+             if is_lazy_user(request.user):
+              return render(request, "details.html",{'task':task})
+             else:
+              return redirect('/')
     else:
         data= {'name':task.name}
         form = TaskForm_md(initial=data)
@@ -566,7 +570,10 @@ def refresh_done(request):
             nq+=1
     variable='Idle jobs='+str(nq)+' Total jobs='+str(njob)
 
-    return render(request, "index.html", {
+    if is_lazy_user(request.user):
+     return redirect('/details/'+str(task.id)+'/')
+    else:
+     return render(request, "index.html", {
                 'tasks': tasks ,
                 'variable' : variable
                         })