From 9a30b809b6fa78a7faa065e6bf5a13724cc06531 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 17 Dec 2025 13:04:31 -0600 Subject: Update samples UI to new streamlined UI format. --- uploader/samples/views.py | 8 +- uploader/static/css/theme.css | 4 + uploader/templates/cli-output.html | 2 +- uploader/templates/samples/sui-base.html | 8 +- uploader/templates/samples/sui-upload-failure.html | 32 +++++ .../templates/samples/sui-upload-progress.html | 26 ++++ uploader/templates/samples/sui-upload-samples.html | 153 +++++++++++++++++++++ uploader/templates/samples/sui-upload-success.html | 31 +++++ 8 files changed, 258 insertions(+), 6 deletions(-) create mode 100644 uploader/templates/samples/sui-upload-failure.html create mode 100644 uploader/templates/samples/sui-upload-progress.html create mode 100644 uploader/templates/samples/sui-upload-samples.html create mode 100644 uploader/templates/samples/sui-upload-success.html (limited to 'uploader') diff --git a/uploader/samples/views.py b/uploader/samples/views.py index fcb895d..93f0c29 100644 --- a/uploader/samples/views.py +++ b/uploader/samples/views.py @@ -149,7 +149,7 @@ def upload_samples(species_id: int, population_id: int):#pylint: disable=[too-ma code=307) if request.method == "GET" or request.files.get("samples_file") is None: - return render_template("samples/upload-samples.html", + return render_template(sui_template("samples/upload-samples.html"), species=species, population=population) @@ -216,7 +216,7 @@ def upload_status(species: dict, population: dict, job_id: uuid.UUID, **kwargs): if job: status = job["status"] if status == "success": - return render_template("samples/upload-success.html", + return render_template(sui_template("samples/upload-success.html"), job=job, species=species, population=population,) @@ -236,7 +236,7 @@ def upload_status(species: dict, population: dict, job_id: uuid.UUID, **kwargs): return redirect(url_for( "samples.upload_failure", job_id=job_id)) - return render_template("samples/upload-progress.html", + return render_template(sui_template("samples/upload-progress.html"), species=species, population=population, job=job) # maybe also handle this? @@ -267,7 +267,7 @@ def upload_failure(species: dict, population: dict, job_id: uuid.UUID, **kwargs) if stat.st_size > 0: return render_template("worker_failure.html", job_id=job_id) - return render_template("samples/upload-failure.html", + return render_template(sui_template("samples/upload-failure.html"), species=species, population=population, job=job) diff --git a/uploader/static/css/theme.css b/uploader/static/css/theme.css index 2acce5f..99b7af3 100644 --- a/uploader/static/css/theme.css +++ b/uploader/static/css/theme.css @@ -56,6 +56,10 @@ body { text-transform: capitalize; } +label { + text-transform: Capitalize; +} + input[type="search"] { border-radius: 5px; } diff --git a/uploader/templates/cli-output.html b/uploader/templates/cli-output.html index 64b1a9a..9cff09d 100644 --- a/uploader/templates/cli-output.html +++ b/uploader/templates/cli-output.html @@ -1,7 +1,7 @@ {%macro cli_output(job, stream)%}

{{stream | upper}} Output

-
+
{{job.get(stream, "")}}
diff --git a/uploader/templates/samples/sui-base.html b/uploader/templates/samples/sui-base.html index ee08e2e..8ec7505 100644 --- a/uploader/templates/samples/sui-base.html +++ b/uploader/templates/samples/sui-base.html @@ -3,7 +3,13 @@ {%block breadcrumbs%} {{super()}} - + {%endblock%} {%block contents%} diff --git a/uploader/templates/samples/sui-upload-failure.html b/uploader/templates/samples/sui-upload-failure.html new file mode 100644 index 0000000..d950c50 --- /dev/null +++ b/uploader/templates/samples/sui-upload-failure.html @@ -0,0 +1,32 @@ +{%extends "sui-base.html"%} +{%from "cli-output.html" import cli_output%} + +{%block title%}Samples Upload Failure{%endblock%} + +{%block contents%} +
+

