You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ry...@apache.org on 2012/02/23 20:23:12 UTC
svn commit: r1292908 [8/9] - in /lucene/dev/trunk/solr/webapp/web: ./ css/
css/styles/ js/ js/lib/ js/scripts/ tpl/
Added: lucene/dev/trunk/solr/webapp/web/js/scripts/dataimport.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/dataimport.js?rev=1292908&view=auto
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/dataimport.js (added)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/dataimport.js Thu Feb 23 19:23:10 2012
@@ -0,0 +1,452 @@
+sammy.bind
+(
+ 'dataimport_queryhandler_load',
+ function( event, params )
+ {
+ var core_basepath = params.active_core.attr( 'data-basepath' );
+
+ $.ajax
+ (
+ {
+ url : core_basepath + '/admin/mbeans?cat=QUERYHANDLER&wt=json',
+ dataType : 'json',
+ beforeSend : function( xhr, settings )
+ {
+ },
+ success : function( response, text_status, xhr )
+ {
+ var handlers = response['solr-mbeans'][1];
+ var dataimport_handlers = [];
+ for( var key in handlers )
+ {
+ if( handlers[key]['class'] !== key &&
+ handlers[key]['class'] === 'org.apache.solr.handler.dataimport.DataImportHandler' )
+ {
+ dataimport_handlers.push( key );
+ }
+ }
+ params.callback( dataimport_handlers );
+ },
+ error : function( xhr, text_status, error_thrown)
+ {
+ },
+ complete : function( xhr, text_status )
+ {
+ }
+ }
+ );
+ }
+);
+
+// #/:core/dataimport
+sammy.get
+(
+ /^#\/([\w\d-]+)\/(dataimport)$/,
+ function( context )
+ {
+ sammy.trigger
+ (
+ 'dataimport_queryhandler_load',
+ {
+ active_core : this.active_core,
+ callback : function( dataimport_handlers )
+ {
+ if( 0 === dataimport_handlers.length )
+ {
+ $( '#content' )
+ .html( 'sorry, no dataimport-handler defined!' );
+
+ return false;
+ }
+
+ context.redirect( context.path + '/' + dataimport_handlers[0] );
+ }
+ }
+ );
+ }
+);
+
+// #/:core/dataimport
+sammy.get
+(
+ /^#\/([\w\d-]+)\/(dataimport)\//,
+ function( context )
+ {
+ var core_basepath = this.active_core.attr( 'data-basepath' );
+ var content_element = $( '#content' );
+
+ var path_parts = this.path.match( /^(.+\/dataimport\/)(.*)$/ );
+ var handler_url = core_basepath + path_parts[2];
+
+ $( 'li.dataimport', this.active_core )
+ .addClass( 'active' );
+
+ $.get
+ (
+ 'tpl/dataimport.html',
+ function( template )
+ {
+ content_element
+ .html( template );
+
+ var dataimport_element = $( '#dataimport', content_element );
+ var form_element = $( '#form', dataimport_element );
+ var config_element = $( '#config', dataimport_element );
+ var config_error_element = $( '#config-error', dataimport_element );
+
+ // handler
+
+ sammy.trigger
+ (
+ 'dataimport_queryhandler_load',
+ {
+ active_core : context.active_core,
+ callback : function( dataimport_handlers )
+ {
+
+ var handlers_element = $( '.handler', form_element );
+ var handlers = [];
+
+ for( var i = 0; i < dataimport_handlers.length; i++ )
+ {
+ handlers.push
+ (
+ '<li><a href="' + path_parts[1] + dataimport_handlers[i] + '">' +
+ dataimport_handlers[i] +
+ '</a></li>'
+ );
+ }
+
+ $( 'ul', handlers_element )
+ .html( handlers.join( "\n") ) ;
+
+ $( 'a[href="' + context.path + '"]', handlers_element ).parent()
+ .addClass( 'active' );
+
+ handlers_element
+ .show();
+ }
+ }
+ );
+
+ // config
+
+ function dataimport_fetch_config()
+ {
+ $.ajax
+ (
+ {
+ url : handler_url + '?command=show-config',
+ dataType : 'xml',
+ context : $( '#dataimport_config', config_element ),
+ beforeSend : function( xhr, settings )
+ {
+ },
+ success : function( config, text_status, xhr )
+ {
+ dataimport_element
+ .removeClass( 'error' );
+
+ config_error_element
+ .hide();
+
+ config_element
+ .addClass( 'hidden' );
+
+
+ var entities = [];
+
+ $( 'document > entity', config )
+ .each
+ (
+ function( i, element )
+ {
+ entities.push( '<option>' + $( element ).attr( 'name' ) + '</option>' );
+ }
+ );
+
+ $( '#entity', form_element )
+ .append( entities.join( "\n" ) );
+ },
+ error : function( xhr, text_status, error_thrown )
+ {
+ if( 'parsererror' === error_thrown )
+ {
+ dataimport_element
+ .addClass( 'error' );
+
+ config_error_element
+ .show();
+
+ config_element
+ .removeClass( 'hidden' );
+ }
+ },
+ complete : function( xhr, text_status )
+ {
+ var code = $(
+ '<pre class="syntax language-xml"><code>' +
+ xhr.responseText.replace( /\</g, '<' ).replace( /\>/g, '>' ) +
+ '</code></pre>'
+ );
+ this.html( code );
+
+ if( 'success' === text_status )
+ {
+ hljs.highlightBlock( code.get(0) );
+ }
+ }
+ }
+ );
+ }
+ dataimport_fetch_config();
+
+ $( '.toggle', config_element )
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ $( this ).parents( '.block' )
+ .toggleClass( 'hidden' );
+
+ return false;
+ }
+ )
+
+ var reload_config_element = $( '.reload_config', config_element );
+ reload_config_element
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ $.ajax
+ (
+ {
+ url : handler_url + '?command=reload-config',
+ dataType : 'xml',
+ context: $( this ),
+ beforeSend : function( xhr, settings )
+ {
+ this
+ .addClass( 'loader' );
+ },
+ success : function( response, text_status, xhr )
+ {
+ this
+ .addClass( 'success' );
+
+ window.setTimeout
+ (
+ function()
+ {
+ reload_config_element
+ .removeClass( 'success' );
+ },
+ 5000
+ );
+ },
+ error : function( xhr, text_status, error_thrown )
+ {
+ this
+ .addClass( 'error' );
+ },
+ complete : function( xhr, text_status )
+ {
+ this
+ .removeClass( 'loader' );
+
+ dataimport_fetch_config();
+ }
+ }
+ );
+ return false;
+ }
+ )
+
+ // state
+
+ function dataimport_fetch_status()
+ {
+ $.ajax
+ (
+ {
+ url : handler_url + '?command=status',
+ dataType : 'xml',
+ beforeSend : function( xhr, settings )
+ {
+ },
+ success : function( response, text_status, xhr )
+ {
+ var state_element = $( '#current_state', content_element );
+
+ var status = $( 'str[name="status"]', response ).text();
+ var rollback_element = $( 'str[name="Rolledback"]', response );
+ var messages_count = $( 'lst[name="statusMessages"] str', response ).size();
+
+ var started_at = $( 'str[name="Full Dump Started"]', response ).text();
+ if( !started_at )
+ {
+ started_at = (new Date()).toGMTString();
+ }
+
+ function dataimport_compute_details( response, details_element )
+ {
+ var details = [];
+
+ var requests = parseInt( $( 'str[name="Total Requests made to DataSource"]', response ).text() );
+ if( NaN !== requests )
+ {
+ details.push
+ (
+ '<abbr title="Total Requests made to DataSource">Requests</abbr>: ' +
+ requests
+ );
+ }
+
+ var fetched = parseInt( $( 'str[name="Total Rows Fetched"]', response ).text() );
+ if( NaN !== fetched )
+ {
+ details.push
+ (
+ '<abbr title="Total Rows Fetched">Fetched</abbr>: ' +
+ fetched
+ );
+ }
+
+ var skipped = parseInt( $( 'str[name="Total Documents Skipped"]', response ).text() );
+ if( NaN !== requests )
+ {
+ details.push
+ (
+ '<abbr title="Total Documents Skipped">Skipped</abbr>: ' +
+ skipped
+ );
+ }
+
+ var processed = parseInt( $( 'str[name="Total Documents Processed"]', response ).text() );
+ if( NaN !== processed )
+ {
+ details.push
+ (
+ '<abbr title="Total Documents Processed">Processed</abbr>: ' +
+ processed
+ );
+ }
+
+ details_element
+ .html( details.join( ', ' ) );
+ }
+
+ state_element
+ .removeClass( 'indexing' )
+ .removeClass( 'success' )
+ .removeClass( 'failure' );
+
+ $( '.info', state_element )
+ .removeClass( 'loader' );
+
+ if( 0 !== rollback_element.size() )
+ {
+ state_element
+ .addClass( 'failure' )
+ .show();
+
+ $( '.info strong', state_element )
+ .text( $( 'str[name=""]', response ).text() );
+
+ console.debug( 'rollback @ ', rollback_element.text() );
+ }
+ else if( 'idle' === status && 0 !== messages_count )
+ {
+ state_element
+ .addClass( 'success' )
+ .show();
+
+ $( '.time', state_element )
+ .text( started_at )
+ .timeago();
+
+ $( '.info strong', state_element )
+ .text( $( 'str[name=""]', response ).text() );
+
+ dataimport_compute_details( response, $( '.info .details', state_element ) );
+ }
+ else if( 'busy' === status )
+ {
+ state_element
+ .addClass( 'indexing' )
+ .show();
+
+ $( '.time', state_element )
+ .text( started_at )
+ .timeago();
+
+ $( '.info', state_element )
+ .addClass( 'loader' );
+
+ $( '.info strong', state_element )
+ .text( 'Indexing ...' );
+
+ dataimport_compute_details( response, $( '.info .details', state_element ) );
+
+ window.setTimeout( dataimport_fetch_status, 2000 );
+ }
+ else
+ {
+ state_element.hide();
+ }
+ },
+ error : function( xhr, text_status, error_thrown )
+ {
+ console.debug( arguments );
+ },
+ complete : function( xhr, text_status )
+ {
+ }
+ }
+ );
+ }
+ dataimport_fetch_status();
+
+ // form
+
+ $( 'form', form_element )
+ .die( 'submit' )
+ .live
+ (
+ 'submit',
+ function( event )
+ {
+ $.ajax
+ (
+ {
+ url : handler_url + '?command=full-import',
+ dataType : 'xml',
+ beforeSend : function( xhr, settings )
+ {
+ },
+ success : function( response, text_status, xhr )
+ {
+ console.debug( response );
+ dataimport_fetch_status();
+ },
+ error : function( xhr, text_status, error_thrown )
+ {
+ console.debug( arguments );
+ },
+ complete : function( xhr, text_status )
+ {
+ }
+ }
+ );
+ return false;
+ }
+ );
+ }
+ );
+ }
+);
\ No newline at end of file
Added: lucene/dev/trunk/solr/webapp/web/js/scripts/file.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/file.js?rev=1292908&view=auto
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/file.js (added)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/file.js Thu Feb 23 19:23:10 2012
@@ -0,0 +1,37 @@
+// #/:core/schema, #/:core/config
+sammy.get
+(
+ /^#\/([\w\d-]+)\/(schema|config)$/,
+ function( context )
+ {
+ var core_basepath = this.active_core.attr( 'data-basepath' );
+
+ $.ajax
+ (
+ {
+ url : core_basepath + app.config[ context.params.splat[1] + '_path' ],
+ dataType : 'xml',
+ context : $( '#content' ),
+ beforeSend : function( xhr, settings )
+ {
+ this
+ .html( '<div class="loader">Loading ...</div>' );
+ },
+ complete : function( xhr, text_status )
+ {
+ var code = $(
+ '<pre class="syntax language-xml"><code>' +
+ xhr.responseText.esc() +
+ '</code></pre>'
+ );
+ this.html( code );
+
+ if( 'success' === text_status )
+ {
+ hljs.highlightBlock( code.get(0) );
+ }
+ }
+ }
+ );
+ }
+);
\ No newline at end of file
Added: lucene/dev/trunk/solr/webapp/web/js/scripts/index.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/index.js?rev=1292908&view=auto
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/index.js (added)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/index.js Thu Feb 23 19:23:10 2012
@@ -0,0 +1,184 @@
+// #/
+sammy.get
+(
+ /^#\/$/,
+ function( context )
+ {
+ var content_element = $( '#content' );
+
+ $( '#index', app.menu_element )
+ .addClass( 'active' );
+
+ content_element
+ .html( '<div id="index"></div>' );
+
+ $.ajax
+ (
+ {
+ url : 'tpl/index.html',
+ context : $( '#index', content_element ),
+ beforeSend : function( arr, form, options )
+ {
+ },
+ success : function( template )
+ {
+ this
+ .html( template );
+
+ var jvm_memory = $.extend
+ (
+ {
+ 'free' : null,
+ 'total' : null,
+ 'max' : null,
+ 'used' : null,
+ 'raw' : {
+ 'free' : null,
+ 'total' : null,
+ 'max' : null,
+ 'used' : null,
+ 'used%' : null
+ }
+ },
+ app.dashboard_values['jvm']['memory']
+ );
+
+ var parse_memory_value = function( value )
+ {
+ if( value !== Number( value ) )
+ {
+ var units = 'BKMGTPEZY';
+ var match = value.match( /^(\d+([,\.]\d+)?) (\w)\w?$/ );
+ var value = parseFloat( match[1] ) * Math.pow( 1024, units.indexOf( match[3].toUpperCase() ) );
+ }
+
+ return value;
+ };
+ var memory_data = {
+ 'memory-bar-max' : parse_memory_value( jvm_memory['raw']['max'] || jvm_memory['max'] ),
+ 'memory-bar-total' : parse_memory_value( jvm_memory['raw']['total'] || jvm_memory['total'] ),
+ 'memory-bar-used' : parse_memory_value( jvm_memory['raw']['used'] || jvm_memory['used'] )
+ };
+
+ for( var key in memory_data )
+ {
+ $( '.value.' + key, this )
+ .text( memory_data[key] );
+ }
+
+ var data = {
+ 'start_time' : app.dashboard_values['jvm']['jmx']['startTime'],
+ 'host' : app.dashboard_values['core']['host'],
+ 'jvm' : app.dashboard_values['jvm']['name'] + ' (' + app.dashboard_values['jvm']['version'] + ')',
+ 'solr_spec_version' : app.dashboard_values['lucene']['solr-spec-version'],
+ 'solr_impl_version' : app.dashboard_values['lucene']['solr-impl-version'],
+ '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['cwd'] = app.dashboard_values['core']['directory']['cwd'];
+ }
+
+ for( var key in data )
+ {
+ var value_element = $( '.' + key + ' dd', this );
+
+ value_element
+ .text( data[key] );
+
+ value_element.closest( 'li' )
+ .show();
+ }
+
+ var commandLineArgs = app.dashboard_values['jvm']['jmx']['commandLineArgs'];
+ if( 0 !== commandLineArgs.length )
+ {
+ var cmd_arg_element = $( '.command_line_args dt', this );
+ var cmd_arg_key_element = $( '.command_line_args dt', this );
+ var cmd_arg_element = $( '.command_line_args dd', this );
+
+ for( var key in commandLineArgs )
+ {
+ cmd_arg_element = cmd_arg_element.clone();
+ cmd_arg_element.text( commandLineArgs[key] );
+
+ cmd_arg_key_element
+ .after( cmd_arg_element );
+ }
+
+ cmd_arg_key_element.closest( 'li' )
+ .show();
+
+ $( '.command_line_args dd:last', this )
+ .remove();
+
+ $( '.command_line_args dd:odd', this )
+ .addClass( 'odd' );
+ }
+
+ $( '.timeago', this )
+ .timeago();
+
+ $( 'li:visible:odd', this )
+ .addClass( 'odd' );
+
+ // -- memory bar
+
+ var max_height = Math.round( $( '#memory-bar-max', this ).height() );
+ var total_height = Math.round( ( memory_data['memory-bar-total'] * max_height ) / memory_data['memory-bar-max'] );
+ var used_height = Math.round( ( memory_data['memory-bar-used'] * max_height ) / memory_data['memory-bar-max'] );
+
+ var memory_bar_total_value = $( '#memory-bar-total span', this ).first();
+
+ $( '#memory-bar-total', this )
+ .height( total_height );
+
+ $( '#memory-bar-used', this )
+ .height( used_height );
+
+ if( used_height < total_height + memory_bar_total_value.height() )
+ {
+ memory_bar_total_value
+ .addClass( 'upper' )
+ .css( 'margin-top', memory_bar_total_value.height() * -1 );
+ }
+
+ var memory_percentage = ( ( memory_data['memory-bar-used'] / memory_data['memory-bar-max'] ) * 100 ).toFixed(1);
+ var headline = $( '#memory h2 span', this );
+
+ headline
+ .text( headline.html() + ' (' + memory_percentage + '%)' );
+
+ $( '#memory-bar .value', this )
+ .each
+ (
+ function()
+ {
+ var self = $( this );
+
+ var byte_value = parseInt( self.html() );
+
+ self
+ .attr( 'title', 'raw: ' + byte_value + ' B' );
+
+ byte_value /= 1024;
+ byte_value /= 1024;
+ byte_value = byte_value.toFixed( 2 ) + ' MB';
+
+ self
+ .text( byte_value );
+ }
+ );
+ },
+ error : function( xhr, text_status, error_thrown )
+ {
+ },
+ complete : function( xhr, text_status )
+ {
+ }
+ }
+ );
+ }
+);
\ No newline at end of file
Added: lucene/dev/trunk/solr/webapp/web/js/scripts/java-properties.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/java-properties.js?rev=1292908&view=auto
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/java-properties.js (added)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/java-properties.js Thu Feb 23 19:23:10 2012
@@ -0,0 +1,84 @@
+// #/java-properties
+sammy.get
+(
+ /^#\/(java-properties)$/,
+ function( context )
+ {
+ var core_basepath = $( 'li[data-basepath]', app.menu_element ).attr( 'data-basepath' );
+ var content_element = $( '#content' );
+
+ content_element
+ .html( '<div id="java-properties"></div>' );
+
+ $.ajax
+ (
+ {
+ url : core_basepath + '/admin/properties?wt=json',
+ dataType : 'json',
+ context : $( '#java-properties', content_element ),
+ beforeSend : function( xhr, settings )
+ {
+ this
+ .html( '<div class="loader">Loading ...</div>' );
+ },
+ success : function( response, text_status, xhr )
+ {
+ var system_properties = response['system.properties'];
+ var properties_data = {};
+ var properties_content = [];
+ var properties_order = [];
+
+ for( var key in system_properties )
+ {
+ var displayed_key = key.replace( /\./g, '.​' );
+ var displayed_value = [ system_properties[key] ];
+ var item_class = 'clearfix';
+
+ if( -1 !== key.indexOf( '.path' ) || -1 !== key.indexOf( '.dirs' ) )
+ {
+ displayed_value = system_properties[key].split( system_properties['path.separator'] );
+ if( 1 < displayed_value.length )
+ {
+ item_class += ' multi';
+ }
+ }
+
+ var item_content = '<li><dl class="' + item_class + '">' + "\n" +
+ '<dt>' + displayed_key.esc() + '</dt>' + "\n";
+
+ for( var i in displayed_value )
+ {
+ item_content += '<dd>' + displayed_value[i].esc() + '</dd>' + "\n";
+ }
+
+ item_content += '</dl></li>';
+
+ properties_data[key] = item_content;
+ properties_order.push( key );
+ }
+
+ properties_order.sort();
+ for( var i in properties_order )
+ {
+ properties_content.push( properties_data[properties_order[i]] );
+ }
+
+ this
+ .html( '<ul>' + properties_content.join( "\n" ) + '</ul>' );
+
+ $( 'li:odd', this )
+ .addClass( 'odd' );
+
+ $( '.multi dd:odd', this )
+ .addClass( 'odd' );
+ },
+ error : function( xhr, text_status, error_thrown)
+ {
+ },
+ complete : function( xhr, text_status )
+ {
+ }
+ }
+ );
+ }
+);
\ No newline at end of file
Added: lucene/dev/trunk/solr/webapp/web/js/scripts/logging.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/logging.js?rev=1292908&view=auto
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/logging.js (added)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/logging.js Thu Feb 23 19:23:10 2012
@@ -0,0 +1,164 @@
+// #/logging
+sammy.get
+(
+ /^#\/(logging)$/,
+ function( context )
+ {
+ var content_element = $( '#content' );
+
+ content_element
+ .html( '<div id="logging"></div>' );
+
+ $.ajax
+ (
+ {
+ url : 'logging.json',
+ dataType : 'json',
+ context : $( '#logging', content_element ),
+ beforeSend : function( xhr, settings )
+ {
+ this
+ .html( '<div class="loader">Loading ...</div>' );
+ },
+ success : function( response, text_status, xhr )
+ {
+ var logger = response.logger;
+
+ var loglevel = '<div class="loglevel %class%">' + "\n";
+ loglevel += '<a class="effective_level trigger"><span>%effective_level%</span></a>' + "\n";
+ loglevel += '<ul>' + "\n";
+
+ for( var key in response.levels )
+ {
+ var level = response.levels[key].esc();
+ loglevel += '<li class="' + level + '"><a>' + level + '</a></li>' + "\n";
+ }
+
+ loglevel += '<li class="UNSET"><a>UNSET</a></li>' + "\n";
+ loglevel += '</ul>' + "\n";
+ loglevel += '</div>';
+
+ var logger_tree = function( filter )
+ {
+ var logger_content = '';
+ var filter_regex = new RegExp( '^' + filter + '\\.\\w+$' );
+
+ for( var logger_name in logger )
+ {
+ var continue_matcher = false;
+
+ if( !filter )
+ {
+ continue_matcher = logger_name.indexOf( '.' ) !== -1;
+ }
+ else
+ {
+ continue_matcher = !logger_name.match( filter_regex );
+ }
+
+ if( continue_matcher )
+ {
+ continue;
+ }
+
+ var has_logger_instance = !!logger[logger_name];
+
+ var classes = [];
+
+ has_logger_instance
+ ? classes.push( 'active' )
+ : classes.push( 'inactive' );
+
+ logger_content += '<li class="jstree-leaf">';
+ logger_content += '<ins class="jstree-icon"> </ins>';
+ logger_content += '<a class="trigger ' + classes.join( ' ' ) + '" ' + "\n" +
+ 'title="' + logger_name.esc() + '"><span>' + "\n" +
+ logger_name.split( '.' ).pop().esc() + "\n" +
+ '</span></a>';
+
+ logger_content += loglevel
+ .replace
+ (
+ /%class%/g,
+ classes.join( ' ' )
+ )
+ .replace
+ (
+ /%effective_level%/g,
+ has_logger_instance
+ ? logger[logger_name].effective_level
+ : 'null'
+ );
+
+ var child_logger_content = logger_tree( logger_name );
+ if( child_logger_content )
+ {
+ logger_content += '<ul>';
+ logger_content += child_logger_content;
+ logger_content += '</ul>';
+ }
+
+ logger_content += '</li>';
+ }
+
+ return logger_content;
+ }
+
+ var logger_content = logger_tree( null );
+
+ this
+ .html( '<ul class="tree jstree">' + logger_content + '</ul>' );
+
+ $( 'li:last-child', this )
+ .addClass( 'jstree-last' );
+
+ $( '.loglevel', this )
+ .each
+ (
+ function( index, element )
+ {
+ var element = $( element );
+ var effective_level = $( '.effective_level span', element ).text();
+
+ element
+ .css( 'z-index', 800 - index );
+
+ $( 'ul .' + effective_level, element )
+ .addClass( 'selected' );
+ }
+ );
+
+ $( '.trigger', this )
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ $( '.loglevel', $( this ).parents( 'li' ).first() ).first()
+ .trigger( 'toggle' );
+ }
+ );
+
+ $( '.loglevel', this )
+ .die( 'toggle')
+ .live
+ (
+ 'toggle',
+ function( event )
+ {
+ $( this )
+ .toggleClass( 'open' );
+ }
+ );
+ },
+ error : function( xhr, text_status, error_thrown)
+ {
+ },
+ complete : function( xhr, text_status )
+ {
+ }
+ }
+ );
+ }
+);
\ No newline at end of file
Added: lucene/dev/trunk/solr/webapp/web/js/scripts/ping.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/ping.js?rev=1292908&view=auto
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/ping.js (added)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/ping.js Thu Feb 23 19:23:10 2012
@@ -0,0 +1,58 @@
+$( '.ping a', app.menu_element )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ $.ajax
+ (
+ {
+ url : $( this ).attr( 'rel' ) + '?wt=json&ts=' + (new Date).getTime(),
+ dataType : 'json',
+ context: this,
+ beforeSend : function( arr, form, options )
+ {
+ loader.show( this );
+ },
+ success : function( response, text_status, xhr )
+ {
+ $( this )
+ .removeAttr( 'title' );
+
+ $( this ).parents( 'li' )
+ .removeClass( 'error' );
+
+ var qtime_element = $( '.qtime', this );
+
+ if( 0 === qtime_element.size() )
+ {
+ qtime_element = $( '<small class="qtime"> (<span></span>)</small>' );
+
+ $( this )
+ .append
+ (
+ qtime_element
+ );
+ }
+
+ $( 'span', qtime_element )
+ .html( response.responseHeader.QTime + 'ms' );
+ },
+ error : function( xhr, text_status, error_thrown )
+ {
+ $( this )
+ .attr( 'title', '/admin/ping is not configured (' + xhr.status + ': ' + error_thrown + ')' );
+
+ $( this ).parents( 'li' )
+ .addClass( 'error' );
+ },
+ complete : function( xhr, text_status )
+ {
+ loader.hide( this );
+ }
+ }
+ );
+
+ return false;
+ }
+ );
\ No newline at end of file
Added: lucene/dev/trunk/solr/webapp/web/js/scripts/plugins.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/plugins.js?rev=1292908&view=auto
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/plugins.js (added)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/plugins.js Thu Feb 23 19:23:10 2012
@@ -0,0 +1,259 @@
+sammy.bind
+(
+ 'plugins_load',
+ function( event, params )
+ {
+ var callback = function()
+ {
+ params.callback( app.plugin_data.plugin_data, app.plugin_data.sort_table, app.plugin_data.types );
+ }
+
+ if( app.plugin_data )
+ {
+ callback( app.plugin_data );
+ return true;
+ }
+
+ var core_basepath = params.active_core.attr( 'data-basepath' );
+ $.ajax
+ (
+ {
+ url : core_basepath + '/admin/mbeans?stats=true&wt=json',
+ dataType : 'json',
+ beforeSend : function( xhr, settings )
+ {
+ },
+ success : function( response, text_status, xhr )
+ {
+ var types = [];
+ var sort_table = {};
+ var plugin_data = {};
+
+ var types_obj = {};
+ var plugin_key = null;
+
+ for( var i = 0; i < response['solr-mbeans'].length; i++ )
+ {
+ if( !( i % 2 ) )
+ {
+ plugin_key = response['solr-mbeans'][i];
+ }
+ else
+ {
+ plugin_data[plugin_key] = response['solr-mbeans'][i];
+ }
+ }
+
+ for( var key in plugin_data )
+ {
+ sort_table[key] = {
+ url : [],
+ component : [],
+ handler : []
+ };
+ for( var part_key in plugin_data[key] )
+ {
+ if( 0 < part_key.indexOf( '.' ) )
+ {
+ types_obj[key] = true;
+ sort_table[key]['handler'].push( part_key );
+ }
+ else if( 0 === part_key.indexOf( '/' ) )
+ {
+ types_obj[key] = true;
+ sort_table[key]['url'].push( part_key );
+ }
+ else
+ {
+ types_obj[key] = true;
+ sort_table[key]['component'].push( part_key );
+ }
+ }
+ }
+
+ for( var type in types_obj )
+ {
+ types.push( type );
+ }
+ types.sort();
+
+ app.plugin_data = {
+ 'plugin_data' : plugin_data,
+ 'sort_table' : sort_table,
+ 'types' : types
+ }
+
+ $.get
+ (
+ 'tpl/plugins.html',
+ function( template )
+ {
+ $( '#content' )
+ .html( template );
+
+ callback( app.plugin_data );
+ }
+ );
+ },
+ error : function( xhr, text_status, error_thrown)
+ {
+ },
+ complete : function( xhr, text_status )
+ {
+ }
+ }
+ );
+ }
+);
+
+// #/:core/plugins/$type
+sammy.get
+(
+ /^#\/([\w\d-]+)\/(plugins)\/(\w+)$/,
+ function( context )
+ {
+ var content_element = $( '#content' );
+ var type = context.params.splat[2].toUpperCase();
+ var context_path = context.path.split( '?' ).shift();
+
+ sammy.trigger
+ (
+ 'plugins_load',
+ {
+ active_core : this.active_core,
+ callback : function( plugin_data, plugin_sort, types )
+ {
+ var frame_element = $( '#frame', content_element );
+ var navigation_element = $( '#navigation ul', content_element );
+
+ var navigation_content = [];
+ for( var i = 0; i < types.length; i++ )
+ {
+ var type_url = context.params.splat[0] + '/' +
+ context.params.splat[1] + '/' +
+ types[i].toLowerCase();
+
+ navigation_content.push
+ (
+ '<li class="' + types[i].toLowerCase() + '">' +
+ '<a href="#/' + type_url + '">' + types[i] + '</a>' +
+ '</li>'
+ );
+ }
+
+ navigation_element
+ .html( navigation_content.join( "\n" ) );
+
+ $( 'a[href="' + context_path + '"]', navigation_element )
+ .parent().addClass( 'current' );
+
+ var content = '<ul>';
+ for( var sort_key in plugin_sort[type] )
+ {
+ plugin_sort[type][sort_key].sort();
+ var plugin_type_length = plugin_sort[type][sort_key].length;
+
+ for( var i = 0; i < plugin_type_length; i++ )
+ {
+ content += '<li class="entry">' + "\n";
+ content += '<a href="' + context_path + '?entry=' + plugin_sort[type][sort_key][i] + '">';
+ content += plugin_sort[type][sort_key][i]
+ content += '</a>' + "\n";
+ content += '<ul class="detail">' + "\n";
+
+ var details = plugin_data[type][ plugin_sort[type][sort_key][i] ];
+ for( var detail_key in details )
+ {
+ if( 'stats' !== detail_key )
+ {
+ var detail_value = details[detail_key];
+
+ if( 'description' === detail_key )
+ {
+ detail_value = detail_value.replace( /,/g, ',​' );
+ }
+ else if( 'src' === detail_key )
+ {
+ detail_value = detail_value.replace( /\//g, '/​' );
+ }
+
+ content += '<li><dl class="clearfix">' + "\n";
+ content += '<dt>' + detail_key + ':</dt>' + "\n";
+ content += '<dd>' + detail_value + '</dd>' + "\n";
+ content += '</dl></li>' + "\n";
+ }
+ else if( 'stats' === detail_key && details[detail_key] )
+ {
+ content += '<li class="stats clearfix">' + "\n";
+ content += '<span>' + detail_key + ':</span>' + "\n";
+ content += '<ul>' + "\n";
+
+ for( var stats_key in details[detail_key] )
+ {
+ var stats_value = details[detail_key][stats_key];
+
+ if( 'readerDir' === stats_key )
+ {
+ stats_value = stats_value.replace( /@/g, '@​' );
+ }
+
+ content += '<li><dl class="clearfix">' + "\n";
+ content += '<dt>' + stats_key + ':</dt>' + "\n";
+ content += '<dd>' + stats_value + '</dd>' + "\n";
+ content += '</dl></li>' + "\n";
+ }
+
+ content += '</ul></li>' + "\n";
+ }
+ }
+
+ content += '</ul>' + "\n";
+ }
+ }
+ content += '</ul>' + "\n";
+
+ frame_element
+ .html( content );
+
+ $( 'a[href="' + decodeURIComponent( context.path ) + '"]', frame_element )
+ .parent().addClass( 'expanded' );
+
+ $( '.entry', frame_element )
+ .each
+ (
+ function( i, entry )
+ {
+ $( '.detail > li', entry ).not( '.stats' ).filter( ':even' )
+ .addClass( 'odd' );
+
+ $( '.stats li:odd', entry )
+ .addClass( 'odd' );
+ }
+ );
+ }
+ }
+ );
+ }
+);
+
+// #/:core/plugins
+sammy.get
+(
+ /^#\/([\w\d-]+)\/(plugins)$/,
+ function( context )
+ {
+ delete app.plugin_data;
+
+ sammy.trigger
+ (
+ 'plugins_load',
+ {
+ active_core : this.active_core,
+ callback : function( plugin_data, plugin_sort, types )
+ {
+ context.redirect( context.path + '/' + types[0].toLowerCase() );
+ }
+ }
+ );
+ }
+);
\ No newline at end of file
Added: lucene/dev/trunk/solr/webapp/web/js/scripts/query.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/query.js?rev=1292908&view=auto
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/query.js (added)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/query.js Thu Feb 23 19:23:10 2012
@@ -0,0 +1,142 @@
+// #/:core/query
+sammy.get
+(
+ /^#\/([\w\d-]+)\/(query)$/,
+ function( context )
+ {
+ var core_basepath = this.active_core.attr( 'data-basepath' );
+ var content_element = $( '#content' );
+
+ $.get
+ (
+ 'tpl/query.html',
+ function( template )
+ {
+ content_element
+ .html( template );
+
+ var query_element = $( '#query', content_element );
+ var query_form = $( '#form form', query_element );
+ var url_element = $( '#url', query_element );
+ var result_element = $( '#result', query_element );
+ var response_element = $( '#response iframe', result_element );
+
+ url_element
+ .die( 'change' )
+ .live
+ (
+ 'change',
+ function( event )
+ {
+ var check_iframe_ready_state = function()
+ {
+ var iframe_element = response_element.get(0).contentWindow.document ||
+ response_element.get(0).document;
+
+ if( !iframe_element )
+ {
+ console.debug( 'no iframe_element found', response_element );
+ return false;
+ }
+
+ url_element
+ .addClass( 'loader' );
+
+ if( 'complete' === iframe_element.readyState )
+ {
+ url_element
+ .removeClass( 'loader' );
+ }
+ else
+ {
+ window.setTimeout( check_iframe_ready_state, 100 );
+ }
+ }
+ check_iframe_ready_state();
+
+ response_element
+ .attr( 'src', this.href );
+
+ if( !response_element.hasClass( 'resized' ) )
+ {
+ response_element
+ .addClass( 'resized' )
+ .css( 'height', $( '#main' ).height() - 60 );
+ }
+ }
+ )
+
+ $( '.optional legend input[type=checkbox]', query_form )
+ .die( 'change' )
+ .live
+ (
+ 'change',
+ function( event )
+ {
+ var fieldset = $( this ).parents( 'fieldset' );
+
+ this.checked
+ ? fieldset.addClass( 'expanded' )
+ : fieldset.removeClass( 'expanded' );
+ }
+ )
+
+ for( var key in context.params )
+ {
+ if( 'string' === typeof context.params[key] )
+ {
+ $( '[name="' + key + '"]', query_form )
+ .val( context.params[key] );
+ }
+ }
+
+ query_form
+ .die( 'submit' )
+ .live
+ (
+ 'submit',
+ function( event )
+ {
+ var form_map = {};
+ var form_values = [];
+ var all_form_values = query_form.formToArray();
+
+ for( var i = 0; i < all_form_values.length; i++ )
+ {
+ if( !all_form_values[i].value || 0 === all_form_values[i].value.length )
+ {
+ continue;
+ }
+
+ var name_parts = all_form_values[i].name.split( '.' );
+ if( 1 < name_parts.length && !form_map[name_parts[0]] )
+ {
+ console.debug( 'skip "' + all_form_values[i].name + '", parent missing' );
+ continue;
+ }
+
+ form_map[all_form_values[i].name] = all_form_values[i].value;
+ form_values.push( all_form_values[i] );
+ }
+
+ var query_url = window.location.protocol + '//' +
+ window.location.host +
+ core_basepath +
+ '/select?' +
+ $.param( form_values );
+
+ url_element
+ .attr( 'href', query_url )
+ .text( query_url )
+ .trigger( 'change' );
+
+ result_element
+ .show();
+
+ return false;
+ }
+ );
+ }
+ );
+ }
+);
\ No newline at end of file
Added: lucene/dev/trunk/solr/webapp/web/js/scripts/replication.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/replication.js?rev=1292908&view=auto
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/replication.js (added)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/replication.js Thu Feb 23 19:23:10 2012
@@ -0,0 +1,443 @@
+// #/:core/replication
+sammy.get
+(
+ /^#\/([\w\d-]+)\/(replication)$/,
+ function( context )
+ {
+ var core_basepath = this.active_core.attr( 'data-basepath' );
+ var content_element = $( '#content' );
+
+ $.get
+ (
+ 'tpl/replication.html',
+ function( template )
+ {
+ content_element
+ .html( template );
+
+ var replication_element = $( '#replication', content_element );
+ var navigation_element = $( '#navigation', replication_element );
+
+ function convert_seconds_to_readable_time( value )
+ {
+ var text = [];
+ value = parseInt( value );
+
+ var minutes = Math.floor( value / 60 );
+ var hours = Math.floor( minutes / 60 );
+
+ if( 0 !== hours )
+ {
+ text.push( hours + 'h' );
+ value -= hours * 60 * 60;
+ minutes -= hours * 60;
+ }
+
+ if( 0 !== minutes )
+ {
+ text.push( minutes + 'm' );
+ value -= minutes * 60;
+ }
+
+ text.push( value + 's' );
+
+ return text.join( ' ' );
+ }
+
+ function replication_fetch_status()
+ {
+ $.ajax
+ (
+ {
+ url : core_basepath + '/replication?command=details&wt=json',
+ dataType : 'json',
+ beforeSend : function( xhr, settings )
+ {
+ $( '.refresh-status', navigation_element )
+ .addClass( 'loader' );
+ },
+ success : function( response, text_status, xhr )
+ {
+ $( '.refresh-status', navigation_element )
+ .removeClass( 'loader' );
+
+ var data = response.details;
+ var is_slave = 'true' === data.isSlave;
+
+ replication_element
+ .addClass( is_slave ? 'slave' : 'master' );
+
+ if( is_slave )
+ {
+ var error_element = $( '#error', replication_element );
+
+ if( data.slave.ERROR )
+ {
+ error_element
+ .html( data.slave.ERROR )
+ .show();
+ }
+ else
+ {
+ error_element
+ .hide()
+ .empty();
+ }
+
+ var progress_element = $( '#progress', replication_element );
+
+ var start_element = $( '#start', progress_element );
+ $( 'span', start_element )
+ .text( data.slave.replicationStartTime );
+
+ var eta_element = $( '#eta', progress_element );
+ $( 'span', eta_element )
+ .text( convert_seconds_to_readable_time( data.slave.timeRemaining ) );
+
+ var bar_element = $( '#bar', progress_element );
+ $( '.files span', bar_element )
+ .text( data.slave.numFilesToDownload );
+ $( '.size span', bar_element )
+ .text( data.slave.bytesToDownload );
+
+ var speed_element = $( '#speed', progress_element );
+ $( 'span', speed_element )
+ .text( data.slave.downloadSpeed );
+
+ var done_element = $( '#done', progress_element );
+ $( '.files span', done_element )
+ .text( data.slave.numFilesDownloaded );
+ $( '.size span', done_element )
+ .text( data.slave.bytesDownloaded );
+ $( '.percent span', done_element )
+ .text( parseInt(data.slave.totalPercent ) );
+
+ var percent = parseInt( data.slave.totalPercent );
+ if( 0 === percent )
+ {
+ done_element
+ .css( 'width', '1px' );
+ }
+ else
+ {
+ done_element
+ .css( 'width', percent + '%' );
+ }
+
+ var current_file_element = $( '#current-file', replication_element );
+ $( '.file', current_file_element )
+ .text( data.slave.currentFile );
+ $( '.done', current_file_element )
+ .text( data.slave.currentFileSizeDownloaded );
+ $( '.total', current_file_element )
+ .text( data.slave.currentFileSize );
+ $( '.percent', current_file_element )
+ .text( parseInt( data.slave.currentFileSizePercent ) );
+
+ if( !data.slave.indexReplicatedAtList )
+ {
+ data.slave.indexReplicatedAtList = [];
+ }
+
+ if( !data.slave.replicationFailedAtList )
+ {
+ data.slave.replicationFailedAtList = [];
+ }
+
+ var iterations_element = $( '#iterations', replication_element );
+ var iterations_list = $( '.iterations ul', iterations_element );
+
+ var iterations_data = [];
+ $.merge( iterations_data, data.slave.indexReplicatedAtList );
+ $.merge( iterations_data, data.slave.replicationFailedAtList );
+
+ if( 0 !== iterations_data.length )
+ {
+ var iterations = [];
+ for( var i = 0; i < iterations_data.length; i++ )
+ {
+ iterations.push
+ (
+ '<li data-date="' + iterations_data[i] + '">' +
+ iterations_data[i] + '</li>'
+ );
+ }
+
+ iterations_list
+ .html( iterations.join( "\n" ) )
+ .show();
+
+ $( data.slave.indexReplicatedAtList )
+ .each
+ (
+ function( key, value )
+ {
+ $( 'li[data-date="' + value + '"]', iterations_list )
+ .addClass( 'replicated' );
+ }
+ );
+
+ if( data.slave.indexReplicatedAt )
+ {
+ $(
+ 'li[data-date="' + data.slave.indexReplicatedAt + '"]',
+ iterations_list
+ )
+ .addClass( 'latest' );
+ }
+
+ $( data.slave.replicationFailedAtList )
+ .each
+ (
+ function( key, value )
+ {
+ $( 'li[data-date="' + value + '"]', iterations_list )
+ .addClass( 'failed' );
+ }
+ );
+
+ if( data.slave.replicationFailedAt )
+ {
+ $(
+ 'li[data-date="' + data.slave.replicationFailedAt + '"]',
+ iterations_list
+ )
+ .addClass( 'latest' );
+ }
+
+ if( 0 !== $( 'li:hidden', iterations_list ).size() )
+ {
+ $( 'a', iterations_element )
+ .show();
+ }
+ else
+ {
+ $( 'a', iterations_element )
+ .hide();
+ }
+ }
+ }
+
+ var details_element = $( '#details', replication_element );
+ var current_type_element = $( ( is_slave ? '.slave' : '.master' ), details_element );
+
+ $( '.version div', current_type_element )
+ .html( data.indexVersion );
+ $( '.generation div', current_type_element )
+ .html( data.generation );
+ $( '.size div', current_type_element )
+ .html( data.indexSize );
+
+ if( is_slave )
+ {
+ var master_element = $( '.master', details_element );
+ $( '.version div', master_element )
+ .html( data.slave.masterDetails.indexVersion );
+ $( '.generation div', master_element )
+ .html( data.slave.masterDetails.generation );
+ $( '.size div', master_element )
+ .html( data.slave.masterDetails.indexSize );
+
+ if( data.indexVersion !== data.slave.masterDetails.indexVersion )
+ {
+ $( '.version', details_element )
+ .addClass( 'diff' );
+ }
+ else
+ {
+ $( '.version', details_element )
+ .removeClass( 'diff' );
+ }
+
+ if( data.generation !== data.slave.masterDetails.generation )
+ {
+ $( '.generation', details_element )
+ .addClass( 'diff' );
+ }
+ else
+ {
+ $( '.generation', details_element )
+ .removeClass( 'diff' );
+ }
+ }
+
+ if( is_slave )
+ {
+ var settings_element = $( '#settings', replication_element );
+
+ if( data.slave.masterUrl )
+ {
+ $( '.masterUrl dd', settings_element )
+ .html( response.details.slave.masterUrl )
+ .parents( 'li' ).show();
+ }
+
+ var polling_content = ' ';
+ var polling_ico = 'ico-1';
+
+ if( 'true' === data.slave.isPollingDisabled )
+ {
+ polling_ico = 'ico-0';
+
+ $( '.disable-polling', navigation_element ).hide();
+ $( '.enable-polling', navigation_element ).show();
+ }
+ else
+ {
+ $( '.disable-polling', navigation_element ).show();
+ $( '.enable-polling', navigation_element ).hide();
+
+ if( data.slave.pollInterval )
+ {
+ polling_content = '(interval: ' + data.slave.pollInterval + ')';
+ }
+ }
+
+ $( '.isPollingDisabled dd', settings_element )
+ .removeClass( 'ico-0' )
+ .removeClass( 'ico-1' )
+ .addClass( polling_ico )
+ .html( polling_content )
+ .parents( 'li' ).show();
+ }
+
+ var master_settings_element = $( '#master-settings', replication_element );
+
+ var master_data = is_slave
+ ? data.slave.masterDetails.master
+ : data.master;
+
+ var replication_icon = 'ico-0';
+ if( 'true' === master_data.replicationEnabled )
+ {
+ replication_icon = 'ico-1';
+
+ $( '.disable-replication', navigation_element ).show();
+ $( '.enable-replication', navigation_element ).hide();
+ }
+ else
+ {
+ $( '.disable-replication', navigation_element ).hide();
+ $( '.enable-replication', navigation_element ).show();
+ }
+
+ $( '.replicationEnabled dd', master_settings_element )
+ .removeClass( 'ico-0' )
+ .removeClass( 'ico-1' )
+ .addClass( replication_icon )
+ .parents( 'li' ).show();
+
+ $( '.replicateAfter dd', master_settings_element )
+ .html( master_data.replicateAfter.join( ', ' ) )
+ .parents( 'li' ).show();
+
+ if( master_data.confFiles )
+ {
+ var conf_files = [];
+ var conf_data = master_data.confFiles.split( ',' );
+
+ for( var i = 0; i < conf_data.length; i++ )
+ {
+ var item = conf_data[i];
+
+ if( - 1 !== item.indexOf( ':' ) )
+ {
+ info = item.split( ':' );
+ item = '<abbr title="' + info[0] + ' » ' + info[1] + '">'
+ + ( is_slave ? info[1] : info[0] )
+ + '</abbr>';
+ }
+
+ conf_files.push( item );
+ }
+
+ $( '.confFiles dd', master_settings_element )
+ .html( conf_files.join( ', ' ) )
+ .parents( 'li' ).show();
+ }
+
+
+ $( '.block', replication_element ).last()
+ .addClass( 'last' );
+
+
+
+
+ if( 'true' === data.slave.isReplicating )
+ {
+ replication_element
+ .addClass( 'replicating' );
+
+ $( '.replicate-now', navigation_element ).hide();
+ $( '.abort-replication', navigation_element ).show();
+
+ window.setTimeout( replication_fetch_status, 1000 );
+ }
+ else
+ {
+ replication_element
+ .removeClass( 'replicating' );
+
+ $( '.replicate-now', navigation_element ).show();
+ $( '.abort-replication', navigation_element ).hide();
+ }
+ },
+ error : function( xhr, text_status, error_thrown )
+ {
+ $( '#content' )
+ .html( 'sorry, no replication-handler defined!' );
+ },
+ complete : function( xhr, text_status )
+ {
+ }
+ }
+ );
+ }
+ replication_fetch_status();
+
+ $( '#iterations a', content_element )
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ $( this ).parents( '.iterations' )
+ .toggleClass( 'expanded' );
+
+ return false;
+ }
+ );
+
+ $( 'button', navigation_element )
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ var button = $( this );
+ var command = button.data( 'command' );
+
+ if( button.hasClass( 'refresh-status' ) && !button.hasClass( 'loader' ) )
+ {
+ replication_fetch_status();
+ }
+ else if( command )
+ {
+ $.get
+ (
+ core_basepath + '/replication?command=' + command + '&wt=json',
+ function()
+ {
+ replication_fetch_status();
+ }
+ );
+ }
+ return false;
+ }
+ );
+ }
+ );
+ }
+);
\ No newline at end of file