mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-14 10:00:40 +00:00
Handle user data streams different 1/2
In the future this will be much more performant!
This commit is contained in:
@ -130,19 +130,19 @@
|
||||
_init() {
|
||||
let corpus;
|
||||
|
||||
corpus = (this.foreignCorpusFlag ? nopaque.foreignCorpora[this.corpusId]
|
||||
: nopaque.corpora[this.corpusId]);
|
||||
corpus = (this.foreignCorpusFlag ? nopaque.foreignUser.corpora[this.corpusId]
|
||||
: nopaque.user.corpora[this.corpusId]);
|
||||
|
||||
// Status
|
||||
this.setStatus(corpus.status, corpus.files.length);
|
||||
this.setStatus(corpus.status);
|
||||
}
|
||||
|
||||
_update(patch) {
|
||||
let pathArray;
|
||||
|
||||
for (let operation of patch) {
|
||||
/* "/corpusId/valueName" -> ["corpusId", "valueName"] */
|
||||
pathArray = operation.path.split("/").slice(1);
|
||||
/* "/corpora/{corpusId}/valueName" -> ["{corpusId}", ...] */
|
||||
pathArray = operation.path.split("/").slice(2);
|
||||
if (pathArray[0] != this.corpusId) {continue;}
|
||||
switch(operation.op) {
|
||||
case "add":
|
||||
@ -165,7 +165,7 @@
|
||||
setStatus(status) {
|
||||
let analyzeElement, buildElement, numFiles, progressIndicatorElement, statusElement;
|
||||
|
||||
numFiles = (this.foreignCorpusFlag ? nopaque.foreignCorpora[this.corpusId] : nopaque.corpora[this.corpusId]).files.length;
|
||||
numFiles = Object.keys((this.foreignCorpusFlag ? nopaque.foreignUser.corpora[this.corpusId] : nopaque.user.corpora[this.corpusId]).files).length;
|
||||
|
||||
progressIndicatorElement = document.getElementById("progress-indicator");
|
||||
if (["queued", "running", "start analysis", "stop analysis"].includes(status)) {
|
||||
|
@ -157,9 +157,8 @@
|
||||
_init() {
|
||||
let job;
|
||||
|
||||
job = (this.foreignJobFlag ? nopaque.foreignJobs[this.jobId]
|
||||
: nopaque.jobs[this.jobId]);
|
||||
|
||||
job = (this.foreignJobFlag ? nopaque.foreignUser.jobs[this.jobId]
|
||||
: nopaque.user.jobs[this.jobId]);
|
||||
// End date
|
||||
this.setEndDate(job.end_date);
|
||||
// Status
|
||||
@ -174,8 +173,8 @@
|
||||
let pathArray;
|
||||
|
||||
for (let operation of patch) {
|
||||
/* "/jobId/valueName" -> ["jobId", "valueName"] */
|
||||
pathArray = operation.path.split("/").slice(1);
|
||||
/* "/jobs/{jobId}/..." -> ["{jobId}", ...] */
|
||||
pathArray = operation.path.split("/").slice(2);
|
||||
if (pathArray[0] != this.jobId) {continue;}
|
||||
switch(operation.op) {
|
||||
case "add":
|
||||
@ -212,20 +211,15 @@
|
||||
}
|
||||
|
||||
setResults(results) {
|
||||
let resultsElement;
|
||||
results.sort(function (a, b) {
|
||||
var filenameA = a.filename.toUpperCase();
|
||||
var filenameB = b.filename.toUpperCase();
|
||||
if (filenameA < filenameB) {
|
||||
return -1;
|
||||
}
|
||||
if (filenameA > filenameB) {
|
||||
return 1;
|
||||
}
|
||||
let resultsArray, resultsElement;
|
||||
resultsArray = Object.values(results)
|
||||
resultsArray.sort(function (a, b) {
|
||||
if (a.filename < b.filename) {return -1;}
|
||||
if (a.filename > b.filename) {return 1;}
|
||||
return 0;
|
||||
});
|
||||
resultsElement = document.getElementById("results");
|
||||
for (let result of results) {
|
||||
for (let result of resultsArray) {
|
||||
resultsElement.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
`<tr>
|
||||
|
@ -44,19 +44,16 @@
|
||||
{% endif %}
|
||||
<script src="{{ url_for('static', filename='js/JSONPatch.js/jsonpatch.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/Dark_Reader/darkreader.js') }}"></script>
|
||||
{% if current_user.is_authenticated and current_user.setting_dark_mode %}
|
||||
<script>
|
||||
DarkReader.enable({"brightness": 150, "contrast": 100, "sepia": 0});
|
||||
</script>
|
||||
{% endif %}
|
||||
<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>
|
||||
{% if current_user.is_authenticated %}
|
||||
nopaque.user.isAuthenticated = true;
|
||||
nopaque.user.settings.darkMode = {{ current_user.setting_dark_mode|tojson }};
|
||||
nopaque.user.settings.jobStatusMailNotifications = {{ current_user.setting_job_status_mail_notifications|tojson }};
|
||||
nopaque.user.settings.jobStatusSiteNotifications = {{ current_user.setting_job_status_site_notifications|tojson }};
|
||||
{% else %}
|
||||
nopaque.user.isAuthenticated = false;
|
||||
{% endif %}
|
||||
nopaque.flashedMessages = {{ get_flashed_messages(with_categories=True)|tojson }};
|
||||
</script>
|
||||
</head>
|
||||
|
Reference in New Issue
Block a user