mirror of
https://github.com/djohnlewis/stackdump
synced 2025-12-07 00:13:33 +00:00
Upgrade Apache Solr to 4.5.0 and PySolr to 3.1.0.
All Solr indexes will need to be re-created.
This commit is contained in:
553
java/solr/server/solr-webapp/webapp/js/scripts/analysis.js
Normal file
553
java/solr/server/solr-webapp/webapp/js/scripts/analysis.js
Normal file
File diff suppressed because it is too large
Load Diff
651
java/solr/server/solr-webapp/webapp/js/scripts/app.js
Normal file
651
java/solr/server/solr-webapp/webapp/js/scripts/app.js
Normal file
File diff suppressed because it is too large
Load Diff
740
java/solr/server/solr-webapp/webapp/js/scripts/cloud.js
Normal file
740
java/solr/server/solr-webapp/webapp/js/scripts/cloud.js
Normal file
File diff suppressed because it is too large
Load Diff
699
java/solr/server/solr-webapp/webapp/js/scripts/cores.js
Normal file
699
java/solr/server/solr-webapp/webapp/js/scripts/cores.js
Normal file
File diff suppressed because it is too large
Load Diff
561
java/solr/server/solr-webapp/webapp/js/scripts/dashboard.js
Normal file
561
java/solr/server/solr-webapp/webapp/js/scripts/dashboard.js
Normal file
File diff suppressed because it is too large
Load Diff
812
java/solr/server/solr-webapp/webapp/js/scripts/dataimport.js
Normal file
812
java/solr/server/solr-webapp/webapp/js/scripts/dataimport.js
Normal file
File diff suppressed because it is too large
Load Diff
370
java/solr/server/solr-webapp/webapp/js/scripts/documents.js
Normal file
370
java/solr/server/solr-webapp/webapp/js/scripts/documents.js
Normal file
@@ -0,0 +1,370 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
//helper for formatting JSON and others
|
||||
var content_generator = {
|
||||
|
||||
_default: function (toEsc) {
|
||||
return toEsc.esc();
|
||||
},
|
||||
|
||||
json: function (toEsc) {
|
||||
return app.format_json(toEsc);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//Utiltity function for turning on/off various elements
|
||||
function toggles(documents_form, show_json, show_file, show_doc, doc_text, show_wizard) {
|
||||
var json_only = $('#json-only');
|
||||
var the_document = $('#document', documents_form);
|
||||
if (show_doc) {
|
||||
//console.log("doc: " + doc_text);
|
||||
the_document.val(doc_text);
|
||||
the_document.show();
|
||||
} else {
|
||||
the_document.hide();
|
||||
}
|
||||
if (show_json) {
|
||||
json_only.show();
|
||||
} else {
|
||||
json_only.hide();
|
||||
}
|
||||
var file_upload = $('#file-upload', documents_form);
|
||||
var upload_only = $('#upload-only', documents_form);
|
||||
if (show_file) {
|
||||
file_upload.show();
|
||||
upload_only.show();
|
||||
} else {
|
||||
file_upload.hide();
|
||||
upload_only.hide();
|
||||
}
|
||||
var wizard = $('#wizard', documents_form);
|
||||
if (show_wizard) {
|
||||
wizard.show();
|
||||
} else {
|
||||
wizard.hide();
|
||||
}
|
||||
}
|
||||
// #/:core/documents
|
||||
|
||||
//Utiltity function for setting up the wizard fields
|
||||
function addWizardFields(active_core, wizard) {
|
||||
var core_basepath = active_core.attr('data-basepath');
|
||||
var select_options = "";
|
||||
//Populate the select options based off the Fields REST API
|
||||
$.getJSON(window.location.protocol + '//' + window.location.host
|
||||
+ core_basepath + "/schema/fields").done(
|
||||
//TODO: handle dynamic fields
|
||||
//TODO: get the unique key, too
|
||||
function (data) {
|
||||
var field_select = $("#wiz-field-select", wizard);
|
||||
field_select.empty();
|
||||
$.each(data.fields,
|
||||
function (i, item) {
|
||||
//console.log("i[" + i + "]=" + item.name);
|
||||
if (item.name != "_version_"){
|
||||
select_options += '<option name="' + item.name + '">'
|
||||
+ item.name + '</option>';
|
||||
}
|
||||
});
|
||||
//console.log("select_options: " + select_options);
|
||||
//fill in the select options
|
||||
field_select.append(select_options);
|
||||
});
|
||||
var wizard_doc = $("#wizard-doc", wizard);
|
||||
wizard_doc.die('focusin')
|
||||
.live('focusin', function (event) {
|
||||
$("#wizard-doc", wizard).text("");
|
||||
}
|
||||
);
|
||||
//Add the click handler for the "Add Field" target, which
|
||||
//takes the field content and moves it into the document target
|
||||
var add_field = $("#add-field-href", wizard);
|
||||
add_field.die("click")
|
||||
.live("click",
|
||||
function (event) {
|
||||
//take the field and the contents and append it to the document
|
||||
var wiz_select = $("#wiz-field-select", wizard);
|
||||
var selected = $("option:selected", wiz_select);
|
||||
console.log("selected field: " + selected);
|
||||
var wiz_doc = $("#wizard-doc", wizard);
|
||||
var the_document = $("#document");
|
||||
var current_doc = the_document.val();
|
||||
console.log("current_text: " + current_doc + " wiz_doc: " + wiz_doc.val());
|
||||
var index = current_doc.lastIndexOf("}");
|
||||
var new_entry = '"' + selected.val() + '":"' + wiz_doc.val() + '"';
|
||||
if (index >= 0) {
|
||||
current_doc = current_doc.substring(0, index) + ', ' + new_entry + "}";
|
||||
} else {
|
||||
//we don't have a doc at all
|
||||
current_doc = "{" + new_entry + "}";
|
||||
}
|
||||
current_doc = content_generator['json'](current_doc);
|
||||
the_document.val(current_doc);
|
||||
//clear the wiz doc window
|
||||
wiz_doc.val("");
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
//console.log("adding " + i + " child: " + child);
|
||||
|
||||
}
|
||||
|
||||
//The main program for adding the docs
|
||||
sammy.get
|
||||
(
|
||||
new RegExp(app.core_regex_base + '\\/(documents)$'),
|
||||
function (context) {
|
||||
var active_core = this.active_core;
|
||||
var core_basepath = active_core.attr('data-basepath');
|
||||
var content_element = $('#content');
|
||||
|
||||
|
||||
$.post
|
||||
(
|
||||
'tpl/documents.html',
|
||||
function (template) {
|
||||
|
||||
content_element
|
||||
.html(template);
|
||||
var documents_element = $('#documents', content_element);
|
||||
var documents_form = $('#form form', documents_element);
|
||||
var url_element = $('#url', documents_element);
|
||||
var result_element = $('#result', documents_element);
|
||||
var response_element = $('#response', documents_element);
|
||||
var doc_type_select = $('#document-type', documents_form);
|
||||
//Since we are showing "example" docs, when the area receives the focus
|
||||
// remove the example content.
|
||||
$('#document', documents_form).die('focusin')
|
||||
.live('focusin',
|
||||
function (event) {
|
||||
var document_type = $('#document-type', documents_form).val();
|
||||
if (document_type != "wizard"){
|
||||
//Don't clear the document when in wizard mode.
|
||||
var the_document = $('#document', documents_form);
|
||||
the_document.text("");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/*response_element.html("");*/
|
||||
//Setup the handlers for toggling the various display options for the "Document Type" select
|
||||
doc_type_select
|
||||
.die('change')
|
||||
.live
|
||||
(
|
||||
'change',
|
||||
function (event) {
|
||||
var document_type = $('#document-type', documents_form).val();
|
||||
var file_upload = $('#file-upload', documents_form);
|
||||
|
||||
//need to clear out any old file upload by forcing a redraw so that
|
||||
//we don't try to upload an old file
|
||||
file_upload.html(file_upload.html());
|
||||
if (document_type == "json") {
|
||||
toggles(documents_form, true, false, true, '{"id":"change.me","title":"change.me"}', false);
|
||||
$("#attribs").show();
|
||||
} else if (document_type == "upload") {
|
||||
toggles(documents_form, false, true, false, "", false);
|
||||
$("#attribs").show();
|
||||
} else if (document_type == "csv") {
|
||||
toggles(documents_form, false, false, true, "id,title\nchange.me,change.me", false);
|
||||
$("#attribs").show();
|
||||
} else if (document_type == "solr") {
|
||||
toggles(documents_form, false, false, true, '<add>\n' +
|
||||
'<doc>\n' +
|
||||
'<field name="id">change.me</field>\n' +
|
||||
'<field name="title" >chang.me</field>\n' +
|
||||
'</doc>\n' +
|
||||
'</add>\n', false);
|
||||
$("#attribs").hide();
|
||||
} else if (document_type == "wizard") {
|
||||
var wizard = $('#wizard', documents_form);
|
||||
addWizardFields(active_core, wizard);
|
||||
//$("#wizard-doc", wizard).text('Enter your field text here and then click "Add Field" to add the field to the document.');
|
||||
toggles(documents_form, false, false, true, "", true);
|
||||
$("#attribs").show();
|
||||
} else if (document_type == "xml") {
|
||||
toggles(documents_form, false, false, true, '<doc>\n' +
|
||||
'<field name="id">change.me</field>' +
|
||||
'<field name="title">change.me</field>' +
|
||||
'</doc>', false);
|
||||
$("#attribs").show();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
);
|
||||
doc_type_select.chosen().trigger('change');
|
||||
//Setup the submit option handling.
|
||||
documents_form
|
||||
.die('submit')
|
||||
.live
|
||||
(
|
||||
'submit',
|
||||
function (event) {
|
||||
var form_values = [];
|
||||
var handler_path = $('#qt', documents_form).val();
|
||||
if ('/' !== handler_path[0]) {
|
||||
form_values.push({ name: 'qt', value: handler_path.esc() });
|
||||
handler_path = '/update';
|
||||
}
|
||||
|
||||
var document_url = window.location.protocol + '//' + window.location.host
|
||||
+ core_basepath + handler_path + '?wt=json';
|
||||
|
||||
url_element
|
||||
.attr('href', document_url)
|
||||
.text(document_url)
|
||||
.trigger('change');
|
||||
var the_document = $('#document', documents_form).val();
|
||||
var commit_within = $('#commitWithin', documents_form).val();
|
||||
var boost = $('#boost', documents_form).val();
|
||||
var overwrite = $('#overwrite', documents_form).val();
|
||||
var the_command = "";
|
||||
var content_type = "";
|
||||
var document_type = $('#document-type', documents_form).val();
|
||||
var doingFileUpload = false;
|
||||
//Both JSON and Wizard use the same pathway for submission
|
||||
//New entries primarily need to fill the_command and set the content_type
|
||||
if (document_type == "json" || document_type == "wizard") {
|
||||
//create a JSON command
|
||||
the_command = "{"
|
||||
+ '"add":{ "doc":' + the_document + ","
|
||||
+ '"boost":' + boost + ","
|
||||
+ '"overwrite":' + overwrite + ","
|
||||
+ '"commitWithin":' + commit_within
|
||||
+ "}}";
|
||||
content_type = "application/json";
|
||||
} else if (document_type == "csv") {
|
||||
the_command = the_document;
|
||||
document_url += "&commitWithin=" + commit_within + "&overwrite=" + overwrite;
|
||||
content_type = "application/csv";
|
||||
} else if (document_type == "xml") {
|
||||
the_command = '<add commitWithin="' + commit_within
|
||||
+ '" overwrite="' + overwrite + '"'
|
||||
+ ">"
|
||||
+ the_document + "</add>";
|
||||
content_type = "text/xml";
|
||||
} else if (document_type == "upload") {
|
||||
doingFileUpload = true;
|
||||
} else if (document_type == "solr") {
|
||||
//guess content_type
|
||||
the_command = the_document;
|
||||
if (the_document.indexOf("<") >= 0) {
|
||||
//XML
|
||||
content_type = "text/xml";
|
||||
} else if (the_document.indexOf("{") >= 0) {
|
||||
//JSON
|
||||
content_type = "application/json";
|
||||
} //TODO: do we need to handle others?
|
||||
} else {
|
||||
//How to handle other?
|
||||
}
|
||||
|
||||
//Handle the submission of the form in the case where we are not uploading a file
|
||||
if (doingFileUpload == false) {
|
||||
$.ajax(
|
||||
{
|
||||
url: document_url,
|
||||
//dataType : 'json',
|
||||
processData: false,
|
||||
type: 'POST',
|
||||
contentType: content_type,
|
||||
data: the_command,
|
||||
context: response_element,
|
||||
beforeSend: function (xhr, settings) {
|
||||
console.log("beforeSend: Vals: " + document_url + " content-type: " + document_type + " the cmd: " + the_command);
|
||||
|
||||
},
|
||||
success: function (response, text_status, xhr) {
|
||||
console.log("success: " + response + " status: " + text_status + " xhr: " + xhr.responseText);
|
||||
this.html('<div><span class="description">Status</span>: ' + text_status + '</div>'
|
||||
+ '<div><span class="description">Response:</span>' + '<pre class="syntax language-json"><code>' + content_generator['json'](xhr.responseText) + "</code></pre></div>");
|
||||
result_element.show();
|
||||
},
|
||||
error: function (xhr, text_status, error_thrown) {
|
||||
console.log("error: " + text_status + " thrown: " + error_thrown);
|
||||
this.html('<div><span class="description">Status</span>: ' + text_status + '</div><div><span class="description">Error:</span> '
|
||||
+ '' + error_thrown
|
||||
+ '</div>'
|
||||
+ '<div><span class="description">Error</span>:' + '<pre class="syntax language-json"><code>'
|
||||
+ content_generator['json'](xhr.responseText) +
|
||||
'</code></pre></div>');
|
||||
result_element.show();
|
||||
},
|
||||
complete: function (xhr, text_status) {
|
||||
//console.log("complete: " + text_status + " xhr: " + xhr.responseText + " doc type: " + document_type);
|
||||
|
||||
//alert(text_status + ": " + xhr.responseText);
|
||||
/*this
|
||||
.removeClass( 'loader' );*/
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
//upload the file
|
||||
var the_file = $('#the-file', documents_form);
|
||||
var erh_params = $('#erh-params', documents_form).val();
|
||||
if (erh_params != "") {
|
||||
if (erh_params.substring(0,1) != "&"){
|
||||
erh_params = "&" + erh_params;
|
||||
}
|
||||
document_url = document_url + erh_params;
|
||||
}
|
||||
console.log("uploading file to: " + document_url);
|
||||
the_file.ajaxfileupload({
|
||||
'action': document_url,
|
||||
'validate_extensions': false,
|
||||
'upload_now': true,
|
||||
'params': {
|
||||
'extra': 'info'
|
||||
},
|
||||
'onComplete': function (response) {
|
||||
response = response.replace('<pre style="word-wrap: break-word; white-space: pre-wrap;">', "");
|
||||
response = response.replace("</pre>", "");
|
||||
console.log('completed upload: ' + response);
|
||||
response_element.html('<div><span class="description">Response:</span>' + '<pre class="syntax language-json"><code>' + content_generator['json'](response) + "</code></pre></div>");
|
||||
result_element.show();
|
||||
|
||||
},
|
||||
'onStart': function () {
|
||||
console.log("starting file upload");
|
||||
//if (weWantedTo) return false; // cancels upload
|
||||
},
|
||||
'onCancel': function () {
|
||||
console.log('no file selected');
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
/*
|
||||
Sample docs:
|
||||
<doc boost="2.5">
|
||||
<field name="id">05991</field>
|
||||
<field name="title" boost="2.0">Bridgewater</field>
|
||||
</doc>
|
||||
|
||||
{"id":"foo","title":"blah"}
|
||||
|
||||
*/
|
||||
73
java/solr/server/solr-webapp/webapp/js/scripts/file.js
Normal file
73
java/solr/server/solr-webapp/webapp/js/scripts/file.js
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
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
|
||||
(
|
||||
new RegExp( app.core_regex_base + '\\/(schema|config)$' ),
|
||||
function( context )
|
||||
{
|
||||
var core_basepath = this.active_core.attr( 'data-basepath' );
|
||||
var content_element = $( '#content' );
|
||||
|
||||
var url = window.location.protocol + '//' + window.location.host + core_basepath + '/admin/file'
|
||||
+ '?file=' + this.active_core.attr( context.params.splat[1] )
|
||||
+ '&contentType=text/xml;charset=utf-8';
|
||||
|
||||
$.get
|
||||
(
|
||||
'tpl/file.html',
|
||||
function( template )
|
||||
{
|
||||
content_element
|
||||
.html( template );
|
||||
|
||||
$( '#url', content_element )
|
||||
.text( url )
|
||||
.attr( 'href', url );
|
||||
|
||||
$.ajax
|
||||
(
|
||||
{
|
||||
url : url,
|
||||
dataType : 'xml',
|
||||
context : $( '#response' ,content_element ),
|
||||
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) );
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
340
java/solr/server/solr-webapp/webapp/js/scripts/index.js
Normal file
340
java/solr/server/solr-webapp/webapp/js/scripts/index.js
Normal file
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
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 generate_bar = function( bar_container, bar_data, convert_label_values )
|
||||
{
|
||||
bar_holder = $( '.bar-holder', bar_container );
|
||||
|
||||
var bar_level = 1;
|
||||
var max_width = Math.round( $( '.bar-max', bar_holder ).width() );
|
||||
$( '.bar-max.val', bar_holder ).text( bar_data['max'] );
|
||||
|
||||
bar_level++;
|
||||
$( '.bar-total.bar', bar_holder ).width( new String( (bar_data['total']/bar_data['max'])*100 ) + '%' );
|
||||
$( '.bar-total.val', bar_holder ).text( bar_data['total'] );
|
||||
|
||||
if( bar_data['used'] )
|
||||
{
|
||||
bar_level++;
|
||||
$( '.bar-used.bar', bar_holder ).width( new String( (bar_data['used']/bar_data['total'])*100 ) + '%' );
|
||||
$( '.bar-used.val', bar_holder ).text( bar_data['used'] );
|
||||
}
|
||||
|
||||
bar_holder
|
||||
.addClass( 'bar-lvl-' + bar_level );
|
||||
|
||||
var percentage = ( ( ( bar_data['used'] || bar_data['total'] ) / bar_data['max'] ) * 100 ).toFixed(1);
|
||||
|
||||
var hl = $( '[data-desc="' + bar_container.attr( 'id' ) + '"]' );
|
||||
|
||||
$( '.bar-desc', hl )
|
||||
.remove();
|
||||
|
||||
hl
|
||||
.append( ' <small class="bar-desc">' + percentage + '%</small>' );
|
||||
|
||||
if( !!convert_label_values )
|
||||
{
|
||||
$( '.val', bar_holder )
|
||||
.each
|
||||
(
|
||||
function()
|
||||
{
|
||||
var self = $( this );
|
||||
|
||||
var unit = null;
|
||||
var byte_value = parseInt( self.html() );
|
||||
|
||||
self
|
||||
.attr( 'title', 'raw: ' + byte_value + ' B' );
|
||||
|
||||
byte_value /= 1024;
|
||||
byte_value /= 1024;
|
||||
unit = 'MB';
|
||||
|
||||
if( 1024 <= byte_value )
|
||||
{
|
||||
byte_value /= 1024;
|
||||
unit = 'GB';
|
||||
}
|
||||
|
||||
byte_value = byte_value.toFixed( 2 ) + ' ' + unit;
|
||||
|
||||
self
|
||||
.text( byte_value );
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
var system_info = function( element, system_data )
|
||||
{
|
||||
// -- usage
|
||||
|
||||
var load_average = ( system_data['system']['uptime'] || '' ).match( /load averages?: (\d+[.,]\d\d),? (\d+[.,]\d\d),? (\d+[.,]\d\d)/ );
|
||||
if( load_average )
|
||||
{
|
||||
var hl = $( '#system h2', element );
|
||||
|
||||
$( '.bar-desc', hl )
|
||||
.remove();
|
||||
|
||||
hl
|
||||
.append( ' <small class="bar-desc">' + load_average.slice( 1 ).join( ' ' ).replace( /,/g, '.' ).esc() + '</small>' );
|
||||
}
|
||||
|
||||
// -- physical-memory-bar
|
||||
|
||||
var bar_holder = $( '#physical-memory-bar', element );
|
||||
if( system_data['system']['totalPhysicalMemorySize'] === undefined || system_data['system']['freePhysicalMemorySize'] === undefined )
|
||||
{
|
||||
bar_holder.hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_holder.show();
|
||||
|
||||
var bar_data = {
|
||||
'max' : parse_memory_value( system_data['system']['totalPhysicalMemorySize'] ),
|
||||
'total' : parse_memory_value( system_data['system']['totalPhysicalMemorySize'] - system_data['system']['freePhysicalMemorySize'] )
|
||||
};
|
||||
|
||||
generate_bar( bar_holder, bar_data, true );
|
||||
}
|
||||
|
||||
// -- swap-space-bar
|
||||
|
||||
var bar_holder = $( '#swap-space-bar', element );
|
||||
if( system_data['system']['totalSwapSpaceSize'] === undefined || system_data['system']['freeSwapSpaceSize'] === undefined )
|
||||
{
|
||||
bar_holder.hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_holder.show();
|
||||
|
||||
var bar_data = {
|
||||
'max' : parse_memory_value( system_data['system']['totalSwapSpaceSize'] ),
|
||||
'total' : parse_memory_value( system_data['system']['totalSwapSpaceSize'] - system_data['system']['freeSwapSpaceSize'] )
|
||||
};
|
||||
|
||||
generate_bar( bar_holder, bar_data, true );
|
||||
}
|
||||
|
||||
// -- file-descriptor-bar
|
||||
|
||||
var bar_holder = $( '#file-descriptor-bar', element );
|
||||
if( system_data['system']['maxFileDescriptorCount'] === undefined || system_data['system']['openFileDescriptorCount'] === undefined )
|
||||
{
|
||||
bar_holder.hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_holder.show();
|
||||
|
||||
var bar_data = {
|
||||
'max' : parse_memory_value( system_data['system']['maxFileDescriptorCount'] ),
|
||||
'total' : parse_memory_value( system_data['system']['openFileDescriptorCount'] )
|
||||
};
|
||||
|
||||
generate_bar( bar_holder, bar_data );
|
||||
}
|
||||
|
||||
0 === $( '#system div[id$="-bar"]:visible', element ).size()
|
||||
? $( '#system .no-info', element ).show()
|
||||
: $( '#system .no-info', element ).hide();
|
||||
|
||||
// -- memory-bar
|
||||
|
||||
var bar_holder = $( '#jvm-memory-bar', element );
|
||||
if( system_data['jvm']['memory'] === undefined )
|
||||
{
|
||||
bar_holder.hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_holder.show();
|
||||
|
||||
var jvm_memory = $.extend
|
||||
(
|
||||
{
|
||||
'free' : null,
|
||||
'total' : null,
|
||||
'max' : null,
|
||||
'used' : null,
|
||||
'raw' : {
|
||||
'free' : null,
|
||||
'total' : null,
|
||||
'max' : null,
|
||||
'used' : null,
|
||||
'used%' : null
|
||||
}
|
||||
},
|
||||
system_data['jvm']['memory']
|
||||
);
|
||||
|
||||
var bar_data = {
|
||||
'max' : parse_memory_value( jvm_memory['raw']['max'] || jvm_memory['max'] ),
|
||||
'total' : parse_memory_value( jvm_memory['raw']['total'] || jvm_memory['total'] ),
|
||||
'used' : parse_memory_value( jvm_memory['raw']['used'] || jvm_memory['used'] )
|
||||
};
|
||||
|
||||
generate_bar( bar_holder, bar_data, true );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// #/
|
||||
sammy.get
|
||||
(
|
||||
/^#\/$/,
|
||||
function( context )
|
||||
{
|
||||
var content_element = $( '#content' );
|
||||
|
||||
content_element
|
||||
.html( '<div id="index"></div>' );
|
||||
|
||||
$.ajax
|
||||
(
|
||||
{
|
||||
url : 'tpl/index.html',
|
||||
context : $( '#index', content_element ),
|
||||
beforeSend : function( arr, form, options )
|
||||
{
|
||||
},
|
||||
success : function( template )
|
||||
{
|
||||
var self = this;
|
||||
|
||||
this
|
||||
.html( template );
|
||||
|
||||
var data = {
|
||||
'start_time' : app.dashboard_values['jvm']['jmx']['startTime'],
|
||||
'jvm_version' : app.dashboard_values['jvm']['name'] + ' (' + app.dashboard_values['jvm']['version'] + ')',
|
||||
'processors' : app.dashboard_values['jvm']['processors'],
|
||||
'solr_spec_version' : app.dashboard_values['lucene']['solr-spec-version'] || '-',
|
||||
'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'] || '-'
|
||||
};
|
||||
|
||||
for( var key in data )
|
||||
{
|
||||
var value_element = $( '.' + key + ' dd', this );
|
||||
|
||||
value_element
|
||||
.text( data[key].esc() );
|
||||
|
||||
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();
|
||||
|
||||
$( '.index-left .block li:visible:odd', this )
|
||||
.addClass( 'odd' );
|
||||
|
||||
// -- system_info
|
||||
|
||||
system_info( this, app.dashboard_values );
|
||||
|
||||
$( '#system a.reload', this )
|
||||
.die( 'click' )
|
||||
.live
|
||||
(
|
||||
'click',
|
||||
function( event )
|
||||
{
|
||||
$.ajax
|
||||
(
|
||||
{
|
||||
url : environment_basepath + '/admin/system?wt=json',
|
||||
dataType : 'json',
|
||||
context : this,
|
||||
beforeSend : function( arr, form, options )
|
||||
{
|
||||
loader.show( this );
|
||||
},
|
||||
success : function( response )
|
||||
{
|
||||
system_info( self, response );
|
||||
},
|
||||
error : function()
|
||||
{
|
||||
},
|
||||
complete : function()
|
||||
{
|
||||
loader.hide( this );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
);
|
||||
},
|
||||
error : function( xhr, text_status, error_thrown )
|
||||
{
|
||||
},
|
||||
complete : function( xhr, text_status )
|
||||
{
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// #/~java-properties
|
||||
sammy.get
|
||||
(
|
||||
/^#\/(~java-properties)$/,
|
||||
function( context )
|
||||
{
|
||||
var content_element = $( '#content' );
|
||||
|
||||
content_element
|
||||
.html( '<div id="java-properties"></div>' );
|
||||
|
||||
$.ajax
|
||||
(
|
||||
{
|
||||
url : app.config.solr_path + '/admin/info/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 = [];
|
||||
|
||||
var workaround = xhr.responseText.match( /"(line\.separator)"\s*:\s*"(.+?)"/ );
|
||||
if( workaround && workaround[2] )
|
||||
{
|
||||
system_properties[workaround[1]] = workaround[2];
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
519
java/solr/server/solr-webapp/webapp/js/scripts/logging.js
Normal file
519
java/solr/server/solr-webapp/webapp/js/scripts/logging.js
Normal file
File diff suppressed because it is too large
Load Diff
72
java/solr/server/solr-webapp/webapp/js/scripts/ping.js
Normal file
72
java/solr/server/solr-webapp/webapp/js/scripts/ping.js
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
$( '.ping a', app.core_menu )
|
||||
.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;
|
||||
}
|
||||
);
|
||||
462
java/solr/server/solr-webapp/webapp/js/scripts/plugins.js
Normal file
462
java/solr/server/solr-webapp/webapp/js/scripts/plugins.js
Normal file
@@ -0,0 +1,462 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
var core_basepath = null;
|
||||
var content_element = null;
|
||||
var selected_type = null;
|
||||
var context_path = null;
|
||||
var active_context = null;
|
||||
var changes = null;
|
||||
var reference_xml = null;
|
||||
|
||||
var compute_plugin_data = function( response, changeset )
|
||||
{
|
||||
var types = [];
|
||||
var sort_table = {};
|
||||
var plugin_data = {};
|
||||
|
||||
var types_obj = {};
|
||||
var plugin_key = null;
|
||||
|
||||
changes = { count : {}, list : {} }
|
||||
|
||||
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( plugin_data[key][part_key]['_changed_'] )
|
||||
{
|
||||
delete plugin_data[key][part_key]['_changed_'];
|
||||
|
||||
changes.count[key] = changes.count[key] || 0;
|
||||
changes.count[key]++;
|
||||
|
||||
changes.list[key] = changes.list[key] || {};
|
||||
changes.list[key][part_key] = true;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
return {
|
||||
'plugin_data' : plugin_data,
|
||||
'sort_table' : sort_table,
|
||||
'types' : types
|
||||
};
|
||||
};
|
||||
|
||||
var render_plugin_data = 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 = active_context.params.splat[0] + '/' + active_context.params.splat[1] + '/' + types[i].toLowerCase();
|
||||
|
||||
var navigation_markup = '<li class="' + types[i].toLowerCase().esc() + '">' +
|
||||
'<a href="#/' + type_url + '" rel="' + types[i].esc() + '">' + types[i].esc();
|
||||
|
||||
if( changes.count[types[i]] )
|
||||
{
|
||||
navigation_markup += ' <span>' + changes.count[types[i]].esc() + '</span>';
|
||||
}
|
||||
|
||||
navigation_markup += '</a>' +
|
||||
'</li>';
|
||||
|
||||
navigation_content.push( navigation_markup );
|
||||
}
|
||||
|
||||
navigation_content.push( '<li class="PLUGINCHANGES"><a href="#">Watch Changes</a></li>' );
|
||||
navigation_content.push( '<li class="RELOAD"><a href="#" onClick="window.location.reload()">Refresh Values</a></li>' );
|
||||
|
||||
navigation_element
|
||||
.html( navigation_content.join( "\n" ) );
|
||||
|
||||
$( '.PLUGINCHANGES a', navigation_element )
|
||||
.die( 'click' )
|
||||
.live
|
||||
(
|
||||
'click',
|
||||
function( event )
|
||||
{
|
||||
load_reference_xml();
|
||||
|
||||
changes = { count : {}, list : {} }
|
||||
$( 'a > span', navigation_element ).remove();
|
||||
$( '.entry.changed', frame_element ).removeClass( 'changed' );
|
||||
|
||||
$.blockUI
|
||||
(
|
||||
{
|
||||
message: $('#recording'),
|
||||
css: { width: '450px' }
|
||||
}
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
$( '#recording button' )
|
||||
.die( 'click' )
|
||||
.live
|
||||
(
|
||||
'click',
|
||||
function( event )
|
||||
{
|
||||
$.ajax
|
||||
(
|
||||
{
|
||||
type: 'POST',
|
||||
url: core_basepath + '/admin/mbeans',
|
||||
dataType : 'json',
|
||||
data: {
|
||||
'stats': 'true',
|
||||
'wt': 'json',
|
||||
'diff': 'true',
|
||||
'all': 'true',
|
||||
'stream.body': reference_xml
|
||||
},
|
||||
success : function( response, text_status, xhr )
|
||||
{
|
||||
load_reference_xml();
|
||||
|
||||
app.plugin_data = compute_plugin_data( response );
|
||||
render_plugin_data( app.plugin_data.plugin_data, app.plugin_data.sort_table, app.plugin_data.types );
|
||||
}
|
||||
}
|
||||
);
|
||||
$.unblockUI();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
$( 'a[href="' + context_path + '"]', navigation_element )
|
||||
.parent().addClass( 'current' );
|
||||
|
||||
var content = '<ul>';
|
||||
for( var sort_key in plugin_sort[selected_type] )
|
||||
{
|
||||
plugin_sort[selected_type][sort_key].sort();
|
||||
var plugin_type_length = plugin_sort[selected_type][sort_key].length;
|
||||
|
||||
for( var i = 0; i < plugin_type_length; i++ )
|
||||
{
|
||||
var bean = plugin_sort[selected_type][sort_key][i];
|
||||
var classes = [ 'entry' ];
|
||||
|
||||
if( changes.list[selected_type] && changes.list[selected_type][bean] )
|
||||
{
|
||||
classes.push( 'changed' );
|
||||
}
|
||||
|
||||
content += '<li class="' + classes.join( ' ' ) + '">' + "\n";
|
||||
content += '<a href="' + context_path + '?entry=' + bean.esc() + '" data-bean="' + bean.esc() + '">';
|
||||
content += '<span>' + bean.esc() + '</span>';
|
||||
content += '</a>' + "\n";
|
||||
content += '<ul class="detail">' + "\n";
|
||||
|
||||
var details = plugin_data[selected_type][ plugin_sort[selected_type][sort_key][i] ];
|
||||
for( var detail_key in details )
|
||||
{
|
||||
if( 'stats' !== detail_key )
|
||||
{
|
||||
var detail_value = details[detail_key];
|
||||
|
||||
if( 'description' === detail_key )
|
||||
{
|
||||
// Link component list to their MBeans page
|
||||
if(detail_value.match(/^Search using components: /)) {
|
||||
var idx = detail_value.indexOf(':');
|
||||
var url = '#/'+active_context.params.splat[0]+'/plugins/other?entry=';
|
||||
var tmp = 'Search using components:<ul>';
|
||||
$.each(detail_value.substr(idx+1).split(","), function(index, value) {
|
||||
value = $.trim(value);
|
||||
tmp += '<li><a href="'+url+value+'" class="linker">'+value+"</a></li>";
|
||||
});
|
||||
tmp += "</ul>";
|
||||
detail_value = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
content += '<li><dl class="clearfix">' + "\n";
|
||||
content += '<dt>' + detail_key + ':</dt>' + "\n";
|
||||
if($.isArray(detail_value)) {
|
||||
$.each(detail_value, function(index, value) {
|
||||
content += '<dd>' + value + '</dd>' + "\n";
|
||||
});
|
||||
}
|
||||
else {
|
||||
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 = new String( details[detail_key][stats_key] );
|
||||
stats_value = stats_value.replace( /([\(@])/g, '$1​' );
|
||||
|
||||
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 );
|
||||
|
||||
|
||||
var path = active_context.path.split( '?entry=' );
|
||||
var entries = ( path[1] || '' ).split( ',' );
|
||||
|
||||
var entry_count = entries.length;
|
||||
for( var i = 0; i < entry_count; i++ )
|
||||
{
|
||||
$( 'a[data-bean="' + entries[i] + '"]', frame_element )
|
||||
.parent().addClass( 'expanded' );
|
||||
}
|
||||
|
||||
$( 'a', frame_element )
|
||||
.off( 'click' )
|
||||
.on
|
||||
(
|
||||
'click',
|
||||
function( event )
|
||||
{
|
||||
var self = $( this );
|
||||
var bean = self.data( 'bean' );
|
||||
|
||||
var split = '?entry=';
|
||||
var path = active_context.path.split( split );
|
||||
var entry = ( path[1] || '' );
|
||||
|
||||
var regex = new RegExp( bean.replace( /\//g, '\\/' ) + '(,|$)' );
|
||||
var match = regex.test( entry );
|
||||
|
||||
var url = path[0] + split;
|
||||
|
||||
url += match
|
||||
? entry.replace( regex, '' )
|
||||
: entry + ',' + bean;
|
||||
|
||||
url = url.replace( /=,/, '=' );
|
||||
url = url.replace( /,$/, '' );
|
||||
url = url.replace( /\?entry=$/, '' );
|
||||
|
||||
active_context.redirect( url );
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
// Try to make links for anything with http (but leave the rest alone)
|
||||
$( '.detail dd' ).each(function(index) {
|
||||
var txt = $(this).html();
|
||||
if(txt.indexOf("http") >= 0) {
|
||||
$(this).linker({
|
||||
className : 'linker'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Add invisible whitespace after each slash
|
||||
$( '.detail a.linker' ).each(function(index) {
|
||||
$(this).html( $(this).html().replace( /\//g, '/​' ) );
|
||||
});
|
||||
|
||||
|
||||
$( '.entry', frame_element )
|
||||
.each
|
||||
(
|
||||
function( i, entry )
|
||||
{
|
||||
$( '.detail > li', entry ).not( '.stats' ).filter( ':even' )
|
||||
.addClass( 'odd' );
|
||||
|
||||
$( '.stats li:odd', entry )
|
||||
.addClass( 'odd' );
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var load_reference_xml = function()
|
||||
{
|
||||
$.ajax
|
||||
(
|
||||
{
|
||||
type: 'GET',
|
||||
url: core_basepath + '/admin/mbeans?stats=true&wt=xml',
|
||||
dataType : 'text',
|
||||
success: function( data )
|
||||
{
|
||||
reference_xml = data;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
$.ajax
|
||||
(
|
||||
{
|
||||
url : core_basepath + '/admin/mbeans?stats=true&wt=json',
|
||||
dataType : 'json',
|
||||
beforeSend : function( xhr, settings )
|
||||
{
|
||||
},
|
||||
success : function( response, text_status, xhr )
|
||||
{
|
||||
app.plugin_data = compute_plugin_data( response );
|
||||
|
||||
$.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
|
||||
(
|
||||
new RegExp( app.core_regex_base + '\\/(plugins)\\/(\\w+)$' ),
|
||||
function( context )
|
||||
{
|
||||
core_basepath = this.active_core.attr( 'data-basepath' );
|
||||
content_element = $( '#content' );
|
||||
selected_type = context.params.splat[2].toUpperCase();
|
||||
context_path = context.path.split( '?' ).shift();
|
||||
active_context = context;
|
||||
|
||||
sammy.trigger
|
||||
(
|
||||
'plugins_load',
|
||||
{
|
||||
active_core : this.active_core,
|
||||
callback : render_plugin_data
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// #/:core/plugins
|
||||
sammy.get
|
||||
(
|
||||
new RegExp( app.core_regex_base + '\\/(plugins)$' ),
|
||||
function( context )
|
||||
{
|
||||
core_basepath = this.active_core.attr( 'data-basepath' );
|
||||
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() );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
229
java/solr/server/solr-webapp/webapp/js/scripts/query.js
Normal file
229
java/solr/server/solr-webapp/webapp/js/scripts/query.js
Normal file
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
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/query
|
||||
sammy.get
|
||||
(
|
||||
new RegExp( app.core_regex_base + '\\/(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', result_element );
|
||||
|
||||
url_element
|
||||
.die( 'change' )
|
||||
.live
|
||||
(
|
||||
'change',
|
||||
function( event )
|
||||
{
|
||||
var wt = $( '[name="wt"]', query_form ).val();
|
||||
|
||||
var content_generator = {
|
||||
|
||||
_default : function( xhr )
|
||||
{
|
||||
return xhr.responseText.esc();
|
||||
},
|
||||
|
||||
json : function( xhr )
|
||||
{
|
||||
return app.format_json( xhr.responseText );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$.ajax
|
||||
(
|
||||
{
|
||||
url : this.href,
|
||||
dataType : wt,
|
||||
context : response_element,
|
||||
beforeSend : function( xhr, settings )
|
||||
{
|
||||
this
|
||||
.html( '<div class="loader">Loading ...</div>' );
|
||||
},
|
||||
complete : function( xhr, text_status )
|
||||
{
|
||||
var code = $(
|
||||
'<pre class="syntax language-' + wt + '"><code>' +
|
||||
( content_generator[wt] || content_generator['_default'] )( xhr ) +
|
||||
'</code></pre>'
|
||||
);
|
||||
this.html( code );
|
||||
|
||||
if( 'success' === text_status )
|
||||
{
|
||||
hljs.highlightBlock( code.get(0) );
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
|
||||
$( '.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' );
|
||||
}
|
||||
);
|
||||
|
||||
$( '.multiple a', query_form )
|
||||
.die( 'click' )
|
||||
.live
|
||||
(
|
||||
'click',
|
||||
function( event )
|
||||
{
|
||||
var self = $( this );
|
||||
var row = self.closest( '.row' );
|
||||
var container = self.closest( '.multiple' );
|
||||
|
||||
var add = parseInt( self.data( 'action' ), 10 );
|
||||
if( add )
|
||||
{
|
||||
var new_row = row.clone();
|
||||
new_row.find( 'input' ).val( '' );
|
||||
row.after( new_row );
|
||||
row.next().find( 'input' ).focus();
|
||||
}
|
||||
else if( 1 === $( '.row', container ).size() )
|
||||
{
|
||||
row.find( 'input' ).val( '' ).focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
row.remove();
|
||||
container.find( 'input:last' ).focus();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
)
|
||||
|
||||
query_form
|
||||
.die( 'submit' )
|
||||
.live
|
||||
(
|
||||
'submit',
|
||||
function( event )
|
||||
{
|
||||
var form_values = [];
|
||||
|
||||
var add_to_form_values = function add_to_form_values( fields )
|
||||
{
|
||||
for( var i in fields )
|
||||
{
|
||||
if( !fields[i].value || 0 === fields[i].value.length )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
form_values.push( fields[i] );
|
||||
}
|
||||
};
|
||||
|
||||
var fieldsets = $( '> fieldset', query_form );
|
||||
|
||||
var fields = fieldsets.first().formToArray( true );
|
||||
add_to_form_values( fields );
|
||||
|
||||
fieldsets.not( '.common' )
|
||||
.each
|
||||
(
|
||||
function( i, set )
|
||||
{
|
||||
if( $( 'legend input', set ).is( ':checked' ) )
|
||||
{
|
||||
var fields = $( set ).formToArray( true );
|
||||
add_to_form_values( fields );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
var handler_path = $( '#qt', query_form ).val();
|
||||
if( '/' !== handler_path[0] )
|
||||
{
|
||||
form_values.push( { name : 'qt', value : handler_path.esc() } );
|
||||
handler_path = '/select';
|
||||
}
|
||||
|
||||
var query_url = window.location.protocol + '//' + window.location.host
|
||||
+ core_basepath + handler_path + '?' + $.param( form_values );
|
||||
|
||||
var custom_parameters = $( '#custom_parameters', query_form ).val();
|
||||
if( custom_parameters && 0 !== custom_parameters.length )
|
||||
{
|
||||
query_url += '&' + custom_parameters.replace( /^&/, '' );
|
||||
}
|
||||
|
||||
url_element
|
||||
.attr( 'href', query_url )
|
||||
.text( query_url )
|
||||
.trigger( 'change' );
|
||||
|
||||
result_element
|
||||
.show();
|
||||
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
var fields = 0;
|
||||
for( var key in context.params )
|
||||
{
|
||||
if( 'string' === typeof context.params[key] )
|
||||
{
|
||||
fields++;
|
||||
$( '[name="' + key + '"]', query_form )
|
||||
.val( context.params[key] );
|
||||
}
|
||||
}
|
||||
|
||||
if( 0 !== fields )
|
||||
{
|
||||
query_form
|
||||
.trigger( 'submit' );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
527
java/solr/server/solr-webapp/webapp/js/scripts/replication.js
Normal file
527
java/solr/server/solr-webapp/webapp/js/scripts/replication.js
Normal file
File diff suppressed because it is too large
Load Diff
1229
java/solr/server/solr-webapp/webapp/js/scripts/schema-browser.js
Normal file
1229
java/solr/server/solr-webapp/webapp/js/scripts/schema-browser.js
Normal file
File diff suppressed because it is too large
Load Diff
158
java/solr/server/solr-webapp/webapp/js/scripts/threads.js
Normal file
158
java/solr/server/solr-webapp/webapp/js/scripts/threads.js
Normal file
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// #/~threads
|
||||
sammy.get
|
||||
(
|
||||
/^#\/(~threads)$/,
|
||||
function( context )
|
||||
{
|
||||
var content_element = $( '#content' );
|
||||
|
||||
$.get
|
||||
(
|
||||
'tpl/threads.html',
|
||||
function( template )
|
||||
{
|
||||
content_element
|
||||
.html( template );
|
||||
|
||||
$.ajax
|
||||
(
|
||||
{
|
||||
url : app.config.solr_path + '/admin/info/threads?wt=json',
|
||||
dataType : 'json',
|
||||
context : $( '#threads', content_element ),
|
||||
beforeSend : function( xhr, settings )
|
||||
{
|
||||
},
|
||||
success : function( response, text_status, xhr )
|
||||
{
|
||||
var self = this;
|
||||
|
||||
var threadDumpData = response.system.threadDump;
|
||||
var threadDumpContent = [];
|
||||
var c = 0;
|
||||
for( var i = 1; i < threadDumpData.length; i += 2 )
|
||||
{
|
||||
var state = threadDumpData[i].state.esc();
|
||||
var name = '<a title="' + state +'"><span>' + threadDumpData[i].name.esc() + ' (' + threadDumpData[i].id.esc() + ')</span></a>';
|
||||
|
||||
var classes = [state];
|
||||
var details = '';
|
||||
|
||||
if( 0 !== c % 2 )
|
||||
{
|
||||
classes.push( 'odd' );
|
||||
}
|
||||
|
||||
if( threadDumpData[i].lock )
|
||||
{
|
||||
classes.push( 'lock' );
|
||||
name += "\n" + '<p title="Waiting on">' + threadDumpData[i].lock.esc() + '</p>';
|
||||
}
|
||||
|
||||
if( threadDumpData[i].stackTrace && 0 !== threadDumpData[i].stackTrace.length )
|
||||
{
|
||||
classes.push( 'stacktrace' );
|
||||
|
||||
var stack_trace = threadDumpData[i].stackTrace
|
||||
.join( '###' )
|
||||
.esc()
|
||||
.replace( /\(/g, '​(' )
|
||||
.replace( /###/g, '</li><li>' );
|
||||
|
||||
name += '<div>' + "\n"
|
||||
+ '<ul>' + "\n"
|
||||
+ '<li>' + stack_trace + '</li>'
|
||||
+ '</ul>' + "\n"
|
||||
+ '</div>';
|
||||
}
|
||||
|
||||
var item = '<tr class="' + classes.join( ' ' ) +'">' + "\n"
|
||||
+ '<td class="name">' + name + '</td>' + "\n"
|
||||
+ '<td class="time">' + threadDumpData[i].cpuTime.esc() + '<br>' + threadDumpData[i].userTime.esc() + '</td>' + "\n"
|
||||
+ '</tr>';
|
||||
|
||||
threadDumpContent.push( item );
|
||||
c++;
|
||||
}
|
||||
|
||||
var threadDumpBody = $( '#thread-dump tbody', this );
|
||||
|
||||
threadDumpBody
|
||||
.html( threadDumpContent.join( "\n" ) );
|
||||
|
||||
$( '.name a', threadDumpBody )
|
||||
.die( 'click' )
|
||||
.live
|
||||
(
|
||||
'click',
|
||||
function( event )
|
||||
{
|
||||
$( this ).closest( 'tr' )
|
||||
.toggleClass( 'open' );
|
||||
}
|
||||
);
|
||||
|
||||
$( '.controls a', this )
|
||||
.die( 'click' )
|
||||
.live
|
||||
(
|
||||
'click',
|
||||
function( event )
|
||||
{
|
||||
var threads_element = $( self );
|
||||
var is_collapsed = threads_element.hasClass( 'collapsed' );
|
||||
var thread_rows = $( 'tr', threads_element );
|
||||
|
||||
thread_rows
|
||||
.each
|
||||
(
|
||||
function( index, element )
|
||||
{
|
||||
if( is_collapsed )
|
||||
{
|
||||
$( element )
|
||||
.addClass( 'open' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$( element )
|
||||
.removeClass( 'open' );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
threads_element
|
||||
.toggleClass( 'collapsed' )
|
||||
.toggleClass( 'expanded' );
|
||||
}
|
||||
);
|
||||
},
|
||||
error : function( xhr, text_status, error_thrown)
|
||||
{
|
||||
},
|
||||
complete : function( xhr, text_status )
|
||||
{
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user