diff options
Diffstat (limited to 'uploader/phenotypes/views.py')
| -rw-r--r-- | uploader/phenotypes/views.py | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index 2afd8a3..9df7d81 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -32,6 +32,8 @@ from r_qtl import r_qtl2_qc as rqc from r_qtl import exceptions as rqe +from uploader.sui import sui_template + from uploader import jobs from uploader import session from uploader.files import save_file @@ -195,7 +197,7 @@ def view_dataset(# pylint: disable=[unused-argument] start_at = max(safe_int(request.args.get("start_at") or 0), 0) count = int(request.args.get("count") or 20) - return render_template("phenotypes/view-dataset.html", + return render_template(sui_template("phenotypes/view-dataset.html"), species=species, population=population, dataset=dataset, @@ -418,8 +420,9 @@ def add_phenotypes(species: dict, population: dict, dataset: dict, **kwargs):# p if request.method == "GET": today = datetime.date.today() return render_template( - ("phenotypes/add-phenotypes-with-rqtl2-bundle.html" - if use_bundle else "phenotypes/add-phenotypes-raw-files.html"), + sui_template("phenotypes/add-phenotypes-with-rqtl2-bundle.html" + if use_bundle + else "phenotypes/add-phenotypes-raw-files.html"), species=species, population=population, dataset=dataset, @@ -505,7 +508,8 @@ def job_status( job = jobs.job(rconn, jobs.jobsnamespace(), str(job_id)) except jobs.JobNotFound as _jnf: job = None - return render_template("phenotypes/job-status.html", + + return render_template(sui_template("phenotypes/job-status.html"), species=species, population=population, dataset=dataset, @@ -585,7 +589,7 @@ def review_job_data( for filetype,meta in metadata.items() } _job_metadata = json.loads(job["job-metadata"]) - return render_template("phenotypes/review-job-data.html", + return render_template(sui_template("phenotypes/review-job-data.html"), species=species, population=population, dataset=dataset, @@ -975,33 +979,34 @@ def load_data_success( _publication["Authors"], (_publication["Title"] or "")) if item != "") - return render_template("phenotypes/load-phenotypes-success.html", - species=species, - population=population, - dataset=dataset, - job=job, - search_page_uri=urlunparse(ParseResult( - scheme=gn2_uri.scheme, - netloc=gn2_uri.netloc, - path="/search", - params="", - query=urlencode({ - "species": species["Name"], - "group": population["Name"], - "type": "Phenotypes", - "dataset": dataset["Name"], - "search_terms_or": ( - # Very long URLs will cause - # errors. + return render_template( + sui_template("phenotypes/load-phenotypes-success.html"), + species=species, + population=population, + dataset=dataset, + job=job, + search_page_uri=urlunparse(ParseResult( + scheme=gn2_uri.scheme, + netloc=gn2_uri.netloc, + path="/search", + params="", + query=urlencode({ + "species": species["Name"], + "group": population["Name"], + "type": "Phenotypes", + "dataset": dataset["Name"], + "search_terms_or": ( + # Very long URLs will cause + # errors. " ".join(_xref_ids) if len(_xref_ids) <= 100 else ""), - "search_terms_and": " ".join( - _search_terms).strip(), - "accession_id": "None", - "FormID": "searchResult" - }), - fragment=""))) + "search_terms_and": " ".join( + _search_terms).strip(), + "accession_id": "None", + "FormID": "searchResult" + }), + fragment=""))) except JobNotFound as _jnf: return render_template("jobs/job-not-found.html", job_id=job_id) @@ -1067,6 +1072,7 @@ def recompute_means(# pylint: disable=[unused-argument] def return_to_dataset_view_handler(job, msg: str): + """Handler for background jobs: Returns to `View Dataset` page.""" flash(msg, "alert alert-success") return redirect(url_for( "species.populations.phenotypes.view_dataset", |
