1 {% extends "base.html" %}
14 height: calc(100% - 170px);
19 background-color: #ffffff;
64 -webkit-box-shadow: inherit;
69 -webkit-box-shadow: inherit;
79 padding-bottom: 4px !important;
80 border-bottom: 4px solid #41ba78 !important;
88 .step_invalid::after {
98 .step_untouched::after {
103 width: calc(100% - 450px);
105 height: calc(100vh - 155px);
112 height: calc(100vh - 155px);
117 background-color: inherit;
120 #breadcrumbs.breadcrumb>li {
121 border: 1px solid #cccccc;
125 #breadcrumbs.breadcrumb>li:first-child {
126 border-left: 1px solid #cccccc;
129 #breadcrumbs.breadcrumb>li+li:before {
136 #topPagination .topcrumb {
139 align-content: center;
140 justify-content: center;
141 border: 1px solid #dee2e6;
150 .topcrumb.active > span {
155 .topcrumb.disabled > span {
161 <div class="row mt-3">
164 <ul class="pagination d-flex flex-row" id="topPagination">
165 <li class="page-item flex-shrink-1 page-control">
166 <a class="page-link" href="#" id="gob" onclick="go('prev')">
167 <i class="fas fa-backward"></i> Back
170 <li class="page-item flex-grow-1 active">
171 <a class="page-link disabled" href="#">
172 Select <i class="far fa-check-square"></i>
175 <li class="page-item flex-grow-1">
176 <a class="page-link disabled" href="#">
177 Configure <i class="far fa-square"></i>
180 <li class="page-item flex-grow-1">
181 <a class="page-link disabled" href="#">
182 Information <i class="far fa-square"></i>
185 <li class="page-item flex-grow-1">
186 <a class="page-link disabled" href="#">
187 OPNFV <i class="far fa-square"></i>
190 <li class="page-item flex-grow-1">
191 <a class="page-link disabled" href="#">
192 Confirm <i class="far fa-square"></i>
195 <li class="page-item flex-shrink-1 page-control">
196 <a class="page-link text-right" href="#" id="gof" onclick="go('next')">
197 Next <i class="fas fa-forward"></i>
205 <div class="row px-4">
207 <div id="iframe_header" class="row view-header">
208 <div class="col-lg-12 step_header">
209 <h1 class="step_title d-inline-block" id="view_title"></h1>
210 <span class="description text-muted" id="view_desc"></span>
211 <p class="step_message" id="view_message"></p>
214 function update_description(title, desc) {
215 document.getElementById("view_title").innerText = title;
216 document.getElementById("view_desc").innerText = desc;
219 function update_message(message, stepstatus) {
220 document.getElementById("view_message").innerText = message;
221 document.getElementById("view_message").className = "step_message";
222 document.getElementById("view_message").classList.add("message_" + stepstatus);
228 <div class="col-auto align-self-center d-flex">
229 <button id="cancel_btn" class="btn btn-danger ml-auto" onclick="cancel_wf()">Cancel</button>
232 <!-- Content here -->
233 <div class="row d-flex flex-column flex-grow-1">
234 <div class="container-fluid d-flex flex-column h-100">
235 <div class="row d-flex flex-grow-1 p-4">
236 <!-- iframe workflow -->
237 <div class="col-12 d-flex border flex-grow-1">
238 <!-- This was where the iframe went -->
239 <iframe src="/wf/workflow" class="w-100 h-100" scrolling="yes" id="viewport-iframe"
240 frameBorder="0"></iframe>
245 <div class="btn_wrapper">
249 <script type="text/javascript">
253 var context_data = false;
260 function request_leave(to) {
264 beforeSend: function (request) {
265 request.setRequestHeader("X-CSRFToken",
266 $('input[name="csrfmiddlewaretoken"]').val());
268 success: function (data) {
269 confirm_permission(to, data);
275 function confirm_permission(to, data) {
276 if (errors_exist(data)) {
282 var problem = function () {
283 alert("There was a problem");
285 //makes an asynch request
286 req = new XMLHttpRequest();
287 url = "/wf/workflow/?step=" + to;
288 req.open("GET", url, true);
289 req.onload = function (e) {
290 if (req.readyState === 4) {
291 if (req.status < 300) {
292 document.getElementById("viewport-iframe").srcdoc = this.responseText;
300 req.onerror = problem;
304 function step_on_leave() {
305 document.getElementById("viewport-iframe").contentWindow.step_on_leave();
308 function errors_exist(data) {
309 var stat = data['steps'][data['active']]['valid'];
310 if (stat >= 100 && stat < 200) {
317 function update_context() {
321 beforeSend: function (request) {
322 request.setRequestHeader("X-CSRFToken",
323 $('input[name="csrfmiddlewaretoken"]').val());
325 success: function (data) {
331 function update_page(data) {
333 update_breadcrumbs(data);
334 if (data["workflow_count"] == 1) {
335 document.getElementById("cancel_btn").innerText = "Exit Workflow";
337 document.getElementById("cancel_btn").innerText = "Return to Parent";
341 function update_breadcrumbs(meta_json) {
342 step = meta_json['active'];
343 page_count = meta_json['steps'].length;
345 var btn = document.getElementById("gob");
346 btn.classList.add("invisible");
349 var btn = document.getElementById("gob");
350 btn.classList.remove("invisible");
351 btn.disabled = false;
353 if (step == page_count - 1) {
354 var btn = document.getElementById("gof");
355 btn.classList.add("invisible");
358 var btn = document.getElementById("gof");
359 btn.classList.remove("invisible");
360 btn.disabled = false;
362 //remove all children of breadcrumbs so we can redraw
363 $("#topPagination").children().not(".page-control").remove();
364 draw_steps(meta_json);
367 function draw_steps(meta_json) {
368 for (var i = 0; i < meta_json["steps"].length; i++) {
369 meta_json["steps"][i]["index"] = i;
370 var step_btn = create_step(meta_json["steps"][i], i == meta_json["active"]);
371 $("#topPagination li:last-child").before(step_btn);
375 function create_step(step_json, active) {
376 var step_dom = document.createElement("li");
377 // First create the dom object depending on active or not
379 step_dom.className = "topcrumb active";
381 step_dom.className = "topcrumb";
383 $(step_dom).html(`<span class="d-flex align-items-center justify-content-center text-capitalize w-100">${step_json['title']}</span>`)
384 var code = step_json['valid'];
388 $(step_dom).children().first().append("<i class='ml-2 far fa-square'></i>")
391 } else if (code < 200) {
392 $(step_dom).children().first().append("<i class='ml-2 fas fa-minus-square'></i>")
394 msg = step_json['message'];
395 } else if (code < 300) {
396 $(step_dom).children().first().append("<i class='ml-2 far fa-check-square'></i>")
398 msg = step_json['message'];
400 if (step_json['enabled'] == false) {
401 step_dom.classList.add("disabled");
404 update_message(msg, stat);
407 var step_number = step_json['index'];
411 function cancel_wf() {
412 var form = $("#workflow_pop_form");
413 var formData = form.serialize();
414 var req = new XMLHttpRequest();
415 req.open("POST", "/wf/workflow/finish/", false);
416 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
417 req.onerror = function () {
418 alert("problem occurred while trying to cancel current workflow");
420 req.onreadystatechange = function () {
421 if (req.readyState === 4) {
428 function refresh_iframe() {
429 req = new XMLHttpRequest();
430 url = "/wf/workflow/";
431 req.open("GET", url, true);
432 req.onload = function (e) {
433 var doc = document.getElementById("viewport-iframe").contentWindow.document;
435 doc.write(this.responseText);
441 function write_iframe(contents) {
442 document.getElementById("viewport-iframe").contentWindow.document.innerHTML = contents;
445 function redirect_root() {
446 window.location.replace('/wf/');
449 function add_wf(type) {
450 add_wf_internal(type, false);
453 function add_edit_wf(type, target) {
454 add_wf_internal(type, target);
457 function add_wf_internal(type, itemid) {
462 data['target'] = itemid;
468 beforeSend: function (request) {
469 request.setRequestHeader("X-CSRFToken",
470 $('input[name="csrfmiddlewaretoken"]').val()
473 success: refresh_wf_iframe()
477 function refresh_wf_iframe() {
478 window.location = window.location;
481 <div style="display: none;" id="workflow_pop_form_div">
482 <form id="workflow_pop_form" action="/wf/workflow/finish/" method="post">
486 {% endblock content %}