From df578c986c1d792692f0063987651a58ad280a04 Mon Sep 17 00:00:00 2001 From: Matthieu Barba Date: Wed, 1 May 2024 18:50:56 +0100 Subject: [PATCH] Show the trace if any, if failed --- css/upload.css | 13 +++++++++++++ js/createdb.js | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/css/upload.css b/css/upload.css index 07f608f..4da35f3 100755 --- a/css/upload.css +++ b/css/upload.css @@ -18,6 +18,19 @@ background: #71FF71; } +#trace_content { + text-align: left; + font-family: monospace; + border: 1px solid white; + background-color: #333; + color: white; + padding: 1em; +} + +.boxtitle { + cursor: pointer; +} + .warning { color: #C22; } diff --git a/js/createdb.js b/js/createdb.js index 485d8f8..afbe2ec 100755 --- a/js/createdb.js +++ b/js/createdb.js @@ -109,6 +109,19 @@ function continuous_check(id) { console.log("Error encountered: " + config.details); } // Don't continue! + } else if (config.status == "failed") { + if (config.details) { + console.log("Error encountered: " + config.details); + } + if (config.trace) { + trace_str = config.trace.replaceAll("\n", "
"); + trace_box = $("
").attr("class", "subbox"); + trace_title = $("
").attr("class", "boxtitle").text("Log trace..."); + trace_content = $("
").attr("class", "boxcontent").attr("id", "trace_content").html(trace_str); + trace_box.append(trace_title).append(trace_content); + $('#building').append(trace_box); + hide_boxes(); + } } else { window.setTimeout(function() { continuous_check(id); @@ -130,6 +143,14 @@ function finish(id) { console.log("Check over"); } + +function hide_boxes() { + $(".boxcontent").hide(); + $(".boxtitle").on('click', function() { + $(this).parent().find(".boxcontent").toggle(); + }); +} + jQuery(function() { var pars = get_url_parameters(); var id = pars.id;