=== modified file 'lava_scheduler_app/models.py'
@@ -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'
@@ -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'
@@ -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'
@@ -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'
@@ -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'
@@ -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))