diff --git a/web/app/corpora/views.py b/web/app/corpora/views.py index 6d78c8b4..765e53d3 100644 --- a/web/app/corpora/views.py +++ b/web/app/corpora/views.py @@ -9,6 +9,7 @@ from .forms import (AddCorpusFileForm, AddCorpusForm, EditCorpusFileForm, from .. import db from ..models import Corpus, CorpusFile import os +from .. import logger @corpora.route('/add', methods=['GET', 'POST']) @@ -44,7 +45,17 @@ def corpus(corpus_id): corpus = Corpus.query.get_or_404(corpus_id) if not (corpus.creator == current_user or current_user.is_administrator()): abort(403) - return render_template('corpora/corpus.html.j2', corpus=corpus, + corpus_files = [dict(filename=corpus_file.filename, + author=corpus_file.author, + title=corpus_file.title, + publishing_year=corpus_file.publishing_year, + corpus_id=corpus.id, + id=corpus_file.id + ) + for corpus_file in corpus.files] + return render_template('corpora/corpus.html.j2', + corpus=corpus, + corpus_files=corpus_files, title='Corpus') @@ -216,7 +227,7 @@ def prepare_corpus(corpus_id): abort(403) if corpus.files.all(): tasks.build_corpus(corpus_id) - flash('Corpus gets build now.', 'corpus') + flash('Building Corpus...', 'corpus') else: flash('Can not build corpus, please add corpus file(s).', 'corpus') return redirect(url_for('corpora.corpus', corpus_id=corpus_id)) diff --git a/web/app/results/views.py b/web/app/results/views.py index 4b591122..53ccd8d8 100644 --- a/web/app/results/views.py +++ b/web/app/results/views.py @@ -10,6 +10,7 @@ from flask import (abort, render_template, current_app, request, redirect, from flask_login import current_user, login_required import json import os +from .. import logger @results.route('/import_results', methods=['GET', 'POST']) @@ -69,7 +70,7 @@ def results_overview(): ''' # get all results of current user results = User.query.get(current_user.id).results - + logger.warning(results) def __p_time(time_str): # helper to convert the datetime into a nice readable string return datetime.strptime(time_str, '%Y-%m-%dT%H:%M:%S.%f') diff --git a/web/app/static/js/nopaque.lists.js b/web/app/static/js/nopaque.lists.js index a2584e71..fdcd4bbd 100644 --- a/web/app/static/js/nopaque.lists.js +++ b/web/app/static/js/nopaque.lists.js @@ -1,6 +1,7 @@ class RessourceList extends List { constructor(idOrElement, subscriberList, type, options={}) { - if (!["corpus", "job", "result", "user", "job_input"].includes(type)) { + if (!["corpus", "job", "result", "user", "job_input", + "corpus_file"].includes(type)) { console.error("Unknown Type!"); return; } @@ -78,7 +79,17 @@ 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, + title: corpus_file.title, + 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` + }), // Mapping for job entities shown in the dashboard table. job: job => ({creation_date: job.creation_date, description: job.description, @@ -86,11 +97,13 @@ 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, @@ -101,14 +114,16 @@ RessourceList.dataMapper = { corpus_type : result.corpus_type, "details-link": `${result.id}/details`, "inspect-link": `${result.id}/inspect`, - "delete-modal": `delete-result-${result.id}-modal`}), + "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}` + }) }; @@ -146,12 +161,12 @@ RessourceList.options = { -