From 13a6ef95c345f621ab364797a789ffd0b16addcb Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Tue, 14 Jul 2020 15:51:02 +0200 Subject: [PATCH] Fix rseults only showing after page navigation in import viewer --- web/app/static/js/nopaque.callbacks.js | 49 +++++++++++++++----------- web/app/static/js/nopaque.lists.js | 1 - 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/web/app/static/js/nopaque.callbacks.js b/web/app/static/js/nopaque.callbacks.js index 43a62e05..15a021b1 100644 --- a/web/app/static/js/nopaque.callbacks.js +++ b/web/app/static/js/nopaque.callbacks.js @@ -85,15 +85,42 @@ function queryRenderResults(payload, imported=false) { for (let item of items) { item.elm = results.jsList.createResultRowElement(item, payload.chunk); } + helperQueryRenderResults(payload); + if (progress === 100) { + queryResultsProgressElement.classList.add("hide"); + queryResultsUserFeedbackElement.classList.add("hide"); + queryResultsExportElement.classList.remove("disabled"); + addToSubResultsElement.removeAttribute("disabled"); + // inital expert mode check and sub results activation + results.jsList.activateInspect(); + if (addToSubResultsElement.checked) { + results.jsList.activateAddToSubResults(); + } + if (expertModeSwitchElement.checked) { + results.jsList.expertModeOn("query-display"); + } + } }); - } else { + } else if (imported) { results.jsList.add(resultItems, (items) => { for (let item of items) { item.elm = results.jsList.createResultRowElement(item, payload.chunk, true); } + helperQueryRenderResults(payload); + progress = 100; + console.log(progress); + results.jsList.activateInspect(); + if (expertModeSwitchElement.checked) { + results.jsList.expertModeOn("query-display"); + } }); } +} + +function helperQueryRenderResults (payload) { + // updating table on finished item creation callback via createResultRowElement + results.jsList.update(); results.jsList.changeContext(); // sets lr context on first result load // incorporating new chunk results into full results results.data.matches.push(...payload.chunk.matches); @@ -110,24 +137,4 @@ function queryRenderResults(payload, imported=false) { console.log("Results recieved:", results.data); // upate progress status progress = payload.progress; // global declaration - if (progress === 100 && !imported) { - queryResultsProgressElement.classList.add("hide"); - queryResultsUserFeedbackElement.classList.add("hide"); - queryResultsExportElement.classList.remove("disabled"); - addToSubResultsElement.removeAttribute("disabled"); - // inital expert mode check and sub results activation - results.jsList.activateInspect(); - if (addToSubResultsElement.checked) { - results.jsList.activateAddToSubResults(); - } - if (expertModeSwitchElement.checked) { - results.jsList.expertModeOn("query-display"); - } - } else if (imported) { - progress = 100; - results.jsList.activateInspect(); - if (expertModeSwitchElement.checked) { - results.jsList.expertModeOn("query-display"); - } - } } \ No newline at end of file diff --git a/web/app/static/js/nopaque.lists.js b/web/app/static/js/nopaque.lists.js index 013290e5..924ec8e2 100644 --- a/web/app/static/js/nopaque.lists.js +++ b/web/app/static/js/nopaque.lists.js @@ -403,7 +403,6 @@ class ResultsList extends List { } helperCreateCpos(cpos_ranges, cpos_values) { - console.log(cpos_values); let lc; let c; let rc;