SOLR-3633 - web UI reports an error if CoreAdminHandler says there are no SolrCores

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1503853 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Matheis 2013-07-16 19:54:52 +00:00
parent 039bdbff0c
commit f15074e704
16 changed files with 324 additions and 114 deletions

View File

@ -64,6 +64,12 @@ Upgrading from Solr 4.4.0
Detailed Change List
----------------------
Bug Fixes
----------------------
* SOLR-3633 - web UI reports an error if CoreAdminHandler says there are no
SolrCores (steffkes)
Other Changes
----------------------

View File

@ -113,7 +113,13 @@ limitations under the License.
</ul>
<div id="core-selector">
<select data-placeholder="Core Selector"></select>
<div id="has-cores">
<select data-placeholder="Core Selector"></select>
</div>
<p id="has-no-cores"><a href="#/~cores">
No cores available
<span>Go and create one</span>
</a></p>
</div>
<div id="core-menu">
<ul></ul>

View File

@ -33,6 +33,11 @@ limitations under the License.
width: 500px;
}
#content #cores.empty .requires-core
{
display: none;
}
#content #cores #frame
{
float: right;
@ -53,6 +58,7 @@ limitations under the License.
#content #cores #frame .actions
{
margin-bottom: 20px;
min-height: 30px;
}
#content #cores .actions div.action
@ -170,7 +176,7 @@ limitations under the License.
display: none;
position: absolute;
left: -50px;
top: 40;
top: 40px;
padding: 10px;
}

View File

