mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-27 00:10:35 +00:00
Add rudimentary rework of corpus analysis
This commit is contained in:
@ -75,25 +75,43 @@
|
||||
CorpusAnalysisDisplay,
|
||||
SocketEventListener} from '../../static/js/modules/nopaque.CorpusAnalysisClient.js';
|
||||
import {recieveSession, recieveQueryStatus,
|
||||
recieveQueryData} from '../../static/js/modules/nopaque.listenerFunctions.js'
|
||||
recieveQueryData} from '../../static/js/modules/nopaque.listenerFunctions.js';
|
||||
import {Results, Data, MetaData} from '../../static/js/nopaque.Results.js';
|
||||
import {ResultsList} from '../../static/js/nopaque.lists.js';
|
||||
|
||||
/**
|
||||
* Second Phase:
|
||||
* Asynchronus and event driven code
|
||||
*/
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// init some modals
|
||||
// Initialize the CorpusAnalysisClient
|
||||
const client = new CorpusAnalysisClient({{ corpus_id }}, nopaque.socket);
|
||||
console.info("CorpusAnalysisClient created as client:", client);
|
||||
// Initialize modals which are shown depending on events or client status
|
||||
const initLoadingElement = document.getElementById("init-display");
|
||||
const initLoadingModal = M.Modal.init(initLoadingElement,
|
||||
{"dismissible": false});
|
||||
// set up display elements
|
||||
// Set up display elements which hare show depending on the client status
|
||||
const initLoadingDisplay = new CorpusAnalysisDisplay(initLoadingModal);
|
||||
// set up CorpusAnalysisClient
|
||||
const client = new CorpusAnalysisClient({{ corpus_id }}, nopaque.socket);
|
||||
console.info("CorpusAnalysisClient created as client:", client);
|
||||
// register display elements to client
|
||||
// Register those display elements to client
|
||||
client.setDisplay("init", initLoadingDisplay);
|
||||
// register listeners and load them
|
||||
/**
|
||||
* Initializing the results object holding all the data of a query.
|
||||
* Also holds the metadata of one query.
|
||||
* resultsListOptions is set to determine how many results per apge are
|
||||
* shown etc.
|
||||
* Lastly it also contains the object ResultsList which is a list.js
|
||||
* subclass which handles the visual reprensetnation of the query data.
|
||||
*/
|
||||
let displayOptionsData = ResultsList.getDisplayOptions('display-options-form');
|
||||
ResultsList.options.page = displayOptionsData["resultsPerPage"];
|
||||
let resultsList = new ResultsList("result-list", ResultsList.options);
|
||||
let resultsMetaData = new MetaData();
|
||||
let results = new Results(new Data(), resultsList, resultsMetaData);
|
||||
// make results part of the client
|
||||
client.results = results;
|
||||
console.info('Initialized the Results object.')
|
||||
// register listeners listening to socket.io events and load them
|
||||
const listenForSession = new SocketEventListener('corpus_analysis_init',
|
||||
recieveSession);
|
||||
const listenForQueryStatus = new SocketEventListener('corpus_analysis_query',
|
||||
@ -102,10 +120,10 @@
|
||||
recieveQueryData);
|
||||
client.setSocketEventListeners([listenForSession, listenForQueryStatus,
|
||||
listenForQueryData]);
|
||||
client.loadListeners();
|
||||
client.loadSocketEventListeners();
|
||||
// Session initialization
|
||||
client.requestSession();
|
||||
// send a query and recieve its answer data
|
||||
// Send a query and recieve its answer data
|
||||
let queryFormElement = document.getElementById("query-form");
|
||||
queryFormElement.addEventListener("submit", (event) => {
|
||||
try {
|
||||
@ -129,8 +147,8 @@
|
||||
// Prevent page from reloading on submit
|
||||
event.preventDefault();
|
||||
// Get query string and send query to server
|
||||
// results.data.getQueryStr(queryFormElement);
|
||||
client.requestQueryData('"this" []* "that" within 10 words;');
|
||||
results.data.getQueryStr(queryFormElement);
|
||||
client.requestQueryData(results.data.query);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -47,7 +47,9 @@
|
||||
<script src="{{ url_for('static', filename='js/List.js/list.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/Socket.IO/socket.io.slim.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/nopaque.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/nopaque.lists.js') }}"></script>
|
||||
<script type="module">
|
||||
import {RessourceList} from '../../static/js/nopaque.lists.js'
|
||||
</script>
|
||||
<script>
|
||||
{% if current_user.is_authenticated %}
|
||||
{% if current_user.setting_dark_mode %}
|
||||
@ -240,43 +242,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!--
|
||||
<footer class="page-footer">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col s12 m3">
|
||||
<a href="https://www.dfg.de/">
|
||||
<img class="responsive-img" src="{{ url_for('static', filename='images/logo_-_dfg.gif') }}">
|
||||
</a>
|
||||
</div>
|
||||
<div class="col s12 m6">
|
||||
<h5 class="white-text" style="margin-left: -15px;">Contact</h5>
|
||||
<div class="row">
|
||||
<p>Contact our interdisciplinary team via email: <b>inf_sfb1288@lists.uni-bielefeld.de</b></p>
|
||||
<p>Silke Schwandt (Digital History), Johanna Vompras (Research Data Management), Julia Becker (Cultural Studies), Patrick Jentsch (Cognitive Informatics), Anna Neubert (Digital Humanities), Stephan Porada (Interdisciplinary Media Studies), Helene Schlicht (History, Philosophy)
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s12 m3">
|
||||
<div class="row">
|
||||
<div class="col s8">
|
||||
<h5 class="white-text">Reminder</h5>
|
||||
<p>
|
||||
Check out our website for nopaque's upcomming release:<br>
|
||||
<small>www.uni-bielefeld.de/sfb1288/projekte/inf.html</small>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col s4">
|
||||
<p> </p>
|
||||
<img class="responsive-img" src="{{ url_for('static', filename='images/qr_-_inf.svg') }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
<script src="{{ url_for('static', filename='js/Materialize/materialize.min.js') }}"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user