[Branch,~linaro-validation/lava-scheduler/trunk] Rev 82: Add job descriptions in the scheduler UI

Message ID 20111011041915.20018.65699.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Paul Larson Oct. 11, 2011, 4:19 a.m.
Merge authors:
  Paul Larson (pwlars)
Related merge proposals:
  https://code.launchpad.net/~pwlars/lava-scheduler/include-job-description/+merge/78343
  proposed by: Paul Larson (pwlars)
  review: Approve - Michael Hudson-Doyle (mwhudson)
  review: Resubmit - Paul Larson (pwlars)
------------------------------------------------------------
revno: 82 [merge]
committer: Paul Larson <paul.larson@canonical.com>
branch nick: lava-scheduler
timestamp: Mon 2011-10-10 23:17:40 -0500
message:
  Add job descriptions in the scheduler UI
added:
  lava_scheduler_app/migrations/0009_auto__add_field_testjob_description.py
modified:
  lava_scheduler_app/models.py
  lava_scheduler_app/templates/lava_scheduler_app/alljobs.html
  lava_scheduler_app/templates/lava_scheduler_app/index.html
  lava_scheduler_app/templates/lava_scheduler_app/job.html


--
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

Patch

=== added file 'lava_scheduler_app/migrations/0009_auto__add_field_testjob_description.py'
--- lava_scheduler_app/migrations/0009_auto__add_field_testjob_description.py	1970-01-01 00:00:00 +0000
+++ lava_scheduler_app/migrations/0009_auto__add_field_testjob_description.py	2011-10-01 03:27:42 +0000
@@ -0,0 +1,87 @@ 
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        
+        # Adding field 'TestJob.description'
+        db.add_column('lava_scheduler_app_testjob', 'description', self.gf('django.db.models.fields.CharField')(default='', max_length=200), keep_default=False)
+
+
+    def backwards(self, orm):
+        
+        # Deleting field 'TestJob.description'
+        db.delete_column('lava_scheduler_app_testjob', 'description')
+
+
+    models = {
+        'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'auth.permission': {
+            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        'auth.user': {
+            'Meta': {'object_name': 'User'},
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+        },
+        'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'lava_scheduler_app.device': {
+            'Meta': {'object_name': 'Device'},
+            'current_job': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['lava_scheduler_app.TestJob']", 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+            'device_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['lava_scheduler_app.DeviceType']"}),
+            'hostname': ('django.db.models.fields.CharField', [], {'max_length': '200', 'primary_key': 'True'}),
+            'status': ('django.db.models.fields.IntegerField', [], {'default': '1'})
+        },
+        'lava_scheduler_app.devicetype': {
+            'Meta': {'object_name': 'DeviceType'},
+            'name': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'primary_key': 'True', 'db_index': 'True'})
+        },
+        'lava_scheduler_app.testjob': {
+            'Meta': {'object_name': 'TestJob'},
+            'actual_device': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'+'", 'null': 'True', 'blank': 'True', 'to': "orm['lava_scheduler_app.Device']"}),
+            'definition': ('django.db.models.fields.TextField', [], {}),
+            'description': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200'}),
+            'end_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'log_file': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'requested_device': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'+'", 'null': 'True', 'blank': 'True', 'to': "orm['lava_scheduler_app.Device']"}),
+            'requested_device_type': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'+'", 'null': 'True', 'blank': 'True', 'to': "orm['lava_scheduler_app.DeviceType']"}),
+            'results_link': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '400', 'null': 'True', 'blank': 'True'}),
+            'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'submit_time': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'submitter': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+        }
+    }
+
+    complete_apps = ['lava_scheduler_app']

=== modified file 'lava_scheduler_app/models.py'
--- lava_scheduler_app/models.py	2011-08-22 03:08:56 +0000
+++ lava_scheduler_app/models.py	2011-10-06 03:06:09 +0000
@@ -103,10 +103,13 @@ 
         verbose_name = _(u"Submitter"),
     )
 
-    #description = models.CharField(
-    #    verbose_name = _(u"Description"),
-    #    max_length = 200
-    #)
+    description = models.CharField(
+        verbose_name = _(u"Description"),
+        max_length = 200,
+        null = True,
+        blank = True,
+        default = None
+    )
 
     # Only one of these two should be non-null.
     requested_device = models.ForeignKey(
@@ -171,9 +174,10 @@ 
         else:
             target = None
             device_type = DeviceType.objects.get(name=job_data['device_type'])
+        job_name = job_data.get('job_name', '')
         job = TestJob(
             definition=json_data, submitter=user, requested_device=target,
-            requested_device_type=device_type)
+            requested_device_type=device_type, description=job_name)
         job.save()
         return job
 

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/alljobs.html'
--- lava_scheduler_app/templates/lava_scheduler_app/alljobs.html	2011-10-04 22:58:15 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/alljobs.html	2011-10-11 04:17:40 +0000
@@ -15,6 +15,7 @@ 
       <th class="id">ID</th>
       <th>Status</th>
       <th>Device</th>
+      <th>Description</th>
       <th>Submitter</th>
       <th>Submit Time</th>
     </tr>
@@ -33,6 +34,7 @@ 
       {% else %}
       <td><i>{{ job.requested_device_type|default:'' }}</i></td>
       {% endif %}{% endif %}
+      <td>{{ job.description|default:'' }}</td>
       <td>{{ job.submitter }}</td>
       <td>{{ job.submit_time }}</td>
     </tr>

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/index.html'
--- lava_scheduler_app/templates/lava_scheduler_app/index.html	2011-10-04 22:58:15 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/index.html	2011-10-11 04:17:40 +0000
@@ -34,6 +34,7 @@ 
       <th class="id">ID</th>
       <th>Status</th>
       <th>Device</th>
+      <th>Description</th>
       <th>Submitter</th>
       <th>Submit Time</th>
     </tr>
@@ -52,6 +53,7 @@ 
       {% else %}
       <td><i>{{ job.requested_device_type|default:'' }}</i></td>
       {% endif %}{% endif %}
+      <td>{{ job.description|default:'' }}</td>
       <td>{{ job.submitter }}</td>
       <td>{{ job.submit_time }}</td>
     </tr>

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/job.html'
--- lava_scheduler_app/templates/lava_scheduler_app/job.html	2011-08-19 03:24:11 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/job.html	2011-10-06 03:06:09 +0000
@@ -8,6 +8,7 @@ 
     float: left;
     padding-right: 2em;
     padding-bottom: 1em;
+    width: 20%;
 }
 #tab-output pre {
     margin: 0;
@@ -43,6 +44,11 @@ 
     <dt>Requested type:</dt>
     <dd>{{ job.requested_device_type }}</dd>
     {% endif %}
+
+    {% if job.description %}
+    <dt>Description:</dt>
+    <dd>{{ job.description }}</dd>
+    {% endif %}
   </div>
 
   <div class="column">