mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +00:00
Fix query results viewer etc. to work with results having eitehr full or no context.
This commit is contained in:
parent
25670b6231
commit
021375f68d
@ -10,7 +10,8 @@ class Client {
|
|||||||
constructor({corpusId = null,
|
constructor({corpusId = null,
|
||||||
socket = null,
|
socket = null,
|
||||||
logging = true,
|
logging = true,
|
||||||
dynamicMode = true} = {}) {
|
dynamicMode = true,
|
||||||
|
fullContext = null} = {}) {
|
||||||
this.corpusId = corpusId;
|
this.corpusId = corpusId;
|
||||||
this.dynamicMode = dynamicMode;
|
this.dynamicMode = dynamicMode;
|
||||||
this.logging = logging;
|
this.logging = logging;
|
||||||
@ -18,6 +19,7 @@ class Client {
|
|||||||
this.socket = socket;
|
this.socket = socket;
|
||||||
this.eventListeners = {};
|
this.eventListeners = {};
|
||||||
this.isBusy = false;
|
this.isBusy = false;
|
||||||
|
this.fullContext = fullContext;
|
||||||
/**
|
/**
|
||||||
* Disables all console logging.
|
* Disables all console logging.
|
||||||
* This is global. So every other log message in every other Class or
|
* This is global. So every other log message in every other Class or
|
||||||
|
@ -735,7 +735,9 @@ class ResultsList extends List {
|
|||||||
addToSubResultsBtn.setAttribute("class", classes + ` add`
|
addToSubResultsBtn.setAttribute("class", classes + ` add`
|
||||||
);
|
);
|
||||||
addToSubResultsBtn.innerHTML = '<i class="material-icons add-btn">add</i>';
|
addToSubResultsBtn.innerHTML = '<i class="material-icons add-btn">add</i>';
|
||||||
aCellElement.appendChild(inspectBtn);
|
if (client.dynamicMode || client.fullContext) {
|
||||||
|
aCellElement.appendChild(inspectBtn);
|
||||||
|
}
|
||||||
if (client.dynamicMode) {
|
if (client.dynamicMode) {
|
||||||
aCellElement.appendChild(addToSubResultsBtn);
|
aCellElement.appendChild(addToSubResultsBtn);
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,9 @@
|
|||||||
"corpus_cqpserver_version": {
|
"corpus_cqpserver_version": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"fullContext": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"cpos_ranges": {
|
"cpos_ranges": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
@ -95,7 +98,8 @@
|
|||||||
"match_count",
|
"match_count",
|
||||||
"matches",
|
"matches",
|
||||||
"query",
|
"query",
|
||||||
"text_lookup"
|
"text_lookup",
|
||||||
|
"fullContext"
|
||||||
],
|
],
|
||||||
"title": "NopaqueCQIPYResults"
|
"title": "NopaqueCQIPYResults"
|
||||||
},
|
},
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
{% include 'interactions/analysis.html.j2' %}
|
{% include 'interactions/analysis.html.j2' %}
|
||||||
{% include 'interactions/cite.html.j2' %}
|
{% include 'interactions/cite.html.j2' %}
|
||||||
<div class="hide">
|
<div class="hide">
|
||||||
{# Hide those because they are not needed when inspecting results #}
|
{# Hide those because they are not needed when inspecting results.
|
||||||
|
But some of their elements are being asked for by the client. #}
|
||||||
{% include 'interactions/export.html.j2' %}
|
{% include 'interactions/export.html.j2' %}
|
||||||
{% include 'interactions/create.html.j2' %}
|
{% include 'interactions/create.html.j2' %}
|
||||||
</div>
|
</div>
|
||||||
@ -109,9 +110,6 @@ import {
|
|||||||
* Asynchronus and event driven code.
|
* Asynchronus and event driven code.
|
||||||
*/
|
*/
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
// Initialize the client with dynamicMode set to false.
|
|
||||||
const client = new Client({'logging': true,
|
|
||||||
'dynamicMode': false});
|
|
||||||
/**
|
/**
|
||||||
* Initializing the results object as a model holding all the data of a
|
* Initializing the results object as a model holding all the data of a
|
||||||
* query. Also holds the metadata of one query and results data.
|
* query. Also holds the metadata of one query and results data.
|
||||||
@ -124,6 +122,10 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
const resultsJson = {{ query_result_file_content|tojson|safe }};
|
const resultsJson = {{ query_result_file_content|tojson|safe }};
|
||||||
// Import metadata from DB passed to this view
|
// Import metadata from DB passed to this view
|
||||||
const metaDataJson = {{ query_metadata|tojson|safe }};
|
const metaDataJson = {{ query_metadata|tojson|safe }};
|
||||||
|
// Initialize the client with dynamicMode set to false.
|
||||||
|
const client = new Client({'logging': true,
|
||||||
|
'dynamicMode': false,
|
||||||
|
'fullContext': metaDataJson.fullContext});
|
||||||
/**
|
/**
|
||||||
* Register needed listeners and their callbacks. But we will
|
* Register needed listeners and their callbacks. But we will
|
||||||
* just call the attached callbacks manually. Because dynamicMode is false.
|
* just call the attached callbacks manually. Because dynamicMode is false.
|
||||||
@ -161,6 +163,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
'#display-options-form-result_context',
|
'#display-options-form-result_context',
|
||||||
'#display-options-form-results_per_page',
|
'#display-options-form-results_per_page',
|
||||||
'#full-results-create',
|
'#full-results-create',
|
||||||
|
'#full-results-export',
|
||||||
'#inspect-results-export',
|
'#inspect-results-export',
|
||||||
'#meta-data-modal-content',
|
'#meta-data-modal-content',
|
||||||
['#meta-data-modal', {
|
['#meta-data-modal', {
|
||||||
@ -173,6 +176,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
'#query-results-table',
|
'#query-results-table',
|
||||||
'#show-meta-data',
|
'#show-meta-data',
|
||||||
'#sub-results-create',
|
'#sub-results-create',
|
||||||
|
'#sub-results-export',
|
||||||
]);
|
]);
|
||||||
// Hide buttons which are not needed when just inspecting results
|
// Hide buttons which are not needed when just inspecting results
|
||||||
resultsList.inspectResultsExport.classList.add('hide');
|
resultsList.inspectResultsExport.classList.add('hide');
|
||||||
|
Loading…
Reference in New Issue
Block a user