diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 39a9ea0ddbb..a214b21a9b3 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -166,6 +166,10 @@ Bug Fixes For the example configuration, this means /browse now works with SolrCloud. (janhoy, ehatcher) +* SOLR-3677: Fixed missleading error message in web ui to distinguish between + no SolrCores loaded vs. no /admin/ handler available. + (hossman, steffkes) + Other Changes ---------------------- diff --git a/solr/webapp/web/js/scripts/app.js b/solr/webapp/web/js/scripts/app.js index 4ae37140b8b..e38e495432c 100644 --- a/solr/webapp/web/js/scripts/app.js +++ b/solr/webapp/web/js/scripts/app.js @@ -152,6 +152,24 @@ var solr_admin = function( app_config ) this.timeout = null; + show_global_error = function( error ) + { + var main = $( '#main' ); + + $( 'div[id$="-wrapper"]', main ) + .remove(); + + main + .addClass( 'error' ) + .append( error ); + + var pre_tags = $( 'pre', main ); + if( 0 !== pre_tags.size() ) + { + hljs.highlightBlock( pre_tags.get(0) ); + } + }; + this.run = function() { $.ajax @@ -167,9 +185,11 @@ var solr_admin = function( app_config ) success : function( response ) { self.cores_data = response.status; + var core_count = 0; for( var core_name in response.status ) { + core_count++; var core_path = config.solr_path + '/' + core_name; var schema = response['status'][core_name]['schema']; var solrconfig = response['status'][core_name]['config']; @@ -211,10 +231,21 @@ var solr_admin = function( app_config ) .append( core_tpl ); } + if( 0 === core_count ) + { + show_global_error + ( + '
' + ); + return; + } // else: we have at least one core.... + + var system_url = environment_basepath + '/admin/system?wt=json'; $.ajax ( { - url : environment_basepath + '/admin/system?wt=json', + url : system_url, dataType : 'json', beforeSend : function( arr, form, options ) { @@ -280,23 +311,17 @@ var solr_admin = function( app_config ) }, error : function() { - var main = $( '#main' ); + show_global_error + ( + ' ' + "\n" + - $( 'div[id$="-wrapper"]', main ) - .remove(); - - main - .addClass( 'error' ) - .append - ( - ' ' + - '' +
- ''.esc() + "\n" +
- ' '.esc() +
- '
' +
+ ''.esc() + "\n" +
+ ' '.esc() +
+ '