mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-13 09:30:40 +00:00
Add a parallel package for query results.
This commit is contained in:
@ -14,6 +14,7 @@ nopaque.user.settings = {};
|
||||
nopaque.user.settings.darkMode = undefined;
|
||||
nopaque.corporaSubscribers = [];
|
||||
nopaque.jobsSubscribers = [];
|
||||
nopaque.queryResultsSubscribers = [];
|
||||
|
||||
// Foreign user (user inspected with admin credentials) data
|
||||
nopaque.foreignUser = {};
|
||||
@ -22,6 +23,7 @@ nopaque.foreignUser.settings = {};
|
||||
nopaque.foreignUser.settings.darkMode = undefined;
|
||||
nopaque.foreignCorporaSubscribers = [];
|
||||
nopaque.foreignJobsSubscribers = [];
|
||||
nopaque.foreignQueryResultsSubscribers = [];
|
||||
|
||||
nopaque.flashedMessages = undefined;
|
||||
|
||||
@ -38,6 +40,9 @@ nopaque.socket.init = function() {
|
||||
for (let subscriber of nopaque.jobsSubscribers) {
|
||||
subscriber._init(nopaque.user.jobs);
|
||||
}
|
||||
for (let subscriber of nopaque.queryResultsSubscribers) {
|
||||
subscriber._init(nopaque.user.query_results);
|
||||
}
|
||||
RessourceList.modifyTooltips(false)
|
||||
});
|
||||
|
||||
@ -48,12 +53,16 @@ nopaque.socket.init = function() {
|
||||
nopaque.user = jsonpatch.apply_patch(nopaque.user, patch);
|
||||
corpora_patch = patch.filter(operation => operation.path.startsWith("/corpora"));
|
||||
jobs_patch = patch.filter(operation => operation.path.startsWith("/jobs"));
|
||||
query_results_patch = patch.filter(operation => operation.path.startsWith("/query_results"));
|
||||
for (let subscriber of nopaque.corporaSubscribers) {
|
||||
subscriber._update(corpora_patch);
|
||||
}
|
||||
for (let subscriber of nopaque.jobsSubscribers) {
|
||||
subscriber._update(jobs_patch);
|
||||
}
|
||||
for (let subscriber of nopaque.queryResultsSubscribers) {
|
||||
subscriber._update(query_results_patch);
|
||||
}
|
||||
if (["all", "end"].includes(nopaque.user.settings.job_status_site_notifications)) {
|
||||
for (operation of jobs_patch) {
|
||||
/* "/jobs/{jobId}/..." -> ["{jobId}", ...] */
|
||||
@ -74,6 +83,9 @@ nopaque.socket.init = function() {
|
||||
for (let subscriber of nopaque.foreignJobsSubscribers) {
|
||||
subscriber._init(nopaque.foreignUser.jobs);
|
||||
}
|
||||
for (let subscriber of nopaque.foreignQueryResultsSubscribers) {
|
||||
subscriber._init(nopaque.foreignUser.query_results);
|
||||
}
|
||||
RessourceList.modifyTooltips(false)
|
||||
});
|
||||
|
||||
@ -84,8 +96,10 @@ nopaque.socket.init = function() {
|
||||
nopaque.foreignUser = jsonpatch.apply_patch(nopaque.foreignUser, patch);
|
||||
corpora_patch = patch.filter(operation => operation.path.startsWith("/corpora"));
|
||||
jobs_patch = patch.filter(operation => operation.path.startsWith("/jobs"));
|
||||
query_results_patch = patch.filter(operation => operation.path.startsWith("/query_results"));
|
||||
for (let subscriber of nopaque.foreignCorporaSubscribers) {subscriber._update(corpora_patch);}
|
||||
for (let subscriber of nopaque.foreignJobsSubscribers) {subscriber._update(jobs_patch);}
|
||||
for (let subscriber of nopaque.foreignQueryResultsSubscribers) {subscriber._update(query_results_patch);}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,15 @@
|
||||
class RessourceList extends List {
|
||||
constructor(idOrElement, subscriberList, type, options={}) {
|
||||
if (!["corpus", "job", "result", "user", "job_input",
|
||||
"corpus_file"].includes(type)) {
|
||||
if (!["corpus", "corpus_file", "job", "job_input", "query_result", "result", "user"].includes(type)) {
|
||||
console.error("Unknown Type!");
|
||||
return;
|
||||
}
|
||||
if (subscriberList) {
|
||||
super(idOrElement, {...RessourceList.options['common'],
|
||||
...RessourceList.options[type],
|
||||
...options});
|
||||
this.type = type;
|
||||
subscriberList.push(this);
|
||||
super(idOrElement, {...RessourceList.options['common'],
|
||||
...RessourceList.options[type],
|
||||
...options});
|
||||
this.type = type;
|
||||
subscriberList.push(this);
|
||||
} else {
|
||||
super(idOrElement, {...RessourceList.options['extended'],
|
||||
...RessourceList.options[type],
|
||||
@ -81,8 +80,7 @@ class RessourceList extends List {
|
||||
|
||||
|
||||
RessourceList.dataMapper = {
|
||||
// ### Mapping Genera Info
|
||||
//The Mapping describes entitys rendered per row. One key value pair holds
|
||||
// A data mapper describes entitys rendered per row. One key value pair holds
|
||||
// the data to be rendered in the list.js table. Key has to correspond
|
||||
// with the ValueNames defined below in RessourceList.options ValueNames.
|
||||
// Links are declared with double ticks(") around them. The key for links
|
||||
@ -96,8 +94,7 @@ RessourceList.dataMapper = {
|
||||
"analyse-link": ["analysing", "prepared", "start analysis"].includes(corpus.status) ? `/corpora/${corpus.id}/analyse` : "",
|
||||
"edit-link": `/corpora/${corpus.id}`,
|
||||
status: corpus.status,
|
||||
title: corpus.title
|
||||
}),
|
||||
title: corpus.title}),
|
||||
// Mapping for corpus file entities shown in the corpus overview
|
||||
corpus_file: corpus_file => ({filename: corpus_file.filename,
|
||||
author: corpus_file.author,
|
||||
@ -105,8 +102,7 @@ RessourceList.dataMapper = {
|
||||
publishing_year: corpus_file.publishing_year,
|
||||
"edit-link": `${corpus_file.corpus_id}/files/${corpus_file.id}/edit`,
|
||||
"download-link": `${corpus_file.corpus_id}/files/${corpus_file.id}/download`,
|
||||
"delete-modal": `delete-corpus-file-${corpus_file.id}-modal`
|
||||
}),
|
||||
"delete-modal": `delete-corpus-file-${corpus_file.id}-modal`}),
|
||||
// Mapping for job entities shown in the dashboard table.
|
||||
job: job => ({creation_date: job.creation_date,
|
||||
description: job.description,
|
||||
@ -114,34 +110,34 @@ RessourceList.dataMapper = {
|
||||
link: `/jobs/${job.id}`,
|
||||
service: job.service,
|
||||
status: job.status,
|
||||
title: job.title
|
||||
}),
|
||||
title: job.title}),
|
||||
// Mapping for job input files shown in table on every job page
|
||||
job_input: job_input => ({filename: job_input.filename,
|
||||
id: job_input.job_id,
|
||||
"download-link": `${job_input.job_id}/inputs/${job_input.id}/download`
|
||||
}),
|
||||
"download-link": `${job_input.job_id}/inputs/${job_input.id}/download`}),
|
||||
// Mapping for imported result entities from corpus analysis.
|
||||
// Shown in imported results table
|
||||
result: result => ({ query: result.query,
|
||||
match_count: result.match_count,
|
||||
corpus_name: result.corpus_name,
|
||||
corpus_creation_date: result.corpus_creation_date,
|
||||
corpus_analysis_date: result.corpus_analysis_date,
|
||||
corpus_type : result.corpus_type,
|
||||
"details-link": `${result.id}/details`,
|
||||
"inspect-link": `${result.id}/inspect`,
|
||||
"download-link": `${result.id}/file/${result.file_id}/download`,
|
||||
"delete-modal": `delete-result-${result.id}-modal`
|
||||
}),
|
||||
query_result: query_result => ({description: query_result.description,
|
||||
id: query_result.id,
|
||||
link: `/query_results/${query_result.id}`,
|
||||
title: query_result.title}),
|
||||
result: result => ({query: result.query,
|
||||
match_count: result.match_count,
|
||||
corpus_name: result.corpus_name,
|
||||
corpus_creation_date: result.corpus_creation_date,
|
||||
corpus_analysis_date: result.corpus_analysis_date,
|
||||
corpus_type : result.corpus_type,
|
||||
"details-link": `${result.id}/details`,
|
||||
"inspect-link": `${result.id}/inspect`,
|
||||
"download-link": `${result.id}/file/${result.file_id}/download`,
|
||||
"delete-modal": `delete-result-${result.id}-modal`}),
|
||||
// Mapping for user entities shown in admin table
|
||||
user: user => ({username: user.username,
|
||||
email: user.email,
|
||||
role_id: user.role_id,
|
||||
confirmed: user.confirmed,
|
||||
id: user.id,
|
||||
"profile-link": `user/${user.id}`
|
||||
})
|
||||
"profile-link": `user/${user.id}`})
|
||||
};
|
||||
|
||||
|
||||
@ -289,6 +285,32 @@ RessourceList.options = {
|
||||
"id",
|
||||
{name: "download-link", attr: "href"}]
|
||||
},
|
||||
query_result: {item: `<tr>
|
||||
<td>
|
||||
<a class="btn-floating disabled">
|
||||
<i class="material-icons service">book</i>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<b class="title"></b><br>
|
||||
<i class="description"></i>
|
||||
</td>
|
||||
<td class="actions right-align">
|
||||
<a class="btn-floating tooltipped link waves-effect
|
||||
waves-light"
|
||||
data-position="top"
|
||||
data-tooltip="Go to query result">
|
||||
<i class="material-icons">send</i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>`,
|
||||
// Job Value Names per column. Have to correspond with the keys from the
|
||||
// Mapping step above.
|
||||
valueNames: ["description",
|
||||
"title",
|
||||
{data: ["id"]},
|
||||
{name: "link", attr: "href"}]
|
||||
},
|
||||
// Result (imported from corpus analysis) entity blueprint setting html
|
||||
// strucuture per entity per row
|
||||
// Link classes have to correspond with Links defined in the Mapping process
|
||||
|
Reference in New Issue
Block a user