SOLR-10042: Clean up old comments from Angular UI code

This commit is contained in:
Jan Høydahl 2017-05-19 13:17:14 +02:00
parent 629624d5df
commit 467af790cb
5 changed files with 0 additions and 594 deletions

View File

@ -463,255 +463,3 @@ solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $
$rootScope.exceptions = {};
});
});
/* THE BELOW CODE IS TAKEN FROM js/scripts/app.js, AND STILL REQUIRES INTEGRATING
// @todo clear timeouts
// activate_core
this.before
(
{},
function( context )
{
var menu_wrapper = $( '#menu-wrapper' );
// global dashboard doesn't have params.splat
if( !this.params.splat )
{
this.params.splat = [ '~index' ];
}
var selector = '~' === this.params.splat[0][0]
? '#' + this.params.splat[0].replace( /^~/, '' ) + '.global'
: '#core-selector #' + this.params.splat[0].replace( /\./g, '__' );
var active_element = $( selector, menu_wrapper );
// @todo "There is no core with this name"
if( active_element.hasClass( 'global' ) )
{
active_element
.addClass( 'active' );
if( this.params.splat[1] )
{
$( '.' + this.params.splat[1], active_element )
.addClass( 'active' );
}
$( '#core-selector option[selected]' )
.removeAttr( 'selected' )
.trigger( 'liszt:updated' );
$( '#core-selector .chzn-container > a' )
.addClass( 'chzn-default' );
}
else
{
active_element
.attr( 'selected', 'selected' )
.trigger( 'liszt:updated' );
$( '#core-menu .' + this.params.splat[1] )
.addClass( 'active' );
}
);
}
);
var solr_admin = function( app_config )
{
this.menu_element = $( '#core-selector select' );
this.core_menu = $( '#core-menu ul' );
this.config = config;
this.timeout = null;
this.core_regex_base = '^#\\/([\\w\\d-\\.]+)';
show_global_error = function( error )
{
var main = $( '#main' );
$( 'div[id$="-wrapper"]', main )
.remove();
main
.addClass( 'error' )
.append( error );
var pre_tags = $( 'pre', main );
if( 0 !== pre_tags.size() )
{
hljs.highlightBlock( pre_tags.get(0) );
}
};
sort_cores_data = function sort_cores_data( cores_status )
{
// build array of core-names for sorting
var core_names = [];
for( var core_name in cores_status )
{
core_names.push( core_name );
}
core_names.sort();
var core_count = core_names.length;
var cores = {};
for( var i = 0; i < core_count; i++ )
{
var core_name = core_names[i];
cores[core_name] = cores_status[core_name];
}
return cores;
};
this.set_cores_data = function set_cores_data( cores )
{
that.cores_data = sort_cores_data( cores.status );
that.menu_element
.empty();
var core_list = [];
core_list.push( '<option></option>' );
var core_count = 0;
for( var core_name in that.cores_data )
{
core_count++;
var core_path = config.solr_path + '/' + core_name;
var classes = [];
if( cores.status[core_name]['isDefaultCore'] )
{
classes.push( 'default' );
}
var core_tpl = '<option '
+ ' id="' + core_name.replace( /\./g, '__' ) + '" '
+ ' class="' + classes.join( ' ' ) + '"'
+ ' data-basepath="' + core_path + '"'
+ ' schema="' + cores.status[core_name]['schema'] + '"'
+ ' config="' + cores.status[core_name]['config'] + '"'
+ ' value="#/' + core_name + '"'
+ ' title="' + core_name + '"'
+ '>'
+ core_name
+ '</option>';
core_list.push( core_tpl );
}
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' );
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' );
}
};
this.run = function()
{
$.ajax
(
{
// load cores (indexInfo = false
success : function( response )
{
var system_url = config.solr_path + '/admin/info/system?wt=json';
$.ajax
(
{
url : system_url,
dataType : 'json',
beforeSend : function( arr, form, options )
{
},
success : function( response )
{
that.dashboard_values = response;
var environment_args = null;
var cloud_args = null;
if( response.jvm && response.jvm.jmx && response.jvm.jmx.commandLineArgs )
{
var command_line_args = response.jvm.jmx.commandLineArgs.join( ' | ' );
environment_args = command_line_args.match( /-Dsolr.environment=((dev|test|prod)?[\w\d]*)/i );
}
// @todo detect $scope.isCloud = response.mode.match( /solrcloud/i );
// environment
var wrapper = $( '#wrapper' );
var environment_element = $( '#environment' );
if( environment_args )
{
wrapper
.addClass( 'has-environment' );
if( environment_args[1] )
{
environment_element
.html( environment_args[1] );
}
if( environment_args[2] )
{
environment_element
.addClass( environment_args[2] );
}
}
else
{
wrapper
.removeClass( 'has-environment' );
}
// cloud
var cloud_nav_element = $( '#menu #cloud' );
if( cloud_args )
{
cloud_nav_element
.show();
}
// sammy
sammy.run( location.hash );
},
error : function()
{
};
*/

