aboutsummaryrefslogtreecommitdiff
path: root/qc_app/static/js/dbinsert.js
diff options
context:
space:
mode:
Diffstat (limited to 'qc_app/static/js/dbinsert.js')
-rw-r--r--qc_app/static/js/dbinsert.js55
1 files changed, 53 insertions, 2 deletions
diff --git a/qc_app/static/js/dbinsert.js b/qc_app/static/js/dbinsert.js
index 3c0be54..63d2c86 100644
--- a/qc_app/static/js/dbinsert.js
+++ b/qc_app/static/js/dbinsert.js
@@ -62,7 +62,6 @@ function setup_types(type_data) {
}
function setup_datasets(dataset_data) {
- console.info("DATASET DATA:", dataset_data);
elt = document.getElementById("dataset");
remove_children(elt);
dataset_data.forEach(dataset => {
@@ -75,14 +74,65 @@ function setup_datasets(dataset_data) {
trigger_change_event(elt);
}
+function radio_column(chip) {
+ col = document.createElement("td");
+ radio = document.createElement("input");
+ radio.setAttribute("type", "radio");
+ radio.setAttribute("name", "genechipid");
+ radio.setAttribute("value", chip["GeneChipId"]);
+ radio.setAttribute("required", "required");
+ col.appendChild(radio);
+ return col;
+}
+
+function setup_genechips(genechip_data) {
+ columns = ["GeneChipName", "Name", "GeoPlatform", "GO_tree_value"]
+ submit_button = document.querySelector(
+ "#select-dataset-form input[type='submit']");
+ elt = document.getElementById(
+ "genechips-table").getElementsByTagName("tbody")[0];
+ remove_children(elt);
+ if((genechip_data === undefined) || genechip_data.length === 0) {
+ row = document.createElement("tr");
+ col = document.createElement("td");
+ col.setAttribute("colspan", "5");
+ text = document.createTextNode("No chips found for selected species");
+ col.appendChild(text);
+ row.appendChild(col);
+ elt.appendChild(row);
+ submit_button.setAttribute("disabled", true);
+ return false;
+ }
+
+ submit_button.removeAttribute("disabled")
+ genechip_data.forEach(chip => {
+ row = document.createElement("tr");
+ row.appendChild(radio_column(chip));
+ columns.forEach(column => {
+ col = document.createElement("td");
+ content = document.createTextNode(chip[column]);
+ col.appendChild(content);
+ row.appendChild(col);
+ });
+ elt.appendChild(row);
+ });
+}
+
function menu_contents() {
return JSON.parse(
- document.getElementsByTagName("form")[0].getAttribute(
+ document.getElementById("select-dataset-form").getAttribute(
"data-menu-content"));
}
+function genechips() {
+ return JSON.parse(
+ document.getElementById("select-dataset-form").getAttribute(
+ "data-genechips"));
+}
+
function update_menu(event) {
menu = menu_contents();
+ genec = genechips();
species_elt = document.getElementById("species");
group_elt = document.getElementById("group");
@@ -91,6 +141,7 @@ function update_menu(event) {
if(event.target == species_elt) {
setup_groups(menu["groups"][species_elt.value]);
+ setup_genechips(genec[species_elt.value.toLowerCase()]);
}
if(event.target == group_elt) {