@ -113,24 +113,25 @@ limitations under the License.
display: none;
}
#content #dashboard #dataimport
#content #dashboard #instance
{
float: right;
}
#content #dashboard #instance .dir_impl
{
margin-top: 10px;
}
#content #dashboard #admin-extra
{
float: right;
float: left;
}
#content #dashboard #system h2 { background-image: url( ../../img/ico/server.png ); }
#content #dashboard #statistics h2 { background-image: url( ../../img/ico/chart.png ); }
#content #dashboard #replication h2 { background-image: url( ../../img/ico/node.png ); }
#content #dashboard #replication.master h2 { background-image: url( ../../img/ico/node-master.png ); }
#content #dashboard #replication.slave h2 { background-image: url( ../../img/ico/node-slave.png ); }
#content #dashboard #dataimport h2 { background-image: url( ../../img/ico/document-import.png ); }
#content #dashboard #admin-extra h2 { background-image: url( ../../img/ico/plus-button.png ); }
#content #dashboard #healthcheck
{
float: right;
}
#content #dashboard #healthcheck .ico
{
@ -144,3 +145,11 @@ limitations under the License.
{
background-image: url( ../../img/ico/tick.png );
}
#content #dashboard #system h2 { background-image: url( ../../img/ico/server.png ); }
#content #dashboard #statistics h2 { background-image: url( ../../img/ico/chart.png ); }
#content #dashboard #replication h2 { background-image: url( ../../img/ico/node.png ); }
#content #dashboard #replication.master h2 { background-image: url( ../../img/ico/node-master.png ); }
#content #dashboard #replication.slave h2 { background-image: url( ../../img/ico/node-slave.png ); }
#content #dashboard #instance h2 { background-image: url( ../../img/ico/server.png ); }
#content #dashboard #admin-extra h2 { background-image: url( ../../img/ico/plus-button.png ); }

View File

@ -147,8 +147,6 @@ limitations under the License.
#content #index #instance h2 { background-image: url( ../../img/ico/server.png ); }
#content #index #instance .start_time dt span { background-image: url( ../../img/ico/clock-select.png ); }
#content #index #instance .host dt span { background-image: url( ../../img/ico/globe.png ); }
#content #index #instance .dir dt span { background-image: url( ../../img/ico/folder.png ); }
#content #index #versions h2 { background-image: url( ../../img/ico/property.png ); }
#content #index #versions .solr span { background-image: url( ../../img/solr-ico.png ); }

View File

@ -54,6 +54,22 @@ limitations under the License.
width: 100%;
}
#core-selector #has-no-cores
{
display: none;
}
#core-selector #has-no-cores a
{
background-image: url( ../../img/ico/database--plus.png );
}
#core-selector #has-no-cores span
{
color: #c0c0c0;
display: block;
}
#menu-wrapper .active p
{
background-color: #fafafa;

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

View File

@ -158,7 +158,6 @@ var solr_admin = function( app_config )
is_multicore = null,
cores_data = null,
active_core = null,
environment_basepath = null,
config = app_config,
params = null,
@ -238,11 +237,6 @@ var solr_admin = function( app_config )
var core_path = config.solr_path + '/' + core_name;
var classes = [];
if( !environment_basepath )
{
environment_basepath = core_path;
}
if( cores.status[core_name]['isDefaultCore'] )
{
classes.push( 'default' );
@ -263,8 +257,29 @@ var solr_admin = function( app_config )
core_list.push( core_tpl );
}
that.menu_element
.append( core_list.join( "\n" ) );
var has_cores = 0 !== core_count;
if( has_cores )
{
that.menu_element
.append( core_list.join( "\n" ) )
.trigger( 'liszt:updated' );
}
var core_selector = $( '#core-selector' );
core_selector.find( '#has-cores' ).toggle( has_cores );
core_selector.find( '#has-no-cores' ).toggle( !has_cores );
if( has_cores )
{
var cores_element = core_selector.find( '#has-cores' );
var selector_width = cores_element.width();
cores_element.find( '.chzn-container' )
.css( 'width', selector_width + 'px' );
cores_element.find( '.chzn-drop' )
.css( 'width', ( selector_width - 2 ) + 'px' );
}
if( cores.initFailures )
{
@ -288,14 +303,6 @@ var solr_admin = function( app_config )
$( 'ul', init_failures ).html( failures.join( "\n" ) );
}
}
if( 0 === core_count )
{
show_global_error
(
'<div class="message">There are no SolrCores running. <br/> Using the Solr Admin UI currently requires at least one SolrCore.</div>'
);
} // else: we have at least one core....
};
this.run = function()
@ -352,26 +359,24 @@ var solr_admin = function( app_config )
var core_name = $( 'option:selected', this ).text();
that.core_menu
.html
(//Keep this in alphabetical order after the overview
'<li class="overview"><a href="#/' + core_name + '"><span>Overview</span></a></li>' + "\n" +
'<li class="analysis"><a href="#/' + core_name + '/analysis"><span>Analysis</span></a></li>' + "\n" +
'<li class="config"><a href="#/' + core_name + '/config"><span>Config</span></a></li>' + "\n" +
'<li class="dataimport"><a href="#/' + core_name + '/dataimport"><span>Dataimport</span></a></li>' + "\n" +
'<li class="documents"><a href="#/' + core_name + '/documents"><span>Documents</span></a></li>' + "\n" +
'<li class="ping"><a rel="' + that.config.solr_path + '/' + core_name + '/admin/ping"><span>Ping</span></a></li>' + "\n" +
'<li class="plugins"><a href="#/' + core_name + '/plugins"><span>Plugins / Stats</span></a></li>' + "\n" +
'<li class="query"><a href="#/' + core_name + '/query"><span>Query</span></a></li>' + "\n" +
'<li class="replication"><a href="#/' + core_name + '/replication"><span>Replication</span></a></li>' + "\n" +
'<li class="schema"><a href="#/' + core_name + '/schema"><span>Schema</span></a></li>' + "\n" +
'<li class="schema-browser"><a href="#/' + core_name + '/schema-browser"><span>Schema Browser</span></a></li>' + "\n"
.html
(
//Keep this in alphabetical order after the overview
'<li class="overview"><a href="#/' + core_name + '"><span>Overview</span></a></li>' + "\n" +
'<li class="analysis"><a href="#/' + core_name + '/analysis"><span>Analysis</span></a></li>' + "\n" +
'<li class="config"><a href="#/' + core_name + '/config"><span>Config</span></a></li>' + "\n" +
'<li class="dataimport"><a href="#/' + core_name + '/dataimport"><span>Dataimport</span></a></li>' + "\n" +
'<li class="documents"><a href="#/' + core_name + '/documents"><span>Documents</span></a></li>' + "\n" +
'<li class="ping"><a rel="' + that.config.solr_path + '/' + core_name + '/admin/ping"><span>Ping</span></a></li>' + "\n" +
'<li class="plugins"><a href="#/' + core_name + '/plugins"><span>Plugins / Stats</span></a></li>' + "\n" +
'<li class="query"><a href="#/' + core_name + '/query"><span>Query</span></a></li>' + "\n" +
'<li class="replication"><a href="#/' + core_name + '/replication"><span>Replication</span></a></li>' + "\n" +
'<li class="schema"><a href="#/' + core_name + '/schema"><span>Schema</span></a></li>' + "\n" +
'<li class="schema-browser"><a href="#/' + core_name + '/schema-browser"><span>Schema Browser</span></a></li>'
)
.show();
)
.show();
if( core_name )
{
}
else
if( !core_name )
{
that.core_menu
.hide()
@ -380,16 +385,7 @@ var solr_admin = function( app_config )
}
);
for( var core_name in response.status )
{
var core_path = config.solr_path + '/' + core_name;
if( !environment_basepath )
{
environment_basepath = core_path;
}
}
var system_url = environment_basepath + '/admin/system?wt=json';
var system_url = config.solr_path + '/admin/info/system?wt=json';
$.ajax
(
{
@ -416,11 +412,6 @@ var solr_admin = function( app_config )
{
cloud_args = response.mode.match( /solrcloud/i );
}
// title
$( 'title', document )
.append( ' (' + response.core.host + ')' );
// environment

View File

@ -30,8 +30,22 @@ sammy.bind
},
success : function( response, text_status, xhr )
{
var has_cores = false;
for( core in response.status )
{
has_cores = true; break;
}
app.set_cores_data( response );
params.callback( app.cores_data );
if( has_cores )
{
params.success( app.cores_data );
}
else
{
params.error();
}
},
error : function( xhr, text_status, error_thrown)
{
@ -102,12 +116,13 @@ sammy.get
function( context )
{
delete app.cores_template;
var content_element = $( '#content' );
sammy.trigger
(
'cores_load_data',
{
callback : function( cores )
success : function( cores )
{
var first_core = null;
for( var key in cores )
@ -119,6 +134,146 @@ sammy.get
continue;
}
context.redirect( context.path + '/' + first_core );
},
error : function()
{
sammy.trigger
(
'cores_load_template',
{
content_element : content_element,
callback : function()
{
var cores_element = $( '#cores', content_element );
var navigation_element = $( '#navigation', cores_element );
var data_element = $( '#data', cores_element );
var core_data_element = $( '#core-data', data_element );
var index_data_element = $( '#index-data', data_element );
// layout
var ui_block = $( '#ui-block' );
var actions_element = $( '.actions', cores_element );
var div_action = $( 'div.action', actions_element );
ui_block
.css( 'opacity', 0.7 )
.width( cores_element.width() + 10 )
.height( cores_element.height() );
if( $( '#cloud.global' ).is( ':visible' ) )
{
$( '.cloud', div_action )
.show();
}
$( 'button.action', actions_element )
.die( 'click' )
.live
(
'click',
function( event )
{
var self = $( this );
self
.toggleClass( 'open' );
$( '.action.' + self.attr( 'id' ), actions_element )
.trigger( 'open' );
return false;
}
);
div_action
.die( 'close' )
.live
(
'close',
function( event )
{
div_action.hide();
ui_block.hide();
}
)
.die( 'open' )
.live
(
'open',
function( event )
{
var self = $( this );
var rel = $( '#' + self.data( 'rel' ) );
self
.trigger( 'close' )
.show()
.css( 'left', rel.position().left );
ui_block
.show();
}
);
$( 'form button.reset', actions_element )
.die( 'click' )
.live
(
'click',
function( event )
{
$( this ).closest( 'div.action' )
.trigger( 'close' );
}
);
$( 'form', div_action )
.ajaxForm
(
{
url : app.config.solr_path + app.config.core_admin_path + '?wt=json&indexInfo=false',
dataType : 'json',
beforeSubmit : function( array, form, options )
{
$( 'button[type="submit"] span', form )
.addClass( 'loader' );
},
success : function( response, status_text, xhr, form )
{
delete app.cores_data;
sammy.refresh();
$( 'button.reset', form )
.trigger( 'click' );
},
error : function( xhr, text_status, error_thrown )
{
var response = null;
eval( 'response = ' + xhr.responseText + ';' );
var error_elem = $( '.error', div_action.filter( ':visible' ) );
error_elem.show();
$( 'span', error_elem ).text( response.error.msg );
},
complete : function()
{
$( 'button span.loader', actions_element )
.removeClass( 'loader' );
}
}
);
// --
$( '#add', content_element )
.trigger( 'click' );
$( '[data-rel="add"] input[type="text"]:first', content_element )
.focus();
}
}
);
}
}
);
@ -140,7 +295,11 @@ sammy.get
(
'cores_load_data',
{
callback : function( cores )
error : function()
{
context.redirect( '#/' + context.params.splat[0] );
},
success : function( cores )
{
sammy.trigger
(
@ -155,6 +314,9 @@ sammy.get
var core_data_element = $( '#core-data', data_element );
var index_data_element = $( '#index-data', data_element );
cores_element
.removeClass( 'empty' );
sammy.trigger
(
'cores_build_navigation',

View File

@ -98,7 +98,7 @@ sammy.get
.show()
.html( 'Loading ...' );
$( '.content' )
$( '.content', this )
.hide();
},
success : function( response, text_status, xhr )
@ -347,9 +347,9 @@ sammy.get
$.ajax
(
{
url : core_basepath + '/dataimport?command=details&wt=json',
url : core_basepath + '/admin/system?wt=json',
dataType : 'json',
context : $( '#dataimport', dashboard_element ),
context : $( '#instance', dashboard_element ),
beforeSend : function( xhr, settings )
{
$( 'h2', this )
@ -358,19 +358,28 @@ sammy.get
$( '.message', this )
.show()
.html( 'Loading' );
$( '.content', this )
.hide();
},
success : function( response, text_status, xhr )
{
$( '.message', this )
.empty()
.hide();
$( '.content', this )
.show();
$( 'dl', this )
.show();
var data = {
'status' : response['status'],
'info' : response['statusMessages']['']
'dir_cwd' : response.core.directory.cwd,
'dir_instance' : response.core.directory.instance,
'dir_data' : response.core.directory.data,
'dir_index' : response.core.directory.index,
'dir_impl' : response.core.directory.dirimpl
};
for( var key in data )
@ -389,7 +398,7 @@ sammy.get
$( '.message', this )
.show()
.html( 'Dataimport is not configured' );
.html( '/admin/system Handler is not configured' );
},
complete : function( xhr, text_status )
{

View File

@ -238,10 +238,6 @@ sammy.get
var data = {
'start_time' : app.dashboard_values['jvm']['jmx']['startTime'],
'host' : app.dashboard_values['core']['host'] || '-',
'dir_instance' : app.dashboard_values['core']['directory']['instance'],
'dir_data' : app.dashboard_values['core']['directory']['data'],
'dir_index' : app.dashboard_values['core']['directory']['index'],
'jvm_version' : app.dashboard_values['jvm']['name'] + ' (' + app.dashboard_values['jvm']['version'] + ')',
'processors' : app.dashboard_values['jvm']['processors'],
'solr_spec_version' : app.dashboard_values['lucene']['solr-spec-version'] || '-',
@ -249,11 +245,6 @@ sammy.get
'lucene_spec_version' : app.dashboard_values['lucene']['lucene-spec-version'] || '-',
'lucene_impl_version' : app.dashboard_values['lucene']['lucene-impl-version'] || '-'
};
if( app.dashboard_values['core']['directory']['cwd'] )
{
data['dir_cwd'] = app.dashboard_values['core']['directory']['cwd'];
}
for( var key in data )
{

View File

@ -21,7 +21,6 @@ sammy.get
/^#\/(~java-properties)$/,
function( context )
{
var core_basepath = $( '[data-basepath]', app.menu_element ).attr( 'data-basepath' );
var content_element = $( '#content' );
content_element
@ -30,7 +29,7 @@ sammy.get
$.ajax
(
{
url : core_basepath + '/admin/properties?wt=json',
url : app.config.solr_path + '/admin/info/properties?wt=json',
dataType : 'json',
context : $( '#java-properties', content_element ),
beforeSend : function( xhr, settings )

View File

@ -15,7 +15,7 @@
limitations under the License.
*/
var loglevel_path = null;
var loglevel_path = app.config.solr_path + '/admin/info/logging';
var frame_element = null;
var logging_handler = function( response, text_status, xhr )
@ -409,8 +409,6 @@ sammy.get
/^#\/(~logging)$/,
function( context )
{
var core_basepath = $( '[data-basepath]', app.menu_element ).attr( 'data-basepath' );
loglevel_path = core_basepath + '/admin/logging';
var content_element = $( '#content' );
$.get
@ -495,8 +493,6 @@ sammy.get
/^#\/(~logging)\/level$/,
function( context )
{
var core_basepath = $( '[data-basepath]', app.menu_element ).attr( 'data-basepath' );
loglevel_path = core_basepath + '/admin/logging';
var content_element = $( '#content' );
$.get

View File

@ -21,7 +21,6 @@ sammy.get
/^#\/(~threads)$/,
function( context )
{
var core_basepath = $( '[data-basepath]', app.menu_element ).attr( 'data-basepath' );
var content_element = $( '#content' );
$.get
@ -35,7 +34,7 @@ sammy.get
$.ajax
(
{
url : core_basepath + '/admin/threads?wt=json',
url : app.config.solr_path + '/admin/info/threads?wt=json',
dataType : 'json',
context : $( '#threads', content_element ),
beforeSend : function( xhr, settings )

View File

@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div id="cores" class="clearfix">
<div id="cores" class="clearfix empty">
<div id="ui-block">&nbsp;</div>
@ -23,11 +23,11 @@ limitations under the License.
<div id="actions" class="actions clearfix">
<button id="add" class="action"><span>Add Core</span></button>
<button id="unload" class="warn"><span>Unload</span></button>
<button id="rename" class="action"><span>Rename</span></button>
<button id="swap" class="action"><span>Swap</span></button>
<button id="reload"><span>Reload</span></button>
<button id="optimize"><span>Optimize</span></button>
<button id="unload" class="warn requires-core"><span>Unload</span></button>
<button id="rename" class="action requires-core"><span>Rename</span></button>
<button id="swap" class="action requires-core"><span>Swap</span></button>
<button id="reload" class="requires-core"><span>Reload</span></button>
<button id="optimize" class="requires-core"><span>Optimize</span></button>
<div class="action add" data-rel="add">
@ -118,7 +118,7 @@ limitations under the License.
</div>
<div id="data">
<div id="data" class="requires-core">
<div class="block" id="core-data">
@ -213,7 +213,7 @@ limitations under the License.
</div>
<div id="navigation" class="clearfix">
<div id="navigation" class="requires-core clearfix">
</div>

View File

@ -60,18 +60,36 @@ limitations under the License.
</div>
</div>
<div class="block" id="admin-extra">
<div class="block fieldlist" id="instance">
<h2><span>Admin Extra</span></h2>
<h2><span>Instance</span></h2>
<div class="message-container">
<div class="message"></div>
</div>
<div class="content">
<dl>
<dt class="dir_cwd"><abbr title="Current Working Directory">CWD</abbr>:</dt>
<dd class="dir_cwd value"></dd>
<dt class="dir_instance">Instance:</dt>
<dd class="dir_instance value"></dd>
<dt class="dir_data">Data:</dt>
<dd class="dir_data value"></dd>
<dt class="dir_index">Index:</dt>
<dd class="dir_index value"></dd>
<dt class="dir_impl">Impl:</dt>
<dd class="dir_impl value"></dd>
</dl>
</div>
</div>
</div>
@ -136,19 +154,6 @@ limitations under the License.
</div>
</div>
<div class="block" id="dataimport">
<h2><span>Dataimport</span></h2>
<div class="message-container">
<div class="message"></div>
</div>
<div class="content"></div>
</div>
</div>
<div class="block fieldlist" id="healthcheck">
@ -171,6 +176,23 @@ limitations under the License.
</div>
</div>
<div class="clearfix">
<div class="block" id="admin-extra">
<h2><span>Admin Extra</span></h2>
<div class="message-container">
<div class="message"></div>
</div>
<div class="content">
</div>
</div>
</div>
</div>