about summary refs log tree commit diff
path: root/uploader/templates/samples
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/templates/samples')
-rw-r--r--uploader/templates/samples/list-samples.html36
-rw-r--r--uploader/templates/samples/sui-base.html25
-rw-r--r--uploader/templates/samples/sui-list-samples.html98
-rw-r--r--uploader/templates/samples/sui-upload-failure.html32
-rw-r--r--uploader/templates/samples/sui-upload-progress.html26
-rw-r--r--uploader/templates/samples/sui-upload-samples.html153
-rw-r--r--uploader/templates/samples/sui-upload-success.html31
-rw-r--r--uploader/templates/samples/upload-samples.html18
8 files changed, 391 insertions, 28 deletions
diff --git a/uploader/templates/samples/list-samples.html b/uploader/templates/samples/list-samples.html
index 185e784..aed27c3 100644
--- a/uploader/templates/samples/list-samples.html
+++ b/uploader/templates/samples/list-samples.html
@@ -29,6 +29,19 @@
   </p>
 </div>
 
+<div class="row">
+  <p>
+    <a href="{{url_for('species.populations.samples.upload_samples',
+             species_id=species.SpeciesId,
+             population_id=population.Id)}}"
+       title="Add samples for population '{{population.FullName}}' from species
+              '{{species.FullName}}'."
+       class="btn btn-primary">
+      add samples
+    </a>
+  </p>
+</div>
+
 {%if samples | length > 0%}
 <div class="row">
   <p>
@@ -96,32 +109,17 @@
 
   <p>
     <a href="#"
-       title="Add samples for population '{{population.FullName}}' from species
+       title="Delete samples from population '{{population.FullName}}' from species
               '{{species.FullName}}'."
-       class="btn btn-danger">
+       class="btn btn-danger not-implemented">
       delete all samples
     </a>
   </p>
 </div>
-
 {%else%}
-
 <div class="row">
-  <p>
-    There are no samples entered for this population. Do please go ahead and add
-    the samples for this population by clicking on the button below.
-  </p>
-
-  <p>
-    <a href="{{url_for('species.populations.samples.upload_samples',
-             species_id=species.SpeciesId,
-             population_id=population.Id)}}"
-       title="Add samples for population '{{population.FullName}}' from species
-              '{{species.FullName}}'."
-       class="btn btn-primary">
-      add samples
-    </a>
-  </p>
+  <p>There are no samples entered for this population. Click the "Add Samples"
+    button above, to add some new samples.</p>
 </div>
 {%endif%}
 
