aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2021-08-02 22:08:25 +0300
committerBonfaceKilz2021-08-03 15:49:50 +0300
commit72bdbc512ee250ffaa1fa0c1ba91b2a065a485d0 (patch)
treec30d376992be3de139c5201998acf971c45814a3 /wqflask
parentfbe52a11f4471d928e398f09edc2e243bbbab58a (diff)
downloadgenenetwork2-72bdbc512ee250ffaa1fa0c1ba91b2a065a485d0.tar.gz
wqflask: views: Only show user's diff
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/templates/display_files_user.html31
-rw-r--r--wqflask/wqflask/views.py14
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)