Some changes to query result list

This commit is contained in:
Patrick Jentsch 2020-07-15 11:07:03 +02:00
parent 44963b1606
commit 7cf04cbe29
4 changed files with 24 additions and 89 deletions

View File

@ -650,6 +650,7 @@ class QueryResult(db.Model):
'user_id': self.user_id,
'description': self.description,
'filename': self.filename,
'query_metadata': self.query_metadata,
'title': self.title}
def __repr__(self):

View File

@ -117,10 +117,11 @@ RessourceList.dataMapper = {
"download-link": `${job_input.job_id}/inputs/${job_input.id}/download`}),
// Mapping for imported result entities from corpus analysis.
// Shown in imported results table
QueryResult: query_result => ({description: query_result.description,
"download-link": `/query_results/${query_result.id}/download`,
QueryResult: query_result => ({corpus_name: query_result.query_metadata.corpus_name,
description: query_result.description,
id: query_result.id,
link: `/query_results/${query_result.id}`,
query: query_result.query_metadata.query,
title: query_result.title}),
result: result => ({query: result.query,
match_count: result.match_count,
@ -252,21 +253,22 @@ RessourceList.options = {
{name: "download-link", attr: "href"}]},
QueryResult: {item: `<tr>
<td>
<a class="btn-floating disabled">
<i class="material-icons service">book</i>
<b class="title"></b><br>
<i class="description"></i><br>
</td>
<td>
<span class="corpus_name"></span><br>
<span class="query"></span>
</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>
<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>`,
valueNames: ["description",
</td>
</tr>`,
valueNames: ["corpus_name",
"description",
"query",
"title",
{data: ["id"]},
{name: "link", attr: "href"}]},

View File

@ -1,71 +0,0 @@
{% extends "nopaque.html.j2" %}
{% set full_width = True %}
{% block page_content %}
<div class="col s12">
<p>This is an overview of all your imported results.</p>
</div>
<div class="col s12">
<div class="card">
<div class="card-content" id="results">
<div class="input-field">
<i class="material-icons prefix">search</i>
<input id="search-results" class="search" type="search"></input>
<label for="search-results">Search results</label>
</div>
<ul class="pagination paginationTop"></ul>
<table class="highlight responsive-table">
<thead>
<tr>
<th class="sort" data-sort="query">Query</th>
<th class="sort" data-sort="match_count">Match count</th>
<th class="sort" data-sort="corpus_name">Corpus name</th>
<th class="sort" data-sort="corpus_creation_date">Corpus creation date</th>
<th class="sort" data-sort="corpus_analysis_date">Corpus analysis date</th>
<th class="sort" data-sort="corpus_type">Corpus type</th>
<th>{# Actions #}</th>
</tr>
</thead>
<tbody class="list">
<tr class="show-if-only-child">
<td colspan="5">
<span class="card-title"><i class="material-icons left">folder</i>Nothing here...</span>
<p>No results yet imported.</p>
</td>
</tr>
</tbody>
</table>
<ul class="pagination paginationBottom"></ul>
</div>
<div class="card-action right-align">
<a class="waves-effect waves-light btn" href="{{ url_for('results.import_results') }}">Import Results<i class="material-icons right">file_upload</i></a>
</div>
</div>
</div>
{# Delete modals #}
{% for result in results %}
<div id="delete-result-{{ result.id }}-modal" class="modal">
<div class="modal-content">
<h4>Confirm result file deletion</h4>
<p>Do you really want to delete the result file created on <i>{{ result.corpus_analysis_date }}</i>?
<p>The file holds results for the query <i>{{ result.query }}</i>.</p>
<p>The file will be permanently deleted!</p>
</div>
<div class="modal-footer">
<a href="#!" class="btn modal-close waves-effect waves-light">Cancel</a>
<a class="btn modal-close red waves-effect waves-light" href="{{ url_for('results.result_delete', result_id=result.id) }}"><i class="material-icons left">delete</i>Delete</a>
</div>
</div>
{% endfor %}
<script>
var ressources = {{ results|tojson|safe }};
var importedResultsList = new RessourceList("results", null, "result");
importedResultsList.addRessources(ressources);
RessourceList.modifyTooltips();
</script>
{% endblock %}

View File

@ -57,11 +57,14 @@
<table class="highlight responsive-table">
<thead>
<tr>
<th>{# Service #}</th>
<th>
<span class="sort" data-sort="title">Title</span>
<span class="sort" data-sort="title">Title</span> and<br>
<span class="sort" data-sort="description">Description</span>
</th>
<th>
<span class="sort" data-sort="corpus">Corpus</span> and<br>
<span class="sort" data-sort="query">Query</span>
</th>
<th>{# Actions #}</th>
</tr>
</thead>