{{job.job_name[0:50]}}…

+ +

There was a failure attempting to upload the samples.

+ +

Here is some information to help with debugging the issue. Provide this + information to the developer/maintainer.

+ +

Debugging Information

+ +
+ +
+

stdout

+{{cli_output(job, "stdout")}} +
+ +
+

stderr

+{{cli_output(job, "stderr")}} +
+{%endblock%} diff --git a/uploader/templates/samples/sui-upload-progress.html b/uploader/templates/samples/sui-upload-progress.html new file mode 100644 index 0000000..8412c46 --- /dev/null +++ b/uploader/templates/samples/sui-upload-progress.html @@ -0,0 +1,26 @@ +{%extends "samples/sui-base.html"%} +{%from "cli-output.html" import cli_output%} + +{%block extrameta%} + +{%endblock%} + +{%block title%}Job Status{%endblock%} + +{%block contents%} +
+

{{job.job_name[0:50]}}…

+ +

+status: +{{job["status"]}} ({{job.get("message", "-")}})
+

+ +

saving to database...

+
+ +
+ {{cli_output(job, "stdout")}} +
+ +{%endblock%} diff --git a/uploader/templates/samples/sui-upload-samples.html b/uploader/templates/samples/sui-upload-samples.html new file mode 100644 index 0000000..83c2061 --- /dev/null +++ b/uploader/templates/samples/sui-upload-samples.html @@ -0,0 +1,153 @@ +{%extends "samples/sui-base.html"%} +{%from "flash_messages.html" import flash_all_messages%} + +{%block title%}Samples — Upload Samples{%endblock%} + +{%block breadcrumbs%} +{{super()}} + +{%endblock%} + +{%block contents%} +{{flash_all_messages()}} + +
+
+ upload samples + + + + +
+ + + + See the documentation below for + details on expected file format. +
+ +
+ + + + + If you select 'Other' for the field separator value, + enter the character that separates the fields in your CSV file in the form + field below. + +
+ +
+ + + + Select this if the first line in your file contains headings for the + columns. + +
+ +
+ + + + If there is a character delimiting the string texts within particular + fields in your CSV, provide the character here. This can be left blank if + no such delimiters exist in your file. + +
+ + +
+
+ +
+

Preview File Content

+ + + + + + + + + + + + + + + + + + +
preview content
NameName2SymbolAlias
+ Please make some selections in the form above to preview the data.
+
+ + + +
+

File Format

+

+ Upload a character-separated value (CSV) file that contains + details about your samples. The CSV file should have the following fields: +

+
Name
+
The primary name/identifier for the sample/individual.
+ +
Name2
+
A secondary name for the sample. This can simply be the same as + Name above. This field MUST contain a + value.
+ +
Symbol
+
A symbol for the sample. This can be a strain name, e.g. 'BXD60' for + species that have strains. This field can be left empty for species like + Humans that do not have strains..
+ +
Alias
+
An alias for the sample. Can be an empty field, or take on the same + value as that of the Symbol.
+
+

+
+{%endblock%} + +{%block javascript%} + +{%endblock%} diff --git a/uploader/templates/samples/sui-upload-success.html b/uploader/templates/samples/sui-upload-success.html new file mode 100644 index 0000000..054bde8 --- /dev/null +++ b/uploader/templates/samples/sui-upload-success.html @@ -0,0 +1,31 @@ +{%extends "samples/sui-base.html"%} +{%from "cli-output.html" import cli_output%} + +{%block title%}Job Status{%endblock%} + +{%block contents%} + +
+

{{job.job_name[0:50]}}…

+ +

+ status: + {{job["status"]}} ({{job.get("message", "-")}})
+

+ +

Successfully uploaded the samples.

+

+ + View samples + +

+
+ +
+ {{cli_output(job, "stdout")}} +
+ +{%endblock%} -- cgit 1.4.1