SOLR-5458: Admin UI - Remove separated Pages for Config & Schema

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1543368 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Matheis 2013-11-19 10:21:02 +00:00
parent 8822632048
commit d744fb54dc
10 changed files with 152 additions and 118 deletions

View File

@ -122,6 +122,11 @@ Bug Fixes
* SOLR-5452: Do not attempt to proxy internal update requests. (Mark Miller)
Optimizations
----------------------
* SOLR-5458: Admin UI - Remove separated Pages for Config & Schema (steffkes)
Other Changes
---------------------

View File

@ -60,6 +60,17 @@ limitations under the License.
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;
@ -69,6 +80,33 @@ 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;
@ -85,15 +123,22 @@ limitations under the License.
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 button span
#content #files #file-content form button span
{
background-image: url( ../../img/ico/disk-black.png );
}

View File

@ -271,8 +271,6 @@ limitations under the License.
#core-menu .overview a { background-image: url( ../../img/ico/home.png ); }
#core-menu .query a { background-image: url( ../../img/ico/magnifier.png ); }
#core-menu .schema a { background-image: url( ../../img/ico/table.png ); }
#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 ); }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -40,7 +40,6 @@ require
'lib/order!scripts/documents',
'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',

View File

@ -364,7 +364,6 @@ var solr_admin = function( app_config )
//Keep this in alphabetical order after the overview
'<li class="overview"><a href="#/' + core_name + '"><span>Overview</span></a></li>' + "\n" +
'<li class="analysis"><a href="#/' + core_name + '/analysis"><span>Analysis</span></a></li>' + "\n" +
'<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" +
@ -372,7 +371,6 @@ var solr_admin = function( app_config )
'<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" +
'<li class="replication"><a href="#/' + core_name + '/replication"><span>Replication</span></a></li>' + "\n" +
'<li class="schema"><a href="#/' + core_name + '/schema"><span>Schema</span></a></li>' + "\n" +
'<li class="schema-browser"><a href="#/' + core_name + '/schema-browser"><span>Schema Browser</span></a></li>'
)
.show();

View File

@ -1,73 +0,0 @@
/*
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) );
}
}
}
);
}
);
}
);

View File

@ -189,6 +189,11 @@ sammy.get
.addClass( 'show' );
var endpoint = file_endpoint + '?file=' + selected_file;
var content_type_map = { xml : 'text/xml', html : 'text/html', js : 'text/javascript' };
var file_ext = selected_file.match( /\.(\w+)$/ );
endpoint += '&contentType=' + ( content_type_map[ file_ext[1] || '' ] || 'text/plain' ) + ';charset=utf-8';
var public_url = window.location.protocol + '//' + window.location.host + endpoint;
$( '#url', frame_element )
@ -257,15 +262,50 @@ sammy.get
(
{
url : endpoint,
context : $( 'form', frame_element ),
context : frame_element,
beforeSend : function( xhr, settings )
{
var block = $( '.view-file .response', this );
if( !block.data( 'placeholder' ) )
{
block.data( 'placeholder', block.text() );
}
block
.text( block.data( 'placeholder' ) );
},
success : function( response, text_status, xhr )
{
change_button_label( this, 'existing-title' );
$( 'textarea', this )
var content_type = xhr.getResponseHeader( 'Content-Type' ) || '';
var highlight = null;
if( 0 === content_type.indexOf( 'text/xml' ) || 0 === xhr.responseText.indexOf( '<?xml' ) ||
0 === content_type.indexOf( 'text/html' ) || 0 === xhr.responseText.indexOf( '<!--' ) )
{
highlight = 'xml';
}
else if( 0 === content_type.indexOf( 'text/javascript' ) )
{
highlight = 'javascript';
}
var code = $(
'<pre class="syntax' + ( highlight ? ' language-' + highlight : '' )+ '"><code>' +
xhr.responseText.esc() +
'</code></pre>'
);
$( '.view-file .response', this )
.html( code );
if( highlight )
{
hljs.highlightBlock( code.get( 0 ) );
}
$( 'form textarea', this )
.val( xhr.responseText );
},
error : function( xhr, text_status, error_thrown)
@ -283,6 +323,19 @@ sammy.get
}
load_file();
$( '.top button', frame_element )
.on
(
'click',
function( event )
{
$( '#file-content', frame_element )
.toggleClass( 'modify-file' );
return false;
}
);
$( 'form.upload', frame_element )
.on
(
@ -341,4 +394,15 @@ sammy.get
}
);
}
);
// legacy redirect for 'config' & 'schema' pages
// #/:core/schema, #/:core/config
sammy.get
(
new RegExp( app.core_regex_base + '\\/(schema|config)$' ),
function( context )
{
context.redirect( '#/' + context.params.splat[0] + '/files?file=' + this.active_core.attr( context.params.splat[1] ) );
}
);

View File

@ -1,23 +0,0 @@
<!--
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="file" class="clearfix">
<a id="url" class="address-bar" href="#"></a>
<div id="response"></div>
</div>

View File

@ -43,29 +43,50 @@ limitations under the License.
</div>
<div id="file-content" class="clearfix">
<a id="url" class="address-bar" href="#"></a>
<div class="top clearfix">
<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>
<a id="url" class="address-bar" href="#"></a>
<form method="post" class="modify">
<textarea name="stream.body"></textarea>
<div class="buttons">
<button class="modify-file"><span>View file</span></button>
<button class="view-file"><span>Modify file</span></button>
<div class="buttons clearfix">
<button type="submit"><span>Save file</span></button>
</div>
</form>
</div>
<form method="post" class="upload">
<div class="view-file">
<input type="file" name="fileupload">
<div class="response">Loading …</div>
<div class="buttons clearfix">
<button><span data-new-title="Upload new file" data-existing-title="Replace current file">Replace current file</span></button>
</div>
</div>
</form>
<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>