From 719ce04cefe84e62662bca1404776a3f55251cc5 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 1 Dec 2020 23:33:29 +0300 Subject: Remove stale comment --- wqflask/wqflask/markdown_routes.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/markdown_routes.py b/wqflask/wqflask/markdown_routes.py index 601845d7..1e077dd1 100644 --- a/wqflask/wqflask/markdown_routes.py +++ b/wqflask/wqflask/markdown_routes.py @@ -26,8 +26,6 @@ look for it inside the file system """ if md_content.status_code == 200: return markdown.markdown(md_content.content.decode("utf-8"), extensions=['tables']) - # TODO: Add fallback on our git server by checking the mirror. - # Content not available return (f"\nContent for {file_name} not available. " "Please check " "(here to see where content exists)" -- cgit v1.2.3 From 6a2fb6cced98d79cd1ccbe6490a59393486fdf92 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 1 Dec 2020 23:34:36 +0300 Subject: Add new function to fetch md file from sys paths * wqflask/wqflask/markdown_routes.py: New imports. (get_file_from_python_search_path): New function. --- wqflask/wqflask/markdown_routes.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'wqflask') diff --git a/wqflask/wqflask/markdown_routes.py b/wqflask/wqflask/markdown_routes.py index 1e077dd1..e43b9860 100644 --- a/wqflask/wqflask/markdown_routes.py +++ b/wqflask/wqflask/markdown_routes.py @@ -4,6 +4,8 @@ Render pages from github, or if they are unavailable, look for it else where """ import requests import markdown +import os +import sys from flask import Blueprint from flask import render_template @@ -33,6 +35,14 @@ look for it inside the file system """ "Please reach out to the gn2 team to have a look at this") +def get_file_from_python_search_path(pathname_suffix): + cands = [os.path.join(d, pathname_suffix) for d in sys.path] + try: + return list(filter(os.path.exists, cands))[0] + except IndexError: + return None + + @glossary_blueprint.route('/') def glossary(): return render_template( -- cgit v1.2.3 From e75056aa81c9d66379a3b4823ded69f0781c5374 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 1 Dec 2020 23:36:10 +0300 Subject: Fetch file from systempath when loading "/environments" route * wqflask/wqflask/markdown_routes.py: (render_markdown): Extend function to check whether "file_name" is to be fetched remotely or locally in syspath. (environments): Extend route to fetch from syspath if dependency file exists there; otherwise fetch remotely from Github as a fallback. --- wqflask/wqflask/markdown_routes.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/markdown_routes.py b/wqflask/wqflask/markdown_routes.py index e43b9860..59a465e7 100644 --- a/wqflask/wqflask/markdown_routes.py +++ b/wqflask/wqflask/markdown_routes.py @@ -18,16 +18,25 @@ policies_blueprint = Blueprint("policies_blueprint", __name__) facilities_blueprint = Blueprint("facilities_blueprint", __name__) -def render_markdown(file_name): +def render_markdown(file_name, is_remote_file=True): """Try to fetch the file name from Github and if that fails, try to look for it inside the file system """ github_url = ("https://raw.githubusercontent.com/" "genenetwork/gn-docs/master/") + if not is_remote_file: + text = "" + with open(file_name, "r", encoding="utf-8") as input_file: + text = input_file.read() + return markdown.markdown(text, + extensions=['tables']) + md_content = requests.get(f"{github_url}{file_name}") + if md_content.status_code == 200: + return markdown.markdown(md_content.content.decode("utf-8"), + extensions=['tables']) - return markdown.markdown(md_content.content.decode("utf-8"), extensions=['tables']) return (f"\nContent for {file_name} not available. " "Please check " "(here to see where content exists)" @@ -59,7 +68,21 @@ def references(): @environments_blueprint.route("/") def environments(): - return render_template("environment.html", rendered_markdown=render_markdown("general/environments/environments.md")), 200 + md_file = get_file_from_python_search_path("wqflask/DEPENDENCIES.md") + if md_file is not None: + return ( + render_template("environment.html", + rendered_markdown=render_markdown( + md_file, + is_remote_file=False)), + 200 + ) + # Fallback: Fetch file from server + return (render_template( + "environment.html", + rendered_markdown=render_markdown( + "general/environments/environments.md")), + 200) @links_blueprint.route("/") -- cgit v1.2.3 From 668d6a97356030e0286365dad53c8d191c193290 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 2 Dec 2020 14:16:08 -0600 Subject: Made changes that should fix Heatmap errors + removed a console.log in panelutil.js --- wqflask/wqflask/static/new/javascript/lodheatmap.js | 6 ++++-- wqflask/wqflask/static/new/javascript/panelutil.js | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/lodheatmap.js b/wqflask/wqflask/static/new/javascript/lodheatmap.js index 965a1d53..b82c95ad 100644 --- a/wqflask/wqflask/static/new/javascript/lodheatmap.js +++ b/wqflask/wqflask/static/new/javascript/lodheatmap.js @@ -44,7 +44,9 @@ lodheatmap = function() { _ref = data.chrnames; for (_i = 0, _len = _ref.length; _i < _len; _i++) { chr = _ref[_i]; - xLR[chr[0]] = getLeftRight(data.posByChr[chr[0]]); + if (data.posByChr[chr[0]].length > 0){ + xLR[chr[0]] = getLeftRight(data.posByChr[chr[0]]); + } } zmin = 0; zmax = 0; @@ -144,7 +146,7 @@ lodheatmap = function() { }).attr("stroke", "none").attr("stroke-width", "1").on("mouseover.paneltip", function(d) { yaxis.select("text#yaxis" + d.lodindex).attr("opacity", 1); d3.select(this).attr("stroke", "black"); - return celltip.show(d); + return celltip.show(d, this); }).on("mouseout.paneltip", function(d) { yaxis.select("text#yaxis" + d.lodindex).attr("opacity", 0); d3.select(this).attr("stroke", "none"); diff --git a/wqflask/wqflask/static/new/javascript/panelutil.js b/wqflask/wqflask/static/new/javascript/panelutil.js index 3c715c81..ea55a7cf 100644 --- a/wqflask/wqflask/static/new/javascript/panelutil.js +++ b/wqflask/wqflask/static/new/javascript/panelutil.js @@ -159,7 +159,6 @@ chrscales = function(data, width, chrGap, leftMargin, pad4heatmap, mappingScale) if (mappingScale == "morgan") { max_pos = d3.max(data.posByChr[chr[0]]) - console.log("max_pos:", max_pos) data.xscale[chr[0]] = d3.scale.linear().domain([chrStart[i], max_pos]).range([data.chrStart[i], data.chrEnd[i]]); } else { -- cgit v1.2.3 From c0fa6e81a0c93bb83e0753732cdcf05fb3290769 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 2 Dec 2020 14:25:08 -0600 Subject: Added index to search result export --- wqflask/wqflask/export_traits.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/export_traits.py b/wqflask/wqflask/export_traits.py index 3a886537..47a2000f 100644 --- a/wqflask/wqflask/export_traits.py +++ b/wqflask/wqflask/export_traits.py @@ -54,7 +54,7 @@ def export_search_results_csv(targs): trait_ob = retrieve_trait_info(trait_ob, trait_ob.dataset, get_qtl_info=True) trait_list.append(trait_ob) - table_headers = ['Species', 'Group', 'Dataset', 'Record ID', 'Symbol', 'Description', 'ProbeTarget', 'PubMed_ID', 'Chr', 'Mb', 'Alias', 'Gene_ID', 'Homologene_ID', 'UniGene_ID', 'Strand_Probe', 'Probe_set_specificity', 'Probe_set_BLAT_score', 'Probe_set_BLAT_Mb_start', 'Probe_set_BLAT_Mb_end', 'QTL_Chr', 'QTL_Mb', 'Locus_at_Peak', 'Max_LRS', 'P_value_of_MAX', 'Mean_Expression'] + table_headers = ['Index', 'Species', 'Group', 'Dataset', 'Record ID', 'Symbol', 'Description', 'ProbeTarget', 'PubMed_ID', 'Chr', 'Mb', 'Alias', 'Gene_ID', 'Homologene_ID', 'UniGene_ID', 'Strand_Probe', 'Probe_set_specificity', 'Probe_set_BLAT_score', 'Probe_set_BLAT_Mb_start', 'Probe_set_BLAT_Mb_end', 'QTL_Chr', 'QTL_Mb', 'Locus_at_Peak', 'Max_LRS', 'P_value_of_MAX', 'Mean_Expression'] traits_by_group = sort_traits_by_group(trait_list) @@ -77,7 +77,7 @@ def export_search_results_csv(targs): csv_rows.append(full_headers) - for trait in group_traits: + for i, trait in enumerate(group_traits): if getattr(trait, "symbol", None): trait_symbol = getattr(trait, "symbol") elif getattr(trait, "abbreviation", None): @@ -85,6 +85,7 @@ def export_search_results_csv(targs): else: trait_symbol = "N/A" row_contents = [ + i + 1, trait.dataset.group.species, trait.dataset.group.name, trait.dataset.name, -- cgit v1.2.3 From 429602ad29c0f04fc8142dd48bc3c75c1412be59 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 2 Dec 2020 14:27:39 -0600 Subject: Added trait URLs to search page export --- wqflask/wqflask/export_traits.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/export_traits.py b/wqflask/wqflask/export_traits.py index 47a2000f..037de5a8 100644 --- a/wqflask/wqflask/export_traits.py +++ b/wqflask/wqflask/export_traits.py @@ -54,7 +54,7 @@ def export_search_results_csv(targs): trait_ob = retrieve_trait_info(trait_ob, trait_ob.dataset, get_qtl_info=True) trait_list.append(trait_ob) - table_headers = ['Index', 'Species', 'Group', 'Dataset', 'Record ID', 'Symbol', 'Description', 'ProbeTarget', 'PubMed_ID', 'Chr', 'Mb', 'Alias', 'Gene_ID', 'Homologene_ID', 'UniGene_ID', 'Strand_Probe', 'Probe_set_specificity', 'Probe_set_BLAT_score', 'Probe_set_BLAT_Mb_start', 'Probe_set_BLAT_Mb_end', 'QTL_Chr', 'QTL_Mb', 'Locus_at_Peak', 'Max_LRS', 'P_value_of_MAX', 'Mean_Expression'] + table_headers = ['Index', 'URL', 'Species', 'Group', 'Dataset', 'Record ID', 'Symbol', 'Description', 'ProbeTarget', 'PubMed_ID', 'Chr', 'Mb', 'Alias', 'Gene_ID', 'Homologene_ID', 'UniGene_ID', 'Strand_Probe', 'Probe_set_specificity', 'Probe_set_BLAT_score', 'Probe_set_BLAT_Mb_start', 'Probe_set_BLAT_Mb_end', 'QTL_Chr', 'QTL_Mb', 'Locus_at_Peak', 'Max_LRS', 'P_value_of_MAX', 'Mean_Expression'] traits_by_group = sort_traits_by_group(trait_list) @@ -86,6 +86,7 @@ def export_search_results_csv(targs): trait_symbol = "N/A" row_contents = [ i + 1, + "https://genenetwork.org/show_trait?trait_id=" + trait.name + "&dataset=" + trait.dataset.name, trait.dataset.group.species, trait.dataset.group.name, trait.dataset.name, -- cgit v1.2.3 From 63ec95384208a1d994d0a381e7ea8a307ca075e2 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 2 Dec 2020 14:33:36 -0600 Subject: Updated Funding line in search result export --- wqflask/wqflask/export_traits.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/export_traits.py b/wqflask/wqflask/export_traits.py index 037de5a8..a2f25f20 100644 --- a/wqflask/wqflask/export_traits.py +++ b/wqflask/wqflask/export_traits.py @@ -44,7 +44,7 @@ def export_search_results_csv(targs): if targs['filter_term'] != "None": metadata.append(["Search Filter Terms: " + targs['filter_term']]) metadata.append(["Exported Row Number: " + str(len(table_rows))]) - metadata.append(["Funding for The GeneNetwork: NIAAA (U01AA13499, U24AA13513), NIDA, NIMH, and NIAAA (P20-DA21131), NCI MMHCC (U01CA105417), and NCRR (U01NR 105417)"]) + metadata.append(["Funding for The GeneNetwork: NIGMS (R01 GM123489, 2017-2021), NIDA (P30 DA044223, 2017-2022), NIA (R01AG043930, 2013-2018), NIAAA (U01 AA016662, U01 AA013499, U24 AA013513, U01 AA014425, 2006-2017), NIDA/NIMH/NIAAA (P20-DA 21131, 2001-2012), NCI MMHCC (U01CA105417), NCRR/BIRN (U24 RR021760) metadata.append([]) trait_list = [] -- cgit v1.2.3 From 1e7a2082a84e260b61349a77de4e8b936fae0123 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 2 Dec 2020 14:34:56 -0600 Subject: Missed a syntax typo in last commit --- wqflask/wqflask/export_traits.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/export_traits.py b/wqflask/wqflask/export_traits.py index a2f25f20..b14c55db 100644 --- a/wqflask/wqflask/export_traits.py +++ b/wqflask/wqflask/export_traits.py @@ -44,7 +44,7 @@ def export_search_results_csv(targs): if targs['filter_term'] != "None": metadata.append(["Search Filter Terms: " + targs['filter_term']]) metadata.append(["Exported Row Number: " + str(len(table_rows))]) - metadata.append(["Funding for The GeneNetwork: NIGMS (R01 GM123489, 2017-2021), NIDA (P30 DA044223, 2017-2022), NIA (R01AG043930, 2013-2018), NIAAA (U01 AA016662, U01 AA013499, U24 AA013513, U01 AA014425, 2006-2017), NIDA/NIMH/NIAAA (P20-DA 21131, 2001-2012), NCI MMHCC (U01CA105417), NCRR/BIRN (U24 RR021760) + metadata.append(["Funding for The GeneNetwork: NIGMS (R01 GM123489, 2017-2021), NIDA (P30 DA044223, 2017-2022), NIA (R01AG043930, 2013-2018), NIAAA (U01 AA016662, U01 AA013499, U24 AA013513, U01 AA014425, 2006-2017), NIDA/NIMH/NIAAA (P20-DA 21131, 2001-2012), NCI MMHCC (U01CA105417), NCRR/BIRN (U24 RR021760)"]) metadata.append([]) trait_list = [] -- cgit v1.2.3 From 1cf0edb0719e4cf1c8410d8a910b199bb10180ef Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 3 Dec 2020 00:12:04 +0300 Subject: Remove edit button in environments page * wqflask/wqflask/templates/environment.html: Delete edit button. The dependency file is autogenerated from guix. --- wqflask/wqflask/templates/environment.html | 8 -------- 1 file changed, 8 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/environment.html b/wqflask/wqflask/templates/environment.html index 94b31464..34ebf36e 100644 --- a/wqflask/wqflask/templates/environment.html +++ b/wqflask/wqflask/templates/environment.html @@ -8,14 +8,6 @@ {% block content %} -
-
- - Edit Text - - -
-
{{ rendered_markdown|safe }}
-- cgit v1.2.3 From bf4b901fe7ebd02416b026974ed784970d8023dd Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 3 Dec 2020 00:23:23 +0300 Subject: Move css from environment.html to markdown.css --- wqflask/wqflask/static/new/css/markdown.css | 19 ++++++++++++++++++- wqflask/wqflask/templates/environment.html | 16 ---------------- 2 files changed, 18 insertions(+), 17 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/css/markdown.css b/wqflask/wqflask/static/new/css/markdown.css index dca3e31d..e10dd9d3 100644 --- a/wqflask/wqflask/static/new/css/markdown.css +++ b/wqflask/wqflask/static/new/css/markdown.css @@ -57,8 +57,25 @@ word-spacing: 0.2em; } +#markdown table { + width: 100%; +} + +#markdown table, +#markdown td, +#markdown th { + border: solid 2px black; +} + +#markdown td, +#markdown th { + padding-top: 8px; + padding-bottom: 8px; + text-align: center; +} + @media(max-width:650px) { .container { width: 100vw; } -} \ No newline at end of file +} diff --git a/wqflask/wqflask/templates/environment.html b/wqflask/wqflask/templates/environment.html index 34ebf36e..cd30e768 100644 --- a/wqflask/wqflask/templates/environment.html +++ b/wqflask/wqflask/templates/environment.html @@ -13,20 +13,4 @@
{{ rendered_markdown|safe }}
- {% endblock %} -- cgit v1.2.3 From 66fb2fa6bf83b8d6e6d1cb7e159ea806bca4aebb Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 3 Dec 2020 00:28:56 +0300 Subject: Center-align the table header and left-align the table body --- wqflask/wqflask/static/new/css/markdown.css | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/css/markdown.css b/wqflask/wqflask/static/new/css/markdown.css index e10dd9d3..0c0309fb 100644 --- a/wqflask/wqflask/static/new/css/markdown.css +++ b/wqflask/wqflask/static/new/css/markdown.css @@ -61,6 +61,15 @@ width: 100%; } +#markdown td { + padding: 1em; + text-align: left; +} + +#markdown th { + text-align: center; +} + #markdown table, #markdown td, #markdown th { @@ -71,7 +80,6 @@ #markdown th { padding-top: 8px; padding-bottom: 8px; - text-align: center; } @media(max-width:650px) { -- cgit v1.2.3 From 3147f1eec3aee3b7844a3ac88cd58fafe53207b3 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Dec 2020 13:43:53 -0600 Subject: Increased correlation table vertical height to 100vh --- wqflask/wqflask/templates/correlation_page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 6419b185..0e623cbb 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -557,7 +557,7 @@ "sDom": "itir", "autoWidth": true, "bSortClasses": false, - "scrollY": "50vh", + "scrollY": "100vh", "scroller": true, "scrollCollapse": true } -- cgit v1.2.3 From 5506ac96077db794c945cc1325300dead8073eea Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Dec 2020 13:45:21 -0600 Subject: Convert trait/dataset names to strings, since phenotype names were being treated as integers --- wqflask/wqflask/correlation/show_corr_results.py | 1 + wqflask/wqflask/export_traits.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 1b801b1d..51aa1622 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -487,6 +487,7 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap results_dict['index'] = i + 1 results_dict['trait_id'] = trait.name results_dict['dataset'] = trait.dataset.name + results_dict['hmac'] = hmac.data_hmac('{}:{}'.format(trait.name, trait.dataset.name)) if target_dataset.type == "ProbeSet": results_dict['symbol'] = trait.symbol results_dict['description'] = "N/A" diff --git a/wqflask/wqflask/export_traits.py b/wqflask/wqflask/export_traits.py index b14c55db..6fb760e0 100644 --- a/wqflask/wqflask/export_traits.py +++ b/wqflask/wqflask/export_traits.py @@ -86,7 +86,7 @@ def export_search_results_csv(targs): trait_symbol = "N/A" row_contents = [ i + 1, - "https://genenetwork.org/show_trait?trait_id=" + trait.name + "&dataset=" + trait.dataset.name, + "https://genenetwork.org/show_trait?trait_id=" + str(trait.name) + "&dataset=" + str(trait.dataset.name), trait.dataset.group.species, trait.dataset.group.name, trait.dataset.name, -- cgit v1.2.3 From fabb29b6f47c11d3a1eeeb4cb94c8362e282dca3 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Dec 2020 13:46:18 -0600 Subject: Converted the submit_traits_to_export_or_bnw function to using DataTables API, since the JQuery it was previously using didn't work with Scroller --- .../static/new/javascript/search_results.js | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index 86660126..27d89867 100644 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -157,18 +157,23 @@ $(function() { }); table_dict['headers'] = headers; - rows = []; - trait_table.find('tbody tr').each(function (i, tr) { - if (trait_table.find('input[name="searchResult"]:checked').length > 0) { - if ($(this).find('input[name="searchResult"]').is(':checked')){ - rows.push($(this).find('input[name="searchResult"]:checked').val()) - } - } - else { - rows.push($(this).find('input[name="searchResult"]').val()) + selected_rows = []; + all_rows = []; //ZS: If no rows are checked, export all + table_api = $('#' + table_name).DataTable(); + check_cells = table_api.column(0).nodes().to$(); + for (let i = 0; i < check_cells.length; i++) { + this_node = check_cells[i].childNodes[0]; + all_rows.push(this_node.value) + if (this_node.checked){ + selected_rows.push(this_node.value) } - }); - table_dict['rows'] = rows; + } + + if (selected_rows.length > 0){ + table_dict['rows'] = selected_rows; + } else { + table_dict['rows'] = all_rows; + } json_table_dict = JSON.stringify(table_dict); $('input[name=export_data]').val(json_table_dict); -- cgit v1.2.3 From f90ae0eb938b48a6467223d44816d9b6522280cf Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Dec 2020 14:08:36 -0600 Subject: Fixed select_all and deselect_all to use DataTables API so they work with any tables that use Scroller --- .../static/new/javascript/search_results.js | 35 ++++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index 27d89867..3319d2cb 100644 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -3,22 +3,31 @@ $(function() { checked_traits = null; select_all = function() { - console.log("selected_all"); - $(".trait_checkbox").each(function() { - $(this).prop('checked', true); - if (!$(this).closest('tr').hasClass('selected')) { - $(this).closest('tr').addClass('selected') - } - }); + table_api = $('#trait_table').DataTable(); + + check_cells = table_api.column(0).nodes().to$(); + for (let i = 0; i < check_cells.length; i++) { + check_cells[i].childNodes[0].checked = true; + } + + check_rows = table_api.rows().nodes(); + for (let i =0; i < check_rows.length; i++) { + check_rows[i].classList.add("selected") + } }; deselect_all = function() { - $(".trait_checkbox").each(function() { - $(this).prop('checked', false); - if ($(this).closest('tr').hasClass('selected')) { - $(this).closest('tr').removeClass('selected') - } - }); + table_api = $('#trait_table').DataTable(); + + check_cells = table_api.column(0).nodes().to$(); + for (let i = 0; i < check_cells.length; i++) { + check_cells[i].childNodes[0].checked = false; + } + + check_rows = table_api.rows().nodes(); + for (let i =0; i < check_rows.length; i++) { + check_rows[i].classList.remove("selected") + } }; invert = function() { -- cgit v1.2.3 From e087a5ed176d3e935ca15c7d066b026dec653a6f Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Dec 2020 14:13:55 -0600 Subject: Changed invert function to use DataTables API so it can also work with Scroller --- .../static/new/javascript/search_results.js | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index 3319d2cb..5e8277b3 100644 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -31,21 +31,25 @@ $(function() { }; invert = function() { - $(".trait_checkbox").each(function() { - if ($(this).prop('checked') == true) { - $(this).prop('checked', false) - } - else { - $(this).prop('checked', true) - } - - if ($(this).closest('tr').hasClass('selected')) { - $(this).closest('tr').removeClass('selected') - } - else { - $(this).closest('tr').addClass('selected') - } - }); + table_api = $('#trait_table').DataTable(); + + check_cells = table_api.column(0).nodes().to$(); + for (let i = 0; i < check_cells.length; i++) { + if (check_cells[i].childNodes[0].checked){ + check_cells[i].childNodes[0].checked = false; + } else { + check_cells[i].childNodes[0].checked = true; + } + } + + check_rows = table_api.rows().nodes(); + for (let i =0; i < check_rows.length; i++) { + if (check_rows[i].classList.contains("selected")){ + check_rows[i].classList.remove("selected") + } else { + check_rows[i].classList.add("selected") + } + } }; $('#searchbox').keyup(function(){ -- cgit v1.2.3 From 244317daae8fb9a242b7d62c2e8f6e3a40c4ba44 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Dec 2020 14:14:09 -0600 Subject: Added Invert button to search result page --- wqflask/wqflask/templates/search_result_page.html | 1 + 1 file changed, 1 insertion(+) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 2a8d6931..8a467bfb 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -129,6 +129,7 @@ {% endif %} + -- cgit v1.2.3 From 64bfeadac33e6d22297714544cd96ef16677fe16 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 3 Dec 2020 23:59:14 +0300 Subject: Display d3js chord dependency diagram of gn2 dependenices * wqflask/wqflask/markdown_routes.py: Add new bs4 import. (references): Filter out javascript from the guix-generated d3js html file and pass it to the jinja template. * wqflask/wqflask/static/new/css/markdown.css: New styles for the graph content. * wqflask/wqflask/templates/environment.html: New graph content. --- wqflask/wqflask/markdown_routes.py | 14 +++ wqflask/wqflask/static/new/css/markdown.css | 14 +++ wqflask/wqflask/templates/environment.html | 134 ++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+) (limited to 'wqflask') diff --git a/wqflask/wqflask/markdown_routes.py b/wqflask/wqflask/markdown_routes.py index 59a465e7..183f4caa 100644 --- a/wqflask/wqflask/markdown_routes.py +++ b/wqflask/wqflask/markdown_routes.py @@ -7,6 +7,8 @@ import markdown import os import sys +from bs4 import BeautifulSoup + from flask import Blueprint from flask import render_template @@ -68,10 +70,21 @@ def references(): @environments_blueprint.route("/") def environments(): + md_file = get_file_from_python_search_path("wqflask/DEPENDENCIES.md") + svg_file = get_file_from_python_search_path( + "wqflask/dependency-graph.html") + svg_data = None + if svg_file: + with open(svg_file, 'r') as f: + svg_data = "".join( + BeautifulSoup(f.read(), + 'lxml').body.script.contents) + if md_file is not None: return ( render_template("environment.html", + svg_data=svg_data, rendered_markdown=render_markdown( md_file, is_remote_file=False)), @@ -80,6 +93,7 @@ def environments(): # Fallback: Fetch file from server return (render_template( "environment.html", + svg_data=None, rendered_markdown=render_markdown( "general/environments/environments.md")), 200) diff --git a/wqflask/wqflask/static/new/css/markdown.css b/wqflask/wqflask/static/new/css/markdown.css index 0c0309fb..38d664e2 100644 --- a/wqflask/wqflask/static/new/css/markdown.css +++ b/wqflask/wqflask/static/new/css/markdown.css @@ -57,6 +57,20 @@ word-spacing: 0.2em; } +.graph-legend h1 { + text-align: center; +} + +.graph-legend, +#guix-graph { + width: 90%; + margin: 10px auto; +} + +#guix-graph { + border: solid 2px black; +} + #markdown table { width: 100%; } diff --git a/wqflask/wqflask/templates/environment.html b/wqflask/wqflask/templates/environment.html index cd30e768..5fe01dad 100644 --- a/wqflask/wqflask/templates/environment.html +++ b/wqflask/wqflask/templates/environment.html @@ -13,4 +13,138 @@
{{ rendered_markdown|safe }}
+{% if svg_data %} + +
+

Chord dependency Graph of Genenetwork2

+ Graph generated from genenetwork.scm. You can zoom in and out within the bounding box. +
+ +
+{% endif %} + +{% endblock %} + +{% block js %} + +{% if svg_data %} + + +{% endif %} + {% endblock %} -- cgit v1.2.3 From 812e9e84ca98c13ba3e378b169dce235feef5c15 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Dec 2020 17:09:05 -0600 Subject: Fixed View Collection table drawCallback to correctly deal with check boxes and the Copy/Delete buttons and fixed an issue where extra white-space on either side of the checkboxes was causing some JS to not work correctly --- wqflask/wqflask/templates/collections/view.html | 33 ++++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index e37f8104..ccec495b 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -73,7 +73,7 @@
- + @@ -81,7 +81,7 @@ - +
@@ -109,10 +109,7 @@ {% for this_trait in trait_obs %} - - - + {{ loop.index }} {{ this_trait.dataset.fullname }} @@ -178,15 +175,21 @@