diff --git a/uploader/templates/samples/sui-base.html b/uploader/templates/samples/sui-base.html
new file mode 100644
index 0000000..8ec7505
--- /dev/null
+++ b/uploader/templates/samples/sui-base.html
@@ -0,0 +1,25 @@
+{%extends "populations/sui-base.html"%}
+{%from "populations/macro-display-population-card.html" import display_sui_population_card%}
+
+{%block breadcrumbs%}
+{{super()}}
+<li class="breadcrumb-item">
+  <a href="{{url_for('species.populations.samples.list_samples',
+           species_id=species['SpeciesId'],
+           population_id=population.Id)}}">
+    Samples
+  </a>
+</li>
+{%endblock%}
+
+{%block contents%}
+<div class="row">
+  <h2 class="heading">{{population.FullName}} ({{population.Name}})</h2>
+</div>
+{%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
new file mode 100644
index 0000000..e9ed71a
--- /dev/null
+++ b/uploader/templates/samples/sui-list-samples.html
@@ -0,0 +1,98 @@
+{%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 &mdash; List Samples{%endblock%}
+
+{%block contents%}
+{{super()}}
+
+<div class="row">
+  <h3 class="subheading">manage samples</h3>
+  {{flash_all_messages()}}
+</div>
+
+<div class="row">
+  <div class="col">
+    <a href="{{url_for('species.populations.samples.upload_samples',
+             species_id=species.SpeciesId,
+             population_id=population.Id)}}"
+       title="Add samples for population '{{population.FullName}}' from species
+              '{{species.FullName}}'."
+       class="btn btn-primary">add new samples</a>
+  </div>
+</div>
+
+{%if samples | length > 0%}
+<div class="row">
+  <p>
+    Population "{{population.FullName}} ({{population.Name}})" already has
+    <strong>{{total_samples}}</strong> samples/individuals entered. You can
+    explore the list of samples in the table below.
+  </p>
+</div>
+
+<div class="row">
+  <div class="col-md-2">
+    {%if offset > 0:%}
+    <a href="{{url_for('species.populations.samples.list_samples',
+             species_id=species.SpeciesId,
+             population_id=population.Id,
+             from=offset-count,
+             count=count)}}">
+      <span class="glyphicon glyphicon-backward"></span>
+      Previous
+    </a>
+    {%endif%}
+  </div>
+
+  <div class="col-md-8" style="text-align: center;">
+    Samples {{offset}} &mdash; {{offset+(count if offset + count < total_samples else total_samples - offset)}} / {{total_samples}}
+                                                                   </div>
+
+  <div class="col-md-2">
+    {%if offset + count < total_samples:%}
+    <a href="{{url_for('species.populations.samples.list_samples',
+             species_id=species.SpeciesId,
+             population_id=population.Id,
+             from=offset+count,
+             count=count)}}">
+      Next
+      <span class="glyphicon glyphicon-forward"></span>
+    </a>
+    {%endif%}
+  </div>
+</div>
+<div class="row">
+  <table class="table">
+    <thead>
+      <tr>
+        <th></th>
+        <th>Name</th>
+        <th>Auxilliary Name</th>
+        <th>Symbol</th>
+        <th>Alias</th>
+      </tr>
+    </thead>
+
+    <tbody>
+      {%for sample in samples%}
+      <tr>
+        <td>{{sample.sequence_number}}</td>
+        <td>{{sample.Name}}</td>
+        <td>{{sample.Name2}}</td>
+        <td>{{sample.Symbol or "-"}}</td>
+        <td>{{sample.Alias or "-"}}</td>
+      </tr>
+      {%endfor%}
+    </tbody>
+  </table>
+</div>
+{%else%}
+<div class="row">
+  <p>There are no samples entered for this population. Click the "Add Samples"
+    button above, to add some new samples.</p>
+</div>
+{%endif%}
+
+{%endblock%}
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%}
+<div class="row">
+<h2 class="heading">{{job.job_name[0:50]}}&hellip;</h2>
+
+<p>There was a failure attempting to upload the samples.</p>
+
+<p>Here is some information to help with debugging the issue. Provide this
+  information to the developer/maintainer.</p>
+
+<h3>Debugging Information</h3>
+<ul>
+  <li><strong>job id</strong>: {{job.jobid}}</li>
+  <li><strong>status</strong>: {{job.status}}</li>
+  <li><strong>job type</strong>: {{job["job-type"]}}</li>
+</ul>
+</div>
+
+<div class="row">
+<h4>stdout</h4>
+{{cli_output(job, "stdout")}}
+</div>
+
+<div class="row">
+<h4>stderr</h4>
+{{cli_output(job, "stderr")}}
+</div>
+{%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%}
+<meta http-equiv="refresh" content="5">
+{%endblock%}
+
+{%block title%}Job Status{%endblock%}
+
+{%block contents%}
+<div class="row" style="overflow-x: clip;">
+<h2 class="heading">{{job.job_name[0:50]}}&hellip;</h2>
+
+<p>
+<strong>status</strong>:
+<span>{{job["status"]}} ({{job.get("message", "-")}})</span><br />
+</p>
+
+<p>saving to database...</p>
+</div>
+
+<div class="row">
+  {{cli_output(job, "stdout")}}
+</div>
+
+{%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 &mdash; Upload Samples{%endblock%}
+
+{%block breadcrumbs%}
+{{super()}}
+<li class="breadcrumb-item">
+  <a href="{{url_for('species.populations.samples.upload_samples',
+           species_id=species['SpeciesId'],
+           population_id=population.Id)}}">
+    Upload
+  </a>
+</li>
+{%endblock%}
+
+{%block contents%}
+{{flash_all_messages()}}
+
+<div class="row">
+  <form id="form-samples"
+        method="POST"
+        action="{{url_for('species.populations.samples.upload_samples',
+                species_id=species.SpeciesId,
+                population_id=population.InbredSetId)}}"
+        enctype="multipart/form-data">
+    <legend class="heading">upload samples</legend>
+
+    <input type="hidden" name="species_id" value="{{species.SpeciesId}}" />
+    <input type="hidden" name="population_id" value="{{population.Id}}" />
+
+    <div class="form-group">
+      <label for="file-samples" class="form-label">select file</label>
+      <input type="file" name="samples_file" id="file-samples"
+	     accept="text/csv, text/tab-separated-values, text/plain"
+	     class="form-control" />
+      <small class="form-text text-muted">
+        See the <a href="#docs-samples-upload">documentation below</a> for
+        details on expected file format.</small>
+    </div>
+
+    <div class="form-group">
+      <label for="select-separator" class="form-label">field separator</label>
+      <select id="select-separator"
+	      name="separator"
+	      required="required"
+	      class="form-control">
+        <option value="">Select separator for your file: (default is comma)</option>
+        <option value="&#x0009;">TAB</option>
+        <option value="&#x0020;">Space</option>
+        <option value=",">Comma</option>
+        <option value=";">Semicolon</option>
+        <option value="other">Other</option>
+      </select>
+      <input id="txt-separator"
+	     type="text"
+	     name="other_separator"
+	     class="form-control" />
+      <small class="form-text text-muted">
+        If you select '<strong>Other</strong>' for the field separator value,
+        enter the character that separates the fields in your CSV file in the form
+        field below.
+      </small>
+    </div>
+
+    <div class="form-group form-check">
+      <input id="chk-heading"
+	     type="checkbox"
+	     name="first_line_heading"
+	     class="form-check-input" />
+      <label for="chk-heading" class="form-check-label">
+        first line is a heading?</label>
+      <small class="form-text text-muted">
+        Select this if the first line in your file contains headings for the
+        columns.
+      </small>
+    </div>
+
+    <div class="form-group">
+      <label for="txt-delimiter" class="form-label">field delimiter</label>
+      <input id="txt-delimiter"
+	     type="text"
+	     name="field_delimiter"
+	     maxlength="1"
+	     class="form-control" />
+      <small class="form-text text-muted">
+        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.
+      </small>
+    </div>
+
+    <button type="submit"
+	    class="btn btn-primary">upload samples file</button>
+  </form>
+</div>
+
+<div class="row">
+  <h3>Preview File Content</h3>
+
+  <table id="tbl:samples-preview" class="table">
+    <caption class="heading">preview content</caption>
+
+    <thead>
+      <tr>
+        <th>Name</th>
+        <th>Name2</th>
+        <th>Symbol</th>
+        <th>Alias</th>
+      </tr>
+    </thead>
+
+    <tbody>
+      <tr id="default-row">
+        <td colspan="4">
+	  Please make some selections in the form above to preview the data.</td>
+      </tr>
+    </tbody>
+  </table>
+</div>
+
+
+
+<div class="row" id="docs-samples-upload">
+  <h3 class="subheading">File Format</h3>
+  <p>
+    Upload a <strong>character-separated value (CSV)</strong> file that contains
+    details about your samples. The CSV file should have the following fields:
+    <dl>
+      <dt>Name</dt>
+      <dd>The primary name/identifier for the sample/individual.</dd>
+
+      <dt>Name2</dt>
+      <dd>A secondary name for the sample. This can simply be the same as
+        <strong>Name</strong> above. This field <strong>MUST</strong> contain a
+        value.</dd>
+
+      <dt>Symbol</dt>
+      <dd>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..</dd>
+
+      <dt>Alias</dt>
+      <dd>An alias for the sample. Can be an empty field, or take on the same
+        value as that of the Symbol.</dd>
+    </dl>
+  </p>
+</div>
+{%endblock%}
+
+{%block javascript%}
+<script src="/static/js/upload_samples.js" type="text/javascript"></script>
+{%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%}
+
+<div class="row" style="overflow-x: clip;">
+  <h2 class="heading">{{job.job_name[0:50]}}&hellip;</h2>
+
+  <p>
+    <strong>status</strong>:
+    <span>{{job["status"]}} ({{job.get("message", "-")}})</span><br />
+  </p>
+
+  <p>Successfully uploaded the samples.</p>
+  <p>
+    <a href="{{url_for('species.populations.samples.list_samples',
+             species_id=species.SpeciesId,
+             population_id=population.Id)}}"
+       title="View population samples">
+      View samples
+    </a>
+  </p>
+</div>
+
+<div class="row">
+  {{cli_output(job, "stdout")}}
+</div>
+
+{%endblock%}
diff --git a/uploader/templates/samples/upload-samples.html b/uploader/templates/samples/upload-samples.html
index 25d3290..4aa2f7f 100644
--- a/uploader/templates/samples/upload-samples.html
+++ b/uploader/templates/samples/upload-samples.html
@@ -65,14 +65,14 @@
 
     <div class="form-group">
       <label for="file-samples" class="form-label">select file</label>
