diff options
Diffstat (limited to 'src/templates/base')
-rw-r--r-- | src/templates/base/account/settings.html | 88 | ||||
-rw-r--r-- | src/templates/base/account/user_list.html | 55 | ||||
-rw-r--r-- | src/templates/base/dashboard/landing.html | 45 | ||||
-rw-r--r-- | src/templates/base/workflow/book_a_pod.html | 57 | ||||
-rw-r--r-- | src/templates/base/workflow/design_a_pod.html | 23 |
5 files changed, 194 insertions, 74 deletions
diff --git a/src/templates/base/account/settings.html b/src/templates/base/account/settings.html new file mode 100644 index 0000000..d1939b7 --- /dev/null +++ b/src/templates/base/account/settings.html @@ -0,0 +1,88 @@ +{% extends "base.html" %} +{% load staticfiles %} +{% load bootstrap4 %} +{% block content %} +<h1>Settings</h1> + <form action="/accounts/settings/" method="post"> + {% csrf_token %} + <input id="hidden_key_list" type="hidden" name="ssh_key_list" value=""> + <div class="form-group"> + {{ company_form }} + {{ preference_form }} + <br> + <label>SSH Keys:</label> + <ul class="list-group" id="key_ul"> + {% for key in existing_keys %} + <li class="card w-25 mb-1"> + <div class="card-body" style="height: 150px; overflow-y: auto;"> + {{key}} + </div> + <div class="card-footer d-flex flex-row-reverse"> + <div class="btn btn-danger" onclick="remove_key('{{key}}', this.parentNode.parentNode)">Delete</div> + </div> + </li> + {% endfor %} + </ul> + <li class="card w-25 text-truncate mb-1"> + <div class="card-body"> + <textarea id="new_key_area" placeholder="New SSH Public Key" class="form-control" id="new_key_input"></textarea> </div> + <div class="card-footer d-flex flex-row-reverse"> + <div class="btn btn-success" onclick="add_key(this.parentNode.parentNode.childNodes[1].childNodes[1].value)">Add</div> + </div> + </li> + <input class="btn btn-success mt-5" style="width: 100px" name="submitButton" type="submit" value="Save"> + </div> + </form> + +<script> +let key_list = [] +$(window).on('load', function() { + document.getElementById('new_key_area').value = ""; + {% for key in existing_keys %} + key_list.push('{{key}}') + {% endfor %} + update_json_list() + console.log(key_list) +}); + + +function remove_key(target_key, node) { + key_list = key_list.filter(key => key != target_key); + node.setAttribute("hidden", "true"); + update_json_list() +} + +function add_key(key_string) { + console.log(key_string) + if (key_list.indexOf(key_string) != -1) { + alert('This key has already been added'); + return; + } + key_list.push(key_string) + create_key_card(key_string) + update_json_list() +} + +function create_key_card(key_string) { + const elem = document.createElement('li'); + elem.classList.add('card', 'w-25', 'mb-1'); + elem.innerHTML = ` + <div class="card-body" style="height: 150px; overflow-y: auto;"> + ` + key_string + ` + </div> + <div class="card-footer d-flex flex-row-reverse"> + <div class="btn btn-danger" onclick="remove_key('` + key_string +`', this.parentNode.parentNode)">Delete</div> + </div> + ` + + document.getElementById('key_ul').appendChild(elem); + document.getElementById('new_key_area').value = ""; + +} + +function update_json_list() { + document.getElementById("hidden_key_list").value = key_list.toString() +} +</script> +{% endblock content %} + diff --git a/src/templates/base/account/user_list.html b/src/templates/base/account/user_list.html deleted file mode 100644 index e564524..0000000 --- a/src/templates/base/account/user_list.html +++ /dev/null @@ -1,55 +0,0 @@ -{% extends "dashboard/table.html" %} -{% load staticfiles %} - -{% block table %} - <thead> - <tr> - <th>Username</th> - <th>Full Name</th> - <th>Email</th> - <th>Company</th> - <th>SSH Key</th> - <th>GPG Key</th> - </tr> - </thead> - <tbody> - {% for user in users %} - <tr> - <td> - {{ user.username }} - </td> - <td> - {{ user.userprofile.full_name }} - </td> - <td> - {{ user.userprofile.email_addr }} - </td> - <td> - {{ user.userprofile.company }} - </td> - <td> - {% if user.userprofile.ssh_public_key %} - <a href={{ user.userprofile.ssh_public_key.url }}>SSH</a> - {% endif %} - </td> - <td> - {% if user.userprofile.pgp_public_key %} - <a href={{ user.userprofile.pgp_public_key.url }}>GPG</a> - {% endif %} - </td> - </tr> - {% endfor %} - </tbody> -{% endblock table %} - - -{% block tablejs %} - <script type="text/javascript"> - $(document).ready(function () { - $('#table').DataTable({ - scrollX: true, - "order": [[0, "asc"]] - }); - }); - </script> -{% endblock tablejs %} diff --git a/src/templates/base/dashboard/landing.html b/src/templates/base/dashboard/landing.html index fea4deb..960ad39 100644 --- a/src/templates/base/dashboard/landing.html +++ b/src/templates/base/dashboard/landing.html @@ -1,16 +1,10 @@ {% extends "base.html" %} {% load staticfiles %} - +{% load bootstrap4 %} {% block content %} <div class="text-center"> {% if not request.user.is_anonymous %} - {% if not request.user.userprofile.ssh_public_key %} - <div class="alert alert-danger alertAnuket" role="alert"> - <b>Warning: you need to upload an ssh key under <a href="/accounts/settings" class="inTextLink" >account settings</a> if you wish to - log into the servers you book</b> - </div> - {% endif %} {% else %} {% endif %} </div> @@ -67,10 +61,37 @@ </div> </div> -<div class="hidden_form d-none" id="form_div"> - <form method="post" action="" class="form" id="wf_selection_form"> - {% csrf_token %} - </form> -</div> +<!-- IPA Modal --> +<div class="modal fade" id="ipa-modal" tabindex="-1"> + <div class="modal-dialog modal-xl"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title">Welcome to LaaS 3.0</h5> + </div> + <div class="modal-body" id="add_resource_modal_body"> + <p>We have made large scale improvements to the dashboard and our host provisioning service to improve your user experience.</p> + <p>{{ ipa_migrator.message }}</p> + <form action="{{ipa_migrator.action}}" method="post"> + {% csrf_token %} + <p class="text-danger">{{error}}</p> + {{ ipa_migrator.form }} + <div class="form-group"> + <input class="btn btn-success" name="submitButton" type="submit" value="{{ipa_migrator.button}}"> + </div> + </form> + </div> + </div> + </div> + </div> + +<script> + +$(window).on('load', function() { + if ({{ipa_migrator.exists}}) { + $('#ipa-modal').modal({backdrop: 'static', keyboard: false}); + $('#ipa-modal').modal('show'); + } + }); +</script> {% endblock content %} diff --git a/src/templates/base/workflow/book_a_pod.html b/src/templates/base/workflow/book_a_pod.html index 7053bfd..7448dc5 100644 --- a/src/templates/base/workflow/book_a_pod.html +++ b/src/templates/base/workflow/book_a_pod.html @@ -98,7 +98,7 @@ </div> </div> <div class="row align-items-center mt-5"> - <button class="btn btn-danger cancel-book-button p-0 mr-2 col-xl-2 col-md-3 col-5" onclick="workflow.onclickCancel()">Cancel</button> + <!-- <button class="btn btn-danger cancel-book-button p-0 mr-2 col-xl-2 col-md-3 col-5" onclick="workflow.onclickCancel()">Cancel</button> --> <button class="btn btn-success cancel-book-button p-0 ml-2 col-xl-2 col-md-3 col-5" onclick="workflow.onclickConfirm()">Book</button> </div> </div> @@ -111,11 +111,60 @@ {% csrf_token %} </form> </div> + +<div class="modal fade" id="ipa-modal" tabindex="-1"> + <div class="modal-dialog modal-xl"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title">Welcome to LaaS 3.0</h5> + <button class="close" onclick="window.location.href = '../../'"><span aria-hidden="true">×</span></button> + </div> + <div class="modal-body" id="add_resource_modal_body"> + <p>Please update your information before creating a booking.</p> + <form action="{{prereq_validator.action}}" method="post"> + {% csrf_token %} + {{ prereq_validator.form }} + <div class="form-group"> + <input class="btn btn-success" name="submitButton" type="submit" value="Save"> + </div> + </form> + </div> + </div> + </div> +</div> + +<!-- Alert Modal --> +<div class="modal fade" id="alert_modal" tabindex="-1"> + <div class="modal-dialog modal-sm"> + <div class="modal-content"> + <div class="modal-header"> + <button class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button> + </div> + <div class="modal-body text-center"> + <h5 id="alert_modal_message"></h5> + </div> + <div class="modal-footer d-flex justify-content-center"> + <button class="btn btn-success" data-dismiss="modal" id="alert-modal-submit" onclick="">Confirm</button> + </div> + </div> + </div> +</div> </body> <script> - const user = "{{user}}" - const workflow = new BookingWorkflow(); - workflow.startWorkflow(); + let user; + let workflow; + $(window).on('load', function() { + if ({{prereq_validator.exists}}) { + $('#ipa-modal').modal({backdrop: 'static', keyboard: false}); + $('#ipa-modal').modal('show'); + } else { + user = "{{user}}" + workflow = new BookingWorkflow(); + workflow.startWorkflow(); + } + }); + + </script> {% endblock %} diff --git a/src/templates/base/workflow/design_a_pod.html b/src/templates/base/workflow/design_a_pod.html index 5d48273..ab3f11b 100644 --- a/src/templates/base/workflow/design_a_pod.html +++ b/src/templates/base/workflow/design_a_pod.html @@ -83,14 +83,14 @@ <textarea id="pod-desc-input" class="form-control form-control-lg border border-dark pt-3 pl-3" rows="5" placeholder="Pod Description"></textarea> </div> </div> - <div class="row align-items-center my-4"> + <!-- <div class="row align-items-center my-4"> <div class="col-xl-6 col-md-8 col-11"> <div class="custom-control custom-switch"> <input type="checkbox" class="custom-control-input" id="pod-public-input"> <label class="custom-control-label" for="pod-public-input">Make pod template public?</label> </div> </div> - </div> + </div> --> <div class="row align-items-center my-4"> <div class="col-xl-6 col-md-8 col-11"> <span id="pod_details_error" class="text-danger"></span> @@ -120,7 +120,7 @@ </div> </div> <div class="row align-items-center mt-5"> - <div class="col-xl-2 col-md-3 col-5"><button class="btn btn-danger cancel-book-button p-0 w-100" onclick="workflow.onclickDiscardTemplate()">Discard</button></div> + <!-- <div class="col-xl-2 col-md-3 col-5"><button class="btn btn-danger cancel-book-button p-0 w-100" onclick="workflow.onclickDiscardTemplate()">Discard</button></div> --> <div class="col-xl-2 col-md-3 col-5"><button class="btn btn-success cancel-book-button p-0 w-100" onclick = "workflow.onclickSubmitTemplate()">Create</button></div> </div> </div> @@ -197,6 +197,23 @@ </div> </div> +<!-- Alert Modal --> +<div class="modal fade" id="alert_modal" tabindex="-1"> + <div class="modal-dialog modal-sm"> + <div class="modal-content"> + <div class="modal-header"> + <button class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button> + </div> + <div class="modal-body text-center"> + <h5 id="alert_modal_message"></h5> + </div> + <div class="modal-footer d-flex justify-content-center"> + <button class="btn btn-success" data-dismiss="modal" id="alert-modal-submit" onclick="">Confirm</button> + </div> + </div> + </div> +</div> + <div class="hidden_form d-none"> <form id="token"> {% csrf_token %} |