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 + ( + '
There are no SolrCores running — for the currenct functionality ' + + 'we require at least one SolrCore, sorry :)
' + ); + 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 + ( + '

Unable to load environment info from ' + system_url.esc() + '.

' + + '

This interface requires that you activate the admin request handlers in all SolrCores by adding the ' + + 'following configuration to your solrconfig.xml:

' + "\n" + - $( 'div[id$="-wrapper"]', main ) - .remove(); - - main - .addClass( 'error' ) - .append - ( - '
This interface requires that you activate the admin request handlers, add the following configuration to your solrconfig.xml:
' + - '
' +
-                    ''.esc() + "\n" +
-                    ''.esc() +
-                    '
' - ); - - hljs.highlightBlock( $( 'pre', main ).get(0) ); + '
' +
+                  ''.esc() + "\n" +
+                  ''.esc() +
+                  '
' + ); }, complete : function() { @@ -317,4 +342,4 @@ var solr_admin = function( app_config ) }; -var app = new solr_admin( app_config ); \ No newline at end of file +var app = new solr_admin( app_config );