From 2c94097c49eedff1def1fb7d53572f290b8fe7d1 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Mon, 17 Apr 2017 22:24:40 +0000
Subject: Added option to remove collections from collection list page
Improved appearance of search result and collection tables
---
wqflask/base/data_set.py | 2 +-
wqflask/wqflask/collect.py | 19 +++--
.../packages/DataTables/css/jquery.dataTables.css | 15 ++--
wqflask/wqflask/templates/collections/list.html | 60 +++++++++++----
wqflask/wqflask/templates/collections/view.html | 86 ++++++++++++----------
wqflask/wqflask/templates/search_result_page.html | 27 +++----
6 files changed, 130 insertions(+), 79 deletions(-)
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 7f08135f..4959457a 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -893,7 +893,7 @@ class GenotypeDataSet(DataSet):
def retrieve_sample_data(self, trait):
query = """
SELECT
- Strain.Name, GenoData.value, GenoSE.error, GenoData.Id, Sample.Name2
+ Strain.Name, GenoData.value, GenoSE.error, GenoData.Id, Strain.Name2
FROM
(GenoData, GenoFreeze, Strain, Geno, GenoXRef)
left join GenoSE on
diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py
index 478dbcaa..2f6c3a96 100644
--- a/wqflask/wqflask/collect.py
+++ b/wqflask/wqflask/collect.py
@@ -335,12 +335,19 @@ def delete_collection():
print("params:", params)
if g.user_session.logged_in:
uc_id = params['uc_id']
- uc = model.UserCollection.query.get(uc_id)
- # Todo: For now having the id is good enough since it's so unique
- # But might want to check ownership in the future
- collection_name = uc.name
- db_session.delete(uc)
- db_session.commit()
+ if len(uc_id.split(":")) > 1:
+ for this_uc_id in uc_id.split(":"):
+ uc = model.UserCollection.query.get(this_uc_id)
+ collection_name = uc.name
+ db_session.delete(uc)
+ db_session.commit()
+ else:
+ uc = model.UserCollection.query.get(uc_id)
+ # Todo: For now having the id is good enough since it's so unique
+ # But might want to check ownership in the future
+ collection_name = uc.name
+ db_session.delete(uc)
+ db_session.commit()
else:
collection_name = params['collection_name']
user_manager.AnonUser().delete_collection(collection_name)
diff --git a/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css b/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css
index 40e58ac8..ab7420a6 100644
--- a/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css
+++ b/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css
@@ -14,6 +14,9 @@ table.dataTable {
* Body styles
*/
}
+td.highlight {
+ background-color: whitesmoke !important;
+}
table.dataTable thead th,
table.dataTable tfoot th {
font-weight: bold;
@@ -25,8 +28,8 @@ table.dataTable thead td {
background-color: #ffffff;
border-collapse: collapse;
border-bottom: #cccccc 2px solid;
- padding: 0;
- //padding: 10px 18px 10px 0px;
+ //padding: 0;
+ padding: 10px 18px 4px 10px;
//border-bottom: 1px solid #111;
}
table.dataTable thead th:active,
@@ -39,8 +42,8 @@ table.dataTable tfoot td {
color: #000000;
background-color: #ffffff;
border-collapse: collapse;
- padding: 0;
- //padding: 10px 18px 6px 18px;
+ //padding: 0;
+ padding: 10px 18px 6px 18px;
//border-top: 1px solid #111;
}
table.dataTable thead .sorting,
@@ -76,12 +79,12 @@ table.dataTable tbody tr {
background-color: #ffffff;
}
table.dataTable tbody tr.selected {
- background-color: #ffff99;
+ background-color: #abb9d3;
}
table.dataTable tbody th,
table.dataTable tbody td {
font: 12px Arial, Sans-serif;
- padding: 4px 16px 4px 0px;
+ padding: 8px 20px 6px 10px;
}
table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td {
border-top: 1px solid #ddd;
diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html
index 6dc52c4d..5a30c98c 100644
--- a/wqflask/wqflask/templates/collections/list.html
+++ b/wqflask/wqflask/templates/collections/list.html
@@ -25,11 +25,21 @@
Your Collections
{% endif %}
-
+
+
+
+
+
+
+
+
-
+
+ |
Index |
Name |
Created |
@@ -41,7 +51,8 @@
{% for uc in collections %}
- {{ loop.index }}
+ | |
+ {{ loop.index }}
{% if g.user_session.user_ob %}
| {{ uc.name }} |
{% else %}
@@ -64,6 +75,7 @@
{% block js %}
+
@@ -72,24 +84,24 @@
-
-
{% if "color_by_trait" in params %}
{% endif %}
{% endblock %}
diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html
index 9d03e6d7..094bc273 100644
--- a/wqflask/wqflask/templates/collections/view.html
+++ b/wqflask/wqflask/templates/collections/view.html
@@ -2,8 +2,7 @@
{% block title %}View Collection{% endblock %}
{% block css %}
-
-
+
{% endblock %}
{% block content %}
@@ -29,42 +28,40 @@
{% for this_trait in trait_obs %}
{{ this_trait.name }}:{{ this_trait.dataset.name }},
{% endfor %}" >
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
@@ -80,7 +77,7 @@
-
+
|
@@ -90,9 +87,9 @@
Description |
Location |
Mean |
- Max LRS ? |
+ Max LRS ![](/static/new/images/question_mark.jpg) |
Max LRS Location |
- Additive Effect ? |
+ Additive Effect ![](/static/new/images/question_mark.jpg) |
@@ -141,8 +138,8 @@
-
-
+
+
-
-
+
+
-
+
@@ -172,6 +172,7 @@
console.time("Creating table");
{% if dataset.type == 'ProbeSet' %}
//ZS: Need to make sort by symbol, also need to make sure blank symbol fields at the bottom and symbols starting with numbers below letters
+
$('#trait_table').DataTable( {
"drawCallback": function( settings ) {
$('#trait_table tr').click(function(event) {
@@ -182,8 +183,7 @@
$('.trait_checkbox:checkbox').on("change", change_buttons);
},
"createdRow": function ( row, data, index ) {
- $('td', row).eq(0).attr('style', 'padding-right: 0px;');
- $('td', row).eq(0).attr('align', 'center');
+ $('td', row).eq(0).attr('style', 'padding-left: 8px; padding-right: 0px; padding-top: 4px; align: center;');
$('td', row).eq(1).attr('align', 'right');
$('td', row).eq(1).attr('data-export', index+1);
$('td', row).eq(2).attr('data-export', $('td', row).eq(2).text());
@@ -207,15 +207,15 @@
"data": json_trait_list,
"columns": [
{ "type": "natural", "width": "2%" },
- { "type": "natural", "width": "4%" },
+ { "type": "natural", "width": "5%" },
{ "type": "natural", "width": "12%" },
{ "type": "natural", "width": "12%" },
- { "type": "natural", "width": "25%" },
+ { "type": "natural" },
{ "type": "natural", "width": "11%" },
+ { "type": "natural", "width": "4%" },
{ "type": "natural", "width": "5%" },
- { "type": "natural", "width": "6%" },
{ "type": "natural", "width": "11%" },
- { "type": "natural", "width": "6%" }
+ { "type": "natural", "width": "5%" }
],
"columnDefs": [ {
"targets": 0,
@@ -224,8 +224,7 @@
"order": [[1, "asc" ]],
buttons: [
{
- extend: 'colvis',
- text: 'Show or Hide Columns',
+ extend: 'columnsToggle',
columns: ':not(:first-child)',
postfixButtons: [ 'colvisRestore' ]
}
@@ -238,7 +237,8 @@
"scrollY": "600px",
"scrollCollapse": false,
"scroller": true,
- "paging": false
+ "paging": false,
+ "orderClasses": true
} );
{% elif dataset.type == 'Publish' %}
@@ -358,6 +358,7 @@
"paging": false
} );
{% endif %}
+
console.timeEnd("Creating table");
var table = $('#trait_table').DataTable();
--
cgit v1.2.3
From 3c46a58f50f339ec56027db6d2108de5b21d63ac Mon Sep 17 00:00:00 2001
From: zsloan
Date: Tue, 25 Apr 2017 16:52:47 +0000
Subject: Fixed issue with correlation result trait links if target dataset is
different from base dataset
Improved collection list and view table appearances
Added question mark image for glossary entries in table headers
Fixed issue where extra decimal place sometimes appeared in bar chart Y axis tick values
---
wqflask/runserver.py | 3 ++
.../wqflask/static/new/images/question_mark.jpg | Bin 0 -> 47158 bytes
wqflask/wqflask/static/new/javascript/bar_chart.js | 11 ++++++
wqflask/wqflask/templates/collections/list.html | 9 ++++-
wqflask/wqflask/templates/collections/view.html | 8 -----
wqflask/wqflask/templates/correlation_page.html | 2 +-
wqflask/wqflask/templates/search_result_page.html | 39 +++++++++++----------
7 files changed, 43 insertions(+), 29 deletions(-)
create mode 100644 wqflask/wqflask/static/new/images/question_mark.jpg
diff --git a/wqflask/runserver.py b/wqflask/runserver.py
index a6ae28af..50805643 100644
--- a/wqflask/runserver.py
+++ b/wqflask/runserver.py
@@ -11,6 +11,9 @@ import logging
import utility.logger
logger = utility.logger.getLogger(__name__ )
+import signal
+signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
BLUE = '\033[94m'
GREEN = '\033[92m'
BOLD = '\033[1m'
diff --git a/wqflask/wqflask/static/new/images/question_mark.jpg b/wqflask/wqflask/static/new/images/question_mark.jpg
new file mode 100644
index 00000000..82df7e81
Binary files /dev/null and b/wqflask/wqflask/static/new/images/question_mark.jpg differ
diff --git a/wqflask/wqflask/static/new/javascript/bar_chart.js b/wqflask/wqflask/static/new/javascript/bar_chart.js
index 7ec35148..d8540580 100644
--- a/wqflask/wqflask/static/new/javascript/bar_chart.js
+++ b/wqflask/wqflask/static/new/javascript/bar_chart.js
@@ -253,6 +253,17 @@
})())
]);
console.log("values: ", values);
+
+ decimal_exists = "False";
+ for(i=0; i < values.length; i++){
+ if (values[i]['y'] % 1 != 0){
+ decimal_exists = "True";
+ break;
+ }
+ }
+ if (decimal_exists == "False"){
+ _this.chart.yAxis.tickFormat(d3.format('d'))
+ }
d3.select("#bar_chart_container svg").datum([
{
values: values
diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html
index 5a30c98c..b1284895 100644
--- a/wqflask/wqflask/templates/collections/list.html
+++ b/wqflask/wqflask/templates/collections/list.html
@@ -51,7 +51,7 @@
{% for uc in collections %}
- |
+ |
{{ loop.index }}
{% if g.user_session.user_ob %}
| {{ uc.name }} |
@@ -89,6 +89,13 @@
{% endif %}