Skip to content

Commit

Permalink
Fix issues with debug list
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTF committed Oct 13, 2023
1 parent c09695a commit 3a1a8a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions backend/static/js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ function appendRuntimeInformation(runtime_info, query, time, queryUpdate) {
query_log[query_log.length - 1] = query;
} else {
// Append to log and shorten log if too long (FIFO).
runtime_log[runtime_log.length] = runtime_info;
query_log[query_log.length] = query;
if (runtime_log.length - 10 >= 0) {
runtime_log[runtime_log.length - 10] = null;
query_log[query_log.length - 10] = null;
}
runtime_log[runtime_log.length] = runtime_info;
query_log[query_log.length] = query;
}
lastQueryUpdate = queryUpdate;
}
Expand Down
14 changes: 6 additions & 8 deletions backend/static/js/qleverUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -706,20 +706,21 @@ function handleStatsDisplay() {
}

// Shows the modal containing the current runtime information tree
function showQueryPlanningTree() {
// calls renderRuntimeInformationToDom() afterwards to render it.
function showQueryPlanningTree(number = undefined) {
$("#visualisation").modal("show");
renderRuntimeInformationToDom(number);
}

// Uses the information inside of runtime_log and query_log
// to populate the DOM with the current runtime information.
// Use showQueryPlanningTree() to display it to the user.
function renderRuntimeInformationToDom(number) {
function renderRuntimeInformationToDom(number = undefined) {
if (runtime_log.length === 0) {
return;
}

// Get the right entries from the runtime log.
let runtime_log_index = number || runtime_log.length - 1;
let runtime_log_index = number !== undefined ? number : runtime_log.length - 1;
let runtime_info = runtime_log[runtime_log_index];
let resultQuery = query_log[runtime_log_index];

Expand Down Expand Up @@ -796,10 +797,7 @@ function renderRuntimeInformationToDom(number) {
href: "#",
text: `[${i}]`
});
link.on("click", () => {
renderRuntimeInformationToDom(i);
showQueryPlanningTree();
});
link.on("click", () => showQueryPlanningTree(i));
queryHistoryList.append($("<li/>", {
class: "page-item",
append: link
Expand Down

0 comments on commit 3a1a8a0

Please sign in to comment.