about summary refs log tree commit diff
path: root/gn2/wqflask/static/new/javascript
diff options
context:
space:
mode:
authorAlexander Kabui2024-08-30 16:47:55 +0300
committerGitHub2024-08-30 16:47:55 +0300
commited20621c23a9a41152f3d6a48334f2a31c018033 (patch)
tree5e2182b99f5f05e2f667dfce1b762921c4ec62dc /gn2/wqflask/static/new/javascript
parent9a345d8abf2f0045b2c47bfcf1ae5860273452be (diff)
parent6db49002d4d2e69fcf4fdd6be6aceeea7b95664f (diff)
downloadgenenetwork2-ed20621c23a9a41152f3d6a48334f2a31c018033.tar.gz
Merge pull request #861 from genenetwork/feature/gnqa-search-2
Feature/gnqa search 2
Diffstat (limited to 'gn2/wqflask/static/new/javascript')
-rw-r--r--gn2/wqflask/static/new/javascript/auth/search_phenotypes.js6
-rw-r--r--gn2/wqflask/static/new/javascript/initialize_show_trait_tables.js2
-rw-r--r--gn2/wqflask/static/new/javascript/search_results.js49
-rw-r--r--gn2/wqflask/static/new/javascript/table_functions.js47
4 files changed, 52 insertions, 52 deletions
diff --git a/gn2/wqflask/static/new/javascript/auth/search_phenotypes.js b/gn2/wqflask/static/new/javascript/auth/search_phenotypes.js
index 99ecb16e..8689af75 100644
--- a/gn2/wqflask/static/new/javascript/auth/search_phenotypes.js
+++ b/gn2/wqflask/static/new/javascript/auth/search_phenotypes.js
@@ -96,8 +96,8 @@ function display_search_results(data, textStatus, jqXHR) {
  * @param {UUID}: The job id to fetch data for
  */
 function fetch_search_results(job_id, success, error=default_error_fn) {
-    host = $("#frm-search-traits").attr("data-gn-server-url");
-    endpoint = host + "auth/data/search/phenotype/" + job_id
+    endpoint = $("#frm-search-traits").attr(
+        "data-pheno-results-template").replace("<jobid>", job_id);
     $("#txt-search").prop("disabled", true);
     $.ajax(
 	endpoint,
@@ -119,7 +119,7 @@ function search_phenotypes() {
     per_page = document.getElementById("txt-per-page").value
     search_table = new TableDataSource(
 	"#tbl-phenotypes", "data-traits", search_checkbox);
-    endpoint = "/auth/data/phenotype/search"
+    endpoint = endpoint = $("#frm-search-traits").attr("data-search-endpoint");
     $.ajax(
 	endpoint,
 	{
diff --git a/gn2/wqflask/static/new/javascript/initialize_show_trait_tables.js b/gn2/wqflask/static/new/javascript/initialize_show_trait_tables.js
index 44076c17..970a49a3 100644
--- a/gn2/wqflask/static/new/javascript/initialize_show_trait_tables.js
+++ b/gn2/wqflask/static/new/javascript/initialize_show_trait_tables.js
@@ -141,7 +141,7 @@ buildColumns = function() {
     columnList.push(
       {
         'title': "<div title='" + js_data.attributes[attrKeys[i]].description + "' style='text-align: " + js_data.attributes[attrKeys[i]].alignment + "'>" + js_data.attributes[attrKeys[i]].name + "</div>",
-        'type': "natural",
+        'type': "natural-minus-na",
         'data': null,
         'targets': attrStart + i,
         'render': function(data, type, row, meta) {
diff --git a/gn2/wqflask/static/new/javascript/search_results.js b/gn2/wqflask/static/new/javascript/search_results.js
index c263ef49..c89b4ce3 100644
--- a/gn2/wqflask/static/new/javascript/search_results.js
+++ b/gn2/wqflask/static/new/javascript/search_results.js
@@ -309,7 +309,7 @@ $(function() {
       return submit_special("/loading")
   });
 
-  $("#send_to_webgestalt, #send_to_bnw, #send_to_geneweaver").on("click", function() {
+  $("#send_to_webgestalt, #send_to_bnw, #send_to_geneweaver, #send_to_genecup").on("click", function() {
       traits = getTraitsFromTable()
       $("#trait_list").val(traits)
       url = $(this).data("url")
@@ -325,53 +325,6 @@ $(function() {
   $("#export_traits").click(exportTraits);
   $("#export_collection").click(exportCollection);
 
-  let naturalAsc = $.fn.dataTableExt.oSort["natural-ci-asc"]
-  let naturalDesc = $.fn.dataTableExt.oSort["natural-ci-desc"]
-
-  let na_equivalent_vals = ["N/A", "--", ""]; //ZS: Since there are multiple values that should be treated the same as N/A
-
-  function extractInnerText(the_string){
-    var span = document.createElement('span');
-    span.innerHTML = the_string;
-    return span.textContent || span.innerText;
-  }
-
-  function sortNAs(a, b, sort_function){
-    if ( na_equivalent_vals.includes(a) && na_equivalent_vals.includes(b)) {
-      return 0;
-    }
-    if (na_equivalent_vals.includes(a)){
-      return 1
-    }
-    if (na_equivalent_vals.includes(b)) {
-      return -1;
-    }
-    return sort_function(a, b)
-  }
-
-  $.extend( $.fn.dataTableExt.oSort, {
-    "natural-minus-na-asc": function (a, b) {
-      return sortNAs(extractInnerText(a), extractInnerText(b), naturalAsc)
-    },
-    "natural-minus-na-desc": function (a, b) {
-      return sortNAs(extractInnerText(a), extractInnerText(b), naturalDesc)
-    }
-  });
-
-  $.fn.dataTable.ext.order['dom-checkbox'] = function  ( settings, col )
-  {
-      return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
-          return $('input', td).prop('checked') ? '1' : '0';
-      } );
-  };
-
-  $.fn.dataTable.ext.order['dom-inner-text'] = function  ( settings, col )
-  {
-      return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
-          return $(td).text();
-      } );
-  }
-
   applyDefault = function() {
     let default_collection_id = $.cookie('default_collection');
     if (default_collection_id) {
diff --git a/gn2/wqflask/static/new/javascript/table_functions.js b/gn2/wqflask/static/new/javascript/table_functions.js
index 62888cd9..a648778e 100644
--- a/gn2/wqflask/static/new/javascript/table_functions.js
+++ b/gn2/wqflask/static/new/javascript/table_functions.js
@@ -88,3 +88,50 @@ function saveColumnSettings(tableId, traitTable) {
   // Save (or update) the settings in localStorage
   localStorage.setItem(tableId, JSON.stringify(userColumnDefs));
 }
+
+let naturalAsc = $.fn.dataTableExt.oSort["natural-ci-asc"]
+let naturalDesc = $.fn.dataTableExt.oSort["natural-ci-desc"]
+
+let na_equivalent_vals = ["N/A", "--", "", "NULL"]; //ZS: Since there are multiple values that should be treated the same as N/A
+
+function extractInnerText(the_string){
+  var span = document.createElement('span');
+  span.innerHTML = the_string;
+  return span.textContent || span.innerText;
+}
+
+function sortNAs(a, b, sort_function){
+  if ( na_equivalent_vals.includes(a) && na_equivalent_vals.includes(b)) {
+    return 0;
+  }
+  if (na_equivalent_vals.includes(a)){
+    return 1
+  }
+  if (na_equivalent_vals.includes(b)) {
+    return -1;
+  }
+  return sort_function(a, b)
+}
+
+$.extend( $.fn.dataTableExt.oSort, {
+  "natural-minus-na-asc": function (a, b) {
+    return sortNAs(extractInnerText(a), extractInnerText(b), naturalAsc)
+  },
+  "natural-minus-na-desc": function (a, b) {
+    return sortNAs(extractInnerText(a), extractInnerText(b), naturalDesc)
+  }
+});
+
+$.fn.dataTable.ext.order['dom-checkbox'] = function  ( settings, col )
+{
+    return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
+        return $('input', td).prop('checked') ? '1' : '0';
+    } );
+};
+
+$.fn.dataTable.ext.order['dom-inner-text'] = function  ( settings, col )
+{
+    return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
+        return $(td).text();
+    } );
+}
\ No newline at end of file