131 lines
3.4 KiB
HTML
131 lines
3.4 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<meta charset="utf-8">
|
||
|
|
|
||
|
|
<html>
|
||
|
|
<header>
|
||
|
|
|
||
|
|
<link href="bootstrap-5.0.2-dist/css/bootstrap.min.css" rel="stylesheet" ></link>
|
||
|
|
<script src="bootstrap-5.0.2-dist/js/bootstrap.bundle.min.js" ></script>
|
||
|
|
</header>
|
||
|
|
<body>
|
||
|
|
<div class="container">
|
||
|
|
<div class="row">
|
||
|
|
<div class="col-3">
|
||
|
|
<label class = "form-label" for="sample_chooser">choose the sample</label>
|
||
|
|
<select class="form-select" name="sample_chooser" id = "sample_chooser"></select>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<h1>ok here are the results</h1>
|
||
|
|
|
||
|
|
<p> Fungal to Bacterial ratio: <span id="BtoF"> </span></p>
|
||
|
|
|
||
|
|
<table class="table" id = "nematode_scan" style="width:100%">
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th>
|
||
|
|
functional group
|
||
|
|
</th>
|
||
|
|
<th>
|
||
|
|
count
|
||
|
|
</th>
|
||
|
|
<th>
|
||
|
|
number per m³
|
||
|
|
</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
</table>
|
||
|
|
<table class="table" id = "main_scan" style="width:100%">
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th>
|
||
|
|
organism [unit]
|
||
|
|
</th>
|
||
|
|
<th>
|
||
|
|
quantity
|
||
|
|
</th>
|
||
|
|
<th>
|
||
|
|
standard deviation
|
||
|
|
</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
</body>
|
||
|
|
<script>
|
||
|
|
var db;
|
||
|
|
let openRequest = indexedDB.open("my_db");
|
||
|
|
var sample;
|
||
|
|
var samples = {};
|
||
|
|
|
||
|
|
openRequest.onerror = function() {
|
||
|
|
console.error("Error", openRequest.error);
|
||
|
|
};
|
||
|
|
|
||
|
|
openRequest.onsuccess = function() {
|
||
|
|
db = openRequest.result;
|
||
|
|
get_all_samples();
|
||
|
|
// continue working with database using db object
|
||
|
|
};
|
||
|
|
|
||
|
|
function get_all_samples(){
|
||
|
|
const request = db.transaction('sample')
|
||
|
|
.objectStore('sample')
|
||
|
|
.openCursor();
|
||
|
|
request.onsuccess = ()=> {
|
||
|
|
let cursor = event.target.result;
|
||
|
|
if (cursor) {
|
||
|
|
// Access the current record
|
||
|
|
make_sample_chooser(cursor.value, cursor.key);
|
||
|
|
sample = cursor.key;
|
||
|
|
// Move to the next record
|
||
|
|
cursor.continue();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
request.onerror = (err)=> {
|
||
|
|
console.error(`Error to get all setups: ${err}`)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
var sample_chooser = document.querySelector("#sample_chooser");
|
||
|
|
|
||
|
|
function make_sample_chooser(sample, key){
|
||
|
|
let sampleID = document.createElement("option");
|
||
|
|
let text = document.createTextNode(sample.Name);
|
||
|
|
sampleID.value = key;
|
||
|
|
samples[key] = sample;
|
||
|
|
sampleID.appendChild(text);
|
||
|
|
sample_chooser.appendChild(sampleID);
|
||
|
|
}
|
||
|
|
|
||
|
|
sample_chooser.addEventListener("change", change_sample);
|
||
|
|
function change_sample(){
|
||
|
|
sample = samples[this.value];
|
||
|
|
};
|
||
|
|
|
||
|
|
function get_results(){
|
||
|
|
const request = db.transaction('main_scan')
|
||
|
|
.objectStore('main_scan')
|
||
|
|
.openCursor();
|
||
|
|
request.onsuccess = ()=> {
|
||
|
|
let cursor = event.target.result;
|
||
|
|
if (cursor) {
|
||
|
|
// Access the current record
|
||
|
|
if (cursor.value.sampleID = sample_chooser.value)
|
||
|
|
render_main_scan_table(cursor.value, cursor.key);
|
||
|
|
sample = cursor.key;
|
||
|
|
// Move to the next record
|
||
|
|
cursor.continue();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
request.onerror = (err)=> {
|
||
|
|
console.error(`Error to get all setups: ${err}`)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function render_main_scan_table(result, key)
|
||
|
|
</script>
|
||
|
|
</html>
|