From b40f14bb409d54fda957e2d8269f1bc86bd34e58 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 29 Dec 2025 11:42:58 -0600 Subject: Samples: Move feature to new UI templates. --- uploader/samples/views.py | 12 +- uploader/templates/samples/base.html | 29 ++-- uploader/templates/samples/list-samples.html | 50 ++----- uploader/templates/samples/sui-base.html | 25 ---- uploader/templates/samples/sui-list-samples.html | 98 ------------- 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 ----- uploader/templates/samples/upload-failure.html | 5 - uploader/templates/samples/upload-progress.html | 5 - uploader/templates/samples/upload-samples.html | 81 +++++------ uploader/templates/samples/upload-success.html | 5 - 13 files changed, 72 insertions(+), 480 deletions(-) delete mode 100644 uploader/templates/samples/sui-base.html delete mode 100644 uploader/templates/samples/sui-list-samples.html delete mode 100644 uploader/templates/samples/sui-upload-failure.html delete mode 100644 uploader/templates/samples/sui-upload-progress.html delete mode 100644 uploader/templates/samples/sui-upload-samples.html delete mode 100644 uploader/templates/samples/sui-upload-success.html diff --git a/uploader/samples/views.py b/uploader/samples/views.py index 93f0c29..f8baf7e 100644 --- a/uploader/samples/views.py +++ b/uploader/samples/views.py @@ -11,8 +11,6 @@ from flask import (flash, Blueprint, current_app as app) -from uploader.sui import sui_template - from uploader import jobs from uploader.files import save_file from uploader.flask_extensions import url_for @@ -88,7 +86,7 @@ def list_samples(species: dict, population: dict, **kwargs):# pylint: disable=[u total_samples = len(all_samples) offset = max(safe_int(request.args.get("from") or 0), 0) count = int(request.args.get("count") or 20) - return render_template(sui_template("samples/list-samples.html"), + return render_template("samples/list-samples.html", species=species, population=population, samples=all_samples[offset:offset+count], @@ -149,7 +147,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(sui_template("samples/upload-samples.html"), + return render_template("samples/upload-samples.html", species=species, population=population) @@ -216,7 +214,7 @@ def upload_status(species: dict, population: dict, job_id: uuid.UUID, **kwargs): if job: status = job["status"] if status == "success": - return render_template(sui_template("samples/upload-success.html"), + return render_template("samples/upload-success.html", job=job, species=species, population=population,) @@ -236,7 +234,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(sui_template("samples/upload-progress.html"), + return render_template("samples/upload-progress.html", species=species, population=population, job=job) # maybe also handle this? @@ -267,7 +265,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(sui_template("samples/upload-failure.html"), + return render_template("samples/upload-failure.html", species=species, population=population, job=job) diff --git a/uploader/templates/samples/base.html b/uploader/templates/samples/base.html index 291782b..7fd5020 100644 --- a/uploader/templates/samples/base.html +++ b/uploader/templates/samples/base.html @@ -1,12 +1,25 @@ {%extends "populations/base.html"%} +{%from "populations/macro-display-population-card.html" import display_sui_population_card%} -{%block lvl3_breadcrumbs%} - -{%block lvl4_breadcrumbs%}{%endblock%} +{%endblock%} + +{%block contents%} +
+

{{population.FullName}} ({{population.Name}})

+
+{%endblock%} + + + +{%block sidebarcontents%} +{{display_sui_population_card(species, population)}} {%endblock%} diff --git a/uploader/templates/samples/list-samples.html b/uploader/templates/samples/list-samples.html index aed27c3..3aac984 100644 --- a/uploader/templates/samples/list-samples.html +++ b/uploader/templates/samples/list-samples.html @@ -1,53 +1,34 @@ {%extends "samples/base.html"%} {%from "flash_messages.html" import flash_all_messages%} {%from "populations/macro-select-population.html" import select_population_form%} -{%from "populations/macro-display-population-card.html" import display_population_card%} {%block title%}Samples — List Samples{%endblock%} -{%block pagetitle%}Samples — List Samples{%endblock%} - -{%block lvl4_breadcrumbs%} - -{%endblock%} - {%block contents%} -{{flash_all_messages()}} +{{super()}}
-

- You selected the population "{{population.FullName}}" from the - "{{species.FullName}}" species. -

+

manage samples

+ {{flash_all_messages()}}
-

+

- add samples - -

+ class="btn btn-primary">add new samples +
{%if samples | length > 0%}

- This population already has {{total_samples}} - samples/individuals entered. You can explore the list of samples in this - population in the table below. + Population "{{population.FullName}} ({{population.Name}})" already has + {{total_samples}} samples/individuals entered. You can + explore the list of samples in the table below.

@@ -106,15 +87,6 @@ {%endfor%} - -

- - delete all samples - -

{%else%}
@@ -124,7 +96,3 @@ {%endif%} {%endblock%} - -{%block sidebarcontents%} -{{display_population_card(species, population)}} -{%endblock%} diff --git a/uploader/templates/samples/sui-base.html b/uploader/templates/samples/sui-base.html deleted file mode 100644 index 8ec7505..0000000 --- a/uploader/templates/samples/sui-base.html +++ /dev/null @@ -1,25 +0,0 @@ -{%extends "populations/sui-base.html"%} -{%from "populations/macro-display-population-card.html" import display_sui_population_card%} - -{%block breadcrumbs%} -{{super()}} - -{%endblock%} - -{%block contents%} -
-

{{population.FullName}} ({{population.Name}})

-
-{%endblock%} - - - -{%block sidebarcontents%} -{{display_sui_population_card(species, population)}} -{%endblock%} diff --git a/uploader/templates/samples/sui-list-samples.html b/uploader/templates/samples/sui-list-samples.html deleted file mode 100644 index e9ed71a..0000000 --- a/uploader/templates/samples/sui-list-samples.html +++ /dev/null @@ -1,98 +0,0 @@ -{%extends "samples/sui-base.html"%} -{%from "flash_messages.html" import flash_all_messages%} -{%from "populations/macro-select-population.html" import select_population_form%} - -{%block title%}Samples — List Samples{%endblock%} - -{%block contents%} -{{super()}} - -
-

manage samples

- {{flash_all_messages()}} -
- -
- -
- -{%if samples | length > 0%} -
-

- Population "{{population.FullName}} ({{population.Name}})" already has - {{total_samples}} samples/individuals entered. You can - explore the list of samples in the table below. -

-
- -
-
- {%if offset > 0:%} - - - Previous - - {%endif%} -
- -
- Samples {{offset}} — {{offset+(count if offset + count < total_samples else total_samples - offset)}} / {{total_samples}} -
- -
- {%if offset + count < total_samples:%} - - Next - - - {%endif%} -
-
-
- - - - - - - - - - - - - {%for sample in samples%} - - - - - - - - {%endfor%} - -
NameAuxilliary NameSymbolAlias
{{sample.sequence_number}}{{sample.Name}}{{sample.Name2}}{{sample.Symbol or "-"}}{{sample.Alias or "-"}}
-
-{%else%} -
-

There are no samples entered for this population. Click the "Add Samples" - button above, to add some new samples.

-
-{%endif%} - -{%endblock%} diff --git a/uploader/templates/samples/sui-upload-failure.html b/uploader/templates/samples/sui-upload-failure.html deleted file mode 100644 index d950c50..0000000 --- a/uploader/templates/samples/sui-upload-failure.html +++ /dev/null @@ -1,32 +0,0 @@ -{%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 deleted file mode 100644 index 8412c46..0000000 --- a/uploader/templates/samples/sui-upload-progress.html +++ /dev/null @@ -1,26 +0,0 @@ -{%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 deleted file mode 100644 index 83c2061..0000000 --- a/uploader/templates/samples/sui-upload-samples.html +++ /dev/null @@ -1,153 +0,0 @@ -{%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 deleted file mode 100644 index 054bde8..0000000 --- a/uploader/templates/samples/sui-upload-success.html +++ /dev/null @@ -1,31 +0,0 @@ -{%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%} diff --git a/uploader/templates/samples/upload-failure.html b/uploader/templates/samples/upload-failure.html index 2cf8053..75192ec 100644 --- a/uploader/templates/samples/upload-failure.html +++ b/uploader/templates/samples/upload-failure.html @@ -1,6 +1,5 @@ {%extends "base.html"%} {%from "cli-output.html" import cli_output%} -{%from "populations/macro-display-population-card.html" import display_population_card%} {%block title%}Samples Upload Failure{%endblock%} @@ -31,7 +30,3 @@ {{cli_output(job, "stderr")}}
{%endblock%} - -{%block sidebarcontents%} -{{display_population_card(species, population)}} -{%endblock%} diff --git a/uploader/templates/samples/upload-progress.html b/uploader/templates/samples/upload-progress.html index 677d457..38f931b 100644 --- a/uploader/templates/samples/upload-progress.html +++ b/uploader/templates/samples/upload-progress.html @@ -1,6 +1,5 @@ {%extends "samples/base.html"%} {%from "cli-output.html" import cli_output%} -{%from "populations/macro-display-population-card.html" import display_population_card%} {%block extrameta%} @@ -25,7 +24,3 @@ {%endblock%} - -{%block sidebarcontents%} -{{display_population_card(species, population)}} -{%endblock%} diff --git a/uploader/templates/samples/upload-samples.html b/uploader/templates/samples/upload-samples.html index 4aa2f7f..1f665a3 100644 --- a/uploader/templates/samples/upload-samples.html +++ b/uploader/templates/samples/upload-samples.html @@ -1,56 +1,22 @@ {%extends "samples/base.html"%} {%from "flash_messages.html" import flash_all_messages%} -{%from "populations/macro-select-population.html" import select_population_form%} -{%from "populations/macro-display-population-card.html" import display_population_card%} {%block title%}Samples — Upload Samples{%endblock%} -{%block pagetitle%}Samples — Upload Samples{%endblock%} - -{%block lvl4_breadcrumbs%} - {%endblock%} {%block contents%} {{flash_all_messages()}} -
-

- You can now upload the samples for the "{{population.FullName}}" population - from the "{{species.FullName}}" species here. -

-

- 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.
-
-

-
-
+ + See the documentation below for + details on expected file format.
@@ -149,10 +118,34 @@
-{%endblock%} -{%block sidebarcontents%} -{{display_population_card(species, population)}} + + +
+

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%} diff --git a/uploader/templates/samples/upload-success.html b/uploader/templates/samples/upload-success.html index 881d466..d6318e9 100644 --- a/uploader/templates/samples/upload-success.html +++ b/uploader/templates/samples/upload-success.html @@ -1,6 +1,5 @@ {%extends "samples/base.html"%} {%from "cli-output.html" import cli_output%} -{%from "populations/macro-display-population-card.html" import display_population_card%} {%block title%}Job Status{%endblock%} @@ -30,7 +29,3 @@ {%endblock%} - -{%block sidebarcontents%} -{{display_population_card(species, population)}} -{%endblock%} -- cgit 1.4.1