Apache Lucene open-source search software
SOLR-5458: Admin UI - Remove separated Pages for Config & Schema
Stefan Matheisd744fb54dc0f
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex a8251665b8e..41fb2b1654c 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -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---------------------diff --git a/solr/webapp/web/css/styles/files.css b/solr/webapp/web/css/styles/files.cssindex dcd0d88f8ef..74e14bdfc8d 100644--- a/solr/webapp/web/css/styles/files.css+++ b/solr/webapp/web/css/styles/files.css@@ -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 );}diff --git a/solr/webapp/web/css/styles/menu.css b/solr/webapp/web/css/styles/menu.cssindex 4fba2e86974..334acdc89c5 100644--- a/solr/webapp/web/css/styles/menu.css+++ b/solr/webapp/web/css/styles/menu.css@@ -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 ); }diff --git a/solr/webapp/web/img/ico/pencil.png b/solr/webapp/web/img/ico/pencil.pngnew file mode 100644index 00000000000..3ef2fa63e26Binary files /dev/null and b/solr/webapp/web/img/ico/pencil.png differdiff --git a/solr/webapp/web/js/main.js b/solr/webapp/web/js/main.jsindex c9b09952450..aa5dec67b05 100644--- a/solr/webapp/web/js/main.js+++ b/solr/webapp/web/js/main.js@@ -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',diff --git a/solr/webapp/web/js/scripts/app.js b/solr/webapp/web/js/scripts/app.jsindex 2ea303d98b6..1267e7cb4c4 100644--- a/solr/webapp/web/js/scripts/app.js+++ b/solr/webapp/web/js/scripts/app.js@@ -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();diff --git a/solr/webapp/web/js/scripts/file.js b/solr/webapp/web/js/scripts/file.jsdeleted file mode 100644index 95d201feba1..00000000000--- a/solr/webapp/web/js/scripts/file.js+++ /dev/null@@ -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) );- }- }- }- );- }- );- }-);\ No newline at end of filediff --git a/solr/webapp/web/js/scripts/files.js b/solr/webapp/web/js/scripts/files.jsindex 9f2ef63617d..401bb0484a1 100644--- a/solr/webapp/web/js/scripts/files.js+++ b/solr/webapp/web/js/scripts/files.js@@ -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] ) );+ });\ No newline at end of filediff --git a/solr/webapp/web/tpl/file.html b/solr/webapp/web/tpl/file.htmldeleted file mode 100755index 25fa03dcf87..00000000000--- a/solr/webapp/web/tpl/file.html+++ /dev/null@@ -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>\ No newline at end of filediff --git a/solr/webapp/web/tpl/files.html b/solr/webapp/web/tpl/files.htmlindex dba9bf0d0e8..93ffca897ca 100644--- a/solr/webapp/web/tpl/files.html+++ b/solr/webapp/web/tpl/files.html@@ -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>++ <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>++ <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>