-      <input type="file" name="samples_file" id="file:samples"
-	     accept="text/csv, text/tab-separated-values"
+      <input type="file" name="samples_file" id="file-samples"
+	     accept="text/csv, text/tab-separated-values, text/plain"
 	     class="form-control" />
     </div>
 
     <div class="form-group">
-      <label for="select:separator" class="form-label">field separator</label>
-      <select id="select:separator"
+      <label for="select-separator" class="form-label">field separator</label>
+      <select id="select-separator"
 	      name="separator"
 	      required="required"
 	      class="form-control">
@@ -83,7 +83,7 @@
         <option value=";">Semicolon</option>
         <option value="other">Other</option>
       </select>
-      <input id="txt:separator"
+      <input id="txt-separator"
 	     type="text"
 	     name="other_separator"
 	     class="form-control" />
@@ -95,11 +95,11 @@
     </div>
 
     <div class="form-group form-check">
-      <input id="chk:heading"
+      <input id="chk-heading"
 	     type="checkbox"
 	     name="first_line_heading"
 	     class="form-check-input" />
-      <label for="chk:heading" class="form-check-label">
+      <label for="chk-heading" class="form-check-label">
         first line is a heading?</label>
       <small class="form-text text-muted">
         Select this if the first line in your file contains headings for the
@@ -108,8 +108,8 @@
     </div>
 
     <div class="form-group">
-      <label for="txt:delimiter" class="form-label">field delimiter</label>
-      <input id="txt:delimiter"
+      <label for="txt-delimiter" class="form-label">field delimiter</label>
+      <input id="txt-delimiter"
 	     type="text"
 	     name="field_delimiter"
 	     maxlength="1"