From 6be40a5f2d75b157cf2a2374f2f866f6fdc92b18 Mon Sep 17 00:00:00 2001 From: Brandon Lo Date: Tue, 26 Nov 2019 16:39:26 -0500 Subject: Add warning email and notification This adds the abandoned changes made to the notification system and also adds a simple task to check for expiring bookings and sends out emails and notifications. Change-Id: I1530d19f41cf93626bb642e6b269f9ec55860b81 Signed-off-by: Brandon Lo --- src/templates/notifier/email_ended.txt | 6 ++++- src/templates/notifier/email_expiring.txt | 25 ++++++++++++++++++++ src/templates/notifier/email_fulfilled.txt | 4 ++++ src/templates/notifier/expiring_booking.html | 35 ++++++++++++++++++++++++++++ src/templates/notifier/new_booking.html | 2 +- 5 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 src/templates/notifier/email_expiring.txt create mode 100644 src/templates/notifier/expiring_booking.html (limited to 'src/templates') diff --git a/src/templates/notifier/email_ended.txt b/src/templates/notifier/email_ended.txt index 7467a0e..1788e00 100644 --- a/src/templates/notifier/email_ended.txt +++ b/src/templates/notifier/email_ended.txt @@ -1,6 +1,10 @@ {{user_name|default:"Developer"}}, -The booking you requested of the OPNFV Lab as a Service has ended. +{% if owner %} +The booking you requested from the OPNFV Lab as a Service has ended. +{% else %} +The booking you collaborated on at the OPNFV Lab as a Service has ended. +{% endif %} booking information: start: {{booking.start}} diff --git a/src/templates/notifier/email_expiring.txt b/src/templates/notifier/email_expiring.txt new file mode 100644 index 0000000..72c9a83 --- /dev/null +++ b/src/templates/notifier/email_expiring.txt @@ -0,0 +1,25 @@ +{{user_name|default:"Developer"}}, + +{% if owner %} +The booking you requested from the OPNFV Lab as a Service is about to expire. +{% else %} +The booking you collaborate on at the OPNFV Lab as a Service is about to expire. +{% endif %} + +booking information: + start: {{booking.start}} + end: {{booking.end}} + machines: + {% for host in hosts %} + - {{host}} + {% endfor %} + purpose: {{booking.purpose}} + +You may visit the following link for more information: +{{booking_url}} + +Please take the time to backup all data or extend the booking if needed. + +Thank you for contributing to the OPNFV platform! + + - The Lab-as-a-Service team diff --git a/src/templates/notifier/email_fulfilled.txt b/src/templates/notifier/email_fulfilled.txt index 65593db..90d294a 100644 --- a/src/templates/notifier/email_fulfilled.txt +++ b/src/templates/notifier/email_fulfilled.txt @@ -1,6 +1,10 @@ {{user_name|default:"Developer"}}, +{% if owner %} The booking you requested of the OPNFV Lab as a Service has finished deploying and is ready for you to use. +{% else %} +A booking you collaborate on is ready for you to use +{% endif %} The lab that fulfilled your booking request has sent you the following messages: {% for email_message in messages %} diff --git a/src/templates/notifier/expiring_booking.html b/src/templates/notifier/expiring_booking.html new file mode 100644 index 0000000..8bfa689 --- /dev/null +++ b/src/templates/notifier/expiring_booking.html @@ -0,0 +1,35 @@ + + +
+ {% if owner %} +

Your booking is about to expire

+

Your booking will expire within 48 hours ({{booking.end}}).

+ {% else %} +

A booking that you collaborate on is about to expire

+

The booking owned by {{booking.owner.username}} that you work on is about to expire

+ {% endif %} +

Please take the time to backup all data or extend the booking if needed.

+

Booking information:

+
    +
  • owner: {{booking.owner.username}}
  • +
  • id: {{booking.id}}
  • +
  • lab: {{booking.resource.template.lab.lab_user.username}}
  • +
  • resource: {{booking.resource.template.name}}
  • +
  • start: {{booking.start}}
  • +
  • end: {{booking.end}}
  • +
  • purpose: {{booking.purpose}}
  • +
  • collaborators: +
      + {% for user in booking.collaborators.all %} +
    • user.username
    • + {% empty %} +
    • No collaborators
    • + {% endfor %} +
    +
  • +
+ +

You can find more detailed information Here

+
+ + diff --git a/src/templates/notifier/new_booking.html b/src/templates/notifier/new_booking.html index d23b12e..64244e0 100644 --- a/src/templates/notifier/new_booking.html +++ b/src/templates/notifier/new_booking.html @@ -6,7 +6,7 @@

We have recieved your booking request and will start working on it right away.

{% else %}

You have been added as a collaborator to a booking

-

{{booking.owner.username}} has given you access to thier booking.

+

{{booking.owner.username}} has given you access to their booking.

{% endif %}

Booking information: