aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/base/notifier
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates/base/notifier')
-rw-r--r--src/templates/base/notifier/email_ended.txt25
-rw-r--r--src/templates/base/notifier/email_expiring.txt25
-rw-r--r--src/templates/base/notifier/email_fulfilled.txt21
-rw-r--r--src/templates/base/notifier/end_booking.html36
-rw-r--r--src/templates/base/notifier/expiring_booking.html35
-rw-r--r--src/templates/base/notifier/inbox.html87
-rw-r--r--src/templates/base/notifier/new_booking.html34
-rw-r--r--src/templates/base/notifier/notification.html50
8 files changed, 313 insertions, 0 deletions
diff --git a/src/templates/base/notifier/email_ended.txt b/src/templates/base/notifier/email_ended.txt
new file mode 100644
index 0000000..1788e00
--- /dev/null
+++ b/src/templates/base/notifier/email_ended.txt
@@ -0,0 +1,25 @@
+{{user_name|default:"Developer"}},
+
+{% 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}}
+ end: {{booking.end}}
+ machines:
+ {% for host in hosts %}
+ - {{host}}
+ {% endfor %}
+ purpose: {{booking.purpose}}
+
+You may visit the following link for more information:
+{{booking_url}}
+
+Feel free to create another booking with us!
+
+Thank you for contributing to the OPNFV platform!
+
+ - The Lab-as-a-Service team
diff --git a/src/templates/base/notifier/email_expiring.txt b/src/templates/base/notifier/email_expiring.txt
new file mode 100644
index 0000000..72c9a83
--- /dev/null
+++ b/src/templates/base/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/base/notifier/email_fulfilled.txt b/src/templates/base/notifier/email_fulfilled.txt
new file mode 100644
index 0000000..90d294a
--- /dev/null
+++ b/src/templates/base/notifier/email_fulfilled.txt
@@ -0,0 +1,21 @@
+{{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 %}
+ {{ email_message.title }}
+ {{ email_message.content }}
+ --------------------
+ {% endfor %}
+
+You may visit the following link for more information:
+{{booking_url}}
+
+Thank you for contributing to the OPNFV platform!
+
+ - The Lab-as-a-Service team
diff --git a/src/templates/base/notifier/end_booking.html b/src/templates/base/notifier/end_booking.html
new file mode 100644
index 0000000..a2981c1
--- /dev/null
+++ b/src/templates/base/notifier/end_booking.html
@@ -0,0 +1,36 @@
+<html>
+ <body>
+ <div id="message_content_wrapper">
+ {% if owner %}
+ <h3>Your booking has expired</h3>
+ <p>Your booking has ended and the machines have been cleaned up.</p>
+ <p>Thank you for working on OPNFV, and feel free to book more machines if you need them.</p>
+ {% else %}
+ <h3>A booking that you collaborated on has expired</h3>
+ <p>The booking owned by {{booking.owner.username}} that you worked on has ended</p>
+ <p>Thank you for contributing to OPNFV!</p>
+ {% endif %}
+ <p>Booking information:</p>
+ <ul>
+ <li>owner: {{booking.owner.username}}</li>
+ <li>id: {{booking.id}}</li>
+ <li>lab: {{booking.resource.template.lab.lab_user.username}}</li>
+ <li>resource: {{booking.resource.template.name}}</li>
+ <li>start: {{booking.start}}</li>
+ <li>end: {{booking.end}}</li>
+ <li>purpose: {{booking.purpose}}</li>
+ <li>collaborators:
+ <ul>
+ {% for user in booking.collaborators.all %}
+ <li>user.username</li>
+ {% empty %}
+ <li>No collaborators</li>
+ {% endfor %}
+ </ul>
+ </li>
+ </ul>
+
+ <p>You can find more detailed information <a href=/booking/detail/{{booking.id}}/>Here</a></p>
+ </div>
+ </body>
+</html>
diff --git a/src/templates/base/notifier/expiring_booking.html b/src/templates/base/notifier/expiring_booking.html
new file mode 100644
index 0000000..8bfa689
--- /dev/null
+++ b/src/templates/base/notifier/expiring_booking.html
@@ -0,0 +1,35 @@
+<html>
+ <body>
+ <div id="message_content_wrapper">
+ {% if owner %}
+ <h3>Your booking is about to expire</h3>
+ <p>Your booking will expire within 48 hours ({{booking.end}}).</p>
+ {% else %}
+ <h3>A booking that you collaborate on is about to expire</h3>
+ <p>The booking owned by {{booking.owner.username}} that you work on is about to expire</p>
+ {% endif %}
+ <p>Please take the time to backup all data or extend the booking if needed.</p>
+ <p>Booking information:</p>
+ <ul>
+ <li>owner: {{booking.owner.username}}</li>
+ <li>id: {{booking.id}}</li>
+ <li>lab: {{booking.resource.template.lab.lab_user.username}}</li>
+ <li>resource: {{booking.resource.template.name}}</li>
+ <li>start: {{booking.start}}</li>
+ <li>end: {{booking.end}}</li>
+ <li>purpose: {{booking.purpose}}</li>
+ <li>collaborators:
+ <ul>
+ {% for user in booking.collaborators.all %}
+ <li>user.username</li>
+ {% empty %}
+ <li>No collaborators</li>
+ {% endfor %}
+ </ul>
+ </li>
+ </ul>
+
+ <p>You can find more detailed information <a href=/booking/detail/{{booking.id}}/>Here</a></p>
+ </div>
+ </body>
+</html>
diff --git a/src/templates/base/notifier/inbox.html b/src/templates/base/notifier/inbox.html
new file mode 100644
index 0000000..26b6d32
--- /dev/null
+++ b/src/templates/base/notifier/inbox.html
@@ -0,0 +1,87 @@
+{% extends "base.html" %}
+
+
+{% load staticfiles %}
+
+{% block content %}
+
+<div class="container-fluid d-flex flex-grow-1 flex-column">
+ <div class="row mt-3 mb-2">
+ <div class="col-2 px-0">
+ <div class="btn-group w-100" id="filterGroup">
+ <button class="btn btn-secondary active" data-read="-1">All</button>
+ <button class="btn btn-secondary" data-read="0">Unread</button>
+ <button class="btn btn-secondary" data-read="1">Read</button>
+ </div>
+ </div>
+ </div>
+ <div class="row flex-grow-1" id="fixHeight">
+ <!-- Notification list && Controls -->
+ <div class="mb-2 mb-lg-0 col-lg-2 px-0 mh-100">
+ <span class="text-muted d-none" id="noMessages">No messages available</span>
+ <div class="list-group rounded-0 rounded-left overflow-auto mh-100 notifications" id="unreadNotifications" data-read="0">
+ {% for notification in unread_notifications %}
+ <a
+ href="#"
+ onclick="showmessage({{notification.id}}); setactive(this);"
+ class="list-group-item list-group-item-action notification">
+ {{ notification }}
+ </a>
+ {% endfor %}
+ </div>
+ <div class="list-group rounded-0 rounded-left overflow-auto mh-100 notifications" id="readNotifications" data-read="1">
+ {% for notification in read_notifications %}
+ <a
+ href="#"
+ onclick="showmessage({{notification.id}}); setactive(this);"
+ class="list-group-item list-group-item-action list-group-item-secondary notification">
+ {{ notification }}
+ </a>
+ {% endfor %}
+ </div>
+ </div>
+ <!-- Content -->
+ <div class="col ml-lg-2 border mh-100 p-4">
+ <iframe name="messageView" class="w-100 h-100" id="inbox-iframe" frameBorder="0" scrolling="yes">Please select a notification</iframe>
+ </div>
+ </div>
+</div>
+
+<script type="text/javascript">
+ function showmessage(msg_id) {
+ window.frames["messageView"].location = "notification/" + msg_id;
+ }
+
+ function setactive(obj) {
+ $(".notification").removeClass("active");
+ $(obj).addClass("active");
+ }
+
+ // Shows messages in the given notification list.
+ // Shows/hides the 'no messages' span after checking children amount
+ // given the .notification classed element
+ function showMessages(notificationList) {
+ $(".notifications").addClass("d-none");
+ if (notificationList.children().length < 1) {
+ $("#noMessages").removeClass("d-none");
+ } else {
+ $("#noMessages").addClass("d-none");
+ notificationList.removeClass("d-none");
+ }
+ }
+
+ $(document).ready(function(){
+ // For all / unread / read
+ $("#filterGroup button").click(function(){
+ let read = $(this).attr("data-read");
+ $(this).siblings().removeClass("active");
+ $(this).addClass("active");
+ if (read === "-1") {
+ return showMessages($(".notifications"));
+ }
+ return showMessages($(`.notifications[data-read="${read}"]`));
+ });
+ showMessages($(".notifications"));
+ });
+</script>
+{% endblock %} \ No newline at end of file
diff --git a/src/templates/base/notifier/new_booking.html b/src/templates/base/notifier/new_booking.html
new file mode 100644
index 0000000..64244e0
--- /dev/null
+++ b/src/templates/base/notifier/new_booking.html
@@ -0,0 +1,34 @@
+<html>
+ <body>
+ <div id="message_content_wrapper">
+ {% if owner %}
+ <h3>You have created a new booking</h3>
+ <p>We have recieved your booking request and will start working on it right away.</p>
+ {% else %}
+ <h3>You have been added as a collaborator to a booking</h3>
+ <p>{{booking.owner.username}} has given you access to their booking.</p>
+ {% endif %}
+ <p>Booking information:</p>
+ <ul>
+ <li>owner: {{booking.owner.username}}</li>
+ <li>id: {{booking.id}}</li>
+ <li>lab: {{booking.resource.template.lab.lab_user.username}}</li>
+ <li>resource: {{booking.resource.template.name}}</li>
+ <li>start: {{booking.start}}</li>
+ <li>end: {{booking.end}}</li>
+ <li>purpose: {{booking.purpose}}</li>
+ <li>collaborators:
+ <ul>
+ {% for user in booking.collaborators.all %}
+ <li>user.username</li>
+ {% empty %}
+ <li>No collaborators</li>
+ {% endfor %}
+ </ul>
+ </li>
+ </ul>
+
+ <p>You can find more detailed information <a href=/booking/detail/{{booking.id}}/>Here</a></p>
+ </div>
+ </body>
+</html>
diff --git a/src/templates/base/notifier/notification.html b/src/templates/base/notifier/notification.html
new file mode 100644
index 0000000..603edea
--- /dev/null
+++ b/src/templates/base/notifier/notification.html
@@ -0,0 +1,50 @@
+{% extends "layout.html" %}
+{% block extrahead %}
+<base target="_parent">
+{% endblock %}
+
+{% block basecontent %}
+<script>
+ function send_request(post_data){
+ var form = $("#notification_action_form");
+ var formData = form.serialize() + '&' + post_data + '=true';
+ var req = new XMLHttpRequest();
+ req.open("POST", ".", false);
+ req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ req.onerror = function() { alert("problem occurred while trying to cancel current workflow"); }
+ req.onreadystatechange = function() { if(req.readyState === 4){
+ window.top.location.href += '';
+ }};
+ req.send(formData);
+ }
+ function delete_notification()
+ {
+ send_request("delete");
+ }
+ function mark_unread()
+ {
+ send_request("unread");
+ }
+</script>
+
+<div class="d-flex justify-content-between border-bottom">
+ <span class="h3">{{notification.title}}</span>
+ <div class="btn_group">
+ <button class="btn btn-primary inbox-btn" onclick="mark_unread()">Mark Unread</button>
+ <button class="btn btn-danger inbox-btn" onclick="delete_notification()">Delete</button>
+ </div>
+</div>
+
+<p class="content-divider"></p>
+
+{% if not notification.is_html %}
+<pre>
+{% endif %}
+ {{notification.content|safe}}
+{% if not notification.is_html %}
+</pre>
+{% endif %}
+<form id="notification_action_form" action="." method="post">
+ {% csrf_token %}
+</form>
+{% endblock %}