SOLR-3677: Fixed missleading error message in web ui to distinguish between no SolrCores loaded vs. no /admin/ handler available.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1367358 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2012-07-30 23:11:35 +00:00
parent ce85e4303e
commit f0e5314f22
2 changed files with 47 additions and 18 deletions

View File

@ -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
----------------------

View File

@ -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
(
'<div class="message">There are no SolrCores running — for the currenct functionality ' +
'we require at least one SolrCore, sorry :)</div>'
);
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
(
'<div class="message"><p>Unable to load environment info from <code>' + system_url.esc() + '</code>.</p>' +
'<p>This interface requires that you activate the admin request handlers in all SolrCores by adding the ' +
'following configuration to your <code>solrconfig.xml</code>:</p></div>' + "\n" +
$( 'div[id$="-wrapper"]', main )
.remove();
main
.addClass( 'error' )
.append
(
'<div class="message">This interface requires that you activate the admin request handlers, add the following configuration to your <code>solrconfig.xml:</code></div>' +
'<div class="code"><pre class="syntax language-xml"><code>' +
'<!-- Admin Handlers - This will register all the standard admin RequestHandlers. -->'.esc() + "\n" +
'<requestHandler name="/admin/" class="solr.admin.AdminHandlers" />'.esc() +
'</code></pre></div>'
);
hljs.highlightBlock( $( 'pre', main ).get(0) );
'<div class="code"><pre class="syntax language-xml"><code>' +
'<!-- Admin Handlers - This will register all the standard admin RequestHandlers. -->'.esc() + "\n" +
'<requestHandler name="/admin/" class="solr.admin.AdminHandlers" />'.esc() +
'</code></pre></div>'
);
},
complete : function()
{
@ -317,4 +342,4 @@ var solr_admin = function( app_config )
};
var app = new solr_admin( app_config );
var app = new solr_admin( app_config );