From 9957da3abeabbe68bb1d77358cbec1dd5274b938 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Sat, 25 Mar 2023 14:57:15 +0300 Subject: oauth2: Add UI to use to link data --- wqflask/wqflask/oauth2/data.py | 12 ++- .../templates/oauth2/data-list-phenotype.html | 99 +++++++++++++++++++--- wqflask/wqflask/templates/oauth2/data-list.html | 5 +- 3 files changed, 99 insertions(+), 17 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/oauth2/data.py b/wqflask/wqflask/oauth2/data.py index 73ed171b..963ab547 100644 --- a/wqflask/wqflask/oauth2/data.py +++ b/wqflask/wqflask/oauth2/data.py @@ -39,11 +39,17 @@ def list_data_by_species_and_dataset( lambda trts: {"traits": tuple({ "index": idx, **trait } for idx, trait in enumerate(trts, start=1))}) + groups = oauth2_get("oauth2/group/list").either( + lambda err: {"groups_error": process_error(err)}, + lambda grps: {"groups": grps}) + + selected_traits = request.form.getlist("selected_traits") return __render_template__( - templates[dataset_type], **roles, **traits, species_name=species_name, - dataset_type=dataset_type, per_page=per_page, - query=query, search_endpoint=urljoin(app.config["GN_SERVER_URL"], "search/")) + templates[dataset_type], **roles, **traits, **groups, + species_name=species_name, dataset_type=dataset_type, per_page=per_page, + query=query, selected_traits=selected_traits, + search_endpoint=urljoin(app.config["GN_SERVER_URL"], "search/")) @data.route("/list", methods=["GET", "POST"]) def list_data(): diff --git a/wqflask/wqflask/templates/oauth2/data-list-phenotype.html b/wqflask/wqflask/templates/oauth2/data-list-phenotype.html index 5212a146..0e94bcfa 100644 --- a/wqflask/wqflask/templates/oauth2/data-list-phenotype.html +++ b/wqflask/wqflask/templates/oauth2/data-list-phenotype.html @@ -24,10 +24,49 @@
+ +
+ +
+
- {{search_endpoint}} {%if dataset_type == "mrna"%} mRNA: Search {%else%} @@ -88,15 +127,17 @@ src="/static/new/javascript/create_datatable.js"> {%endblock%} diff --git a/wqflask/wqflask/templates/oauth2/data-list.html b/wqflask/wqflask/templates/oauth2/data-list.html index 4e0cf5ae..b7c526c6 100644 --- a/wqflask/wqflask/templates/oauth2/data-list.html +++ b/wqflask/wqflask/templates/oauth2/data-list.html @@ -23,7 +23,8 @@ {%else%}
- {%for spc in species%}