From edf4c59212c757d81a51fbc8d587bb7384d921fa Mon Sep 17 00:00:00 2001 From: Sean Smith Date: Fri, 18 Sep 2020 15:26:53 -0400 Subject: 3 contact us buttons and booking links on landing Signed-off-by: Sean Smith Change-Id: Ic50767e566f06d34457b6543644eeee03e584b89 --- src/booking/views.py | 11 +++++++++-- src/dashboard/views.py | 16 +++++++++++++++- src/templates/akraino/booking/quick_deploy.html | 3 ++- src/templates/base/booking/booking_detail.html | 3 ++- src/templates/base/booking/quick_deploy.html | 5 ++++- src/templates/base/dashboard/landing.html | 17 ++++++++++++++++- src/templates/base/workflow/viewport-base.html | 5 +++++ src/templates/laas/dashboard/landing.html | 2 +- src/workflow/views.py | 8 +++++++- 9 files changed, 61 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/booking/views.py b/src/booking/views.py index bd57812..c41a7d6 100644 --- a/src/booking/views.py +++ b/src/booking/views.py @@ -19,7 +19,7 @@ from django.db.models import Q from django.urls import reverse from resource_inventory.models import ResourceBundle, ResourceProfile, Image, ResourceQuery -from account.models import Downtime +from account.models import Downtime, Lab from booking.models import Booking from booking.stats import StatisticsManager from booking.forms import HostReImageForm @@ -44,6 +44,7 @@ def quick_create(request): context['form'] = QuickBookingForm(lab_data=attrs, default_user=request.user.username, user=request.user) context['lab_profile_map'] = {} context.update(drop_filter(request.user)) + context['contact_email'] = Lab.objects.filter(name="UNH_IOL").first().contact_email return render(request, 'booking/quick_deploy.html', context) if request.method == 'POST': @@ -74,9 +75,15 @@ class BookingView(TemplateView): def get_context_data(self, **kwargs): booking = get_object_or_404(Booking, id=self.kwargs['booking_id']) title = 'Booking Details' + contact = Lab.objects.filter(name="UNH_IOL").first().contact_email downtime = Downtime.objects.filter(lab=booking.lab, start__lt=timezone.now, end__gt=timezone.now()).first() context = super(BookingView, self).get_context_data(**kwargs) - context.update({'title': title, 'booking': booking, 'downtime': downtime}) + context.update({ + 'title': title, + 'booking': booking, + 'downtime': downtime, + 'contact_email': contact + }) return context diff --git a/src/dashboard/views.py b/src/dashboard/views.py index 2ace2d4..f9a908c 100644 --- a/src/dashboard/views.py +++ b/src/dashboard/views.py @@ -12,8 +12,12 @@ from django.shortcuts import get_object_or_404 from django.views.generic import TemplateView from django.shortcuts import render +from django.db.models import Q +from datetime import datetime +import pytz from account.models import Lab +from booking.models import Booking from resource_inventory.models import Image, ResourceProfile, ResourceQuery from workflow.workflow_manager import ManagerTracker @@ -65,12 +69,22 @@ def host_profile_detail_view(request): def landing_view(request): manager = ManagerTracker.managers.get(request.session.get('manager_session')) + user = request.user + if not user.is_anonymous: + bookings = Booking.objects.filter( + Q(owner=user) | Q(collaborators=user), + end__gte=datetime.now(pytz.utc) + ) + else: + bookings = None + return render( request, 'dashboard/landing.html', { 'manager': manager is not None, - 'title': "Welcome to the Lab as a Service Dashboard" + 'title': "Welcome to the Lab as a Service Dashboard", + 'bookings': bookings } ) diff --git a/src/templates/akraino/booking/quick_deploy.html b/src/templates/akraino/booking/quick_deploy.html index af9b3d3..c3e519f 100644 --- a/src/templates/akraino/booking/quick_deploy.html +++ b/src/templates/akraino/booking/quick_deploy.html @@ -6,7 +6,8 @@ Please select a host type you wish to book. Only available types are shown. More information can be found here: - Akraino Wiki + Akraino Wiki. + If something isn't working right, let us know here!

{% endblock form-text %} {% block collab %} diff --git a/src/templates/base/booking/booking_detail.html b/src/templates/base/booking/booking_detail.html index 4b70f69..24a654c 100644 --- a/src/templates/base/booking/booking_detail.html +++ b/src/templates/base/booking/booking_detail.html @@ -159,7 +159,8 @@

Deployment Progress

-

These are the different tasks that have to be completed before your deployment is ready

+

These are the different tasks that have to be completed before your deployment is ready. + If this is taking a really long time, let us know here!

diff --git a/src/templates/base/booking/quick_deploy.html b/src/templates/base/booking/quick_deploy.html index e4b9431..c954073 100644 --- a/src/templates/base/booking/quick_deploy.html +++ b/src/templates/base/booking/quick_deploy.html @@ -9,7 +9,10 @@
{% block form-text %} -

Please select a host type you wish to book. Only available types are shown.

+

+ Please select a host type you wish to book. Only available types are shown. + If something isn't working right, let us know here! +

{% endblock form-text %} {% bootstrap_field form.filter_field show_label=False %}
diff --git a/src/templates/base/dashboard/landing.html b/src/templates/base/dashboard/landing.html index ed50638..ecb12c6 100644 --- a/src/templates/base/dashboard/landing.html +++ b/src/templates/base/dashboard/landing.html @@ -16,12 +16,27 @@ {% csrf_token %}
-
+

About Us

{% block about_us %}

Here is some information about us!

{% endblock about_us %} + {% block welcome_back %} + {% if user.is_authenticated %} +

Welcome Back!

+ {% if bookings %} +
These are your current bookings:
+ + {% else %} +
You have no current bookings
+ {% endif %} + {% endif %} + {% endblock welcome_back %}
diff --git a/src/templates/base/workflow/viewport-base.html b/src/templates/base/workflow/viewport-base.html index d08145c..d9648c2 100644 --- a/src/templates/base/workflow/viewport-base.html +++ b/src/templates/base/workflow/viewport-base.html @@ -28,6 +28,11 @@
+
+
+
+ Is something not working right? Let us know here! +
diff --git a/src/templates/laas/dashboard/landing.html b/src/templates/laas/dashboard/landing.html index a8e0ff8..fc6b3e3 100644 --- a/src/templates/laas/dashboard/landing.html +++ b/src/templates/laas/dashboard/landing.html @@ -9,4 +9,4 @@ book a whole block of servers with customized layer2 networks (e.g. a Pharos Pod). Read more here: LaaS Wiki

-{% endblock about_us %} +{% endblock %} \ No newline at end of file diff --git a/src/workflow/views.py b/src/workflow/views.py index 9666d72..fb311b7 100644 --- a/src/workflow/views.py +++ b/src/workflow/views.py @@ -10,6 +10,7 @@ from django.http import HttpResponse from django.shortcuts import render +from account.models import Lab import uuid @@ -73,7 +74,12 @@ def viewport_view(request): if request.method != 'GET': return HttpResponse(status=405) - return render(request, 'workflow/viewport-base.html') + + context = { + 'contact_email': Lab.objects.get(name="UNH_IOL").contact_email + } + + return render(request, 'workflow/viewport-base.html', context) def create_workflow(request): -- cgit 1.2.3-korg