mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Fix error that did not delete old results when fetching new results from the server.
This commit is contained in:
parent
609a887d73
commit
b5ec4906c5
@ -122,6 +122,16 @@ class Client {
|
|||||||
getResultsData(resultsType, dataIndexes, results) {
|
getResultsData(resultsType, dataIndexes, results) {
|
||||||
let tmp_first_cpos = [];
|
let tmp_first_cpos = [];
|
||||||
let tmp_last_cpos = [];
|
let tmp_last_cpos = [];
|
||||||
|
let objectKey = '';
|
||||||
|
if (resultsType === 'full-results') {
|
||||||
|
objectKey = 'fullResultsData';
|
||||||
|
} else if (resultsType === 'sub-results') {
|
||||||
|
objectKey = 'subResultsData';
|
||||||
|
} else if (resultsType = 'inspect-results') {
|
||||||
|
objectKey = 'inspectResultsData';
|
||||||
|
}
|
||||||
|
// Delete old data before new data is coming in.
|
||||||
|
results[objectKey].init();
|
||||||
for (let dataIndex of dataIndexes) {
|
for (let dataIndex of dataIndexes) {
|
||||||
tmp_first_cpos.push(results.data.matches[dataIndex].c[0]);
|
tmp_first_cpos.push(results.data.matches[dataIndex].c[0]);
|
||||||
tmp_last_cpos.push(results.data.matches[dataIndex].c[1]);
|
tmp_last_cpos.push(results.data.matches[dataIndex].c[1]);
|
||||||
|
@ -90,7 +90,7 @@ function getResultsData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles incoming results whcih have been requestes via getResultsData(). and
|
* Handles incoming results which have been requested via getResultsData(). and
|
||||||
* saves the data accorindgly into the results object.
|
* saves the data accorindgly into the results object.
|
||||||
*/
|
*/
|
||||||
function saveResultsData() {
|
function saveResultsData() {
|
||||||
@ -103,7 +103,7 @@ function saveResultsData() {
|
|||||||
console.info('Saving sub-results data.');
|
console.info('Saving sub-results data.');
|
||||||
objectKey = 'subResultsData';
|
objectKey = 'subResultsData';
|
||||||
} else if (type = 'inspect-results') {
|
} else if (type = 'inspect-results') {
|
||||||
objectKey = 'inspectResultsData'
|
objectKey = 'inspectResultsData';
|
||||||
console.info('Saving inspect-results data');
|
console.info('Saving inspect-results data');
|
||||||
}
|
}
|
||||||
// Save incoming data. Data is incoming one match at a time.
|
// Save incoming data. Data is incoming one match at a time.
|
||||||
|
@ -327,7 +327,14 @@ class ResultsList extends List {
|
|||||||
]);
|
]);
|
||||||
// Clear fields from old data on every new inspect() call.
|
// Clear fields from old data on every new inspect() call.
|
||||||
this.contextId = dataIndex[0];
|
this.contextId = dataIndex[0];
|
||||||
this.contextResults.innerHTML = "";
|
this.contextResults.innerHTML = '';
|
||||||
|
// Open modal.
|
||||||
|
this.contextModal.open();
|
||||||
|
this.contextResults.insertAdjacentHTML('afterbegin', `
|
||||||
|
<div class="progress">
|
||||||
|
<div class="indeterminate"></div>
|
||||||
|
</div>
|
||||||
|
`);
|
||||||
if (client.dynamicMode) {
|
if (client.dynamicMode) {
|
||||||
// Notify Client to get results from server.
|
// Notify Client to get results from server.
|
||||||
this.notifyClient('get-results', {resultsType: 'inspect-results',
|
this.notifyClient('get-results', {resultsType: 'inspect-results',
|
||||||
@ -342,7 +349,6 @@ class ResultsList extends List {
|
|||||||
// Match nr for user to display derived from data_index.
|
// Match nr for user to display derived from data_index.
|
||||||
let contextMatchNrElement = document.getElementById("context-match-nr");
|
let contextMatchNrElement = document.getElementById("context-match-nr");
|
||||||
contextMatchNrElement.textContent = this.contextId + 1;
|
contextMatchNrElement.textContent = this.contextId + 1;
|
||||||
this.contextModal.open();
|
|
||||||
// Add the add button to add this match to sub results with onclick event.
|
// Add the add button to add this match to sub results with onclick event.
|
||||||
let classes = `btn-floating btn waves-effect` +
|
let classes = `btn-floating btn waves-effect` +
|
||||||
` waves-light corpus-analysis-color.lighten right`
|
` waves-light corpus-analysis-color.lighten right`
|
||||||
@ -390,7 +396,6 @@ class ResultsList extends List {
|
|||||||
'#inspect-display-options-form-highlight_sentences',
|
'#inspect-display-options-form-highlight_sentences',
|
||||||
'#context-sentences'
|
'#context-sentences'
|
||||||
])
|
])
|
||||||
|
|
||||||
let uniqueS = new Set();
|
let uniqueS = new Set();
|
||||||
let uniqueContextS = new Set();
|
let uniqueContextS = new Set();
|
||||||
let {lc, c, rc} = this.helperCreateCpos(results.inspectResultsData.cpos_ranges,
|
let {lc, c, rc} = this.helperCreateCpos(results.inspectResultsData.cpos_ranges,
|
||||||
@ -451,6 +456,8 @@ class ResultsList extends List {
|
|||||||
tokenHTMlElement = this.HTMLTStrToElement(htmlTokenStr)
|
tokenHTMlElement = this.HTMLTStrToElement(htmlTokenStr)
|
||||||
tokenHTMLArray.push(tokenHTMlElement);
|
tokenHTMLArray.push(tokenHTMlElement);
|
||||||
}
|
}
|
||||||
|
// Remove loading indeterminate HTML before context is inserted.
|
||||||
|
this.contextResults.innerHTML = '';
|
||||||
for (let sId of uniqueS) {
|
for (let sId of uniqueS) {
|
||||||
let htmlSentence = `<span class="sentence" data-sid="${sId}"></span>`;
|
let htmlSentence = `<span class="sentence" data-sid="${sId}"></span>`;
|
||||||
let sentenceElement = this.HTMLTStrToElement(htmlSentence);
|
let sentenceElement = this.HTMLTStrToElement(htmlSentence);
|
||||||
|
Loading…
Reference in New Issue
Block a user