about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--wqflask/utility/authentication_tools.py6
-rw-r--r--wqflask/wqflask/show_trait/show_trait.py4
-rw-r--r--wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js48
3 files changed, 30 insertions, 28 deletions
diff --git a/wqflask/utility/authentication_tools.py b/wqflask/utility/authentication_tools.py
index 9a2a5ccd..ece7022c 100644
--- a/wqflask/utility/authentication_tools.py
+++ b/wqflask/utility/authentication_tools.py
@@ -24,9 +24,9 @@ def check_resource_availability(dataset, trait_id=None):
 
     resource_id = get_resource_id(dataset, trait_id)
 
-    if resource_id:
+    if resource_id: #ZS: This should never be false, but it's technically possible if a non-Temp dataset somehow had a type other than Publish/ProbeSet/Geno
         resource_info = get_resource_info(resource_id)
-        if not resource_info:
+        if not resource_info: #ZS: If resource isn't already in redis, add it with default privileges
             resource_info = add_new_resource(dataset, trait_id)
 
     #ZS: Check if super-user - we should probably come up with some way to integrate this into the proxy
@@ -84,7 +84,7 @@ def check_admin(resource_id=None):
     try:
         response = json.loads(requests.get(the_url).content)['admin']
     except:
-        logger.debug(resource_info)
+        resource_info = get_resource_info(resource_id)
         response = resource_info['default_mask']['admin']
 
     if 'edit-admins' in response:
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 5fc69cab..f188fd9d 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -546,9 +546,9 @@ def get_table_widths(sample_groups, has_num_cases=False):
 
     trait_table_width = 380
     if sample_groups[0].se_exists():
-        trait_table_width += 70
+        trait_table_width += 80
     if has_num_cases:
-        trait_table_width += 30
+        trait_table_width += 80
     trait_table_width += len(sample_groups[0].attributes)*70
 
     trait_table_width = str(trait_table_width) + "px"
diff --git a/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js b/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
index 934cc14d..a8a3041d 100644
--- a/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
+++ b/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
@@ -37,29 +37,31 @@ $('#trait_table').dataTable( {
     "orderClasses": true
 } );
 
-$('#collection_table').dataTable( {
-    "createdRow": function ( row, data, index ) {
-        if ($('td', row).eq(2).text().length > 40) {
-            $('td', row).eq(2).text($('td', row).eq(2).text().substring(0, 40));
-            $('td', row).eq(2).text($('td', row).eq(2).text() + '...')
-        }
-        if ($('td', row).eq(4).text().length > 50) {
-            $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 50));
-            $('td', row).eq(4).text($('td', row).eq(4).text() + '...')
-        }
-    },
-    "columnDefs": [ {
-        "targets": 0,
-        "orderable": false
-    } ],
-    "order": [[1, "asc" ]],
-    "sDom": "ZRtr",
-    "iDisplayLength": -1,
-    "autoWidth": true,
-    "bSortClasses": false,
-    "paging": false,
-    "orderClasses": true
-} );
+if ( ! $.fn.DataTable.isDataTable( '#collection_table' ) ) {
+  $('#collection_table').dataTable( {
+      "createdRow": function ( row, data, index ) {
+          if ($('td', row).eq(2).text().length > 40) {
+              $('td', row).eq(2).text($('td', row).eq(2).text().substring(0, 40));
+              $('td', row).eq(2).text($('td', row).eq(2).text() + '...')
+          }
+          if ($('td', row).eq(4).text().length > 50) {
+              $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 50));
+              $('td', row).eq(4).text($('td', row).eq(4).text() + '...')
+          }
+      },
+      "columnDefs": [ {
+          "targets": 0,
+          "orderable": false
+      } ],
+      "order": [[1, "asc" ]],
+      "sDom": "ZRtr",
+      "iDisplayLength": -1,
+      "autoWidth": true,
+      "bSortClasses": false,
+      "paging": false,
+      "orderClasses": true
+  } );
+}
 
 collection_click = function() {
   var this_collection_url;