diff --git a/js/source/legacy/solGS/loadAcronyms.js b/js/source/legacy/solGS/loadAcronyms.js index 77662f9ac5..119cd4f8be 100644 --- a/js/source/legacy/solGS/loadAcronyms.js +++ b/js/source/legacy/solGS/loadAcronyms.js @@ -4,65 +4,61 @@ * */ - var solGS = solGS || function solGS () {}; solGS.acronyms = { loadAcronyms: function() { - var id; var page = document.URL; + var id = page.match(/breeders\/trial\//) + ? jQuery('#trial_id').val() + : jQuery('#training_pop_id').val(); - if (page.match(/breeders\/trial\//)) { - id = jQuery('#trial_id').val(); - } else { - id = jQuery('#training_pop_id').val(); - } - - var acros = jQuery.ajax({ + return jQuery.ajax({ type : 'POST', dataType: 'json', - data : {'id': id}, + data : { id: id }, url : '/solgs/load/trait/acronyms/', }); - - return acros; }, - displayAcronyms: function(data) { - var table = jQuery('#trait_acronyms_table').DataTable({ - 'searching' : false, - 'ordering' : false, - 'processing': true, - 'paging' : false, - 'info' : false, - }); + if (!data || !data.length) return; + + var table; + if (jQuery.fn.DataTable.isDataTable('#trait_acronyms_table')) { + table = jQuery('#trait_acronyms_table').DataTable(); + } else { + table = jQuery('#trait_acronyms_table').DataTable({ + searching : false, + ordering : false, + processing : true, + paging : false, + info : false, + }); + } table.rows.add(data).draw(); + }, - } - -///////////// -} -//////////// - - -jQuery(document).ready( function() { - jQuery('#trait_acronyms_div').show(); - - solGS.acronyms.loadAcronyms().done( function(res) { - solGS.acronyms.displayAcronyms(res.acronyms); - }); - - solGS.acronyms.loadAcronyms().fail( function(res) { - jQuery('#trait_acronyms_table').hide(); - var errorMsg = 'Error occured loading acronyms'; + showError: function() { + jQuery('#trait_acronyms_table').hide(); jQuery('#acronyms_message') - .html(errorMsg) + .html('Error occurred loading acronyms') .show() - .fadeOut(50000); - }); + .fadeOut(5000); + }, +}; + +jQuery(document).ready(function() { + jQuery('#trait_acronyms_div').show(); + solGS.acronyms.loadAcronyms() + .done(function(res) { + solGS.acronyms.displayAcronyms(res.acronyms); + }) + .fail(function() { + solGS.acronyms.showError(); + }); }); diff --git a/lib/CXGN/Stock/Vector/ParseUpload/Plugin/VectorsGeneric.pm b/lib/CXGN/Stock/Vector/ParseUpload/Plugin/VectorsGeneric.pm index 0fb3eb7274..8be2d87b17 100644 --- a/lib/CXGN/Stock/Vector/ParseUpload/Plugin/VectorsGeneric.pm +++ b/lib/CXGN/Stock/Vector/ParseUpload/Plugin/VectorsGeneric.pm @@ -24,7 +24,7 @@ sub _validate_with_plugin { file => $filename, required_columns => ['uniquename'], optional_columns => $editable_vector_stockprops, - unique_only_columns => {'uniquename' => 1}, + unique_only_columns => ['uniquename'], column_aliases => { 'uniquename' => ['Uniquename', 'Name', 'name', 'vector_name', 'vector name'], 'Strain' => ['strain'], diff --git a/lib/SGN/Controller/solGS/Trait.pm b/lib/SGN/Controller/solGS/Trait.pm index f2e78be629..a549872457 100644 --- a/lib/SGN/Controller/solGS/Trait.pm +++ b/lib/SGN/Controller/solGS/Trait.pm @@ -242,9 +242,20 @@ sub get_acronym_pairs { $pop_id = $c->stash->{training_pop_id} if !$pop_id; #$pop_id = $c->stash->{combo_pops_id} if !$pop_id; + my @acronym_pairs; my $dir = $c->stash->{solgs_cache_dir}; - opendir my $dh, $dir - or die "can't open $dir: $!\n"; + + if ( !defined $dir || !-d $dir ) { + print STDERR "solgs cache dir does not exists: $dir"; + $c->stash->{acronym} = \@acronym_pairs; + return \@acronym_pairs; + } + + opendir my $dh, $dir or do { + print STDERR "can not open $dir: $!"; + $c->stash->{acronym} = \@acronym_pairs; + return \@acronym_pairs; + }; no warnings 'uninitialized'; @@ -256,8 +267,8 @@ sub get_acronym_pairs { my @acronym_pairs; if (-f $acronyms_file) { - @acronym_pairs = map { [ split(/\t/) ] } read_file($acronyms_file, {binmode => ':utf8'}); - shift(@acronym_pairs); # remove header; + @acronym_pairs = map { [ split(/\t/) ] } read_file($acronyms_file, {binmode => ':utf8'}); + shift(@acronym_pairs); # remove header } @acronym_pairs = sort {uc $a->[0] cmp uc $b->[0] } @acronym_pairs; diff --git a/mason/breeders_toolbox/trial.mas b/mason/breeders_toolbox/trial.mas index 816e5993c8..861c139327 100644 --- a/mason/breeders_toolbox/trial.mas +++ b/mason/breeders_toolbox/trial.mas @@ -89,15 +89,25 @@ $project_id => undef % $barcode_section_title = 'Generate barcode labels for plots or plants or accessions in this trial.'; % } - - - - - - - - - + + + + + + + + + + + + + + + + + + +
@@ -201,7 +211,7 @@ icon_class => "glyphicon glyphicon-list-alt", info_section_id => "trial_design_s <& /page/detail_page_2_col_section.mas, trial_id => $trial_id, info_section_title => "

Compute New Phenotypes

", info_section_subtitle => 'Compute derived traits or compute plot phenotypes from plant phenotypes.', icon_class => "glyphicon glyphicon-scale", info_section_id => "compute_derived_traits" &> <& /page/detail_page_2_col_section.mas, trial_id => $trial_id, info_section_title => "

Phenotype Raw Data

", info_section_subtitle => 'View phenotyping raw data.', info_section_id => "trial_raw_data", trial_name => $trial_name, site_project_name => $site_project_name, sgn_session_id => $sgn_session_id, user_name => $user_name, main_production_site_url => $main_production_site_url, trial_stock_type => $trial_stock_type, user_can_modify => $user_can_modify &> -<& /page/detail_page_2_col_section.mas, trial_id => $trial_id, trial_name => $trial_name, site_projct_name => $site_project_name, sgn_session_id => $sgn_session_id, username=> $user_name, main_production_site_url => $main_production_site_url, trial_stock_type => $trial_stock_type, info_section_title => "

Repetitive Measurements

", info_section_subtitle => 'View a plot by repetitive measurements level', info_section_id => "repetitive_measurements_data", icon_class => "glyphicon glyphicon-repeat" &> +<& /page/detail_page_2_col_section.mas, trial_id => $trial_id, trial_name => $trial_name, site_project_name => $site_project_name, sgn_session_id => $sgn_session_id, username=> $user_name, main_production_site_url => $main_production_site_url, trial_stock_type => $trial_stock_type, info_section_title => "

Repetitive Measurements

", info_section_subtitle => 'View a plot by repetitive measurements level', info_section_id => "repetitive_measurements_data", icon_class => "glyphicon glyphicon-repeat" &> <& /page/detail_page_2_col_section.mas, trial_id => $trial_id, info_section_title => "

Phenotype Summary Statistics

", info_section_subtitle => 'View and download uploaded phenotype data.', buttons_html => "", icon_class => "glyphicon glyphicon-equalizer", info_section_id => "trial_detail_traits_assayed", has_expression_atlas => $has_expression_atlas, trial_name => $trial_name, expression_atlas_url => $expression_atlas_url, site_project_name => $site_project_name, sgn_session_id => $sgn_session_id, user_name => $user_name, main_production_site_url => $main_production_site_url, trial_stock_type => $trial_stock_type &> <& /page/detail_page_2_col_section.mas, trial_id => $trial_id, info_section_title => "

Analysis Tools

", info_section_subtitle => 'Run correlation, anova, population structure (PCA), or clustering. Also access HIDAP, if enabled on this site.', icon_class => "glyphicon glyphicon-signal", info_section_id => "trial_analysis_tools", hidap_enabled => $hidap_enabled, main_production_site_url => $main_production_site_url, breeding_program_name => $breeding_program_name, folder_name => $folder_name, trial_name => $trial_name &> diff --git a/mason/breeders_toolbox/trial/repetitive_measurements_data.mas b/mason/breeders_toolbox/trial/repetitive_measurements_data.mas index 54902f28e7..7be175095d 100644 --- a/mason/breeders_toolbox/trial/repetitive_measurements_data.mas +++ b/mason/breeders_toolbox/trial/repetitive_measurements_data.mas @@ -5,6 +5,7 @@ $trial_stock_type => undef <& /util/import_javascript.mas, classes => ['CXGN.BreedersToolbox.HTMLSelect', 'jquery.iframe-post-form', 'jszip-min', 'buttons.bootstrap-min', 'buttons.html5-min', 'jquery', 'jquery.dataTables', 'jquery.dataTables-select-min', 'd3.d3v4Min', 'd3.graphers.lineGraphRepetitiveValues', 'solGS.olsLine'] &> + - -<& /util/import_javascript.mas, classes => [ 'jquery', 'thickbox', 'jquery.dataTables', 'd3.graphers.nirsDataLineGraph.js', 'd3.d3v4Min' ] &> +<& /util/import_javascript.mas, classes => [ 'jquery', 'thickbox', 'jquery.dataTables', 'jquery.dataTables-buttons-min', 'd3.graphers.nirsDataLineGraph.js', 'd3.d3v4Min' ] &>