aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-07-26 13:17:14 +0300
committerBonfaceKilz2021-08-03 15:49:50 +0300
commitb355b91f67305c4cb3ebbad994cc0ff2906eb701 (patch)
tree4936a7ff50968b5b848195f8fcfbc7e7f3f160f6
parent749807d0bd676ad76e427a8151339bba2780a659 (diff)
downloadgenenetwork2-b355b91f67305c4cb3ebbad994cc0ff2906eb701.tar.gz
wqflask: views: Show diff files for the admin
* wqflask/wqflask/views.py (display_diffs_admin): New function. * wqflask/wqflask/templates/display_files.html: New template to show the diffs.
-rw-r--r--wqflask/wqflask/templates/display_files.html21
-rw-r--r--wqflask/wqflask/views.py12
2 files changed, 33 insertions, 0 deletions
diff --git a/wqflask/wqflask/templates/display_files.html b/wqflask/wqflask/templates/display_files.html
new file mode 100644
index 00000000..e7210c1b
--- /dev/null
+++ b/wqflask/wqflask/templates/display_files.html
@@ -0,0 +1,21 @@
+{% extends "base.html" %}
+{% block title %}Trait Submission{% endblock %}
+{% block content %}
+<!-- Start of body -->
+Show files for approval
+
+<div>
+ <ul>
+ {% for file in files %}
+ <li><a href="/display-file/{{ file }}" target="_blank">{{ file }}</a><br/> <button>Approve</button> <button>Reject</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 73829bb2..cf7b5552 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -1375,3 +1375,15 @@ def get_sample_data_as_csv(trait_name: int, phenotype_id: int):
headers={"Content-disposition":
"attachment; filename=myplot.csv"}
)
+
+
+@app.route("/data/approve/")
+def display_diffs_admin():
+ DIFF_DIR = "/tmp/sample-data/diffs"
+ files = []
+ if os.path.exists(DIFF_DIR):
+ files = filter(lambda x: not(x.endswith((".approved", ".rejected"))),
+ os.listdir(DIFF_DIR))
+ return render_template("display_files.html",
+ files=files)
+