SOLR-4526: Admin UI depends on optional system info

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1452835 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Matheis 2013-03-05 15:02:39 +00:00
parent a5e5c904c8
commit e2ce3914e2
2 changed files with 42 additions and 29 deletions

View File

@ -239,6 +239,9 @@ Optimizations
* SOLR-4529: Improve Admin UI Dashboard legibility (Felix Buenemann via
steffkes)
* SOLR-4526: Admin UI depends on optional system info (Felix Buenemann via
steffkes)
Other Changes
----------------------

View File

@ -97,8 +97,8 @@ var system_info = function( element, system_data )
{
// -- usage
var load_average = ( system_data['system']['uptime'] || '' ).match( /load average: (.+)/ );
if( load_average && load_average[1] )
var load_average = ( system_data['system']['uptime'] || '' ).match( /load averages?: (\d+[.,]\d\d),? (\d+[.,]\d\d),? (\d+[.,]\d\d)/ );
if( load_average )
{
var hl = $( '#system h2', element );
@ -106,20 +106,20 @@ var system_info = function( element, system_data )
.remove();
hl
.append( ' <small class="bar-desc">' + load_average[1].split( ', ' ).join( ' ' ).esc() + '</small>' );
.append( ' <small class="bar-desc">' + load_average.slice( 1 ).join( ' ' ).replace( /,/g, '.' ).esc() + '</small>' );
}
// -- physical-memory-bar
var bar_holder = $( '#physical-memory-bar', element );
if( !system_data['system']['totalPhysicalMemorySize'] )
if( system_data['system']['totalPhysicalMemorySize'] === undefined || system_data['system']['freePhysicalMemorySize'] === undefined )
{
bar_holder.hide();
}
else
{
bar_holder.show();
var bar_data = {
'max' : parse_memory_value( system_data['system']['totalPhysicalMemorySize'] ),
'total' : parse_memory_value( system_data['system']['totalPhysicalMemorySize'] - system_data['system']['freePhysicalMemorySize'] )
@ -131,7 +131,7 @@ var system_info = function( element, system_data )
// -- swap-space-bar
var bar_holder = $( '#swap-space-bar', element );
if( !system_data['system']['totalSwapSpaceSize'] )
if( system_data['system']['totalSwapSpaceSize'] === undefined || system_data['system']['freeSwapSpaceSize'] === undefined )
{
bar_holder.hide();
}
@ -147,10 +147,10 @@ var system_info = function( element, system_data )
generate_bar( bar_holder, bar_data, true );
}
// -- swap-space-bar
// -- file-descriptor-bar
var bar_holder = $( '#file-descriptor-bar', element );
if( !system_data['system']['maxFileDescriptorCount'] )
if( system_data['system']['maxFileDescriptorCount'] === undefined || system_data['system']['openFileDescriptorCount'] === undefined )
{
bar_holder.hide();
}
@ -172,32 +172,42 @@ var system_info = function( element, system_data )
// -- memory-bar
var jvm_memory = $.extend
(
{
'free' : null,
'total' : null,
'max' : null,
'used' : null,
'raw' : {
var bar_holder = $( '#jvm-memory-bar', element );
if( system_data['jvm']['memory'] === undefined )
{
bar_holder.hide();
}
else
{
bar_holder.show();
var jvm_memory = $.extend
(
{
'free' : null,
'total' : null,
'max' : null,
'used' : null,
'used%' : null
}
},
system_data['jvm']['memory']
);
var bar_holder = $( '#jvm-memory-bar', element );
var bar_data = {
'max' : parse_memory_value( jvm_memory['raw']['max'] || jvm_memory['max'] ),
'total' : parse_memory_value( jvm_memory['raw']['total'] || jvm_memory['total'] ),
'used' : parse_memory_value( jvm_memory['raw']['used'] || jvm_memory['used'] )
};
'raw' : {
'free' : null,
'total' : null,
'max' : null,
'used' : null,
'used%' : null
}
},
system_data['jvm']['memory']
);
var bar_data = {
'max' : parse_memory_value( jvm_memory['raw']['max'] || jvm_memory['max'] ),
'total' : parse_memory_value( jvm_memory['raw']['total'] || jvm_memory['total'] ),
'used' : parse_memory_value( jvm_memory['raw']['used'] || jvm_memory['used'] )
};
generate_bar( bar_holder, bar_data, true );
}
generate_bar( bar_holder, bar_data, true );
}
// #/