You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2012/03/07 17:30:22 UTC
svn commit: r1298010 [4/8] - in /lucene/dev/trunk/solr:
core/src/java/org/apache/solr/handler/
core/src/java/org/apache/solr/servlet/ webapp/web/ webapp/web/css/
webapp/web/css/styles/ webapp/web/js/ webapp/web/js/lib/
webapp/web/js/scripts/ webapp/web...
Modified: lucene/dev/trunk/solr/webapp/web/js/scripts/cores.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/cores.js?rev=1298010&r1=1298009&r2=1298010&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/cores.js (original)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/cores.js Wed Mar 7 16:30:20 2012
@@ -1,495 +1,512 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ 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.
+*/
+
sammy.bind
(
- 'cores_load_data',
- function( event, params )
+ 'cores_load_data',
+ function( event, params )
+ {
+ if( app.cores_data )
{
- if( app.cores_data )
+ params.callback( app.cores_data );
+ return true;
+ }
+
+ $.ajax
+ (
+ {
+ url : app.config.solr_path + app.config.core_admin_path + '?wt=json',
+ dataType : 'json',
+ beforeSend : function( xhr, settings )
+ {
+ },
+ success : function( response, text_status, xhr )
+ {
+ app.cores_data = response.status;
+ params.callback( app.cores_data );
+ },
+ error : function( xhr, text_status, error_thrown)
+ {
+ },
+ complete : function( xhr, text_status )
{
- params.callback( app.cores_data );
- return true;
}
-
- $.ajax
- (
- {
- url : app.config.solr_path + app.config.core_admin_path + '?wt=json',
- dataType : 'json',
- beforeSend : function( xhr, settings )
- {
- },
- success : function( response, text_status, xhr )
- {
- app.cores_data = response.status;
- params.callback( app.cores_data );
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- }
+ }
+ );
+ }
);
sammy.bind
(
- 'cores_build_navigation',
- function( event, params )
- {
- var navigation_content = ['<ul>'];
+ 'cores_build_navigation',
+ function( event, params )
+ {
+ var navigation_content = ['<ul>'];
- for( var core in params.cores )
- {
- navigation_content.push( '<li><a href="' + params.basepath + core + '">' + core + '</a></li>' );
- }
+ for( var core in params.cores )
+ {
+ navigation_content.push( '<li><a href="' + params.basepath + core + '">' + core + '</a></li>' );
+ }
- params.navigation_element
- .html( navigation_content.join( "\n" ) );
+ params.navigation_element
+ .html( navigation_content.join( "\n" ) );
- $( 'a[href="' + params.basepath + params.current_core + '"]', params.navigation_element ).parent()
- .addClass( 'current' );
- }
+ $( 'a[href="' + params.basepath + params.current_core + '"]', params.navigation_element ).parent()
+ .addClass( 'current' );
+ }
);
sammy.bind
(
- 'cores_load_template',
- function( event, params )
+ 'cores_load_template',
+ function( event, params )
+ {
+ if( app.cores_template )
{
- if( app.cores_template )
- {
- params.callback();
- return true;
- }
+ params.callback();
+ return true;
+ }
- $.get
- (
- 'tpl/cores.html',
- function( template )
- {
- params.content_element
- .html( template );
+ $.get
+ (
+ 'tpl/cores.html',
+ function( template )
+ {
+ params.content_element
+ .html( template );
- app.cores_template = template;
- params.callback();
- }
- );
- }
+ app.cores_template = template;
+ params.callback();
+ }
+ );
+ }
);
// #/cores
sammy.get
(
- /^#\/(cores)$/,
- function( context )
- {
- delete app.cores_template;
-
- sammy.trigger
- (
- 'cores_load_data',
+ /^#\/(cores)$/,
+ function( context )
+ {
+ delete app.cores_template;
+
+ sammy.trigger
+ (
+ 'cores_load_data',
+ {
+ callback : function( cores )
+ {
+ var first_core = null;
+ for( var key in cores )
+ {
+ if( !first_core )
{
- callback : function( cores )
- {
- var first_core = null;
- for( var key in cores )
- {
- if( !first_core )
- {
- first_core = key;
- }
- continue;
- }
- context.redirect( context.path + '/' + first_core );
- }
+ first_core = key;
}
- );
- }
+ continue;
+ }
+ context.redirect( context.path + '/' + first_core );
+ }
+ }
+ );
+ }
);
// #/cores
sammy.get
(
- /^#\/(cores)\//,
- function( context )
- {
- var content_element = $( '#content' );
-
- var path_parts = this.path.match( /^(.+\/cores\/)(.*)$/ );
- var current_core = path_parts[2];
-
- sammy.trigger
- (
- 'cores_load_data',
+ /^#\/(cores)\//,
+ function( context )
+ {
+ var content_element = $( '#content' );
+
+ var path_parts = this.path.match( /^(.+\/cores\/)(.*)$/ );
+ var current_core = path_parts[2];
+
+ sammy.trigger
+ (
+ 'cores_load_data',
+ {
+ callback : function( cores )
+ {
+ sammy.trigger
+ (
+ 'cores_load_template',
{
- callback : function( cores )
- {
- sammy.trigger
- (
- 'cores_load_template',
- {
- content_element : content_element,
- callback : function()
- {
- var cores_element = $( '#cores', content_element );
- var navigation_element = $( '#navigation', cores_element );
- var list_element = $( '#list', navigation_element );
- var data_element = $( '#data', cores_element );
- var core_data_element = $( '#core-data', data_element );
- var index_data_element = $( '#index-data', data_element );
+ content_element : content_element,
+ callback : function()
+ {
+ var cores_element = $( '#cores', content_element );
+ var navigation_element = $( '#navigation', cores_element );
+ var list_element = $( '#list', navigation_element );
+ var data_element = $( '#data', cores_element );
+ var core_data_element = $( '#core-data', data_element );
+ var index_data_element = $( '#index-data', data_element );
- sammy.trigger
- (
- 'cores_build_navigation',
- {
- cores : cores,
- basepath : path_parts[1],
- current_core : current_core,
- navigation_element : list_element
- }
- );
+ sammy.trigger
+ (
+ 'cores_build_navigation',
+ {
+ cores : cores,
+ basepath : path_parts[1],
+ current_core : current_core,
+ navigation_element : list_element
+ }
+ );
- var core_data = cores[current_core];
- var core_basepath = $( '#' + current_core, app.menu_element ).attr( 'data-basepath' );
+ var core_data = cores[current_core];
+ var core_basepath = $( '#' + current_core, app.menu_element ).attr( 'data-basepath' );
- // core-data
+ // core-data
- $( 'h2 span', core_data_element )
- .html( core_data.name );
+ $( 'h2 span', core_data_element )
+ .html( core_data.name );
- $( '.startTime dd', core_data_element )
- .html( core_data.startTime );
+ $( '.startTime dd', core_data_element )
+ .html( core_data.startTime );
- $( '.instanceDir dd', core_data_element )
- .html( core_data.instanceDir );
+ $( '.instanceDir dd', core_data_element )
+ .html( core_data.instanceDir );
- $( '.dataDir dd', core_data_element )
- .html( core_data.dataDir );
+ $( '.dataDir dd', core_data_element )
+ .html( core_data.dataDir );
- // index-data
+ // index-data
- $( '.lastModified dd', index_data_element )
- .html( core_data.index.lastModified );
+ $( '.lastModified dd', index_data_element )
+ .html( core_data.index.lastModified );
- $( '.version dd', index_data_element )
- .html( core_data.index.version );
+ $( '.version dd', index_data_element )
+ .html( core_data.index.version );
- $( '.numDocs dd', index_data_element )
- .html( core_data.index.numDocs );
+ $( '.numDocs dd', index_data_element )
+ .html( core_data.index.numDocs );
- $( '.maxDoc dd', index_data_element )
- .html( core_data.index.maxDoc );
+ $( '.maxDoc dd', index_data_element )
+ .html( core_data.index.maxDoc );
- $( '.optimized dd', index_data_element )
- .addClass( core_data.index.optimized ? 'ico-1' : 'ico-0' );
+ $( '.optimized dd', index_data_element )
+ .addClass( core_data.index.optimized ? 'ico-1' : 'ico-0' );
- $( '#actions .optimize', cores_element )
- .show();
+ $( '#actions .optimize', cores_element )
+ .show();
- $( '.optimized dd span', index_data_element )
- .html( core_data.index.optimized ? 'yes' : 'no' );
+ $( '.optimized dd span', index_data_element )
+ .html( core_data.index.optimized ? 'yes' : 'no' );
- $( '.current dd', index_data_element )
- .addClass( core_data.index.current ? 'ico-1' : 'ico-0' );
+ $( '.current dd', index_data_element )
+ .addClass( core_data.index.current ? 'ico-1' : 'ico-0' );
- $( '.current dd span', index_data_element )
- .html( core_data.index.current ? 'yes' : 'no' );
+ $( '.current dd span', index_data_element )
+ .html( core_data.index.current ? 'yes' : 'no' );
- $( '.hasDeletions dd', index_data_element )
- .addClass( core_data.index.hasDeletions ? 'ico-1' : 'ico-0' );
+ $( '.hasDeletions dd', index_data_element )
+ .addClass( core_data.index.hasDeletions ? 'ico-1' : 'ico-0' );
- $( '.hasDeletions dd span', index_data_element )
- .html( core_data.index.hasDeletions ? 'yes' : 'no' );
+ $( '.hasDeletions dd span', index_data_element )
+ .html( core_data.index.hasDeletions ? 'yes' : 'no' );
- $( '.directory dd', index_data_element )
- .html
- (
- core_data.index.directory
- .replace( /:/g, ':​' )
- .replace( /@/g, '@​' )
- );
+ $( '.directory dd', index_data_element )
+ .html
+ (
+ core_data.index.directory
+ .replace( /:/g, ':​' )
+ .replace( /@/g, '@​' )
+ );
- var core_names = [];
- var core_selects = $( '#actions select', cores_element );
+ var core_names = [];
+ var core_selects = $( '#actions select', cores_element );
- for( var key in cores )
- {
- core_names.push( '<option value="' + key + '">' + key + '</option>' )
- }
+ for( var key in cores )
+ {
+ core_names.push( '<option value="' + key + '">' + key + '</option>' )
+ }
- core_selects
- .html( core_names.join( "\n") );
+ core_selects
+ .html( core_names.join( "\n") );
- $( 'option[value="' + current_core + '"]', core_selects.filter( '#swap_core' ) )
- .attr( 'selected', 'selected' );
+ $( 'option[value="' + current_core + '"]', core_selects.filter( '#swap_core' ) )
+ .attr( 'selected', 'selected' );
- $( 'option[value="' + current_core + '"]', core_selects.filter( '.other' ) )
- .attr( 'disabled', 'disabled' )
- .addClass( 'disabled' );
+ $( 'option[value="' + current_core + '"]', core_selects.filter( '.other' ) )
+ .attr( 'disabled', 'disabled' )
+ .addClass( 'disabled' );
- $( 'input[name="core"]', cores_element )
- .val( current_core );
+ $( 'input[name="core"]', cores_element )
+ .val( current_core );
- // layout
+ // layout
- var actions_element = $( '.actions', cores_element );
- var button_holder_element = $( '.button-holder.options', actions_element );
+ var actions_element = $( '.actions', cores_element );
+ var button_holder_element = $( '.button-holder.options', actions_element );
- button_holder_element
- .die( 'toggle' )
- .live
- (
- 'toggle',
- function( event )
- {
- var element = $( this );
+ button_holder_element
+ .die( 'toggle' )
+ .live
+ (
+ 'toggle',
+ function( event )
+ {
+ var element = $( this );
- element
- .toggleClass( 'active' );
+ element
+ .toggleClass( 'active' );
- if( element.hasClass( 'active' ) )
- {
- button_holder_element
- .not( element )
- .removeClass( 'active' );
- }
- }
- );
-
- $( '.button a', button_holder_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( this ).parents( '.button-holder' )
- .trigger( 'toggle' );
- }
- );
-
- $( 'form a.submit', button_holder_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- var element = $( this );
- var form_element = element.parents( 'form' );
- var action = $( 'input[name="action"]', form_element ).val().toLowerCase();
-
- form_element
- .ajaxSubmit
- (
- {
- url : app.config.solr_path + app.config.core_admin_path + '?wt=json',
- dataType : 'json',
- beforeSubmit : function( array, form, options )
- {
- //loader
- },
- success : function( response, status_text, xhr, form )
- {
- delete app.cores_data;
-
- if( 'rename' === action )
- {
- context.redirect( path_parts[1] + $( 'input[name="other"]', form_element ).val() );
- }
- else if( 'swap' === action )
- {
- window.location.reload();
- }
+ if( element.hasClass( 'active' ) )
+ {
+ button_holder_element
+ .not( element )
+ .removeClass( 'active' );
+ }
+ }
+ );
+
+ $( '.button a', button_holder_element )
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ $( this ).parents( '.button-holder' )
+ .trigger( 'toggle' );
+ }
+ );
+
+ $( 'form a.submit', button_holder_element )
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ var element = $( this );
+ var form_element = element.parents( 'form' );
+ var action = $( 'input[name="action"]', form_element ).val().toLowerCase();
+
+ form_element
+ .ajaxSubmit
+ (
+ {
+ url : app.config.solr_path + app.config.core_admin_path + '?wt=json',
+ dataType : 'json',
+ beforeSubmit : function( array, form, options )
+ {
+ //loader
+ },
+ success : function( response, status_text, xhr, form )
+ {
+ delete app.cores_data;
+
+ if( 'rename' === action )
+ {
+ context.redirect( path_parts[1] + $( 'input[name="other"]', form_element ).val() );
+ }
+ else if( 'swap' === action )
+ {
+ window.location.reload();
+ }
- $( 'a.reset', form )
- .trigger( 'click' );
- },
- error : function( xhr, text_status, error_thrown )
- {
- },
- complete : function()
- {
- //loader
- }
- }
- );
-
- return false;
- }
- );
-
- $( 'form a.reset', button_holder_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( this ).parents( 'form' )
- .resetForm();
+ $( 'a.reset', form )
+ .trigger( 'click' );
+ },
+ error : function( xhr, text_status, error_thrown )
+ {
+ },
+ complete : function()
+ {
+ //loader
+ }
+ }
+ );
+
+ return false;
+ }
+ );
+
+ $( 'form a.reset', button_holder_element )
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ $( this ).parents( 'form' )
+ .resetForm();
- $( this ).parents( '.button-holder' )
- .trigger( 'toggle' );
+ $( this ).parents( '.button-holder' )
+ .trigger( 'toggle' );
- return false;
- }
- );
+ return false;
+ }
+ );
- var reload_button = $( '#actions .reload', cores_element );
+ var reload_button = $( '#actions .reload', cores_element );
+ reload_button
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ $.ajax
+ (
+ {
+ url : app.config.solr_path + app.config.core_admin_path + '?wt=json&action=RELOAD&core=' + current_core,
+ dataType : 'json',
+ context : $( this ),
+ beforeSend : function( xhr, settings )
+ {
+ this
+ .addClass( 'loader' );
+ },
+ success : function( response, text_status, xhr )
+ {
+ this
+ .addClass( 'success' );
+
+ window.setTimeout
+ (
+ function()
+ {
reload_button
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- url : app.config.solr_path + app.config.core_admin_path + '?wt=json&action=RELOAD&core=' + current_core,
- dataType : 'json',
- context : $( this ),
- beforeSend : function( xhr, settings )
- {
- this
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- this
- .addClass( 'success' );
-
- window.setTimeout
- (
- function()
- {
- reload_button
- .removeClass( 'success' );
- },
- 5000
- );
- },
- error : function( xhr, text_status, error_thrown )
- {
- },
- complete : function( xhr, text_status )
- {
- this
- .removeClass( 'loader' );
- }
- }
- );
- }
- );
+ .removeClass( 'success' );
+ },
+ 5000
+ );
+ },
+ error : function( xhr, text_status, error_thrown )
+ {
+ },
+ complete : function( xhr, text_status )
+ {
+ this
+ .removeClass( 'loader' );
+ }
+ }
+ );
+ }
+ );
- $( '#actions .unload', cores_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- url : app.config.solr_path + app.config.core_admin_path + '?wt=json&action=UNLOAD&core=' + current_core,
- dataType : 'json',
- context : $( this ),
- beforeSend : function( xhr, settings )
- {
- this
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- delete app.cores_data;
- context.redirect( path_parts[1].substr( 0, path_parts[1].length - 1 ) );
- },
- error : function( xhr, text_status, error_thrown )
- {
- },
- complete : function( xhr, text_status )
- {
- this
- .removeClass( 'loader' );
- }
- }
- );
- }
- );
+ $( '#actions .unload', cores_element )
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ $.ajax
+ (
+ {
+ url : app.config.solr_path + app.config.core_admin_path + '?wt=json&action=UNLOAD&core=' + current_core,
+ dataType : 'json',
+ context : $( this ),
+ beforeSend : function( xhr, settings )
+ {
+ this
+ .addClass( 'loader' );
+ },
+ success : function( response, text_status, xhr )
+ {
+ delete app.cores_data;
+ context.redirect( path_parts[1].substr( 0, path_parts[1].length - 1 ) );
+ },
+ error : function( xhr, text_status, error_thrown )
+ {
+ },
+ complete : function( xhr, text_status )
+ {
+ this
+ .removeClass( 'loader' );
+ }
+ }
+ );
+ }
+ );
- var optimize_button = $( '#actions .optimize', cores_element );
+ var optimize_button = $( '#actions .optimize', cores_element );
+ optimize_button
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ $.ajax
+ (
+ {
+ url : core_basepath + '/update?optimize=true&waitFlush=true&wt=json',
+ dataType : 'json',
+ context : $( this ),
+ beforeSend : function( xhr, settings )
+ {
+ this
+ .addClass( 'loader' );
+ },
+ success : function( response, text_status, xhr )
+ {
+ this
+ .addClass( 'success' );
+
+ window.setTimeout
+ (
+ function()
+ {
optimize_button
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- url : core_basepath + '/update?optimize=true&waitFlush=true&wt=json',
- dataType : 'json',
- context : $( this ),
- beforeSend : function( xhr, settings )
- {
- this
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- this
- .addClass( 'success' );
-
- window.setTimeout
- (
- function()
- {
- optimize_button
- .removeClass( 'success' );
- },
- 5000
- );
+ .removeClass( 'success' );
+ },
+ 5000
+ );
- $( '.optimized dd.ico-0', index_data_element )
- .removeClass( 'ico-0' )
- .addClass( 'ico-1' );
- },
- error : function( xhr, text_status, error_thrown)
- {
- console.warn( 'd0h, optimize broken!' );
- },
- complete : function( xhr, text_status )
- {
- this
- .removeClass( 'loader' );
- }
- }
- );
- }
- );
-
- $( '.timeago', data_element )
- .timeago();
-
- $( 'ul', data_element )
- .each
- (
- function( i, element )
- {
- $( 'li:odd', element )
- .addClass( 'odd' );
- }
- )
- }
+ $( '.optimized dd.ico-0', index_data_element )
+ .removeClass( 'ico-0' )
+ .addClass( 'ico-1' );
+ },
+ error : function( xhr, text_status, error_thrown)
+ {
+ console.warn( 'd0h, optimize broken!' );
+ },
+ complete : function( xhr, text_status )
+ {
+ this
+ .removeClass( 'loader' );
+ }
}
- );
- }
+ );
+ }
+ );
+
+ $( '.timeago', data_element )
+ .timeago();
+
+ $( 'ul', data_element )
+ .each
+ (
+ function( i, element )
+ {
+ $( 'li:odd', element )
+ .addClass( 'odd' );
+ }
+ )
+ }
}
- );
- }
+ );
+ }
+ }
+ );
+ }
);
\ No newline at end of file
Modified: lucene/dev/trunk/solr/webapp/web/js/scripts/dashboard.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/dashboard.js?rev=1298010&r1=1298009&r2=1298010&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/dashboard.js (original)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/dashboard.js Wed Mar 7 16:30:20 2012
@@ -1,400 +1,417 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ 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.
+*/
+
// #/:core
sammy.get
(
- /^#\/([\w\d-]+)$/,
- function( context )
- {
- var core_basepath = this.active_core.attr( 'data-basepath' );
- var content_element = $( '#content' );
+ /^#\/([\w\d-]+)$/,
+ function( context )
+ {
+ var core_basepath = this.active_core.attr( 'data-basepath' );
+ var content_element = $( '#content' );
- content_element
- .removeClass( 'single' );
+ content_element
+ .removeClass( 'single' );
- var core_menu = $( 'ul', this.active_core );
- if( !core_menu.data( 'admin-extra-loaded' ) )
- {
- core_menu.data( 'admin-extra-loaded', new Date() );
+ var core_menu = $( 'ul', this.active_core );
+ if( !core_menu.data( 'admin-extra-loaded' ) )
+ {
+ core_menu.data( 'admin-extra-loaded', new Date() );
- $.get
- (
- core_basepath + '/admin/file/?file=admin-extra.menu-top.html',
- function( menu_extra )
- {
- core_menu
- .prepend( menu_extra );
- }
- );
+ $.get
+ (
+ core_basepath + '/admin/file/?file=admin-extra.menu-top.html',
+ function( menu_extra )
+ {
+ core_menu
+ .prepend( menu_extra );
+ }
+ );
- $.get
- (
- core_basepath + '/admin/file/?file=admin-extra.menu-bottom.html',
- function( menu_extra )
- {
- core_menu
- .append( menu_extra );
- }
- );
+ $.get
+ (
+ core_basepath + '/admin/file/?file=admin-extra.menu-bottom.html',
+ function( menu_extra )
+ {
+ core_menu
+ .append( menu_extra );
}
+ );
+ }
- $.get
- (
- 'tpl/dashboard.html',
- function( template )
- {
- content_element
- .html( template );
+ $.get
+ (
+ 'tpl/dashboard.html',
+ function( template )
+ {
+ content_element
+ .html( template );
- var dashboard_element = $( '#dashboard' );
+ var dashboard_element = $( '#dashboard' );
- $.ajax
- (
- {
- url : core_basepath + '/admin/luke?wt=json&show=index&numTerms=0',
- dataType : 'json',
- context : $( '#statistics', dashboard_element ),
- beforeSend : function( xhr, settings )
- {
- $( 'h2', this )
- .addClass( 'loader' );
-
- $( '.message', this )
- .show()
- .html( 'Loading ...' );
-
- $( '.content' )
- .hide();
- },
- success : function( response, text_status, xhr )
- {
- $( '.message', this )
- .empty()
- .hide();
+ $.ajax
+ (
+ {
+ url : core_basepath + '/admin/luke?wt=json&show=index&numTerms=0',
+ dataType : 'json',
+ context : $( '#statistics', dashboard_element ),
+ beforeSend : function( xhr, settings )
+ {
+ $( 'h2', this )
+ .addClass( 'loader' );
+
+ $( '.message', this )
+ .show()
+ .html( 'Loading ...' );
+
+ $( '.content' )
+ .hide();
+ },
+ success : function( response, text_status, xhr )
+ {
+ $( '.message', this )
+ .empty()
+ .hide();
- $( '.content', this )
- .show();
+ $( '.content', this )
+ .show();
- var data = {
- 'index_num-docs' : response['index']['numDocs'],
- 'index_max-doc' : response['index']['maxDoc'],
- 'index_version' : response['index']['version'],
- 'index_segmentCount' : response['index']['segmentCount'],
- 'index_last-modified' : response['index']['lastModified']
- };
-
- for( var key in data )
- {
- $( '.' + key, this )
- .show();
+ var data = {
+ 'index_num-docs' : response['index']['numDocs'],
+ 'index_max-doc' : response['index']['maxDoc'],
+ 'index_version' : response['index']['version'],
+ 'index_segmentCount' : response['index']['segmentCount'],
+ 'index_last-modified' : response['index']['lastModified']
+ };
+
+ for( var key in data )
+ {
+ $( '.' + key, this )
+ .show();
- $( '.value.' + key, this )
- .html( data[key] );
- }
-
- var optimized_element = $( '.value.index_optimized', this );
- if( !response['index']['hasDeletions'] )
- {
- optimized_element
- .addClass( 'ico-1' );
-
- $( 'span', optimized_element )
- .html( 'yes' );
- }
- else
- {
- optimized_element
- .addClass( 'ico-0' );
-
- $( 'span', optimized_element )
- .html( 'no' );
- }
-
- var current_element = $( '.value.index_current', this );
- if( response['index']['current'] )
- {
- current_element
- .addClass( 'ico-1' );
-
- $( 'span', current_element )
- .html( 'yes' );
- }
- else
- {
- current_element
- .addClass( 'ico-0' );
-
- $( 'span', current_element )
- .html( 'no' );
- }
-
- $( 'a', optimized_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- url : core_basepath + '/update?optimize=true&waitFlush=true&wt=json',
- dataType : 'json',
- context : $( this ),
- beforeSend : function( xhr, settings )
- {
- this
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- this.parents( 'dd' )
- .removeClass( 'ico-0' )
- .addClass( 'ico-1' );
- },
- error : function( xhr, text_status, error_thrown)
- {
- console.warn( 'd0h, optimize broken!' );
- },
- complete : function( xhr, text_status )
- {
- this
- .removeClass( 'loader' );
- }
- }
- );
- }
- );
+ $( '.value.' + key, this )
+ .html( data[key] );
+ }
+
+ var optimized_element = $( '.value.index_optimized', this );
+ if( !response['index']['hasDeletions'] )
+ {
+ optimized_element
+ .addClass( 'ico-1' );
+
+ $( 'span', optimized_element )
+ .html( 'yes' );
+ }
+ else
+ {
+ optimized_element
+ .addClass( 'ico-0' );
+
+ $( 'span', optimized_element )
+ .html( 'no' );
+ }
+
+ var current_element = $( '.value.index_current', this );
+ if( response['index']['current'] )
+ {
+ current_element
+ .addClass( 'ico-1' );
+
+ $( 'span', current_element )
+ .html( 'yes' );
+ }
+ else
+ {
+ current_element
+ .addClass( 'ico-0' );
+
+ $( 'span', current_element )
+ .html( 'no' );
+ }
+
+ $( 'a', optimized_element )
+ .die( 'click' )
+ .live
+ (
+ 'click',
+ function( event )
+ {
+ $.ajax
+ (
+ {
+ url : core_basepath + '/update?optimize=true&waitFlush=true&wt=json',
+ dataType : 'json',
+ context : $( this ),
+ beforeSend : function( xhr, settings )
+ {
+ this
+ .addClass( 'loader' );
+ },
+ success : function( response, text_status, xhr )
+ {
+ this.parents( 'dd' )
+ .removeClass( 'ico-0' )
+ .addClass( 'ico-1' );
+ },
+ error : function( xhr, text_status, error_thrown)
+ {
+ console.warn( 'd0h, optimize broken!' );
+ },
+ complete : function( xhr, text_status )
+ {
+ this
+ .removeClass( 'loader' );
+ }
+ }
+ );
+ }
+ );
- $( '.timeago', this )
+ $( '.timeago', this )
.timeago();
- },
- error : function( xhr, text_status, error_thrown )
- {
- this
- .addClass( 'disabled' );
-
- $( '.message', this )
- .show()
- .html( 'Luke is not configured' );
- },
- complete : function( xhr, text_status )
- {
- $( 'h2', this )
- .removeClass( 'loader' );
- }
- }
- );
+ },
+ error : function( xhr, text_status, error_thrown )
+ {
+ this
+ .addClass( 'disabled' );
+
+ $( '.message', this )
+ .show()
+ .html( 'Luke is not configured' );
+ },
+ complete : function( xhr, text_status )
+ {
+ $( 'h2', this )
+ .removeClass( 'loader' );
+ }
+ }
+ );
- $.ajax
- (
- {
- url : core_basepath + '/replication?command=details&wt=json',
- dataType : 'json',
- context : $( '#replication', dashboard_element ),
- beforeSend : function( xhr, settings )
- {
- $( 'h2', this )
- .addClass( 'loader' );
-
- $( '.message', this )
- .show()
- .html( 'Loading' );
-
- $( '.content', this )
- .hide();
- },
- success : function( response, text_status, xhr )
- {
- $( '.message', this )
- .empty()
- .hide();
-
- $( '.content', this )
- .show();
-
- $( '.replication', context.active_core )
- .show();
-
- var data = response.details;
- var is_slave = 'undefined' !== typeof( data.slave );
- var headline = $( 'h2 span', this );
- var details_element = $( '#details', this );
- var current_type_element = $( ( is_slave ? '.slave' : '.master' ), this );
-
- if( is_slave )
- {
- this
- .addClass( 'slave' );
+ $.ajax
+ (
+ {
+ url : core_basepath + '/replication?command=details&wt=json',
+ dataType : 'json',
+ context : $( '#replication', dashboard_element ),
+ beforeSend : function( xhr, settings )
+ {
+ $( 'h2', this )
+ .addClass( 'loader' );
+
+ $( '.message', this )
+ .show()
+ .html( 'Loading' );
+
+ $( '.content', this )
+ .hide();
+ },
+ success : function( response, text_status, xhr )
+ {
+ $( '.message', this )
+ .empty()
+ .hide();
+
+ $( '.content', this )
+ .show();
+
+ $( '.replication', context.active_core )
+ .show();
+
+ var data = response.details;
+ var is_slave = 'undefined' !== typeof( data.slave );
+ var headline = $( 'h2 span', this );
+ var details_element = $( '#details', this );
+ var current_type_element = $( ( is_slave ? '.slave' : '.master' ), this );
+
+ if( is_slave )
+ {
+ this
+ .addClass( 'slave' );
- headline
- .html( headline.html() + ' (Slave)' );
- }
- else
- {
- this
- .addClass( 'master' );
+ headline
+ .html( headline.html() + ' (Slave)' );
+ }
+ else
+ {
+ this
+ .addClass( 'master' );
- headline
- .html( headline.html() + ' (Master)' );
- }
-
- $( '.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 );
+ headline
+ .html( headline.html() + ' (Master)' );
+ }
+
+ $( '.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.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' );
- }
- }
- },
- error : function( xhr, text_status, error_thrown)
- {
- this
- .addClass( 'disabled' );
-
- $( '.message', this )
- .show()
- .html( 'Replication is not configured' );
- },
- complete : function( xhr, text_status )
- {
- $( 'h2', this )
- .removeClass( 'loader' );
- }
- }
- );
+ if( data.generation !== data.slave.masterDetails.generation )
+ {
+ $( '.generation', details_element )
+ .addClass( 'diff' );
+ }
+ else
+ {
+ $( '.generation', details_element )
+ .removeClass( 'diff' );
+ }
+ }
+ },
+ error : function( xhr, text_status, error_thrown)
+ {
+ this
+ .addClass( 'disabled' );
+
+ $( '.message', this )
+ .show()
+ .html( 'Replication is not configured' );
+ },
+ complete : function( xhr, text_status )
+ {
+ $( 'h2', this )
+ .removeClass( 'loader' );
+ }
+ }
+ );
- $.ajax
- (
- {
- url : core_basepath + '/dataimport?command=details&wt=json',
- dataType : 'json',
- context : $( '#dataimport', dashboard_element ),
- beforeSend : function( xhr, settings )
- {
- $( 'h2', this )
- .addClass( 'loader' );
-
- $( '.message', this )
- .show()
- .html( 'Loading' );
- },
- success : function( response, text_status, xhr )
- {
- $( '.message', this )
- .empty()
- .hide();
-
- $( 'dl', this )
- .show();
-
- var data = {
- 'status' : response['status'],
- 'info' : response['statusMessages']['']
- };
-
- for( var key in data )
- {
- $( '.' + key, this )
- .show();
+ $.ajax
+ (
+ {
+ url : core_basepath + '/dataimport?command=details&wt=json',
+ dataType : 'json',
+ context : $( '#dataimport', dashboard_element ),
+ beforeSend : function( xhr, settings )
+ {
+ $( 'h2', this )
+ .addClass( 'loader' );
+
+ $( '.message', this )
+ .show()
+ .html( 'Loading' );
+ },
+ success : function( response, text_status, xhr )
+ {
+ $( '.message', this )
+ .empty()
+ .hide();
+
+ $( 'dl', this )
+ .show();
+
+ var data = {
+ 'status' : response['status'],
+ 'info' : response['statusMessages']['']
+ };
+
+ for( var key in data )
+ {
+ $( '.' + key, this )
+ .show();
- $( '.value.' + key, this )
- .html( data[key] );
- }
- },
- error : function( xhr, text_status, error_thrown)
- {
- this
- .addClass( 'disabled' );
-
- $( '.message', this )
- .show()
- .html( 'Dataimport is not configured' );
- },
- complete : function( xhr, text_status )
- {
- $( 'h2', this )
- .removeClass( 'loader' );
- }
- }
- );
-
- $.ajax
- (
- {
- url : core_basepath + '/admin/file/?file=admin-extra.html',
- dataType : 'html',
- context : $( '#admin-extra', dashboard_element ),
- beforeSend : function( xhr, settings )
- {
- $( 'h2', this )
- .addClass( 'loader' );
-
- $( '.message', this )
- .show()
- .html( 'Loading' );
-
- $( '.content', this )
- .hide();
- },
- success : function( response, text_status, xhr )
- {
- $( '.message', this )
- .hide()
- .empty();
-
- $( '.content', this )
- .show()
- .html( response );
- },
- error : function( xhr, text_status, error_thrown)
- {
- this
- .addClass( 'disabled' );
-
- $( '.message', this )
- .show()
- .html( 'We found no "admin-extra.html" file.' );
- },
- complete : function( xhr, text_status )
- {
- $( 'h2', this )
- .removeClass( 'loader' );
- }
- }
- );
+ $( '.value.' + key, this )
+ .html( data[key] );
+ }
+ },
+ error : function( xhr, text_status, error_thrown)
+ {
+ this
+ .addClass( 'disabled' );
+
+ $( '.message', this )
+ .show()
+ .html( 'Dataimport is not configured' );
+ },
+ complete : function( xhr, text_status )
+ {
+ $( 'h2', this )
+ .removeClass( 'loader' );
+ }
+ }
+ );
+ $.ajax
+ (
+ {
+ url : core_basepath + '/admin/file/?file=admin-extra.html',
+ dataType : 'html',
+ context : $( '#admin-extra', dashboard_element ),
+ beforeSend : function( xhr, settings )
+ {
+ $( 'h2', this )
+ .addClass( 'loader' );
+
+ $( '.message', this )
+ .show()
+ .html( 'Loading' );
+
+ $( '.content', this )
+ .hide();
+ },
+ success : function( response, text_status, xhr )
+ {
+ $( '.message', this )
+ .hide()
+ .empty();
+
+ $( '.content', this )
+ .show()
+ .html( response );
+ },
+ error : function( xhr, text_status, error_thrown)
+ {
+ this
+ .addClass( 'disabled' );
+
+ $( '.message', this )
+ .show()
+ .html( 'We found no "admin-extra.html" file.' );
+ },
+ complete : function( xhr, text_status )
+ {
+ $( 'h2', this )
+ .removeClass( 'loader' );
}
+ }
);
- }
+
+ }
+ );
+ }
);
\ No newline at end of file
Modified: 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=1298010&r1=1298009&r2=1298010&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/dataimport.js (original)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/dataimport.js Wed Mar 7 16:30:20 2012
@@ -1,3 +1,20 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ 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.
+*/
+
sammy.bind
(
'dataimport_queryhandler_load',
@@ -186,7 +203,7 @@ sammy.get
{
var code = $(
'<pre class="syntax language-xml"><code>' +
- xhr.responseText.replace( /\</g, '<' ).replace( /\>/g, '>' ) +
+ xhr.responseText.esc() +
'</code></pre>'
);
this.html( code );
@@ -415,38 +432,29 @@ sammy.get
// form
$( 'form', form_element )
- .die( 'submit' )
- .live
+ .ajaxForm
(
- '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;
+ url : handler_url,
+ 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 )
+ {
+ }
}
);
}
);
}
-);
\ No newline at end of file
+);
Modified: 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=1298010&r1=1298009&r2=1298010&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/file.js (original)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/file.js Wed Mar 7 16:30:20 2012
@@ -1,37 +1,54 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ 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.
+*/
+
// #/:core/schema, #/:core/config
sammy.get
(
- /^#\/([\w\d-]+)\/(schema|config)$/,
- function( context )
- {
- var core_basepath = this.active_core.attr( 'data-basepath' );
+ /^#\/([\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 );
+ $.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) );
- }
- }
- }
- );
- }
+ if( 'success' === text_status )
+ {
+ hljs.highlightBlock( code.get(0) );
+ }
+ }
+ }
+ );
+ }
);
\ No newline at end of file