SOLR-5539: Admin UI - Remove ability to create/modify files

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1548477 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Matheis 2013-12-06 09:53:03 +00:00
parent 325637c2cf
commit ad4b95a353
4 changed files with 4 additions and 319 deletions

View File

@ -229,6 +229,8 @@ Other Changes
* SOLR-5502: Added a test for tri-level compositeId routing with documents
having a "/" in a document id. (Anshum Gupta via Mark Miller)
* SOLR-5539: Admin UI - Remove ability to create/modify files (steffkes)
================== 4.6.0 ==================
Versions of Major Components

View File

@ -23,54 +23,11 @@ limitations under the License.
width: 20%;
}
#content #files #new-file-holder
{
margin-top: 20px;
padding-bottom: 10px;
}
#content #files #new-file-holder button span
{
background-image: url( ../../img/ico/plus-button.png );
}
#content #files #new-file-holder form
{
box-shadow: 5px 5px 10px #c0c0c0;
-moz-box-shadow: 5px 5px 10px #c0c0c0;
-webkit-box-shadow: 5px 5px 10px #c0c0c0;
display: none;
padding: 10px;
}
#content #files #new-file-holder form input
{
margin-bottom: 3px;
width: 98%;
}
#content #files #new-file-holder .note
{
color: #c0c0c0;
margin-bottom: 5px;
}
#content #files form .buttons button
{
float: right;
}
#content #files .modify-file,
#content #files .modify-file .view-file
{
display: none;
}
#content #files .modify-file .modify-file
{
display: block;
}
#content #files #file-content
{
display: none;
@ -80,84 +37,13 @@ limitations under the License.
min-height: 100px
}
#content #files .top #url
{
float: left;
width: 80%;
}
#content #files .top .buttons
{
float: right;
width: 15%;
}
#content #files .top .buttons button
{
float: right;
}
#content #files .top .buttons button.view-file span
{
background-image: url( ../../img/ico/pencil.png );
}
#content #files .top .buttons button.modify-file span
{
background-image: url( ../../img/ico/document-text.png );
}
#content #files .show #file-content
{
display: block;
}
#content #files #new-file-note
{
background-color: #ffa662;
background-image: url( ../../img/ico/exclamation-button.png );
background-position: 10px 50%;
display: none;
margin-bottom: 10px;
padding: 10px;
padding-left: 31px;
}
#content #files #file-content .response
{
border: 1px solid transparent;
padding: 2px;
}
#content #files #file-content textarea
{
display: block;
font-family: monospace;
height: 500px;
margin-bottom: 10px;
width: 99%;
}
#content #files #file-content form 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

@ -27,7 +27,6 @@ sammy.get
var content_element = $( '#content' );
var file_endpoint = core_basepath + '/admin/file';
var file_exists = null;
var path = context.path.split( '?' );
var selected_file = null;
@ -144,34 +143,6 @@ sammy.get
};
load_tree();
var new_file_form = $( '#new-file-holder form' );
$( '#new-file-holder > button' )
.on
(
'click',
function( event )
{
new_file_form.toggle();
return false;
}
);
new_file_form
.on
(
'submit',
function( event )
{
$( 'body' )
.animate( { scrollTop: 0 }, 500 );
window.location.href = '#/' + current_core + '/files?file=' + $( 'input', this ).val();
return false;
}
);
if( selected_file )
{
$( '#new-file-holder input' )
@ -200,57 +171,6 @@ sammy.get
.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' );
load_file( !file_exists );
window.setTimeout
(
function()
{
button
.removeClass( 'success' );
},
1000
);
}
}
);
var change_button_label = function( form, label )
{
$( 'span[data-' + label + ']', form )
.each
(
function( index, element )
{
var self = $( this );
self.text( self.data( label ) );
}
);
}
var load_file = function( load_tree )
{
if( load_tree )
@ -277,8 +197,6 @@ sammy.get
},
success : function( response, text_status, xhr )
{
change_button_label( this, 'existing-title' );
var content_type = xhr.getResponseHeader( 'Content-Type' ) || '';
var highlight = null;
@ -310,86 +228,16 @@ sammy.get
},
error : function( xhr, text_status, error_thrown)
{
change_button_label( this, 'new-title' );
$( '.view-file .response', this )
.text( 'No such file exists.' );
},
complete : function( xhr, text_status )
{
file_exists = 200 === xhr.status;
$( '#new-file-note' )
.toggle( !file_exists );
}
}
);
}
load_file();
$( '.top button', frame_element )
.on
(
'click',
function( event )
{
$( '#file-content', frame_element )
.toggleClass( 'modify-file' );
return false;
}
);
$( '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( !file_exists );
$( 'body' )
.animate( { scrollTop: 0 }, 500 );
window.setTimeout
(
function()
{
button
.removeClass( 'success' );
},
1000
);
}
}
);
return false;
}
);
}
}
);

View File

@ -22,24 +22,6 @@ limitations under the License.
<div id="tree" class="tree">#tree</div>
<div id="new-file-holder">
<button><span>Create new file</span></button>
<form method="get">
<p class="note">Enter filename, on the next page you can input content or upload a file.</p>
<input type="text" name="file" placeholder="sample.xml">
<div class="buttons clearfix">
<button type="submit">Next </button>
</div>
</form>
</div>
</div>
<div id="file-content" class="clearfix">
@ -47,13 +29,6 @@ limitations under the License.
<a id="url" class="address-bar" href="#"></a>
<div class="buttons">
<button class="modify-file"><span>View file</span></button>
<button class="view-file"><span>Modify file</span></button>
</div>
</div>
<div class="view-file">
@ -62,32 +37,6 @@ limitations under the License.
</div>
<div class="modify-file">
<p id="new-file-note">The requested file does (not yet) exist. <strong>Save file</strong> or <strong>Upload new file</strong> will create it.</p>
<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 data-new-title="Upload new file" data-existing-title="Replace current file">Replace current file</span></button>
</div>
</form>
</div>
</div>
</div>