diff --git a/web/app/corpora/events.py b/web/app/corpora/events.py index 3a36e9d3e4d8ed970ca411deb9eac9e15fdd1cfa..7357d81782003d04798e29e056a931696506afb3 100644 --- a/web/app/corpora/events.py +++ b/web/app/corpora/events.py @@ -177,7 +177,6 @@ def corpus_analysis_get_match_with_full_context(payload): i = 0 # Send data one match at a time. for index, f_cpos, l_cpos in zip(data_indexes, first_cpos, last_cpos): - logger.warning(index) i += 1 tmp_match = s.export(f_cpos, l_cpos, context=10) payload['matches'].append(tmp_match['matches'][0]) diff --git a/web/app/static/js/modules/corpus_analysis/client/Client.js b/web/app/static/js/modules/corpus_analysis/client/Client.js index b5b1bfdfbc3e2f92301577df8bb55be68f4bfe5f..2d94121fd886a1e2716c480ca66331bc699d5c68 100644 --- a/web/app/static/js/modules/corpus_analysis/client/Client.js +++ b/web/app/static/js/modules/corpus_analysis/client/Client.js @@ -200,6 +200,12 @@ class Client { results[objectKey].match_count = matches.length; results[objectKey].cpos_ranges = results.data.cpos_ranges; results[objectKey].fullContext = false; + if (objectKey === 'subResultsData') { + // Remove match_count from texts, because they are useless in sub results + for (let [key, value] of Object.entries(results[objectKey].text_lookup)) { + delete results[objectKey].text_lookup[key].match_count; + } + } console.info('Results data without context has been saved.', results); this.isBusy = false; this.notifyView('results-data-recieved', {type: resultsType, diff --git a/web/app/static/js/modules/corpus_analysis/client/callbacks.js b/web/app/static/js/modules/corpus_analysis/client/callbacks.js index 342995059f2f9020b9c7c55dee0fcb01b2b0b661..7420747884d5ea38ced573f61ddbbbf81d0ed1ef 100644 --- a/web/app/static/js/modules/corpus_analysis/client/callbacks.js +++ b/web/app/static/js/modules/corpus_analysis/client/callbacks.js @@ -111,8 +111,8 @@ function saveResultsData() { } // Save incoming data. Data is incoming one match at a time. results[objectKey].matches.push(...payload.matches); - results[objectKey].addData(payload.cpos_lookup, "cpos_lookup"); - results[objectKey].addData(payload.text_lookup, "text_lookup"); + results[objectKey].addData(payload.cpos_lookup, 'cpos_lookup'); + results[objectKey].addData(payload.text_lookup, 'text_lookup'); results[objectKey].addData(results.metaData); results[objectKey].query = results.data.query; results[objectKey].corpus_type = type; @@ -125,6 +125,10 @@ function saveResultsData() { progress: payload.progress}) client.isBusy = false; if (payload.progress === 100) { + if (objectKey === 'fullResultsData') { + // Get match count per text from results.data only for fullResultsData + results[objectKey].text_lookup = results.data.text_lookup; + } client.notifyView('results-data-recieved', {type: type, results: results, fullContext: true}); diff --git a/web/app/static/js/modules/corpus_analysis/view/eventListeners.js b/web/app/static/js/modules/corpus_analysis/view/eventListeners.js index 9215bae35526c7ee2429ef0dc8c8ff8caeffa05a..1685c47c06bac134a2cba77ae0289623c8e12187 100644 --- a/web/app/static/js/modules/corpus_analysis/view/eventListeners.js +++ b/web/app/static/js/modules/corpus_analysis/view/eventListeners.js @@ -138,8 +138,8 @@ function createFullResults(resultsList, results) { function createSubResults(resultsList, results) { resultsList.subResultsCreate.onclick = (event) => { let dataIndexes = []; - resultsList.addToSubResultsIdsToShow.forEach((id) => { - dataIndexes.push(id - 1); + Object.keys(resultsList.subResultsIndexes).forEach((id) => { + dataIndexes.push(id); }); resultsList.subResultsCreate.querySelector('i').classList.toggle('hide'); resultsList.subResultsCreate.innerText = 'Creating...'; diff --git a/web/app/static/js/web-components/InfoMenu.js b/web/app/static/js/web-components/InfoMenu.js deleted file mode 100644 index af6f8599c121005219f811b8d8dca83d6fcbe7f1..0000000000000000000000000000000000000000 --- a/web/app/static/js/web-components/InfoMenu.js +++ /dev/null @@ -1,83 +0,0 @@ -/** - * HTML for showing infos about the current query or result. Also gives - * the user the abiltiy to access the meta data for the current query or - * result. - */ -const template = document.createElement('template'); -template.innerHTML = ` - - <link rel="stylesheet" href="../../static/fonts/Material_design_icons/material-icons.css"> - <link rel="stylesheet" href="../../static/css/Materialize/materialize.min.css"> - <link rel="stylesheet" href="../../static/css/nopaque.css"> - - <div class="col"> - <h6 style="margin-top: 0px;">Infos</h6> - <div class="divider" style="margin-bottom: 10px;"></div> - <div class="row"> - <div class="col s12"> - <button id="show-metadata" - class="waves-effect - waves-light - btn-flat - flat-interaction" - type="submit">Corpus Metadata - <i class="material-icons left">info_outline</i> - </button> - </div> - <div class="col s12"> - <p> - <slot name="received-match-count"> - 0 - </slot> of - <slot name="match-count">(to be determined)</slot> - matches loaded. - <br> - Matches occured in - <slot name="text-lookup-count">(to be determined)</slot> - corpus files: - <br> - <slot name=text-titles>(to be determined)</slot> - </p> - <p id="query-results-user-feedback"> - <i class="material-icons">help</i> - The Server is still sending your results. - Functions like "Export Results" and "Match Inspect" will be - available after all matches have been loaded. - </p> - <div class="progress" id="query-progress-bar"> - <div class="determinate"></div> - </div> - </div> - </div> - </div> -`; - -class InfoMenu extends HTMLElement { - constructor() { - super(); - - this.appendChild(template.content.cloneNode(true)); - this.attachShadow({ mode: 'open' }); - this.shadowRoot.appendChild(template.content.cloneNode(true)); - - } - - // methods that will be used in connectedCallback on eventListeners - showMetadata() { - console.log('Show metadata somehow'); - } - - connectedCallback() { - const showMetadataBtn = this.querySelector('#show-metadata'); - showMetadataBtn.addEventListener('click', () => this.showMetadata()); - } - - disconnectedCallback() { - const showMetadataBtn = this.querySelector('#show-metadata'); - showMetadataBtn.removeEventListener(); - } -} - -window.customElements.define('info-menu', InfoMenu); - -export { InfoMenu }; \ No newline at end of file