[cig-commits] r12046 - in cs/portal/trunk/northridge/SeismoWebPortal: . static/images templates/SeismoWebPortal

leif at geodynamics.org leif at geodynamics.org
Wed May 28 15:04:41 PDT 2008


Author: leif
Date: 2008-05-28 15:04:40 -0700 (Wed, 28 May 2008)
New Revision: 12046

Added:
   cs/portal/trunk/northridge/SeismoWebPortal/static/images/barbers_pole.gif
   cs/portal/trunk/northridge/SeismoWebPortal/static/images/progress_bar.gif
   cs/portal/trunk/northridge/SeismoWebPortal/static/images/progress_box.gif
Modified:
   cs/portal/trunk/northridge/SeismoWebPortal/forms.py
   cs/portal/trunk/northridge/SeismoWebPortal/management.py
   cs/portal/trunk/northridge/SeismoWebPortal/mezzanine.py
   cs/portal/trunk/northridge/SeismoWebPortal/models.py
   cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/pluggable.html
   cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_detail.html
   cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.html
   cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html
   cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/style.css
   cs/portal/trunk/northridge/SeismoWebPortal/views.py
Log:
Added confirmation step and job info to run status page.


Modified: cs/portal/trunk/northridge/SeismoWebPortal/forms.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/forms.py	2008-05-28 17:50:12 UTC (rev 12045)
+++ cs/portal/trunk/northridge/SeismoWebPortal/forms.py	2008-05-28 22:04:40 UTC (rev 12046)
@@ -167,6 +167,7 @@
                 parametersType = parametersType,
                 parametersId = parametersId,
                 record_length = record_length,
+                status = "unconfirmed",
             )
         return obj
 

Modified: cs/portal/trunk/northridge/SeismoWebPortal/management.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/management.py	2008-05-28 17:50:12 UTC (rev 12045)
+++ cs/portal/trunk/northridge/SeismoWebPortal/management.py	2008-05-28 22:04:40 UTC (rev 12046)
@@ -161,11 +161,13 @@
 
     # UserInfo
     cur.execute("select * from SeismoWebPortal_userinfo")
