aboutsummaryrefslogtreecommitdiffstats
path: root/src/static/js/workflows/workflow.js
diff options
context:
space:
mode:
authorJustin Choquette <jchoquette@iol.unh.edu>2023-08-08 11:33:57 -0400
committerJustin Choquette <jchoquette@iol.unh.edu>2023-08-18 11:59:01 -0400
commitecadb07367d31c0929212618e120130f54af78da (patch)
treef626ef347f6fa7cb7f9ee962539a5f769bc3d471 /src/static/js/workflows/workflow.js
parenta6168306c08e8d5b207b9acc48869180d194ff01 (diff)
MVP
Change-Id: Ib590302f49e7e66f8d04841fb6cb97baf623f51a Signed-off-by: Justin Choquette <jchoquette@iol.unh.edu>
Diffstat (limited to 'src/static/js/workflows/workflow.js')
-rw-r--r--src/static/js/workflows/workflow.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/static/js/workflows/workflow.js b/src/static/js/workflows/workflow.js
index f3f39e9..97bf8f4 100644
--- a/src/static/js/workflows/workflow.js
+++ b/src/static/js/workflows/workflow.js
@@ -29,7 +29,6 @@ class LibLaaSAPI {
/** POSTs to dashboard, which then auths and logs the requests, makes the request to LibLaaS, and passes the result back to here.
Treat this as a private function. Only use the async functions when outside of this class */
static makeRequest(method, endpoint, workflow_data) {
- console.log("Making request: %s, %s, %s", method, endpoint, workflow_data.toString())
const token = document.getElementsByName('csrfmiddlewaretoken')[0].value
return new Promise((resolve, reject) => {// -> HttpResponse
$.ajax(
@@ -130,7 +129,6 @@ class LibLaaSAPI {
static async makeTemplate(templateBlob) { // -> UUID or null
templateBlob.owner = user;
- console.log(JSON.stringify(templateBlob))
return await this.handleResponse(this.makeRequest(HTTP.POST, endpoint.MAKE_TEMPLATE, templateBlob));
}
@@ -230,12 +228,13 @@ class Workflow {
}
goTo(step_number) {
- while (step_number > this.step) {
- this.goNext();
- }
-
- while (step_number < this.step) {
- this.goPrev();
+ if (step_number < 0) return;
+ this.step = step_number
+ document.getElementById(this.sections[this.step]).scrollIntoView({behavior: 'smooth'});
+ if (this.step == this.sections.length - 1) {
+ document.getElementById('next').setAttribute('disabled', '');
+ } else if (this.step == 1) {
+ document.getElementById('prev').removeAttribute('disabled');
}
}
@@ -245,9 +244,11 @@ function apiError(info) {
showError("Unable to fetch " + info +". Please try again later or contact support.")
}
-function showError(message) {
+// global variable needed for a scrollintoview bug affecting chrome
+let alert_destination = -1;
+function showError(message, destination) {
+ alert_destination = destination;
const text = document.getElementById('alert_modal_message');
-
text.innerText = message;
$("#alert_modal").modal('show');
}