diff options
45 files changed, 228 insertions, 747 deletions
diff --git a/docs/labs/ericsson/images/ericsson-opnfv-topology.png b/docs/labs/ericsson/images/ericsson-opnfv-topology.png Binary files differnew file mode 100644 index 00000000..b3c86d3e --- /dev/null +++ b/docs/labs/ericsson/images/ericsson-opnfv-topology.png diff --git a/docs/labs/ericsson/index.rst b/docs/labs/ericsson/index.rst new file mode 100644 index 00000000..f7058eca --- /dev/null +++ b/docs/labs/ericsson/index.rst @@ -0,0 +1,15 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2016 OPNFV. + +.. Top level of Pharos templates and configuration files + +************************************** +ERICSSON OPNFV Lab Configuration Files +************************************** + + +.. toctree:: + :maxdepth: 2 + + ./lab_description.rst diff --git a/docs/labs/ericsson/lab_description.rst b/docs/labs/ericsson/lab_description.rst new file mode 100644 index 00000000..b4c5b856 --- /dev/null +++ b/docs/labs/ericsson/lab_description.rst @@ -0,0 +1,148 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2016 OPNFV. + +.. _pharos_lab: + +********************************* +Ericssion OPNFV Lab Specification +********************************* + + +Introduction +------------ + +Ericsson OPNFV Lab currently has 2 Bare Metal and 3 Virtual PODs available globally (hosted in +the GIC). Each POD has 5 servers, comprised of 3 controller nodes (HA) and 2 computes nodes. NOTE: +(this make differ depending on scenario). + +.. _pharos_pod: + +These PODs are dedicated for use by Production/CI. These PODs focus on providing verification, +build, deploy and testing for scenarios related with **test** projects, **installer** projects and +perforamnce enhancement projects, such as KVM, OVS, FDS, etc. + +In addition to the full-time CI/CD resources, the Ericsson OPNFV lab provides developer labs (DRs) +for project usage, testing and development. + +Scenarios services by this lab are: + +Scenario defitions can be found here: +`Colorado Scenario Status <https://wiki.opnfv.org/display/SWREL/Colorado+Scenario+Status>`_ + +Lab Resources +------------- + +- `Ericsson Hostting And Request Page <https://wiki.opnfv.org/display/pharos/Ericsson+Hosting+and+Request+Process>`_ + ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| POD Name | Project(s) | PTL(s) | Email(s) | POD Role | Status | Notes | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| POD1 | CI/CD | Daniel | daniel.smith@ericsson.com | CI: latest | Active | BM-CI | +| | | Smith | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| POD2 | CI/CD | Daniel | daniel.smith@ericsson.com | CI: latest | Active | BM-CI | +| | | Smith | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| vPOD1 | CI/CD | Fatih | fatih.degirmenci@ericsson.com | CI: latest | Active | Virt-CI | +| | | Degirmenci | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| PHAROS-166 | FUEL | Constant | constant.wette@ericsson.com | DR: B-rel | Active | Nested | +| | | Wette | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| PHAROS-167 | OVSNFV | Billy | billy.omahoney@intel.com | DR: C-rel | Active | Hybrid | +| | | O'Mahoney | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| PHAROS-174 | GLUON | Bin | bh526r@att.com | DR: D-rel | Active | Nested* | +| | | Hu | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| PHAROS-180 | SAVI | Rick | richard.brunner@ericsson.com | DR: D-rel | Active | Nested* | +| | | Brunner | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| PHAROS-181 | IPV6-MULTI | Bin | bh526r@att.com | DR: D-rel | Active | Nested* | +| | | Hu | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| PHAROS-191 | AUTO-DEP | Peter | Peter.Barabas@ericsson.com | DR: C-rel | Active | Nested* | +| | | Barabas | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| PHAROS-199 | SDN-L3 | Tim | Tim.Irnich@ericsson.com | DR: C-rel | Active | Nested* | +| | | Irnich | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| PHAROS-236 | LLT-TOOL | Jose | Jose.Lausuch@ericsson.com | DR: C-rel | Active | Nested* | +| | | Lausuch | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ +| PHAROS-253 | ODL-II | Nikolas | Nikolas.Hermanns@ericsson.com | DR: C-rel | Active | Nested* | +| | | Hermanns | | | | | ++------------+------------+------------+-------------------------------+------------+--------+---------+ + + +- `ACTIVE CI/CD LAB SPECS <https://wiki.opnfv.org/pages/viewpage.action?pageId=6829012>`_ +* `CI-ERICSSON-POD1 wiki page <https://wiki.opnfv.org/display/pharos/CI-ERICSSON-POD1>`_ +* `CI-ERICSSON-POD1 wiki page <https://wiki.opnfv.org/display/pharos/CI-ERICSSON-POD2>`_ +- `ACTIVE LAB SPECS <https://wiki.opnfv.org/display/pharos/Active+Lab+Specs>`_ +* `PHAROS-166 wiki page <https://wiki.opnfv.org/display/pharos/PHAROS-166%3A+++++++PaaS+PoC>`_ +* `PHAROS-167 wiki page <https://wiki.opnfv.org/display/pharos/PHAROS-167%3A+OVS-NFV+BareMetal+Lab>`_ +* `PHAROS-174 wiki page <https://wiki.opnfv.org/display/pharos/PHAROS-174%3A+Gluon+PoC+for+OPNFV+Summit>`_ +* `PHAROS-180 wiki page <https://wiki.opnfv.org/display/pharos/PHAROS-180%3A+++++++SAVI+CDN+POC>`_ +* `PHAROS-181 wiki page <https://wiki.opnfv.org/display/pharos/PHAROS-181%3A+IPV6+Multisite>`_ +* `PHAROS-191 wiki page <https://wiki.opnfv.org/display/pharos/PHAROS-191%3A+++++++Colorado+-+Autodeployer+Uplift>`_ +* `PHAROS-199 wiki page <https://wiki.opnfv.org/display/pharos/PHAROS-199%3A+++++++ODL-L3+troubleshooting>`_ +* `PHAROS-236 wiki page <https://wiki.opnfv.org/display/pharos/PHAROS-236%3A+Tracing+Tool+-+LLTng>`_ +* `PHAROS-253 wiki page <https://wiki.opnfv.org/pages/viewpage.action?pageId=6828594>`_ +- `Decommissioned Requets <https://wiki.opnfv.org/display/pharos/Decommissioned+Lab+Request>`_ + + +Acceptable Usage Policy +----------------------- + +Resources located in Ericsson OPNFV lab shall only be used for CI, infra setup/configuration and +troubleshooting purposes. No development work is allowed in these PODs. Development Work should +only be performed on the DR labs assigned to individual projects. + + +Remote Access Infrastructure +---------------------------- + +Ericsson OPNFV lab provides a SSH GW that allows for unlimited port-forwarding, as well as Remote +Desktop, VNC and SOCKS proxy capability allowing the end user to feel as though directly connected +to the lab. + +Remote Access Procedure +----------------------- + +Access to this environment can be granted by sending an e-mail to: **daniel.smith@ericsson.com**. + +Subject: ericsson opnfv access. + +The following information should be provided in the request: + +:: + + Full name: + E-mail: + Organization: + Why is access needed: + How long is access needed: + Number of Hosts required: + Topology Required (HA, SA): + Feature/Plugins/Options Required (DPDK, ODL, ONOS): + +Enclosed a copy of your id_rsa.pub (public key) with your request and a login will be created for you + + +Lab Documentation +----------------- + + +Lab Topology +------------ + +.. image:: ./images/ericsson_opnfv_topology.png + :alt: Lab diagram not found + +Each POD is an individual entity with its own set of independant networks allowing for +interconnection between DR labs, intra connectinos within multiple Nested DRs all without touching +the CI/CD running in production. + +Refer to each Lab specific wiki page for IP and Login and Topology Information. + diff --git a/docs/labs/index.rst b/docs/labs/index.rst index d787e70b..db07640b 100755 --- a/docs/labs/index.rst +++ b/docs/labs/index.rst @@ -12,6 +12,7 @@ PHAROS Community Labs :maxdepth: 2 ./Dell.rst + ./ericsson/index.rst ./huawei-us-lab/huawei-us-lab.rst ./ool/index.rst ./orange-paris-lab/index.rst diff --git a/docs/labs/zte-sh-lab/lab_description.rst b/docs/labs/zte-sh-lab/lab_description.rst index f6224855..47caed45 100644 --- a/docs/labs/zte-sh-lab/lab_description.rst +++ b/docs/labs/zte-sh-lab/lab_description.rst @@ -13,7 +13,7 @@ Introduction ------------ ZTE SH Pharos lab currently has three PODs available in Shanghai. Each POD has 5 servers, 3 -controller nodes and 2 computer nodes. These PODs are dedicatedly used for Production/CI. These PODs +controller nodes and 2 computer nodes. These PODs are dedicated for use by Production/CI. These PODs focus scenarios related with **test** projects, **installer** projects and performance enhancement projects, such as KVM, OVS, FDS, etc. @@ -79,7 +79,7 @@ The following information should be provided in the request: Organization: Why is access needed: How long is access needed: - What sepcific Host will be accessed: + What specific Host will be accessed: What support is needed from zte admin: Once access requirment is approved, the instructions for setting up VPN access will be send to you by mail. diff --git a/tools/pharos-dashboard/.gitignore b/tools/pharos-dashboard/.gitignore index b5e9284a..9eb1cfde 100644 --- a/tools/pharos-dashboard/.gitignore +++ b/tools/pharos-dashboard/.gitignore @@ -19,6 +19,7 @@ coverage.xml # Django: *.log *.pot +migrations/ # KDE: .directory diff --git a/tools/pharos-dashboard/account/forms.py b/tools/pharos-dashboard/account/forms.py index 14f11cda..92c55d85 100644 --- a/tools/pharos-dashboard/account/forms.py +++ b/tools/pharos-dashboard/account/forms.py @@ -9,6 +9,4 @@ class AccountSettingsForm(forms.ModelForm): model = UserProfile fields = ['company', 'ssh_public_key', 'pgp_public_key', 'timezone'] - ssh_public_key = forms.CharField(max_length=2048, widget=forms.Textarea) - pgp_public_key = forms.CharField(max_length=2048, widget=forms.Textarea) timezone = forms.ChoiceField(choices=[(x, x) for x in pytz.common_timezones], initial='UTC') diff --git a/tools/pharos-dashboard/account/migrations/0001_initial.py b/tools/pharos-dashboard/account/migrations/0001_initial.py deleted file mode 100644 index 4ff9510a..00000000 --- a/tools/pharos-dashboard/account/migrations/0001_initial.py +++ /dev/null @@ -1,33 +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 -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.CreateModel( - name='UserProfile', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('timezone', models.CharField(default='UTC', max_length=100)), - ('sshkey', models.CharField(max_length=2048)), - ('pgpkey', models.CharField(max_length=2048)), - ('company', models.CharField(max_length=200)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - options={ - 'db_table': 'user_profile', - }, - ), - ] diff --git a/tools/pharos-dashboard/account/migrations/0002_auto_20160816_1511.py b/tools/pharos-dashboard/account/migrations/0002_auto_20160816_1511.py deleted file mode 100644 index 3fcd989a..00000000 --- a/tools/pharos-dashboard/account/migrations/0002_auto_20160816_1511.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-16 15:11 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='userprofile', - name='oauth_secret', - field=models.CharField(default='', max_length=1024), - preserve_default=False, - ), - migrations.AddField( - model_name='userprofile', - name='oauth_token', - field=models.CharField(default='', max_length=1024), - preserve_default=False, - ), - ] diff --git a/tools/pharos-dashboard/account/migrations/0002_userprofile_timezone.py b/tools/pharos-dashboard/account/migrations/0002_userprofile_timezone.py deleted file mode 100644 index ea67598a..00000000 --- a/tools/pharos-dashboard/account/migrations/0002_userprofile_timezone.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-12 13:17 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='userprofile', - name='timezone', - field=models.CharField(default='UTC', max_length=100), - ), - ] diff --git a/tools/pharos-dashboard/account/migrations/0003_auto_20160819_1024.py b/tools/pharos-dashboard/account/migrations/0003_auto_20160819_1024.py deleted file mode 100644 index b648844e..00000000 --- a/tools/pharos-dashboard/account/migrations/0003_auto_20160819_1024.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-19 10:24 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0002_auto_20160816_1511'), - ] - - operations = [ - migrations.RenameField( - model_name='userprofile', - old_name='pgpkey', - new_name='pgp_pupblic_key', - ), - migrations.RenameField( - model_name='userprofile', - old_name='sshkey', - new_name='ssh_public_key', - ), - ] diff --git a/tools/pharos-dashboard/account/migrations/0003_userprofile_registration_complete.py b/tools/pharos-dashboard/account/migrations/0003_userprofile_registration_complete.py deleted file mode 100644 index d6114434..00000000 --- a/tools/pharos-dashboard/account/migrations/0003_userprofile_registration_complete.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-12 17:09 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0002_userprofile_timezone'), - ] - - operations = [ - migrations.AddField( - model_name='userprofile', - name='registration_complete', - field=models.BooleanField(default=False), - ), - ] diff --git a/tools/pharos-dashboard/account/migrations/0004_auto_20160812_1805.py b/tools/pharos-dashboard/account/migrations/0004_auto_20160812_1805.py deleted file mode 100644 index cb228557..00000000 --- a/tools/pharos-dashboard/account/migrations/0004_auto_20160812_1805.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-12 18:05 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0003_userprofile_registration_complete'), - ] - - operations = [ - migrations.AddField( - model_name='userprofile', - name='gpgkey', - field=models.CharField(default='a', max_length=2048), - preserve_default=False, - ), - migrations.AlterField( - model_name='userprofile', - name='sshkey', - field=models.CharField(max_length=2048), - ), - ] diff --git a/tools/pharos-dashboard/account/migrations/0004_auto_20160819_1055.py b/tools/pharos-dashboard/account/migrations/0004_auto_20160819_1055.py deleted file mode 100644 index 51af0aa9..00000000 --- a/tools/pharos-dashboard/account/migrations/0004_auto_20160819_1055.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-19 10:55 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0003_auto_20160819_1024'), - ] - - operations = [ - migrations.RenameField( - model_name='userprofile', - old_name='pgp_pupblic_key', - new_name='pgp_public_key', - ), - ] diff --git a/tools/pharos-dashboard/account/migrations/0005_remove_userprofile_registration_complete.py b/tools/pharos-dashboard/account/migrations/0005_remove_userprofile_registration_complete.py deleted file mode 100644 index fa4bf729..00000000 --- a/tools/pharos-dashboard/account/migrations/0005_remove_userprofile_registration_complete.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-13 10:49 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0004_auto_20160812_1805'), - ] - - operations = [ - migrations.RemoveField( - model_name='userprofile', - name='registration_complete', - ), - ] diff --git a/tools/pharos-dashboard/account/migrations/0006_auto_20160813_1443.py b/tools/pharos-dashboard/account/migrations/0006_auto_20160813_1443.py deleted file mode 100644 index 7d9cd58e..00000000 --- a/tools/pharos-dashboard/account/migrations/0006_auto_20160813_1443.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-13 14:43 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0005_remove_userprofile_registration_complete'), - ] - - operations = [ - migrations.RemoveField( - model_name='userresource', - name='resource', - ), - migrations.RemoveField( - model_name='userresource', - name='user', - ), - migrations.DeleteModel( - name='UserResource', - ), - ] diff --git a/tools/pharos-dashboard/account/migrations/0007_auto_20160814_1056.py b/tools/pharos-dashboard/account/migrations/0007_auto_20160814_1056.py deleted file mode 100644 index 2d1bbaeb..00000000 --- a/tools/pharos-dashboard/account/migrations/0007_auto_20160814_1056.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-14 10:56 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0006_auto_20160813_1443'), - ] - - operations = [ - migrations.RenameField( - model_name='userprofile', - old_name='gpgkey', - new_name='pgpkey', - ), - ] diff --git a/tools/pharos-dashboard/account/models.py b/tools/pharos-dashboard/account/models.py index fbabf6c4..fb2c8ddd 100644 --- a/tools/pharos-dashboard/account/models.py +++ b/tools/pharos-dashboard/account/models.py @@ -4,12 +4,14 @@ from django.contrib.auth.models import User from dashboard.models import Resource +def upload_to(object, filename): + return object.user.username + '/' + filename class UserProfile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) timezone = models.CharField(max_length=100, blank=False, default='UTC') - ssh_public_key = models.CharField(max_length=2048, blank=False) - pgp_public_key = models.CharField(max_length=2048, blank=False) + ssh_public_key = models.FileField(upload_to=upload_to, null=True, blank=True) + pgp_public_key = models.FileField(upload_to=upload_to, null=True, blank=True) company = models.CharField(max_length=200, blank=False) oauth_token = models.CharField(max_length=1024, blank=False) oauth_secret = models.CharField(max_length=1024, blank=False) diff --git a/tools/pharos-dashboard/booking/migrations/0001_initial.py b/tools/pharos-dashboard/booking/migrations/0001_initial.py deleted file mode 100644 index 9706b812..00000000 --- a/tools/pharos-dashboard/booking/migrations/0001_initial.py +++ /dev/null @@ -1,34 +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 -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('dashboard', '0001_initial'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.CreateModel( - name='Booking', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('start', models.DateTimeField()), - ('end', models.DateTimeField()), - ('purpose', models.CharField(max_length=300)), - ('resource', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='dashboard.Resource')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - options={ - 'db_table': 'booking', - }, - ), - ] diff --git a/tools/pharos-dashboard/booking/migrations/0002_remove_booking_deleted.py b/tools/pharos-dashboard/booking/migrations/0002_remove_booking_deleted.py deleted file mode 100644 index 335379d5..00000000 --- a/tools/pharos-dashboard/booking/migrations/0002_remove_booking_deleted.py +++ /dev/null @@ -1,19 +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 - - -class Migration(migrations.Migration): - - dependencies = [ - ('booking', '0001_initial'), - ] - - operations = [ - migrations.RemoveField( - model_name='booking', - name='deleted', - ), - ] diff --git a/tools/pharos-dashboard/booking/migrations/0003_remove_booking_status.py b/tools/pharos-dashboard/booking/migrations/0003_remove_booking_status.py deleted file mode 100644 index 95089a7a..00000000 --- a/tools/pharos-dashboard/booking/migrations/0003_remove_booking_status.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-13 12:51 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('booking', '0002_remove_booking_deleted'), - ] - - operations = [ - migrations.RemoveField( - model_name='booking', - name='status', - ), - ] diff --git a/tools/pharos-dashboard/booking/models.py b/tools/pharos-dashboard/booking/models.py index 719dd9bf..8011fa41 100644 --- a/tools/pharos-dashboard/booking/models.py +++ b/tools/pharos-dashboard/booking/models.py @@ -10,6 +10,7 @@ class Booking(models.Model): resource = models.ForeignKey(Resource, models.PROTECT) start = models.DateTimeField() end = models.DateTimeField() + jira_issue_id = models.IntegerField(null=True) purpose = models.CharField(max_length=300, blank=False) @@ -25,11 +26,10 @@ class Booking(models.Model): if user.has_perm('booking.add_booking'): return True # Check if User owns this resource - if user in self.resource.owners.all(): + if user == self.resource.owner: return True return False - def save(self, *args, **kwargs): """ Save the booking if self.user is authorized and there is no overlapping booking. diff --git a/tools/pharos-dashboard/booking/tests/test_models.py b/tools/pharos-dashboard/booking/tests/test_models.py index 00f6b266..7a572c5f 100644 --- a/tools/pharos-dashboard/booking/tests/test_models.py +++ b/tools/pharos-dashboard/booking/tests/test_models.py @@ -4,6 +4,7 @@ from django.contrib.auth.models import User, Permission from django.test import TestCase from django.utils import timezone +from account.models import UserProfile from booking.models import Booking from dashboard.models import Resource from jenkins.models import JenkinsSlave @@ -12,9 +13,12 @@ from jenkins.models import JenkinsSlave class BookingModelTestCase(TestCase): def setUp(self): self.slave = JenkinsSlave.objects.create(name='test', url='test') + self.owner = User.objects.create(username='owner') - self.res1 = Resource.objects.create(name='res1', slave=self.slave, description='x', url='x') - self.res2 = Resource.objects.create(name='res2', slave=self.slave, description='x', url='x') + self.res1 = Resource.objects.create(name='res1', slave=self.slave, description='x', + url='x',owner=self.owner) + self.res2 = Resource.objects.create(name='res2', slave=self.slave, description='x', + url='x',owner=self.owner) self.user1 = User.objects.create(username='user1') @@ -78,12 +82,14 @@ class BookingModelTestCase(TestCase): def test_authorization(self): user = User.objects.create(username='user') + user.userprofile = UserProfile.objects.create(user=user) self.assertRaises(PermissionError, Booking.objects.create, start=timezone.now(), end=timezone.now() + timedelta(days=1), resource=self.res1, user=user) - self.res1.owners.add(user) + self.res1.owner = user self.assertTrue( Booking.objects.create(start=timezone.now(), end=timezone.now() + timedelta(days=1), resource=self.res1, user=user)) + self.res1.owner = self.owner user.user_permissions.add(self.add_booking_perm) user = User.objects.get(pk=user.id) self.assertTrue( diff --git a/tools/pharos-dashboard/booking/tests/test_views.py b/tools/pharos-dashboard/booking/tests/test_views.py index b0c4b498..c5dff586 100644 --- a/tools/pharos-dashboard/booking/tests/test_views.py +++ b/tools/pharos-dashboard/booking/tests/test_views.py @@ -19,7 +19,9 @@ class BookingViewTestCase(TestCase): def setUp(self): self.client = Client() self.slave = JenkinsSlave.objects.create(name='test', url='test') - self.res1 = Resource.objects.create(name='res1', slave=self.slave, description='x', url='x') + self.owner = User.objects.create(username='owner') + self.res1 = Resource.objects.create(name='res1', slave=self.slave, description='x', + url='x',owner=self.owner) self.user1 = User.objects.create(username='user1') self.user1.set_password('user1') self.user1profile = UserProfile.objects.create(user=self.user1) diff --git a/tools/pharos-dashboard/booking/views.py b/tools/pharos-dashboard/booking/views.py index c461aef4..c2f437f3 100644 --- a/tools/pharos-dashboard/booking/views.py +++ b/tools/pharos-dashboard/booking/views.py @@ -5,6 +5,8 @@ from django.shortcuts import get_object_or_404 from django.urls import reverse from django.views import View from django.views.generic import FormView +from django.shortcuts import redirect +from jira import JIRAError from account.jira_util import get_jira from booking.forms import BookingForm @@ -12,20 +14,26 @@ from booking.models import Booking from dashboard.models import Resource +def create_jira_ticket(user, booking): + jira = get_jira(user) + issue_dict = { + 'project': 'PHAROS', + 'summary': str(booking.resource) + ': Access Request', + 'description': booking.purpose, + 'issuetype': {'name': 'Task'}, + 'components': [{'name': 'POD Access Request'}], + 'assignee': {'name': booking.resource.owner.username} + } + issue = jira.create_issue(fields=issue_dict) + jira.add_attachment(issue, user.userprofile.pgp_public_key) + jira.add_attachment(issue, user.userprofile.ssh_public_key) + booking.jira_issue_id = issue.id + + class BookingFormView(LoginRequiredMixin, FormView): template_name = "booking/booking_calendar.html" form_class = BookingForm - def open_jira_issue(self,booking): - jira = get_jira(self.request.user) - issue_dict = { - 'project': 'PHAROS', - 'summary': 'Booking: ' + str(self.resource), - 'description': str(booking), - 'issuetype': {'name': 'Task'}, - } - jira.create_issue(fields=issue_dict) - def dispatch(self, request, *args, **kwargs): self.resource = get_object_or_404(Resource, id=self.kwargs['resource_id']) return super(BookingFormView, self).dispatch(request, *args, **kwargs) @@ -40,9 +48,14 @@ class BookingFormView(LoginRequiredMixin, FormView): return reverse('booking:create', kwargs=self.kwargs) def form_valid(self, form): + user = self.request.user + if not user.userprofile.ssh_public_key or not user.userprofile.pgp_public_key: + messages.add_message(self.request, messages.INFO, + 'Please upload your private keys before booking') + return redirect('account:settings') booking = Booking(start=form.cleaned_data['start'], end=form.cleaned_data['end'], purpose=form.cleaned_data['purpose'], resource=self.resource, - user=self.request.user) + user=user) try: booking.save() except ValueError as err: @@ -51,7 +64,14 @@ class BookingFormView(LoginRequiredMixin, FormView): except PermissionError as err: messages.add_message(self.request, messages.ERROR, err) return super(BookingFormView, self).form_invalid(form) - self.open_jira_issue(booking) + try: + create_jira_ticket(user, booking) + except JIRAError: + messages.add_message(self.request, messages.ERROR, 'Failed to create Jira Ticket. ' + 'Please check your Jira ' + 'permissions.') + booking.delete() + return super(BookingFormView, self).form_invalid(form) messages.add_message(self.request, messages.SUCCESS, 'Booking saved') return super(BookingFormView, self).form_valid(form) 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 diff --git a/tools/pharos-dashboard/jenkins/migrations/0001_initial.py b/tools/pharos-dashboard/jenkins/migrations/0001_initial.py deleted file mode 100644 index a9bb8d56..00000000 --- a/tools/pharos-dashboard/jenkins/migrations/0001_initial.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-15 12:19 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='JenkinsSlave', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('name', models.CharField(max_length=100, unique=True)), - ('status', models.CharField(default='offline', max_length=30)), - ('url', models.CharField(max_length=1024)), - ('ci_slave', models.BooleanField(default=False)), - ('dev_pod', models.BooleanField(default=False)), - ('building', models.BooleanField(default=False)), - ('last_job_name', models.CharField(default='', max_length=1024)), - ('last_job_url', models.CharField(default='', max_length=1024)), - ('last_job_scenario', models.CharField(default='', max_length=50)), - ('last_job_branch', models.CharField(default='', max_length=50)), - ('last_job_installer', models.CharField(default='', max_length=50)), - ('last_job_result', models.CharField(default='', max_length=30)), - ], - options={ - 'db_table': 'jenkins_slave', - }, - ), - migrations.CreateModel( - name='JenkinsStatistic', - fields=[ - ('timestamp', models.DateTimeField(auto_created=True)), - ('id', models.AutoField(primary_key=True, serialize=False)), - ('offline', models.BooleanField(default=False)), - ('idle', models.BooleanField(default=False)), - ('online', models.BooleanField(default=False)), - ('slave', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='jenkins.JenkinsSlave')), - ], - options={ - 'db_table': 'jenkins_statistic', - }, - ), - ] diff --git a/tools/pharos-dashboard/jenkins/migrations/0002_auto_20160815_1226.py b/tools/pharos-dashboard/jenkins/migrations/0002_auto_20160815_1226.py deleted file mode 100644 index f1cf7f99..00000000 --- a/tools/pharos-dashboard/jenkins/migrations/0002_auto_20160815_1226.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-15 12:26 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('jenkins', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='jenkinsstatistic', - name='timestamp', - field=models.DateTimeField(auto_now_add=True), - ), - ] diff --git a/tools/pharos-dashboard/jenkins/models.py b/tools/pharos-dashboard/jenkins/models.py index f7d54c96..438a8827 100644 --- a/tools/pharos-dashboard/jenkins/models.py +++ b/tools/pharos-dashboard/jenkins/models.py @@ -21,6 +21,9 @@ class JenkinsSlave(models.Model): class Meta: db_table = 'jenkins_slave' + def __str__(self): + return self.name + class JenkinsStatistic(models.Model): id = models.AutoField(primary_key=True) diff --git a/tools/pharos-dashboard/pharos_dashboard/settings.py b/tools/pharos-dashboard/pharos_dashboard/settings.py index a482f95d..3678b030 100644 --- a/tools/pharos-dashboard/pharos_dashboard/settings.py +++ b/tools/pharos-dashboard/pharos_dashboard/settings.py @@ -123,6 +123,8 @@ USE_L10N = True USE_TZ = True +MEDIA_ROOT = '/home/max/tmp/django_media/' + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.10/howto/static-files/ diff --git a/tools/pharos-dashboard/templates/account/userprofile_update_form.html b/tools/pharos-dashboard/templates/account/userprofile_update_form.html index 0a921d51..542ea81e 100644 --- a/tools/pharos-dashboard/templates/account/userprofile_update_form.html +++ b/tools/pharos-dashboard/templates/account/userprofile_update_form.html @@ -13,12 +13,12 @@ </h3> </div> <div class="panel-body"> - <form method="post" action=""> + <form enctype="multipart/form-data" method="post"> {% csrf_token %} {% bootstrap_form form %} {% buttons %} <button type="submit" class="btn btn btn-success"> - Submit + Save </button> {% endbuttons %} </form> diff --git a/tools/pharos-dashboard/templates/booking/booking_form.html b/tools/pharos-dashboard/templates/booking/booking_form.html deleted file mode 100644 index f13c4b41..00000000 --- a/tools/pharos-dashboard/templates/booking/booking_form.html +++ /dev/null @@ -1,21 +0,0 @@ -{% load bootstrap3 %} - - -{% bootstrap_form_errors form type='non_fields' %} -<form method="post" action="" class="form" id="bookingform"> - {% csrf_token %} - - <div class='input-group' id='starttimepicker'> - {% bootstrap_field form.start addon_after='<span class="glyphicon glyphicon-calendar"></span>' %} - </div> - <div class='input-group' id='endtimepicker'> - {% bootstrap_field form.end addon_after='<span class="glyphicon glyphicon-calendar"></span>' %} - </div> - {% bootstrap_field form.purpose %} - - {% buttons %} - <button type="submit" class="btn btn btn-success"> - Book - </button> - {% endbuttons %} -</form>
\ No newline at end of file diff --git a/tools/pharos-dashboard/templates/registration/login.html b/tools/pharos-dashboard/templates/registration/login.html deleted file mode 100644 index 45b9d451..00000000 --- a/tools/pharos-dashboard/templates/registration/login.html +++ /dev/null @@ -1,51 +0,0 @@ -{% extends "layout.html" %} -{% load bootstrap3 %} - -{% block basecontent %} - <div class="container"> - <div class="row"> - <div class="col-md-4 col-md-offset-4"> - {% if next %} - <div class="alert alert-dismissable alert-info"> - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> - <span aria-hidden="true">×</span> - </button> - {% if user.is_authenticated %} - Your account doesn't have access to this page. To proceed, - please login with an account that has access. - {% else %} - Please login to see this page. - {% endif %} - </div> - {% endif %} - </div> - </div> - <div class="row"> - <div class="col-md-4 col-md-offset-4"> - <div class="login-panel panel panel-default"> - <div class="panel-heading"> - <h3 class="panel-title"> - Login - </h3> - </div> - <div class="panel-body"> - <form method="post"> - {% csrf_token %} - {% bootstrap_form form %} - {% buttons %} - <button type="submit" class="btn btn btn-success"> - Login - </button> - <a href="{% url 'account:registration' %}" class="btn btn-info" - role="button">Register</a> - {% endbuttons %} - </form> - </div> - </div> - </div> - </div> - </div> - - {# Assumes you setup the password_reset view in your URLconf #} - {# <p><a href="{% url 'password_reset' %}">Lost password?</a></p>#} -{% endblock basecontent %} diff --git a/tools/pharos-dashboard/templates/registration/registration_form.html b/tools/pharos-dashboard/templates/registration/registration_form.html deleted file mode 100644 index 0a921d51..00000000 --- a/tools/pharos-dashboard/templates/registration/registration_form.html +++ /dev/null @@ -1,30 +0,0 @@ -{% extends "layout.html" %} -{% load bootstrap3 %} - -{% block basecontent %} - <div class="container"> - <div class="row"> - <div class="col-md-4 col-md-offset-4"> - {% bootstrap_messages %} - <div class="login-panel panel panel-default"> - <div class="panel-heading"> - <h3 class="panel-title"> - {{ title }} - </h3> - </div> - <div class="panel-body"> - <form method="post" action=""> - {% csrf_token %} - {% bootstrap_form form %} - {% buttons %} - <button type="submit" class="btn btn btn-success"> - Submit - </button> - {% endbuttons %} - </form> - </div> - </div> - </div> - </div> - </div> -{% endblock basecontent %} |