diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 34: a very simple ui for the scheduler

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

Commit Message

Michael-Doyle Hudson July 20, 2011, 3:25 a.m. UTC
Merge authors:
  Michael Hudson-Doyle (mwhudson)
Related merge proposals:
  https://code.launchpad.net/~mwhudson/lava-scheduler/scheduler-ui/+merge/67652
  proposed by: Michael Hudson-Doyle (mwhudson)
  review: Approve - Zygmunt Krynicki (zkrynicki)
------------------------------------------------------------
revno: 34 [merge]
committer: Michael-Doyle Hudson <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Wed 2011-07-20 15:23:22 +1200
message:
  a very simple ui for the scheduler
added:
  lava_scheduler_app/templates/lava_scheduler_app/_content.html
  lava_scheduler_app/templates/lava_scheduler_app/alljobs.html
modified:
  lava_scheduler_app/models.py
  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/models.py'
--- lava_scheduler_app/models.py	2011-06-22 23:38:39 +0000
+++ lava_scheduler_app/models.py	2011-07-11 21:24:27 +0000
@@ -78,6 +78,8 @@ 
         (CANCELED, 'Canceled'),
     )
 
+    id = models.IntegerField(primary_key=True)
+
     submitter = models.ForeignKey(
         User,
         verbose_name = _(u"Submitter"),
@@ -124,8 +126,11 @@ 
         editable = False,
     )
 
-    #def __unicode__(self):
-    #    return self.description
+    def __unicode__(self):
+        r = "%s test job" % self.get_status_display()
+        if self.target:
+            r += " for %s" % (self.target.hostname,)
+        return r
 
     @classmethod
     def from_json_and_user(cls, json_data, user):

=== added file 'lava_scheduler_app/templates/lava_scheduler_app/_content.html'
--- lava_scheduler_app/templates/lava_scheduler_app/_content.html	1970-01-01 00:00:00 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/_content.html	2011-07-20 03:15:42 +0000
@@ -0,0 +1,14 @@ 
+{% extends "layouts/content.html" %}
+
+{% block extrahead %}
+{{ block.super }}
+<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}lava-server/css/demo_table_jui.css"/>
+<script type="text/javascript" src="{{ STATIC_URL }}dashboard_app/js/FixedHeader.min.js"></script> 
+<script type="text/javascript" src="{{ STATIC_URL }}lava-server/js/jquery.dataTables.min.js"></script> 
+{% endblock %}
+
+
+{% block breadcrumbs %}
+{{ block.super }}
+<li><a href="{% url lava_scheduler_app.views.index %}">Scheduler</a></li>
+{% endblock %}

=== added file 'lava_scheduler_app/templates/lava_scheduler_app/alljobs.html'
--- lava_scheduler_app/templates/lava_scheduler_app/alljobs.html	1970-01-01 00:00:00 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/alljobs.html	2011-07-20 03:17:42 +0000
@@ -0,0 +1,45 @@ 
+{% extends "lava_scheduler_app/_content.html" %}
+
+{% block breadcrumbs %}
+{{ block.super }}
+<li><a href="{% url lava_scheduler_app.views.alljobs %}">All Jobs</a></li>
+{% endblock %}
+
+
+{% block content %}
+<h2>All Jobs</h2>
+
+<table class="data display">
+  <thead>
+    <tr>
+      <th>ID</th>
+      <th>Status</th>
+      <th>Target</th>
+      <th>Submitter</th>
+      <th>Submit Time</th>
+    </tr>
+  </thead>
+  <tbody>
+    {% for job in jobs %}
+    <tr>
+      <td>{{ job.id }}</td>
+      <td>{{ job.get_status_display }}</td>
+      <td>{{ job.target }}</td>
+      <td>{{ job.submitter }}</td>
+      <td>{{ job.submit_time }}</td>
+    </tr>
+    {% endfor %}
+  </tbody>
+</table>
+
+<script>
+$(document).ready(
+  function() {
+    $("table.data").dataTable({
+      "bJQueryUI": true
+    })
+  }
+);
+</script>
+
+{% endblock %}

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/index.html'
--- lava_scheduler_app/templates/lava_scheduler_app/index.html	2011-07-08 02:57:31 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/index.html	2011-07-20 03:16:25 +0000
@@ -1,12 +1,62 @@ 
-{% extends "layouts/content.html" %}
-
-
-{% block breadcrumbs %}
-{{ block.super }}
-<li><a href="{% url lava_scheduler_app.views.index %}">Scheduler</a></li>
-{% endblock %}
-
+{% extends "lava_scheduler_app/_content.html" %}
 
 {% block content %}
-<p>Hello World from LAVA Scheduler</p>
+<h2>Devices</h2>
+
+<table class="display data">
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Hostname</th>
+      <th>Status</th>
+    </tr>
+  </thead>
+  <tbody>
+    {% for device in devices %}
+    <tr>
+      <td>{{ device.device_type }}</td>
+      <td>{{ device.hostname }}</td>
+      <td>{{ device.get_status_display }}</td>
+    </tr>
+    {% endfor %}
+  </tbody>
+</table>
+
+<h2>Active Jobs</h2>
+
+<table class="data display">
+  <thead>
+    <tr>
+      <th>ID</th>
+      <th>Status</th>
+      <th>Target</th>
+      <th>Submitter</th>
+      <th>Submit Time</th>
+    </tr>
+  </thead>
+  <tbody>
+    {% for job in jobs %}
+    <tr>
+      <td>{{ job.id }}</td>
+      <td>{{ job.get_status_display }}</td>
+      <td>{{ job.target }}</td>
+      <td>{{ job.submitter }}</td>
+      <td>{{ job.submit_time }}</td>
+    </tr>
+    {% endfor %}
+  </tbody>
+</table>
+
+<a href="{% url lava_scheduler_app.views.alljobs %}">All jobs</a>
+
+<script>
+$(document).ready(
+  function() {
+    $("table.data").dataTable({
+      "bJQueryUI": true
+    })
+  }
+);
+</script>
+
 {% endblock %}

=== modified file 'lava_scheduler_app/urls.py'
--- lava_scheduler_app/urls.py	2011-07-12 02:25:34 +0000
+++ lava_scheduler_app/urls.py	2011-07-20 02:53:04 +0000
@@ -2,4 +2,6 @@ 
 
 urlpatterns = patterns(
     'lava_scheduler_app.views',
-    url(r'$', 'index'))
+    url(r'^$', 'index'),
+    url(r'^alljobs$', 'alljobs'),
+    )

=== modified file 'lava_scheduler_app/views.py'
--- lava_scheduler_app/views.py	2011-05-25 04:32:03 +0000
+++ lava_scheduler_app/views.py	2011-07-12 02:12:28 +0000
@@ -1,6 +1,23 @@ 
 from django.template import RequestContext
 from django.shortcuts import render_to_response
 
+from lava_scheduler_app.models import Device, TestJob
+
 def index(request):
-    return render_to_response("lava_scheduler_app/index.html", {},
-                              RequestContext(request))
+    return render_to_response(
+        "lava_scheduler_app/index.html",
+        {
+            'devices': Device.objects.all(),
+            'jobs': TestJob.objects.filter(status__in=[
+                TestJob.SUBMITTED, TestJob.RUNNING]),
+        },
+        RequestContext(request))
+
+
+def alljobs(request):
+    return render_to_response(
+        "lava_scheduler_app/alljobs.html",
+        {
+            'jobs': TestJob.objects.all(),
+        },
+        RequestContext(request))