Some small fixes and user feedback

This commit is contained in:
Stephan Porada 2020-06-29 11:09:12 +02:00
parent 5764e918f5
commit 820845b499
3 changed files with 17 additions and 3 deletions

View File

@ -40,6 +40,7 @@ function querySetup(payload) {
let textarea = subResultsIdListElement.getElementsByTagName("textarea")[0];
textarea.innerText = "";
M.textareaAutoResize(textarea);
nrMarkedMatches.innerText = 0;
results.jsList.addToSubResultsStatus = {};
results.jsList.addToSubResultsIdsToShow = new Set();
queryResultsExportElement.classList.add("disabled");

View File

@ -227,12 +227,14 @@ class ResultsList extends List {
this.addToSubResultsIdsToShow.add(dataIndex + 1); // + 1 because user does not see zero indexd data indexes
textarea.innerText = [...this.addToSubResultsIdsToShow].sort(function(a, b){return a-b}).join(", "); // automaticalle sorts ids into the textarea in ascending order
M.textareaAutoResize(textarea); // after an insert textarea has to be resized manually
nrMarkedMatches.innerText = [...this.addToSubResultsIdsToShow].length;
} else if (this.addToSubResultsStatus[dataIndex]) {
// add button is deactivated because status is true
this.helperDeactivateBtn(event.target);
this.addToSubResultsStatus[dataIndex] = false; // sets status to false
this.addToSubResultsIdsToShow.delete(dataIndex + 1); // + 1 because user does not see zero indexd data indexes
textarea.innerText = [...this.addToSubResultsIdsToShow].sort(function(a, b){return a-b}).join(", "); // automaticalle sorts ids into the textarea in ascending order
nrMarkedMatches.innerText = [...this.addToSubResultsIdsToShow].length;
M.textareaAutoResize(textarea); // after an insert textarea has to be resized manually
}
// Toggles the create button accoring to the number of ids in addToSubResultsIdsToShow
@ -293,8 +295,12 @@ class ResultsList extends List {
// gets result cpos infos for one dataIndex (list of length 1) to send back to
// the server
inspect(dataIndex, type) {
let contextMatchNrElement;
// get result infos from server and show them in context modal
this.contextId = dataIndex[0];
// match nr for user to display derived from data_index
contextMatchNrElement = document.getElementById("context-match-nr");
contextMatchNrElement.innerText = this.contextId + 1;
let contextResultsElement;
contextResultsElement = document.getElementById("context-results");
contextResultsElement.innerHTML = ""; // clear it from old inspects
@ -353,6 +359,7 @@ class ResultsList extends List {
let uniqueS;
this.contextData = response.payload;
console.log(this.contextData);
this.contextData["cpos_ranges"] = response.payload.cpos_ranges;
this.contextData["query"] = results.data.query;
this.contextData["context_id"] = this.contextId;

View File

@ -119,7 +119,8 @@
</div>
<div class="col s12 hide" id="sub-results-match-ids-div">
<div class="input-field">
<p>Marked matches for Sub-Results:</p>
<p><span id="nr-marked-matches"></span> matches marked
for Sub-Results:</p>
<textarea id="sub-results-match-ids"
class="materialize-textarea"
disabled>
@ -299,7 +300,9 @@
</div>
<div class="col s12" style="margin-bottom: 10px;">
Sentences around match
<div class="input-field right" style="margin-top: -2rem;margin-bottom: -2rem;">
<div class="input-field right" style="margin-top: -2rem;
margin-bottom: -2rem;
height: 0px;">
<p class="range-field">
<input type="range"
id="context-sentences"
@ -325,7 +328,8 @@
</div>
</form>
<div class="row section">
<h5 style="margin-top: 0px;">Context</h5>
<h5 style="margin-top: 0px;">Context for match:
<span id="context-match-nr"></span></h5>
<div class="divider" style="margin-bottom: 10px;"></div>
<div class="col s12" >
<div id="context-results">
@ -379,6 +383,7 @@
var subResultsIdListElement; // list showing marked matches for sub corpus creation
var textLookupCountElement // Nr of texts the matches occured in will be shown in this element
var textTitlesElement; // matched text titles
var nrMarkedMatches; // count of matches marked for subresults
// ###### Defining local scope variables ######
let contextPerItemElement; // Form Element for display option
@ -425,6 +430,7 @@
subResultsIdListElement = document.getElementById("sub-results-match-ids-div");
textLookupCountElement = document.getElementById("text-lookup-count");
textTitlesElement = document.getElementById("text-titles");
nrMarkedMatches = document.getElementById("nr-marked-matches");
// ###### js list options and intialization ######
displayOptionsData = ResultsList.getDisplayOptions(displayOptionsFormElement);