aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Morgan <jack.morgan@intel.com>2018-01-08 23:56:21 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-01-08 23:56:21 +0000
commit6173050b6bfc3d96d3056c5de4c927f1b461fe6e (patch)
treec58f857f8734c41b48d3e43229aa235dfcce4152 /src
parentee1caa30008635717943bfdfecc692cde052a461 (diff)
parenteb75879a4632015b427d97ab945eaaa0bc26959a (diff)
Merge "Add Dashboard OS Selection Menu on Booking"
Diffstat (limited to 'src')
-rw-r--r--src/api/serializers.py3
-rw-r--r--src/booking/admin.py3
-rw-r--r--src/booking/forms.py7
-rw-r--r--src/booking/migrations/0002_auto_20171213_1506.py28
-rw-r--r--src/booking/models.py7
-rw-r--r--src/booking/views.py3
-rw-r--r--src/templates/booking/booking_calendar.html3
-rw-r--r--src/templates/booking/booking_detail.html5
-rw-r--r--src/templates/booking/booking_table.html6
9 files changed, 56 insertions, 9 deletions
diff --git a/src/api/serializers.py b/src/api/serializers.py
index 4478175..5ef32d6 100644
--- a/src/api/serializers.py
+++ b/src/api/serializers.py
@@ -16,10 +16,11 @@ from dashboard.models import Server, Resource, ResourceStatus
class BookingSerializer(serializers.ModelSerializer):
installer_name = serializers.CharField(source='installer.name')
scenario_name = serializers.CharField(source='scenario.name')
+ opsys_name = serializers.CharField(source='opsys.name')
class Meta:
model = Booking
- fields = ('id', 'resource_id', 'start', 'end', 'installer_name', 'scenario_name', 'purpose')
+ fields = ('id', 'resource_id', 'start', 'end', 'opsys_name', 'installer_name', 'scenario_name', 'purpose')
class ServerSerializer(serializers.ModelSerializer):
diff --git a/src/booking/admin.py b/src/booking/admin.py
index d883be1..51e1031 100644
--- a/src/booking/admin.py
+++ b/src/booking/admin.py
@@ -13,5 +13,6 @@ from django.contrib import admin
from booking.models import *
admin.site.register(Booking)
+admin.site.register(Opsys)
admin.site.register(Installer)
-admin.site.register(Scenario) \ No newline at end of file
+admin.site.register(Scenario)
diff --git a/src/booking/forms.py b/src/booking/forms.py
index 2dbfacb..1f09c05 100644
--- a/src/booking/forms.py
+++ b/src/booking/forms.py
@@ -10,14 +10,15 @@
import django.forms as forms
-from booking.models import Installer, Scenario
+from booking.models import Installer, Scenario, Opsys
class BookingForm(forms.Form):
- fields = ['start', 'end', 'purpose', 'installer', 'scenario']
+ fields = ['start', 'end', 'purpose', 'opsys', 'installer', 'scenario']
start = forms.DateTimeField()
end = forms.DateTimeField()
purpose = forms.CharField(max_length=300)
+ opsys = forms.ModelChoiceField(queryset=Opsys.objects.all(), required=False)
installer = forms.ModelChoiceField(queryset=Installer.objects.all(), required=False)
- scenario = forms.ModelChoiceField(queryset=Scenario.objects.all(), required=False) \ No newline at end of file
+ scenario = forms.ModelChoiceField(queryset=Scenario.objects.all(), required=False)
diff --git a/src/booking/migrations/0002_auto_20171213_1506.py b/src/booking/migrations/0002_auto_20171213_1506.py
new file mode 100644
index 0000000..3e0a5fa
--- /dev/null
+++ b/src/booking/migrations/0002_auto_20171213_1506.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10 on 2017-12-13 15:06
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('booking', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Opsys',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('name', models.CharField(max_length=100)),
+ ],
+ ),
+ migrations.AddField(
+ model_name='booking',
+ name='opsys',
+ field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='booking.Opsys'),
+ ),
+ ]
diff --git a/src/booking/models.py b/src/booking/models.py
index 0b3fa3b..0bf5961 100644
--- a/src/booking/models.py
+++ b/src/booking/models.py
@@ -31,6 +31,12 @@ class Scenario(models.Model):
def __str__(self):
return self.name
+class Opsys(models.Model):
+ id = models.AutoField(primary_key=True)
+ name = models.CharField(max_length=100)
+
+ def __str__(self):
+ return self.name
class Booking(models.Model):
id = models.AutoField(primary_key=True)
@@ -41,6 +47,7 @@ class Booking(models.Model):
jira_issue_id = models.IntegerField(null=True)
jira_issue_status = models.CharField(max_length=50)
+ opsys = models.ForeignKey(Opsys, models.DO_NOTHING, null=True)
installer = models.ForeignKey(Installer, models.DO_NOTHING, null=True)
scenario = models.ForeignKey(Scenario, models.DO_NOTHING, null=True)
purpose = models.CharField(max_length=300, blank=False)
diff --git a/src/booking/views.py b/src/booking/views.py
index 6fdca0e..da2fe11 100644
--- a/src/booking/views.py
+++ b/src/booking/views.py
@@ -70,6 +70,7 @@ class BookingFormView(FormView):
booking = Booking(start=form.cleaned_data['start'],
end=form.cleaned_data['end'],
purpose=form.cleaned_data['purpose'],
+ opsys=form.cleaned_data['opsys'],
installer=form.cleaned_data['installer'],
scenario=form.cleaned_data['scenario'],
resource=self.resource, user=user)
@@ -117,6 +118,6 @@ class ResourceBookingsJSON(View):
def get(self, request, *args, **kwargs):
resource = get_object_or_404(Resource, id=self.kwargs['resource_id'])
bookings = resource.booking_set.get_queryset().values('id', 'start', 'end', 'purpose',
- 'jira_issue_status',
+ 'jira_issue_status', 'opsys__name',
'installer__name', 'scenario__name')
return JsonResponse({'bookings': list(bookings)})
diff --git a/src/templates/booking/booking_calendar.html b/src/templates/booking/booking_calendar.html
index 4644e85..16f0a4a 100644
--- a/src/templates/booking/booking_calendar.html
+++ b/src/templates/booking/booking_calendar.html
@@ -45,6 +45,7 @@
<div class='input-group' id='endtimepicker'>
{% bootstrap_field form.end addon_after='<span class="glyphicon glyphicon-calendar"></span>' %}
</div>
+ {% bootstrap_field form.opsys %}
{% bootstrap_field form.purpose %}
{% bootstrap_field form.installer %}
{% bootstrap_field form.scenario %}
@@ -100,4 +101,4 @@
<script src={% static "js/fullcalendar-options.js" %}></script>
<script src={% static "js/datetimepicker-options.js" %}></script>
<script src={% static "js/booking-calendar.js" %}></script>
-{% endblock extrajs %} \ No newline at end of file
+{% endblock extrajs %}
diff --git a/src/templates/booking/booking_detail.html b/src/templates/booking/booking_detail.html
index 4b016b2..cb937d3 100644
--- a/src/templates/booking/booking_detail.html
+++ b/src/templates/booking/booking_detail.html
@@ -19,8 +19,11 @@
<b>Purpose: </b> {{ booking.purpose }}
</p>
<p>
+ <b>Operating System: </b> {{ booking.opsys }}
+</p>
+<p>
<b>Installer: </b> {{ booking.installer }}
</p>
<p>
<b>Scenario: </b> {{ booking.scenario }}
-</p> \ No newline at end of file
+</p>
diff --git a/src/templates/booking/booking_table.html b/src/templates/booking/booking_table.html
index 655b013..af2248c 100644
--- a/src/templates/booking/booking_table.html
+++ b/src/templates/booking/booking_table.html
@@ -7,6 +7,7 @@
<th>Purpose</th>
<th>Start</th>
<th>End</th>
+ <th>Operating System</th>
<th>Installer</th>
<th>Scenario</th>
</tr>
@@ -27,6 +28,9 @@
{{ booking.end }}
</td>
<td>
+ {{ booking.opsys }}
+ </td>
+ <td>
{{ booking.installer }}
</td>
<td>
@@ -34,4 +38,4 @@
</td>
</tr>
{% endfor %}
-</tbody> \ No newline at end of file
+</tbody>