From 0714070a9b33571da185773ec882099a14bbbaeb Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Wed, 15 Jul 2020 13:16:31 +0200 Subject: [PATCH] Fully integrate new query_results model. old one is now deprecated. --- web/app/query_results/views.py | 12 ++- web/app/static/js/nopaque.lists.js | 5 ++ ...t_query_result.html.j2 => inspect.html.j2} | 78 ++++++++++++++++++- 3 files changed, 87 insertions(+), 8 deletions(-) rename web/app/templates/query_results/{inspect_query_result.html.j2 => inspect.html.j2} (75%) diff --git a/web/app/query_results/views.py b/web/app/query_results/views.py index 70c879f0..8a2e0176 100644 --- a/web/app/query_results/views.py +++ b/web/app/query_results/views.py @@ -1,7 +1,7 @@ from . import query_results from . import tasks from .. import db -from ..corpora.forms import DisplayOptionsForm +from ..corpora.forms import DisplayOptionsForm, InspectDisplayOptionsForm from ..models import QueryResult from .forms import AddQueryResultForm from flask import (abort, current_app, flash, make_response, redirect, @@ -101,6 +101,9 @@ def inspect_query_result(query_result_id): results_per_page=request.args.get('results_per_page', 30), result_context=request.args.get('context', 20) ) + inspect_display_options_form = InspectDisplayOptionsForm( + prefix='inspect-display-options-form' + ) query_result_file_path = os.path.join( current_app.config['NOPAQUE_STORAGE'], str(current_user.id), @@ -109,10 +112,11 @@ def inspect_query_result(query_result_id): query_result.filename ) with open(query_result_file_path, 'r') as query_result_file: - query_result_content = json.load(query_result_file) - return render_template('query_results/inspect_query_result.html.j2', + query_result_file_content = json.load(query_result_file) + return render_template('query_results/inspect.html.j2', display_options_form=display_options_form, - query_result_content=query_result_content, + inspect_display_options_form=inspect_display_options_form, + query_result_file_content=query_result_file_content, title='Inspect query result') diff --git a/web/app/static/js/nopaque.lists.js b/web/app/static/js/nopaque.lists.js index eaf0f2e7..c7ec8fa8 100644 --- a/web/app/static/js/nopaque.lists.js +++ b/web/app/static/js/nopaque.lists.js @@ -120,6 +120,7 @@ RessourceList.dataMapper = { QueryResult: query_result => ({corpus_name: query_result.query_metadata.corpus_name, description: query_result.description, id: query_result.id, + "inspect-link": `/query_results/${query_result.id}/inspect`, link: `/query_results/${query_result.id}`, query: query_result.query_metadata.query, title: query_result.title}), @@ -261,6 +262,9 @@ RessourceList.options = { + + search + send @@ -271,6 +275,7 @@ RessourceList.options = { "query", "title", {data: ["id"]}, + {name: "inspect-link", attr: "href"}, {name: "link", attr: "href"}]}, // Result (imported from corpus analysis) entity blueprint setting html // strucuture per entity per row diff --git a/web/app/templates/query_results/inspect_query_result.html.j2 b/web/app/templates/query_results/inspect.html.j2 similarity index 75% rename from web/app/templates/query_results/inspect_query_result.html.j2 rename to web/app/templates/query_results/inspect.html.j2 index 73910f82..a2e810c3 100644 --- a/web/app/templates/query_results/inspect_query_result.html.j2 +++ b/web/app/templates/query_results/inspect.html.j2 @@ -77,6 +77,70 @@ + + + -{% endblock %} \ No newline at end of file +{% endblock %}