View File

@ -199,13 +199,3 @@ solrAdminApp.controller('AnalysisController',
$scope.refresh();
}
);
/***************
function(error) {
if (error.status == 404) {
$scope.isHandlerMissing = true;
} else {
$scope.analysisError = error.error.msg;
}
****/

View File

@ -52,38 +52,6 @@ function($scope, $rootScope, $routeParams, Luke, CoreSystem, Update, Replication
function(error) {
$scope.replicationMessage = "Replication is not configured";
});
/*
/replication?command=details&wt=json
if( is_slave )
{
// warnings if slave version|gen doesn't match what's replicable
if( data.indexVersion !== master_data.master.replicableVersion )
{
$( '.version', details_element )
.addClass( 'diff' );
}
else
{
$( '.version', details_element )
.removeClass( 'diff' );
}
if( data.generation !== master_data.master.replicableGeneration )
{
$( '.generation', details_element )
.addClass( 'diff' );
}
else
{
$( '.generation', details_element )
.removeClass( 'diff' );
}
}
},
*/
};
$scope.refreshAdminExtra = function() {

View File

@ -193,286 +193,3 @@ solrAdminApp.controller('CoreAdminController',
$scope.refresh();
}
);
/**************
'cores_load_data',
function( event, params )
{
$.ajax
(
{
url : app.config.solr_path + app.config.core_admin_path + '?wt=json',
dataType : 'json',
success : function( response, text_status, xhr )
{
if( params.only_failures )
{
app.check_for_init_failures( response );
return true;
}
=========== NO CORES
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();
}
}
);
}
}
);
}
);
// #/~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',
{
error : function()
{
context.redirect( '#/' + context.params.splat[0] );
},
success : 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 data_element = $( '#data', cores_element );
var core_data_element = $( '#core-data', data_element );
var index_data_element = $( '#index-data', data_element );
cores_element
.removeClass( 'empty' );
var core_data = cores[current_core];
var core_basepath = $( '#' + current_core, app.menu_element ).attr( 'data-basepath' );
var core_names = [];
var core_selects = $( '#actions select', cores_element );
$( 'option[value="' + current_core + '"]', core_selects.filter( '.other' ) )
.remove();
$( 'input[data-core="current"]', cores_element )
.val( current_core );
// 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();
}
var form_callback = {
rename : function( form, response )
{
var url = path_parts[1] + $( 'input[name="other"]', form ).val();
context.redirect( url );
}
};
$( 'form', div_action )
.ajaxForm
(
{
url : app.config.solr_path + app.config.core_admin_path + '?wt=json&indexInfo=false',
success : function( response, status_text, xhr, form )
{
var action = $( 'input[name="action"]', form ).val().toLowerCase();
delete app.cores_data;
if( form_callback[action] )
{
form_callback[action]( form, response );
}
else
{
sammy.refresh();
}
$( 'button.reset', form )
.trigger( 'click' );
},
);
$( '#actions #unload', cores_element )
var ret = confirm( 'Do you really want to unload Core "' + current_core + '"?' );
if( !ret )
return false;
url : app.config.solr_path + app.config.core_admin_path + '?wt=json&action=UNLOAD&core=' + current_core,
success : function( response, text_status, xhr )
{
delete app.cores_data;
context.redirect( path_parts[1].substr( 0, path_parts[1].length - 1 ) );
},
optimize_button
url : core_basepath + '/update?optimize=true&waitFlush=true&wt=json',
success : function( response, text_status, xhr )
******/

View File

@ -612,20 +612,3 @@ var sortedObjectArray = function(list) {
var shortenPackages = function(className) {
return className.replace("org.apache.solr", "o.a.s").replace("org.apache.lucene", "o.a.l");
};
/*
var get_width = function get_width()
{
return $( this ).width();
}
var max_width = 10 + Math.max.apply( Math, $( 'p', topterms_table_element ).map( get_width ).get() );
topterms:
p { width: {{maxWidth}}px !important; }
ul { margin-left: {{max_width + 5 }}px !important; }
var max_width = 10 + Math.max.apply( Math, $( 'dt', histogram_holder_element ).map( get_width ).get() );
histogram_holder:
ul { margin-left: {{maxWidth}}px !important; }
li dt { left: {{-maxWidth}}px !important; width: {{maxWidth}}px !important; }
*/