diff options
Diffstat (limited to 'tools/pharos-dashboard/dashboard')
12 files changed, 4 insertions, 239 deletions
diff --git a/tools/pharos-dashboard/dashboard/fixtures/dashboard.json b/tools/pharos-dashboard/dashboard/fixtures/dashboard.json index d90e99b8..f0ac3b2f 100644 --- a/tools/pharos-dashboard/dashboard/fixtures/dashboard.json +++ b/tools/pharos-dashboard/dashboard/fixtures/dashboard.json @@ -4,7 +4,6 @@ "pk": 1, "fields": { "name": "Linux Foundation POD 1", - "slavename": "lf-pod1", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Lf+Lab" } @@ -14,7 +13,6 @@ "pk": 2, "fields": { "name": "Linux Foundation POD 2", - "slavename": "lf-pod2", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Lf+Lab" } @@ -24,7 +22,6 @@ "pk": 3, "fields": { "name": "Ericsson POD 2", - "slavename": "ericsson-pod2", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Ericsson+Hosting+and+Request+Process" } @@ -34,7 +31,6 @@ "pk": 4, "fields": { "name": "Intel POD 2", - "slavename": "intel-pod2", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Intel+Pod2" } @@ -44,7 +40,6 @@ "pk": 5, "fields": { "name": "Intel POD 5", - "slavename": "intel-pod5", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Intel+Pod5" } @@ -54,7 +49,6 @@ "pk": 6, "fields": { "name": "Intel POD 6", - "slavename": "intel-pod6", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Intel+Pod6" } @@ -64,7 +58,6 @@ "pk": 7, "fields": { "name": "Intel POD 8", - "slavename": "intel-pod8", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Intel+Pod8" } @@ -74,7 +67,6 @@ "pk": 8, "fields": { "name": "Huawei POD 1", - "slavename": "huawei-pod1", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Huawei+Hosting" } @@ -84,7 +76,6 @@ "pk": 9, "fields": { "name": "Intel POD 3", - "slavename": "intel-pod3", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Intel+Pod3" } @@ -94,7 +85,6 @@ "pk": 10, "fields": { "name": "Dell POD 1", - "slavename": "dell-pod1", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Dell+Hosting" } @@ -104,7 +94,6 @@ "pk": 11, "fields": { "name": "Dell POD 2", - "slavename": "dell-pod2", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Dell+Hosting" } @@ -114,7 +103,6 @@ "pk": 12, "fields": { "name": "Orange POD 2", - "slavename": "orange-pod2", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Opnfv-orange-pod2" } @@ -124,7 +112,6 @@ "pk": 13, "fields": { "name": "Arm POD 1", - "slavename": "arm-build1", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Enea-pharos-lab" } @@ -134,7 +121,6 @@ "pk": 14, "fields": { "name": "Ericsson POD 1", - "slavename": "ericsson-pod1", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Ericsson+Hosting+and+Request+Process" } @@ -144,7 +130,6 @@ "pk": 15, "fields": { "name": "Huawei POD 2", - "slavename": "huawei-pod2", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Huawei+Hosting" } @@ -154,7 +139,6 @@ "pk": 16, "fields": { "name": "Huawei POD 3", - "slavename": "huawei-pod3", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Huawei+Hosting" } @@ -164,7 +148,6 @@ "pk": 17, "fields": { "name": "Huawei POD 4", - "slavename": "huawei-pod4", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Huawei+Hosting" } @@ -174,7 +157,6 @@ "pk": 18, "fields": { "name": "Intel POD 9", - "slavename": "intel-pod9", "description": "Some description", "url": "https://wiki.opnfv.org/display/pharos/Intel+Pod9" } diff --git a/tools/pharos-dashboard/dashboard/migrations/0001_initial.py b/tools/pharos-dashboard/dashboard/migrations/0001_initial.py deleted file mode 100644 index 6343b463..00000000 --- a/tools/pharos-dashboard/dashboard/migrations/0001_initial.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-15 12:19 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.CreateModel( - name='Resource', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('name', models.CharField(max_length=100, unique=True)), - ('slavename', models.CharField(blank=True, max_length=50, null=True)), - ('description', models.CharField(blank=True, max_length=300, null=True)), - ('url', models.CharField(blank=True, max_length=100, null=True)), - ('owners', models.ManyToManyField(to=settings.AUTH_USER_MODEL)), - ], - options={ - 'db_table': 'resource', - }, - ), - migrations.CreateModel( - name='ResourceUtilization', - fields=[ - ('timestamp', models.DateTimeField(auto_created=True)), - ('id', models.AutoField(primary_key=True, serialize=False)), - ('pod_status', models.IntegerField()), - ], - ), - ] diff --git a/tools/pharos-dashboard/dashboard/migrations/0002_auto_20160815_1511.py b/tools/pharos-dashboard/dashboard/migrations/0002_auto_20160815_1511.py deleted file mode 100644 index 67822a72..00000000 --- a/tools/pharos-dashboard/dashboard/migrations/0002_auto_20160815_1511.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-15 15:11 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('jenkins', '0002_auto_20160815_1226'), - ('dashboard', '0001_initial'), - ] - - operations = [ - migrations.RemoveField( - model_name='resource', - name='slavename', - ), - migrations.AddField( - model_name='resource', - name='slave', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.DO_NOTHING, to='jenkins.JenkinsSlave'), - preserve_default=False, - ), - ] diff --git a/tools/pharos-dashboard/dashboard/migrations/0002_resourceutilization.py b/tools/pharos-dashboard/dashboard/migrations/0002_resourceutilization.py deleted file mode 100644 index 8e10acf8..00000000 --- a/tools/pharos-dashboard/dashboard/migrations/0002_resourceutilization.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-13 12:50 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('dashboard', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='ResourceUtilization', - fields=[ - ('timestamp', models.DateTimeField(auto_created=True)), - ('id', models.AutoField(primary_key=True, serialize=False)), - ('pod_status', models.IntegerField()), - ], - ), - ] diff --git a/tools/pharos-dashboard/dashboard/migrations/0003_auto_20160813_1302.py b/tools/pharos-dashboard/dashboard/migrations/0003_auto_20160813_1302.py deleted file mode 100644 index 8c4c2139..00000000 --- a/tools/pharos-dashboard/dashboard/migrations/0003_auto_20160813_1302.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-13 13:02 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('dashboard', '0002_resourceutilization'), - ] - - operations = [ - migrations.RemoveField( - model_name='resource', - name='active', - ), - migrations.RemoveField( - model_name='resource', - name='bookable', - ), - ] diff --git a/tools/pharos-dashboard/dashboard/migrations/0003_auto_20160815_1512.py b/tools/pharos-dashboard/dashboard/migrations/0003_auto_20160815_1512.py deleted file mode 100644 index 53b4fcd4..00000000 --- a/tools/pharos-dashboard/dashboard/migrations/0003_auto_20160815_1512.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-15 15:12 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('dashboard', '0002_auto_20160815_1511'), - ] - - operations = [ - migrations.RemoveField( - model_name='resource', - name='slave', - ), - migrations.AddField( - model_name='resource', - name='slavename', - field=models.CharField(blank=True, max_length=50, null=True), - ), - ] diff --git a/tools/pharos-dashboard/dashboard/migrations/0004_resource_owners.py b/tools/pharos-dashboard/dashboard/migrations/0004_resource_owners.py deleted file mode 100644 index b851588c..00000000 --- a/tools/pharos-dashboard/dashboard/migrations/0004_resource_owners.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-13 14:43 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('dashboard', '0003_auto_20160813_1302'), - ] - - operations = [ - migrations.AddField( - model_name='resource', - name='owners', - field=models.ManyToManyField(to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/tools/pharos-dashboard/dashboard/migrations/0004_resource_slave.py b/tools/pharos-dashboard/dashboard/migrations/0004_resource_slave.py deleted file mode 100644 index 82d45f0b..00000000 --- a/tools/pharos-dashboard/dashboard/migrations/0004_resource_slave.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-15 15:13 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('jenkins', '0002_auto_20160815_1226'), - ('dashboard', '0003_auto_20160815_1512'), - ] - - operations = [ - migrations.AddField( - model_name='resource', - name='slave', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.DO_NOTHING, to='jenkins.JenkinsSlave'), - preserve_default=False, - ), - ] diff --git a/tools/pharos-dashboard/dashboard/migrations/0005_remove_resource_slavename.py b/tools/pharos-dashboard/dashboard/migrations/0005_remove_resource_slavename.py deleted file mode 100644 index 339f8c3f..00000000 --- a/tools/pharos-dashboard/dashboard/migrations/0005_remove_resource_slavename.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-15 15:17 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('dashboard', '0004_resource_slave'), - ] - - operations = [ - migrations.RemoveField( - model_name='resource', - name='slavename', - ), - ] diff --git a/tools/pharos-dashboard/dashboard/migrations/0006_delete_resourceutilization.py b/tools/pharos-dashboard/dashboard/migrations/0006_delete_resourceutilization.py deleted file mode 100644 index fb637bd7..00000000 --- a/tools/pharos-dashboard/dashboard/migrations/0006_delete_resourceutilization.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-16 10:42 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('dashboard', '0005_remove_resource_slavename'), - ] - - operations = [ - migrations.DeleteModel( - name='ResourceUtilization', - ), - ] diff --git a/tools/pharos-dashboard/dashboard/models.py b/tools/pharos-dashboard/dashboard/models.py index 02073e6f..971af6a2 100644 --- a/tools/pharos-dashboard/dashboard/models.py +++ b/tools/pharos-dashboard/dashboard/models.py @@ -10,8 +10,8 @@ class Resource(models.Model): name = models.CharField(max_length=100, unique=True) description = models.CharField(max_length=300, blank=True, null=True) url = models.CharField(max_length=100, blank=True, null=True) - owners = models.ManyToManyField(User) - slave = models.ForeignKey(JenkinsSlave, on_delete=models.DO_NOTHING) + owner = models.ForeignKey(User) + slave = models.ForeignKey(JenkinsSlave, on_delete=models.DO_NOTHING, null=True) class Meta: db_table = 'resource' diff --git a/tools/pharos-dashboard/dashboard/views.py b/tools/pharos-dashboard/dashboard/views.py index 6af2c1ad..56b3a510 100644 --- a/tools/pharos-dashboard/dashboard/views.py +++ b/tools/pharos-dashboard/dashboard/views.py @@ -1,4 +1,6 @@ from datetime import timedelta + +from django.contrib.auth.models import User from django.utils import timezone from django.views.generic import TemplateView |