aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-04-08 09:36:38 +0300
committerFrederick Muriuki Muriithi2024-04-08 09:36:38 +0300
commit186df2bacd11beae53a0c4562e9dcc72c6d253c8 (patch)
treeba01098eb4769af51d11219d843a78a360f5a0c3
parentd904748a0c8c35d937c6e56fadc7ba52b9f43634 (diff)
downloadgn-uploader-186df2bacd11beae53a0c4562e9dcc72c6d253c8.tar.gz
bug: UI: Provide better error messaging.
-rw-r--r--qc_app/templates/rqtl2/select-probeset-dataset.html6
-rw-r--r--qc_app/upload/rqtl2.py15
2 files changed, 11 insertions, 10 deletions
diff --git a/qc_app/templates/rqtl2/select-probeset-dataset.html b/qc_app/templates/rqtl2/select-probeset-dataset.html
index aa30f6f..d00d6aa 100644
--- a/qc_app/templates/rqtl2/select-probeset-dataset.html
+++ b/qc_app/templates/rqtl2/select-probeset-dataset.html
@@ -1,5 +1,5 @@
{%extends "base.html"%}
-{%from "flash_messages.html" import flash_all_messages%}
+{%from "flash_messages.html" import flash_messages%}
{%block title%}Upload R/qtl2 Bundle{%endblock%}
@@ -12,14 +12,13 @@
<p>This page gives you the ability to do that.</p>
</div>
-{{flash_all_messages()}}
-
{%if datasets | length > 0%}
<form method="POST"
action="{{url_for('upload.rqtl2.select_probeset_dataset',
species_id=species.SpeciesId, population_id=population.Id)}}"
id="frm:select-probeset-dataset">
<legend class="heading">Select from existing ProbeSet datasets</legend>
+ {{flash_messages("error-rqtl2-select-probeset-dataset")}}
<input type="hidden" name="species_id" value="{{species.SpeciesId}}" />
<input type="hidden" name="population_id"
@@ -68,6 +67,7 @@
species_id=species.SpeciesId, population_id=population.Id)}}"
id="frm:create-probeset-dataset">
<legend class="heading">Create a new ProbeSet dataset</legend>
+ {{flash_messages("error-rqtl2-create-probeset-dataset")}}
<input type="hidden" name="species_id" value="{{species.SpeciesId}}" />
<input type="hidden" name="population_id"
diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py
index e0fb40c..876f17c 100644
--- a/qc_app/upload/rqtl2.py
+++ b/qc_app/upload/rqtl2.py
@@ -651,6 +651,7 @@ def create_probeset_study(species_id: int, population_id: int):
methods=["POST"])
def create_probeset_dataset(species_id: int, population_id: int):#pylint: disable=[too-many-return-statements]
"""Create a new probeset dataset."""
+ errorclasses = "alert-error error-rqtl2 error-rqtl2-create-probeset-dataset"
with database_connection(app.config["SQL_URI"]) as conn:
def __thunk__():
form = request.form
@@ -659,23 +660,23 @@ def create_probeset_dataset(species_id: int, population_id: int):#pylint: disabl
population_id=population_id),
code=307)
if not bool(form.get("averageid")):
- flash("Averaging method not selected!", "alert-error error-rqtl2")
+ flash("Averaging method not selected!", errorclasses)
return summary_page
if not bool(form.get("datasetname")):
- flash("Dataset name not provided!", "alert-error error-rqtl2")
+ flash("Dataset name not provided!", errorclasses)
return summary_page
if not bool(form.get("datasetfullname")):
- flash("Dataset full name not provided!", "alert-error error-rqtl2")
+ flash("Dataset full name not provided!", errorclasses)
return summary_page
study = probeset_study_by_id(conn, int(form["probe-study-id"]))
if not bool(study):
- flash("Invalid ProbeSet study provided!", "alert-error error-rqtl2")
+ flash("Invalid ProbeSet study provided!", errorclasses)
return summary_page
avgmethod = averaging_method_by_id(conn, int(form["averageid"]))
if not bool(avgmethod):
- flash("Invalid averaging method provided!", "alert-error error-rqtl2")
+ flash("Invalid averaging method provided!", errorclasses)
return summary_page
try:
@@ -691,14 +692,14 @@ def create_probeset_dataset(species_id: int, population_id: int):#pylint: disabl
except mdb.IntegrityError as _ierr:
flash(("A dataset with that name already exists. Try selecting "
"from list of datasets instead."),
- "alert-error error-rqtl2")
+ errorclasses)
return summary_page
except Exception as _exc:
app.logger.debug("Error creating ProbeSet dataset: %s",
traceback.format_exc())
flash(("There was a problem creating your dataset. Please try "
"again."),
- "alert-error error-rqtl2")
+ errorclasses)
return render_template(
"rqtl2/create-probe-dataset-success.html",
species=species_by_id(conn, species_id),