Add function to import exported results and view them after the import

This commit is contained in:
Stephan Porada
2020-07-03 14:41:57 +02:00
parent a997fbe0ee
commit 1811623583
27 changed files with 880 additions and 32 deletions

View File

@ -29,4 +29,32 @@ class InteractionElement {
let boundedCallback = callback["function"].bind(callback.bindThis);
return boundedCallback;
}
}
static onChangeExecute(interactionElements) {
// checks if a change for every interactionElement happens and executes
// the callbacks accordingly
// TODO: This function scould be a static function of the Class InteractionElements
// This class does not exist yet. The Class InteractionElements should hold
// a list of InteractionElement objects. onChangeExecute loops over InteractionElements
// and executes the callbacks as mentioned accordingly. An additional
// InteractionElements Class is logically right but also makes things a little more
// complex. It is not yet decided.
for (let interaction of interactionElements) {
if (interaction.checkStatus) {
interaction.element.addEventListener("change", (event) => {
if (event.target.checked) {
let f_on = interaction.bindThisToCallback("on");
let args_on = interaction.callbacks.on.args;
f_on(...args_on);
} else if (!event.target.checked){
let f_off = interaction.bindThisToCallback("off");
let args_off = interaction.callbacks.off.args;
f_off(...args_off);
}
});
} else {
continue
}
};
}
}

View File

@ -63,7 +63,7 @@ function querySetup(payload) {
// This callback is called on socket.on "query_results"
// this handels the incoming result chunks
function queryRenderResults(payload) {
function queryRenderResults(payload, imported=false) {
let resultItems; // array of built html result items row element
// This is called when results are transmitted and being recieved
console.log("Current recieved chunk:", payload.chunk);
@ -102,18 +102,23 @@ function queryRenderResults(payload) {
console.log("Results recieved:", results.data);
// upate progress status
progress = payload.progress; // global declaration
if (progress === 100) {
if (progress === 100 && !imported) {
queryResultsProgressElement.classList.add("hide");
queryResultsUserFeedbackElement.classList.add("hide");
queryResultsExportElement.classList.remove("disabled");
addToSubResultsElement.removeAttribute("disabled");
results.jsList.activateInspect();
// 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) {
results.jsList.activateInspect();
if (expertModeSwitchElement.checked) {
results.jsList.expertModeOn("query-display");
}
}
}