diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 41: a simple job view

Message ID 20110724230314.29297.62447.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson July 24, 2011, 11:03 p.m. UTC
Merge authors:
  Michael Hudson-Doyle (mwhudson)
------------------------------------------------------------
revno: 41 [merge]
committer: Michael-Doyle Hudson <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Mon 2011-07-25 11:01:00 +1200
message:
  a simple job view
added:
  lava_scheduler_app/templates/lava_scheduler_app/job.html
modified:
  lava_scheduler_app/templates/lava_scheduler_app/alljobs.html
  lava_scheduler_app/templates/lava_scheduler_app/index.html
  lava_scheduler_app/urls.py
  lava_scheduler_app/views.py


--
lp:lava-scheduler
https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk

You are subscribed to branch lp:lava-scheduler.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/alljobs.html'
--- lava_scheduler_app/templates/lava_scheduler_app/alljobs.html	2011-07-20 03:17:42 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/alljobs.html	2011-07-24 22:10:38 +0000
@@ -22,7 +22,7 @@ 
   <tbody>
     {% for job in jobs %}
     <tr>
-      <td>{{ job.id }}</td>
+      <td><a href="{% url lava_scheduler_app.views.job pk=job.pk %}">{{ job.id }}</a></td>
       <td>{{ job.get_status_display }}</td>
       <td>{{ job.target }}</td>
       <td>{{ job.submitter }}</td>
@@ -36,8 +36,11 @@ 
 $(document).ready(
   function() {
     $("table.data").dataTable({
-      "bJQueryUI": true
-    })
+      "bJQueryUI": true,
+      "aoColumnDefs": [
+        { "sType": "numeric", "aTargets": [ "id" ] }
+      ]
+    });
   }
 );
 </script>

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/index.html'
--- lava_scheduler_app/templates/lava_scheduler_app/index.html	2011-07-20 03:16:25 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/index.html	2011-07-24 21:58:58 +0000
@@ -27,7 +27,7 @@ 
 <table class="data display">
   <thead>
     <tr>
-      <th>ID</th>
+      <th class="id">ID</th>
       <th>Status</th>
       <th>Target</th>
       <th>Submitter</th>
@@ -37,7 +37,7 @@ 
   <tbody>
     {% for job in jobs %}
     <tr>
-      <td>{{ job.id }}</td>
+      <td><a href="{% url lava_scheduler_app.views.job pk=job.pk %}">{{ job.id }}</a></td>
       <td>{{ job.get_status_display }}</td>
       <td>{{ job.target }}</td>
       <td>{{ job.submitter }}</td>
@@ -53,8 +53,11 @@ 
 $(document).ready(
   function() {
     $("table.data").dataTable({
-      "bJQueryUI": true
-    })
+      "bJQueryUI": true,
+      "aoColumnDefs": [
+        { "sType": "numeric", "aTargets": [ "id" ] }
+      ]
+    });
   }
 );
 </script>

=== added file 'lava_scheduler_app/templates/lava_scheduler_app/job.html'
--- lava_scheduler_app/templates/lava_scheduler_app/job.html	1970-01-01 00:00:00 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/job.html	2011-07-24 22:53:00 +0000
@@ -0,0 +1,69 @@ 
+{% extends "lava_scheduler_app/_content.html" %}
+
+{% block extrahead %}
+{{ block.super }}
+<style type="text/css">
+.column {
+    position: relative;
+    float: left;
+    padding-right: 2em;
+    padding-bottom: 1em;
+}
+</style>
+{% endblock %}
+
+{% block content %}
+<h2>Job {{ job.pk }}</h2>
+
+<div id="columns">
+  <div class="column">
+    <dt>Submitted by:</dt>
+    <dd>{{ job.submitter }}</dd>
+
+    <dt>Targeted to:</dt>
+    <dd>{{ job.target }}</dd>
+
+    <dt>Requested type:</dt>
+    <dd>{{ job.device_type }}</dd>
+  </div>
+
+  <div class="column">
+    <dt>Status:</dt>
+    <dd><b>{{ job.get_status_display }}</b></dd>
+  </div>
+
+  <div class="column">
+    <dt>Submitted at:</dt>
+    <dd>{{ job.submit_time }}</dd>
+
+    <dt>Started at:</dt>
+    <dd>{{ job.start_time|default:"not started" }}</dd>
+
+    <dt>Finished at:</dt>
+    <dd>{{ job.end_time|default:"not finished" }}</dd>
+  </div>
+  <div style="clear: both"></div>
+</div>
+
+<div id="tabs">
+  <ul>
+    <li><a href="#tab-definition">Job Definition</a></li>
+  </ul>
+  <div id="tab-definition">
+    <pre>
+{{ job.definition }}
+    </pre>
+  </div>
+  <!-- Log viewing will go here, when it's possible -->
+</div>
+
+<script>
+$(document).ready(
+  function() {
+    $("#tabs").tabs({
+    });
+  }
+);
+</script>
+
+{% endblock %}

=== modified file 'lava_scheduler_app/urls.py'
--- lava_scheduler_app/urls.py	2011-07-20 02:53:04 +0000
+++ lava_scheduler_app/urls.py	2011-07-21 03:53:15 +0000
@@ -4,4 +4,5 @@ 
     'lava_scheduler_app.views',
     url(r'^$', 'index'),
     url(r'^alljobs$', 'alljobs'),
+    url(r'^job/(?P<pk>[0-9]+)$', 'job'),
     )

=== modified file 'lava_scheduler_app/views.py'
--- lava_scheduler_app/views.py	2011-07-12 02:12:28 +0000
+++ lava_scheduler_app/views.py	2011-07-21 03:53:15 +0000
@@ -21,3 +21,12 @@ 
             'jobs': TestJob.objects.all(),
         },
         RequestContext(request))
+
+
+def job(request, pk):
+    return render_to_response(
+        "lava_scheduler_app/job.html",
+        {
+            'job': TestJob.objects.get(pk=pk),
+        },
+        RequestContext(request))