-    for (user_id,
+    for userInfo in cur:
+        userInfo = userInfo[0:9]
+        (user_id,
          institution,
          address1, address2, address3, phone,
          invite_id, approved,
-         help_visible) in cur:
+         help_visible) = userInfo
         user = users[user_id]
         models.UserInfo.objects.create(
             user         = user,

Modified: cs/portal/trunk/northridge/SeismoWebPortal/mezzanine.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/mezzanine.py	2008-05-28 17:50:12 UTC (rev 12045)
+++ cs/portal/trunk/northridge/SeismoWebPortal/mezzanine.py	2008-05-28 22:04:40 UTC (rev 12046)
@@ -778,7 +778,13 @@
         from forms import RunManipulator
         return RunManipulator(self.obj.id)
 
+    def start(self, request):
+        obj = self.obj
+        obj.status = "ready"
+        obj.save()
+        return HttpResponseRedirect(self.urlForObject(self, request.root))
 
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # support code
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Modified: cs/portal/trunk/northridge/SeismoWebPortal/models.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/models.py	2008-05-28 17:50:12 UTC (rev 12045)
+++ cs/portal/trunk/northridge/SeismoWebPortal/models.py	2008-05-28 22:04:40 UTC (rev 12046)
@@ -442,10 +442,23 @@
     class Admin:
         list_display = ('id', 'run', 'task', 'status', 'started', 'finished', 'url')
 
+    def save(self):
+        if self.status == 'done':
+            self.progress = 1.0
+        super(Job, self).save()
+        return
+
     def wait(self): return 0 # NYI
     def duration(self): return "-" # NYI
 
+    def progressPx154(self):
+        imageWidth = 154
+        offset = imageWidth - int(float(imageWidth) * self.progress)
+        if offset < 0:
+            offset = 0
+        return offset
 
+
 class OutputFile(models.Model):
     job = models.ForeignKey(Job)
     

Copied: cs/portal/trunk/northridge/SeismoWebPortal/static/images/barbers_pole.gif (from rev 12045, cs/portal/trunk/seismo/SeismoWebPortal/static/pics/barbers_pole.gif)
===================================================================
(Binary files differ)

Copied: cs/portal/trunk/northridge/SeismoWebPortal/static/images/progress_bar.gif (from rev 12045, cs/portal/trunk/seismo/SeismoWebPortal/static/pics/progress_bar.gif)
===================================================================
(Binary files differ)

Copied: cs/portal/trunk/northridge/SeismoWebPortal/static/images/progress_box.gif (from rev 12045, cs/portal/trunk/seismo/SeismoWebPortal/static/pics/progress_box.gif)
===================================================================
(Binary files differ)

Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/pluggable.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/pluggable.html	2008-05-28 17:50:12 UTC (rev 12045)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/pluggable.html	2008-05-28 22:04:40 UTC (rev 12046)
@@ -236,7 +236,7 @@
 <div id="messages">
     <ul>
         {% for message in messages %}
-        <li>{{ message }}</li>
+        <li class="message">{{ message }}</li>
         {% endfor %}
     </ul>
 </div>

Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_detail.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_detail.html	2008-05-28 17:50:12 UTC (rev 12045)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_detail.html	2008-05-28 22:04:40 UTC (rev 12046)
@@ -1,7 +1,51 @@
 
 <h2><img src="{{root}}/images/rocket.gif" width=32 height=32> {{ object }}</h2>
 
+{% ifequal object.status 'unconfirmed' %}
+<p class="message">This run has not been started. Verify that the parameters below are correct.  Then click the "Start" button at the bottom of this page.</p>
+{% endifequal %}
+
 <dl class=parameters>
+    <dt>status</dt>
+    <dd>
+        <p>{{ object.status }}</p>
+
+        {% if object.job_set.count %}
+        <table rules=cols>
+            <thead>
+            <tr>
+                <th>task</th>
+                <th>status</th>
+                <th>progress</th>
+                <th>output</th>
+            </tr>
+            </thead>
+            <tbody>
+            {% for job in object.job_set.all %}
+            <tr class="{% cycle odd,even %}">
+                <td>{{ job.task }}</td>
+                <td>{{ job.status }}</td>
+                <td>
+                    {% ifequal job.progress -1.0 %}
+                    <img src="{{root}}/images/progress_box.gif" style="background: white url({{root}}/images/barbers_pole.gif) top left no-repeat; background-position: -40px 0px;">
+                    {% else %}
+                    <img src="{{root}}/images/progress_box.gif" style="background: white url({{root}}/images/progress_bar.gif) top left no-repeat; background-position: -{{job.progressPx154}}px 0px;">
+                    {% endifequal %}
+                </td>
+                <td>
+                    <ul>
+                        {% for outputFile in job.outputfile_set.all %}
+                        <li><a href="{{outputFile.url}}">{{ outputFile.name }}</a></li>
+                        {% endfor %}
+                    </ul>
+                </td>
+            </tr>
+            {% endfor %}
+            </tbody>
+        </table>
+        {% endif %}
+    </dd>
+
     <dt>event</dt>
     <dd>
         <a href="{{root}}/?class=Event&object={{object.event.id}}">{{ object.event }}</a>
@@ -42,6 +86,14 @@
     <dt>zero half duration</dt>
         <dd><img src="{{root}}/images/icon-{% if object.zero_half_duration %}yes{% else %}no{% endif %}.gif"> {{ object.zero_half_duration }}</dd>
     <dt>started</dt><dd>{{ object.started|date }} {{ object.started|time }}</dd>
-    <dt>finished</dt><dd>{{ object.finshed|date }} {{ object.finished|time }}</dd>
-    <dt>status</dt><dd>{{ object.status }}</dd>
+    <dt>finished</dt><dd>{{ object.finished|date }} {{ object.finished|time }}</dd>
 </dl>
+
+{% ifequal object.status 'unconfirmed' %}
+<form method="post" action="{{root}}/?class=Run&object={{object.id}}&action=start">
+    <div class="tab30ex message">
+     <p>Click "Start" to start this run.</p>
+    <div><input class=submit type="submit" name="start" value="Start" /></div>
+    </div> <!-- tab30ex -->
+</form>
+{% endifequal %}

Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.html	2008-05-28 17:50:12 UTC (rev 12045)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_list.html	2008-05-28 22:04:40 UTC (rev 12046)
@@ -23,7 +23,7 @@
             <td>{{ object.stationList }}</td>
             <td>{{ object.parameters }}</td>
             <td>{{ object.started|date }} {{ object.started|time }}</td>
-            <td>{{ object.finshed|date }} {{ object.finished|time }}</td>
+            <td>{{ object.finished|date }} {{ object.finished|time }}</td>
             <td>{{ object.status }}</td>
         </tr>
         {% endfor %}

Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html	2008-05-28 17:50:12 UTC (rev 12045)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html	2008-05-28 22:04:40 UTC (rev 12046)
@@ -1,18 +1,14 @@
 
-{% extends "SeismoWebPortal/base.html" %}
+{% extends "SeismoWebPortal/root.html" %}
 
-{% block content %}
+{% block body %}
 
 <div id="splash">
 
+    <h1><img src="{{root}}/images/cig.gif"> <img src="{{root}}/images/seismogram.gif"><br>CIG Seismology Web Portal</h1>
+
     <p>Version 3</p>
 
-    <p id="powered">Powered by:</p>
-    <ul id="codes">
-        <li><img src="{{root}}/images/specfem3dg_logo.jpg" width=99 height=94> Specfem 3D Globe v4.0
-        <li><img src="{{root}}/images/mineos_logo.gif" width=75 height=75> Mineos v1.0
-    </ul>
-
     <hr>
 
     <p id="login"><a href="login/">Login</a></p>
@@ -22,6 +18,14 @@
 
     <hr>
 
+    <p id="powered">Powered by:</p>
+    <ul id="codes">
+        <li><img src="{{root}}/images/specfem3dg_logo.jpg" width=99 height=94> Specfem 3D Globe v4.0
+        <li><img src="{{root}}/images/mineos_logo.gif" width=75 height=75> Mineos v1.0
+    </ul>
+
+    <hr>
+
     <p id="sponsored">Brought to you by:</p>
     <ul id="sponsors">
         <li><a href="http://www.geodynamics.org/"><img src="{{root}}/images/cig-logo_small-initials.gif"></a>

Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/style.css
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/style.css	2008-05-28 17:50:12 UTC (rev 12045)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/style.css	2008-05-28 22:04:40 UTC (rev 12046)
@@ -9,7 +9,7 @@
     border-width: 0;
 }
 
