diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/templates/display_files_user.html | 31 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 14 |
2 files changed, 45 insertions, 0 deletions
diff --git a/wqflask/wqflask/templates/display_files_user.html b/wqflask/wqflask/templates/display_files_user.html new file mode 100644 index 00000000..b6bab709 --- /dev/null +++ b/wqflask/wqflask/templates/display_files_user.html @@ -0,0 +1,31 @@ +{% extends "base.html" %} +{% block title %}Trait Submission{% endblock %} +{% block content %} +<!-- Start of body --> +{% with messages = get_flashed_messages(with_categories=true) %} +{% if messages %} +{% for category, message in messages %} +<div class="container-fluid bg-{{ category }}"> + <p>{{ message }}</p> +</div> +{% endfor %} +{% endif %} +{% endwith %} +Show files for approval + +<div> + <ul> + {% for file in files %} + <li><a href="/display-file/{{ file }}" target="_blank">{{ file }}</a><br/> + <button><a href="/data-samples/reject/{{ file }}">Reject</a></button></li> + {% endfor %} + </ul> +</div> +{%endblock%} + +{% block js %} +<script> + gn_server_url = "{{ gn_server_url }}"; + +</script> +{% endblock %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 56f9a5eb..78da024f 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -1392,6 +1392,7 @@ def get_sample_data_as_csv(trait_name: int, phenotype_id: int): @app.route("/admin/data-sample/diffs/") +@admin_login_required def display_diffs_admin(): DIFF_DIR = "/tmp/sample-data/diffs" files = [] @@ -1401,6 +1402,19 @@ def display_diffs_admin(): files) return render_template("display_files_admin.html", files=files) + + +@app.route("/user/data-sample/diffs/") +def display_diffs_users(): + DIFF_DIR = "/tmp/sample-data/diffs" + files = [] + author = g.user_session.record.get(b'user_name').decode("utf-8") + if os.path.exists(DIFF_DIR): + files = os.listdir(DIFF_DIR) + files = filter(lambda x: not(x.endswith((".approved", ".rejected"))) \ + and author in x, + files) + return render_template("display_files_user.html", files=files) |