aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/workflow/confirm.html
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-07-02 17:33:09 -0400
committerSawyer Bergeron <sbergeron@iol.unh.edu>2019-07-08 14:32:53 +0000
commitbf45f8f4d05d9842b285013cfcb0a0235ce51c5d (patch)
tree528ceb8bf7627a65ed771ac3738031778e8750c8 /src/templates/workflow/confirm.html
parente0b8bb3ee3c218a65562acdc5e76f714aab92926 (diff)
Hacking on AJAX
This change incorporates the multiple changes we've made in the past few days in order to actually get AJAX working. Change-Id: Ia61a0395e7dbac26a143ca6e15049e6a4bdc8b0d Signed-off-by: Parker Berberian <pberberian@iol.unh.edu> Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Diffstat (limited to 'src/templates/workflow/confirm.html')
-rw-r--r--src/templates/workflow/confirm.html97
1 files changed, 6 insertions, 91 deletions
diff --git a/src/templates/workflow/confirm.html b/src/templates/workflow/confirm.html
index b7e6c46..2f99a41 100644
--- a/src/templates/workflow/confirm.html
+++ b/src/templates/workflow/confirm.html
@@ -8,11 +8,6 @@
<div class="text-center">
<h3>Confirm Session</h3>
</div>
-<div id="vlan_warning"></div>
-<form id="vlan_form" action="/wf/workflow/" method="post">
- {% csrf_token %}
- <input id="vlan_input" name="vlan_input" type="hidden"/>
-</form>
<div class="container">
<div class="row justify-content-center">
<div class="col-auto">
@@ -22,7 +17,7 @@
<div class="row">
<div class="col">
<div id="form_div" class="text-center p-4">
- <form id="confirmation_form" action="/wf/workflow/" method="post">
+ <form id="step_form" action="/workflow/manager/" method="post">
{% csrf_token %}
<div class="d-none">
{{form|default:"<p> No Form Loaded</p>"}}
@@ -33,7 +28,7 @@
<button id="cancel_button" class="btn btn-danger" onclick="formcancel()">Cancel</button>
</div>
<div class="d-none">
- <form id="manager_delete_form" action="/wf/workflow/finish/" method="post">
+ <form id="manager_delete_form" action="/workflow/finish/" method="post">
{% csrf_token %}
</form>
</div>
@@ -44,104 +39,24 @@
<script>
var select = document.getElementById("id_confirm");
- function processResponseText(json)
- {
- var dict = JSON.parse(json);
-
- if( !dict["redir_url"] ) {
- window.top.refresh_iframe();
- } else {
- top.window.location.href = dict["redir_url"];
- }
- }
-
- function delete_manager()
- {
- var form = $("#manager_delete_form");
- var formData = form.serialize();
- var req = new XMLHttpRequest();
- req.open("POST", "/wf/workflow/finish/", false);
- req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- req.onerror = function() { alert("problem with cleaning up session"); }
- req.onreadystatechange = function() { if(req.readyState === 4 ) {
- processResponseText(req.responseText);
- }}
- req.send(formData);
- }
-
- function submitForm()
- {
- var form = $("#confirmation_form");
- var formData = form.serialize();
- var req = new XMLHttpRequest();
- req.open("POST", "/wf/workflow/", false);
- req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- req.onerror = function() { alert("problem submitting confirmation"); }
- req.onreadystatechange = function() { if(req.readyState === 4 ) { delete_manager(); } }
- req.send(formData);
- }
-
-
function formconfirm()
{
select.value = "True";
- submitForm();
+ submitStepForm();
}
function formcancel()
{
select.value = "False";
- submitForm();
+ submitStepForm();
}
- var confirmed = {{bypassed|default:"false"}};
+ var confirmed = {{confirm_succeeded|default:"false"}};
if( confirmed )
{
- delete_manager();
- }
-</script>
-<script>
- function fixVlans() {
- document.getElementById("vlan_input").value = "True";
- var form = $("#vlan_form");
- var formData = form.serialize();
- var req = new XMLHttpRequest();
- req.open("POST", "/wf/workflow/", false);
- req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- req.onerror = function() { alert("problem submitting form"); }
- req.onreadystatechange = function() { //replaces current page with response
- if(req.readyState === 4 ) {
- var d = document.getElementById("vlan_warning").innerHTML = "";
- document.getElementById("confirm_button").disabled = false;
- document.getElementById("cancel_button").disabled = false;
- }
- }
- req.send(formData);
- }
- var problem = {{vlan_warning|default:'false'}};
- if(problem){
- var d = document.getElementById("vlan_warning");
- var h3 = document.createElement("h3");
- h3.innerHTML = "WARNING: Vlans not available";
- var h4 = document.createElement("h4");
- h4.innerHTML = "The vlans you selected are not currently available. Would you like to automatically change them?";
- var button1 = document.createElement("button");
- button1.innerHTML = "Correct Vlans For Me";
- button1.onclick = function() { fixVlans(); }
-
- var button2 = document.createElement("button");
- button2.innerHTML = "Cancel. I will change my vlans";
- button2.onclick = function() { formcancel(); }
- d.appendChild(h3);
- d.appendChild(h4);
- d.appendChild(button1);
- d.appendChild(button2);
- document.getElementById("confirm_button").disabled = true;
- document.getElementById("cancel_button").disabled = true;
+ pop_workflow();
}
</script>
{% block element_messages %}
{% endblock element_messages %}
{% endblock content %}
-{% block onleave %}
-{% endblock %}