diff options
Diffstat (limited to 'uploader/templates/phenotypes/view-dataset.html')
| -rw-r--r-- | uploader/templates/phenotypes/view-dataset.html | 119 |
1 files changed, 92 insertions, 27 deletions
diff --git a/uploader/templates/phenotypes/view-dataset.html b/uploader/templates/phenotypes/view-dataset.html index 38a4d11..c634a48 100644 --- a/uploader/templates/phenotypes/view-dataset.html +++ b/uploader/templates/phenotypes/view-dataset.html @@ -46,12 +46,50 @@ </div> <div class="row"> - <p><a href="{{url_for('species.populations.phenotypes.add_phenotypes', - species_id=species.SpeciesId, - population_id=population.Id, - dataset_id=dataset.Id)}}" - title="Add a bunch of phenotypes" - class="btn btn-primary">Add phenotypes</a></p> + <div class="col"> + <a href="{{url_for('species.populations.phenotypes.add_phenotypes', + species_id=species.SpeciesId, + population_id=population.Id, + dataset_id=dataset.Id)}}" + title="Add a bunch of phenotypes" + class="btn btn-primary">Add phenotypes</a> + </div> + + <div class="col"> + <form id="frm-recompute-phenotype-means" + method="POST" + action="{{url_for( + 'species.populations.phenotypes.recompute_means', + species_id=species['SpeciesId'], + population_id=population['Id'], + dataset_id=dataset['Id'])}}" + class="d-flex flex-row align-items-center flex-wrap" + style="display: inline;"> + <input type="submit" + title="Compute/Recompute the means for all phenotypes." + class="btn btn-info" + value="(rec/c)ompute means" + id="submit-frm-recompute-phenotype-means" /> + </form> + </div> + + <div class="col"> + <form id="frm-run-qtlreaper" + method="POST" + action="{{url_for( + 'species.populations.phenotypes.rerun_qtlreaper', + species_id=species['SpeciesId'], + population_id=population['Id'], + dataset_id=dataset['Id'])}}" + class="d-flex flex-row align-items-center flex-wrap" + style="display: inline;"> + <input type="submit" + title="Run/Rerun QTLReaper." + class="btn btn-info" + value="(re)run QTLReaper" + id="submit-frm-rerun-qtlreaper" /> + </form> + </div> </div> <div class="row"> @@ -65,11 +103,7 @@ <div class="row"> - <div style="padding-bottom: 0.5em;"> - <a href="#" class="btn btn-info" id="btn-phenotypes-list-select-all">select all</a> - <a href="#" class="btn btn-info" id="btn-phenotypes-list-deselect-all">deselect all</a> - <a href="#" class="btn btn-info" id="btn-phenotypes-list-edit">edit</a> - </div> + <table id="tbl-phenotypes-list" class="table compact stripe cell-border"> <thead> <tr> @@ -93,20 +127,16 @@ {%block javascript%} <script type="text/javascript"> $(function() { - dtAddCommonHandlers("#tbl-phenotypes-list"); - + var species_id = {{species.SpeciesId}}; + var population_id = {{population.Id}}; + var dataset_id = {{dataset.Id}}; + var dataset_name = "{{dataset.Name}}"; var data = {{phenotypes | tojson}}; - $("#tbl-phenotypes-list").DataTable({ - responsive: true, - lengthMenu: [10, 25, 50, 100, 1000, data.length], - language: { - processing: "Processing results… Please wait.", - loadingRecord: "Loading phenotypes — Please wait.", - info: "_START_ to _END_ of _TOTAL_ phenotypes", - lengthMenu: "Show _MENU_ phenotypes", - }, - data: data, - columns: [ + + var dtPhenotypesList = buildDataTable( + "#tbl-phenotypes-list", + data, + [ { data: function(pheno) { return `<input type="checkbox" name="selected-phenotypes" ` @@ -117,7 +147,7 @@ }, {data: "sequence_number"}, { - data: function(pheno) { + data: function(pheno, type, set, meta) { var spcs_id = {{species.SpeciesId}}; var pop_id = {{population.Id}}; var dtst_id = {{dataset.Id}}; @@ -137,8 +167,43 @@ pheno.Pre_publication_description); } } - ] - }); + ], + { + select: "multi+shift", + layout: { + top1Start: { + pageLength: { + text: "Show _MENU_ of _TOTAL_" + } + }, + topStart: "info", + top1End: null + }, + rowId: function(pheno) { + return `${pheno.InbredSetCode}_${pheno.xref_id}`; + } + }); + + + $("#submit-frm-rerun-qtlreaper").on( + "click", + function(event) { + // (Re)run the QTLReaper script for selected phenotypes. + event.preventDefault(); + var form = $("#frm-run-qtlreaper"); + form.find(".dynamically-added-element").remove(); + dtPhenotypesList.rows({selected: true}).nodes().each((node, index) => { + _cloned = $(node).find(".chk-row-select").clone(); + _cloned.removeAttr("id"); + _cloned.removeAttr("class"); + _cloned.attr("style", "display: none;"); + _cloned.attr("data-type", "dynamically-added-element"); + _cloned.attr("class", "dynamically-added-element checkbox"); + _cloned.prop("checked", true); + form.append(_cloned); + }); + form.submit(); + }); }); </script> {%endblock%} |