-h1 {
+#header h1 {
     font-size: medium;
 }
 
@@ -31,6 +31,9 @@
     position: absolute;
     top: -3ex;
     right: 1ex;
+}
+
+.message {
     font-weight: bold;
     background-color: yellow;
     border: medium double black;
@@ -469,10 +472,6 @@
   splash
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
-#header h1 a {
-    text-decoration: none;
-}
-
 #splash {
     text-align: center;
 }
@@ -482,7 +481,7 @@
 }
 
 #splash hr {
-    width: 50%;
+    width: 20em;
     margin-left: auto;
     margin-right: auto;
     margin-top: 1em;

Modified: cs/portal/trunk/northridge/SeismoWebPortal/views.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/views.py	2008-05-28 17:50:12 UTC (rev 12045)
+++ cs/portal/trunk/northridge/SeismoWebPortal/views.py	2008-05-28 22:04:40 UTC (rev 12046)
@@ -138,6 +138,8 @@
                 ret = obj.downloadAsText(request)
             elif action == 'downloadAsKML':
                 ret = obj.downloadAsKML(request)
+            elif action == 'start':
+                ret = obj.start(request)
 
         if ret is None:
             raise Http404
@@ -326,7 +328,8 @@
 def notify_user_of_successful_run(run):
     from django.core.mail import send_mail
 
-    sim = run.simulation
+    if True:
+        return # NYI
     user = sim.user
 
     subject = 'The simulation "%s" has finished running.' % sim.name



More information about the cig-commits mailing list