From 19f24ba8cd4b574c58f84b3cad1a78ebd18f5cdb Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 21 Mar 2025 14:12:32 -0500 Subject: Bulk Edit: Initialise the bulk-edit upload * Provide UI for uploading the file * Provide (partially implemented) endpoint to handle the uploaded file. --- uploader/phenotypes/views.py | 26 +++++++++ .../templates/phenotypes/bulk-edit-upload.html | 61 ++++++++++++++++++++++ uploader/templates/phenotypes/view-dataset.html | 8 ++- 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 uploader/templates/phenotypes/bulk-edit-upload.html diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index 2f6e926..3d2ff76 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -932,3 +932,29 @@ def edit_download_phenotype_data(# pylint: disable=[unused-argument] mimetype="text/csv", as_attachment=True, download_name=secure_filename(f"{dataset['Name']}_data")) + + +@phenotypesbp.route( + "/populations//phenotypes/datasets" + "//edit-upload", + 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 edit_upload_phenotype_data(# pylint: disable=[unused-argument] + species: dict, + population: dict, + dataset: dict, + **kwargs +): + if request.method == "GET": + return render_template( + "phenotypes/bulk-edit-upload.html", + species=species, + population=population, + dataset=dataset, + activelink="edit-phenotype") + + return "NOT Implemented: Would do actual edit." diff --git a/uploader/templates/phenotypes/bulk-edit-upload.html b/uploader/templates/phenotypes/bulk-edit-upload.html new file mode 100644 index 0000000..926bcf5 --- /dev/null +++ b/uploader/templates/phenotypes/bulk-edit-upload.html @@ -0,0 +1,61 @@ +{%extends "phenotypes/base.html"%} +{%from "flash_messages.html" import flash_all_messages%} +{%from "macro-table-pagination.html" import table_pagination%} +{%from "populations/macro-display-population-card.html" import display_population_card%} + +{%block title%}Phenotypes{%endblock%} + +{%block pagetitle%}Phenotypes{%endblock%} + +{%block lvl4_breadcrumbs%} + +{%endblock%} + +{%block contents%} +
+

Upload the edited file you downloaded and edited.

+
+ +
+
+ +
+ +
+ +
+
+ + + +
+
+{%endblock%} + + +{%block javascript%} +{%endblock%} diff --git a/uploader/templates/phenotypes/view-dataset.html b/uploader/templates/phenotypes/view-dataset.html index e08afc1..21563d6 100644 --- a/uploader/templates/phenotypes/view-dataset.html +++ b/uploader/templates/phenotypes/view-dataset.html @@ -216,7 +216,13 @@ className: "btn btn-info btn-bulk-edit", titleAttr: "Click to upload edited data you got by clicking the `Bulk Edit (Download Data)` button.", action: (event, dt, node, config) => { - alert("Not implemented yet!") + window.location.assign( + `${window.location.protocol}//` + + `${window.location.host}` + + `/species/${species_id}` + + `/populations/${population_id}` + + `/phenotypes/datasets/${dataset_id}` + + `/edit-upload`) } } ] -- cgit v1.2.3