SOLR-5446: Admin UI - Allow changing Schema and Config

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1542720 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Matheis 2013-11-17 13:23:23 +00:00
parent 496f27ad66
commit 2aec8731a4
13 changed files with 422 additions and 7 deletions

View File

@ -87,6 +87,8 @@ New Features
* SOLR-5447: Add a QParserPlugin for Lucene's SimpleQueryParser.
(Jack Conradson via shalin)
* SOLR-5446: Admin UI - Allow changing Schema and Config (steffkes)
Bug Fixes
----------------------

View File

@ -30,6 +30,7 @@ limitations under the License.
<link rel="stylesheet" type="text/css" href="css/styles/cores.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/styles/dashboard.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/styles/dataimport.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/styles/files.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/styles/index.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/styles/java-properties.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/styles/logging.css?_=${version}">

View File

@ -244,12 +244,6 @@ limitations under the License.
/* tree */
#content #cloud .tree a.active
{
background-color: #f0f0f0;
color: #00f;
}
#content #cloud #legend
{
border: 1px solid #f0f0f0;

View File

@ -606,6 +606,12 @@ pre.syntax .tex .formula
background:#beebff; border:1px solid #99defd; padding:0 2px 0 1px;
}
#content .tree a.active
{
background-color: #f0f0f0;
color: #00f;
}
#content .tree a .jstree-icon
{
background-image: url( ../../img/ico/folder.png );

View File

@ -0,0 +1,102 @@
/*
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.
*/
#content #files #tree
{
float: left;
width: 20%;
}
#content #files .show #tree
{
overflow: hidden;
}
#content #files #file-content
{
display: none;
float: right;
position: relative;
width: 78%;
min-height: 100px
}
#content #files .show #file-content
{
display: block;
}
#content #files #file-content .close
{
background-image: url( ../../img/ico/cross-0.png );
background-position: 50% 50%;
display: block;
height: 20px;
position: absolute;
right: 0;
top: 0;
width: 20px;
}
#content #files #file-content .close:hover
{
background-image: url( ../../img/ico/cross-1.png );
}
#content #files #file-content .close span
{
display: none;
}
#content #files #file-content form .buttons button
{
float: right;
}
#content #files #file-content textarea
{
display: block;
height: 500px;
margin-bottom: 10px;
width: 99%;
}
#content #files #file-content button span
{
background-image: url( ../../img/ico/disk-black.png );
}
#content #files #file-content form.upload
{
border-top: 1px solid #c0c0c0;
margin-top: 20px;
padding-top: 20px;
padding-bottom: 20px;
}
#content #files #file-content .upload input
{
border: 0;
float: left;
}
#content #files #file-content .upload button span
{
background-image: url( ../../img/ico/drive-upload.png );
}

View File

@ -275,6 +275,7 @@ limitations under the License.
#core-menu .config a { background-image: url( ../../img/ico/gear.png ); }
#core-menu .analysis a { background-image: url( ../../img/ico/funnel.png ); }
#core-menu .documents a { background-image: url( ../../img/ico/documents-stack.png ); }
#core-menu .files a { background-image: url( ../../img/ico/folder.png ); }
#core-menu .schema-browser a { background-image: url( ../../img/ico/book-open-text.png ); }
#core-menu .replication a { background-image: url( ../../img/ico/node.png ); }
#core-menu .distribution a { background-image: url( ../../img/ico/node-select.png ); }

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

View File

@ -149,6 +149,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// with uninit() later, to allow updating that settings
if ($element.data('ajaxUploader-setup') === true) return;
/*
$element.change(function () {
// since a new image was selected, reset the marker
uploading_file = false;
@ -159,6 +160,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
upload_file();
}
});
//*/
if (settings.submit_button == null) {
// do nothing

View File

@ -41,6 +41,7 @@ require
'lib/order!scripts/dataimport',
'lib/order!scripts/dashboard',
'lib/order!scripts/file',
'lib/order!scripts/files',
'lib/order!scripts/index',
'lib/order!scripts/java-properties',
'lib/order!scripts/logging',

View File

@ -9388,7 +9388,8 @@ jQuery.extend({
return this;
},
url : s.url
url : s.url,
data : s.data
};
// Callback for when everything is done

View File

@ -367,6 +367,7 @@ var solr_admin = function( app_config )
'<li class="config"><a href="#/' + core_name + '/config"><span>Config</span></a></li>' + "\n" +
'<li class="dataimport"><a href="#/' + core_name + '/dataimport"><span>Dataimport</span></a></li>' + "\n" +
'<li class="documents"><a href="#/' + core_name + '/documents"><span>Documents</span></a></li>' + "\n" +
'<li class="files"><a href="#/' + core_name + '/files"><span>Files</span></a></li>' + "\n" +
'<li class="ping"><a rel="' + that.config.solr_path + '/' + core_name + '/admin/ping"><span>Ping</span></a></li>' + "\n" +
'<li class="plugins"><a href="#/' + core_name + '/plugins"><span>Plugins / Stats</span></a></li>' + "\n" +
'<li class="query"><a href="#/' + core_name + '/query"><span>Query</span></a></li>' + "\n" +

View File

@ -0,0 +1,254 @@
/*
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/files
sammy.get
(
new RegExp( app.core_regex_base + '\\/(files)$' ),
function( context )
{
core_basepath = this.active_core.attr( 'data-basepath' );
current_core = context.params.splat[0];
var content_element = $( '#content' );
var file_endpoint = core_basepath + '/admin/file';
var path = context.path.split( '?' );
var selected_file = null;
if( path && path[1] )
{
selected_file = path[1].split( '=' ).pop();
}
$.get
(
'tpl/files.html',
function( template )
{
content_element
.html( template );
var frame_element = $( '#frame', content_element );
var tree_callback = function( event, data )
{
$( 'li[data-file].jstree-closed', event.currentTarget )
.filter
(
function( index, element )
{
return selected_file && 0 === selected_file.indexOf( $( element ).data( 'file' ) );
}
)
.each
(
function( index, element )
{
data.inst.open_node( element );
}
);
if( selected_file )
{
$( 'li[data-file="' + selected_file.replace( /\/$/, '' ) + '"] > a', event.currentTarget )
.addClass( 'active' );
}
};
$( '#tree', frame_element )
.jstree
(
{
plugins : [ 'json_data', 'sort' ],
json_data : {
ajax: {
url : file_endpoint + '?wt=json',
data : function( n )
{
if( -1 === n )
return null;
return {
file : n.attr( 'data-file' )
};
},
success : function( response, status, xhr )
{
var files = [];
for( var file in response.files )
{
var is_directory = response.files[file].directory;
var prefix = xhr.data ? xhr.data.file + '/' : ''
var item = {
data: {
title : file,
attr : {
href : '#/' + current_core + '/files?file=' + prefix + file
}
},
attr : {
'data-file' : prefix + file
}
};
if( is_directory )
{
item.state = 'closed';
item.data.attr.href += '/';
}
files.push( item );
}
return files;
}
},
progressive_render : true
},
core : {
animation : 0
}
}
)
.on
(
'loaded.jstree',
tree_callback
)
.on
(
'open_node.jstree',
tree_callback
);
if( selected_file && '/' !== selected_file.substr( -1 ) )
{
frame_element
.addClass( 'show' );
var endpoint = file_endpoint + '?file=' + selected_file;
var public_url = window.location.protocol + '//' + window.location.host + endpoint;
$( '#url', frame_element )
.text( public_url )
.attr( 'href', public_url );
var form = $( 'form.modify', frame_element );
form
.attr( 'action', file_endpoint + '?wt=json&op=write&file=' + selected_file )
.ajaxForm
(
{
context : form,
beforeSubmit: function( arr, form, options )
{
$( 'button span', form )
.addClass( 'loader' );
},
success : function( response, status, xhr )
{
$( 'button span', this )
.removeClass( 'loader' );
var button = $( 'button', this );
button
.addClass( 'success' );
window.setTimeout
(
function()
{
button
.removeClass( 'success' );
},
1000
);
}
}
);
var load_file = function()
{
$( 'form textarea', frame_element )
.load( endpoint );
}
load_file();
$( 'form.upload', frame_element )
.on
(
'submit',
function( event )
{
$( 'form input', frame_element )
.ajaxfileupload
(
{
action: endpoint + '&op=write&wt=json',
validate_extensions: false,
upload_now: true,
onStart: function ()
{
$( 'form.upload button span', frame_element )
.addClass( 'loader' );
},
onCancel: function ()
{
$( 'form.upload button span', frame_element )
.removeClass( 'loader' );
},
onComplete: function( response )
{
$( 'form.upload button span', frame_element )
.removeClass( 'loader' );
var button = $( 'form.upload button', frame_element );
button
.addClass( 'success' );
load_file();
$( 'body' )
.animate( { scrollTop: 0 }, 500 );
window.setTimeout
(
function()
{
button
.removeClass( 'success' );
},
1000
);
}
}
);
return false;
}
);
}
}
);
}
);

View File

@ -0,0 +1,50 @@
<!--
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.
-->
<div id="files" class="clearfix">
<div id="frame">
<div id="tree" class="tree">#tree</div>
<div id="file-content" class="clearfix">
<a id="url" class="address-bar" href="#"></a>
<form method="post" class="modify">
<textarea name="stream.body"></textarea>
<div class="buttons clearfix">
<button type="submit"><span>Save file</span></button>
</div>
</form>
<form method="post" class="upload">
<input type="file" name="fileupload">
<div class="buttons clearfix">
<button><span>Replace current file</span></button>
</div>
</form>
</div>
</div>
</div>