4 <& /util/import_css.mas, paths => ['tools/GraphicalFiltering.css'] &>
6 <& /util/import_javascript.mas, classes => [ 'CXGN.List', 'd3.d3v4Min', 'brapi.BrAPI', 'brapi.GraphicalFilter' ] &>
8 <&| /page/info_section.mas, id=>"stock_search_graphical_filter", title => 'Graphical Filter Accessions By Traits (Includes all Search Criteria From Above Search Form)', collapsible=>1, collapsed=>1&>
10 <div class="well well-sm">
12 <div class="panel panel-default">
13 <div class="panel-body">
14 <div id="stock_search_graphical_filter_div" style="margin:1em">
22 <div class="panel panel-default">
23 <div class="panel-body">
24 <div style="overflow:scroll">
25 <table id="stock_search_graphical_filter_results_div" >
33 <&| /page/info_section.mas, title => 'Copy Filtered Accessions to a List', collapsible=>1, collapsed=>0, subtitle=>'<i>Copy the accession names in table to a new or exisiting list</i>'&>
34 <div style="text-align:right" id="graphical_filter_results_to_list_menu"></div>
35 <div id="graphical_filter_result_names" style="display: none;"></div>
45 jQuery(document).ready(function () {
49 var currentGFilter = null;
50 function loadBrAPIData(server,parameters,success){
52 var require_login = "<% $c->get_conf('brapi_require_login') %>";
53 if (require_login === '1'){
54 auth_token = "<% CXGN::Login->new($c->dbc->dbh)->get_login_cookie() %>";
55 if (!auth_token){ alert("Login required to display graphical filtering"); }
59 "pageSize" : 10000000,
60 "includeObservations" : "true",
62 d3.entries(parameters).forEach(function(entry){
63 data[entry.key] = data[entry.key]||entry.value;
66 var brapi_Data = BrAPI("/brapi/v2",'v2.0',auth_token).search_observationunits(data);
68 if (currentGFilter!=null){
69 $("#stock_search_graphical_filter_results_div").DataTable().destroy();
70 $("#stock_search_graphical_filter_results_div").html("");
73 currentGFilter = GraphicalFilter(
75 function(d) { // traits/values
77 d.observations.forEach(function(obs){
78 traits[obs.observationVariableName] = obs.value;
84 'Accession':d.germplasmName
89 return d.germplasmDbId
93 currentGFilter.draw("#stock_search_graphical_filter_div","#stock_search_graphical_filter_results_div");
95 jQuery('#stock_search_graphical_filter_results_div').on( 'draw.dt', function () {
98 var data = $("#stock_search_graphical_filter_results_div").DataTable().context[0].aoData;
99 var displayed_rows = $("#stock_search_graphical_filter_results_div").DataTable().context[0].aiDisplay;
101 for (var i =0; i< displayed_rows.length; i++){
102 var displayed_index = displayed_rows[i];
103 names.push(data[displayed_index].nTr.firstChild.innerText+'\n');
105 jQuery('#graphical_filter_result_names').html(names);
106 addToListMenu('graphical_filter_results_to_list_menu', 'graphical_filter_result_names', {
107 listType: 'accessions'