about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2026-01-23 12:54:56 -0600
committerFrederick Muriuki Muriithi2026-01-23 13:00:08 -0600
commit770a3171af257ec689ae14ca48fb5c6ac7be9812 (patch)
tree53f7a2c4bb02dffc5584bed01a275380a1c2c5c9
parentc689c97b2a7003a475f35f786710a7591631b06c (diff)
downloadgn-uploader-770a3171af257ec689ae14ca48fb5c6ac7be9812.tar.gz
Initialise UI for deletion of phenotypes.
-rw-r--r--uploader/phenotypes/views.py22
-rw-r--r--uploader/templates/phenotypes/view-dataset.html18
2 files changed, 38 insertions, 2 deletions
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py
index 60d5775..aaccf18 100644
--- a/uploader/phenotypes/views.py
+++ b/uploader/phenotypes/views.py
@@ -1155,3 +1155,25 @@ def rerun_qtlreaper(# pylint: disable=[unused-argument]
 def rerun_qtlreaper_success_handler(job):
     """Handle success (re)running QTLReaper script."""
     return return_to_dataset_view_handler(job, "QTLReaper ran successfully!")
+
+
+@phenotypesbp.route(
+    "<int:species_id>/populations/<int:population_id>/phenotypes/datasets"
+    "/<int:dataset_id>/delete",
+    methods=["GET", "POST"])
+@require_login
+@with_dataset(
+    species_redirect_uri="species.populations.phenotypes.index",
+    population_redirect_uri="species.populations.phenotypes.select_population",
+    redirect_uri="species.populations.phenotypes.list_datasets")
+def delete_phenotypes(# pylint: disable=[unused-argument]
+        species: dict,
+        population: dict,
+        dataset: dict,
+        **kwargs
+):
+    """Delete the specified phenotype data."""
+    if request.method == "GET":
+        return "Would confirm deletion."
+
+    return "Would delete!"
diff --git a/uploader/templates/phenotypes/view-dataset.html b/uploader/templates/phenotypes/view-dataset.html
index 1fd15b2..1beeb32 100644
--- a/uploader/templates/phenotypes/view-dataset.html
+++ b/uploader/templates/phenotypes/view-dataset.html
@@ -67,7 +67,7 @@
       <input type="submit"
              title="Compute/Recompute the means for all phenotypes."
              class="btn btn-info"
-             value="(rec/c)ompute means"
+             value="compute means"
              id="submit-frm-recompute-phenotype-means" />
     </form>
   </div>
@@ -85,10 +85,24 @@
       <input type="submit"
              title="Run/Rerun QTLReaper."
              class="btn btn-info"
-             value="(re)run QTLReaper"
+             value="run QTLReaper"
              id="submit-frm-rerun-qtlreaper" />
     </form>
   </div>
+
+  {%if view_under_construction%}
+  <div class="col">
+    <a href="{{url_for(
+                'species.populations.phenotypes.delete_phenotypes',
+                species_id=species['SpeciesId'],
+                population_id=population['Id'],
+                dataset_id=dataset['Id'])}}"
+       class="btn btn-danger"
+       id="btn-delete-phenotypes"
+       title="Delete phenotypes from this dataset. If no phenotypes are selected in the table, this will delete ALL the phenotypes.">
+      delete phenotypes</a>
+  </div>
+  {%endif%}
 </div>
 
 <div class="row">