From d744fb54dc0f47fae72003dd35b9b954e225ab7e Mon Sep 17 00:00:00 2001 From: Stefan Matheis Date: Tue, 19 Nov 2013 10:21:02 +0000 Subject: [PATCH] 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 --- solr/CHANGES.txt | 5 ++ solr/webapp/web/css/styles/files.css | 47 ++++++++++++++++- solr/webapp/web/css/styles/menu.css | 2 - solr/webapp/web/img/ico/pencil.png | Bin 0 -> 1529 bytes solr/webapp/web/js/main.js | 1 - solr/webapp/web/js/scripts/app.js | 2 - solr/webapp/web/js/scripts/file.js | 73 --------------------------- solr/webapp/web/js/scripts/files.js | 68 ++++++++++++++++++++++++- solr/webapp/web/tpl/file.html | 23 --------- solr/webapp/web/tpl/files.html | 49 +++++++++++++----- 10 files changed, 152 insertions(+), 118 deletions(-) create mode 100644 solr/webapp/web/img/ico/pencil.png delete mode 100644 solr/webapp/web/js/scripts/file.js delete mode 100755 solr/webapp/web/tpl/file.html diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 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.css index 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.css index 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.png new file mode 100644 index 0000000000000000000000000000000000000000..3ef2fa63e268971a0bc18951278218e279429ac1 GIT binary patch literal 1529 zcmaJ>dr;GM9FHP`2n^XkM5kHQox9N{Y5I&Uu1Q)cv#6yLl#MgAfktf7CFxoiK2UGq zr01prhj%`vo6l3`L_Kxj1H`f0M4jAJ#+>Iib|z|m^5HNX2n3V?OvwvHFlsOu!Wt@-LPjXW5>BFn3Qn9ls6a8IOJIEx%X45@ zkuKo=U|IGk~k#Ji37=!(*_4=AB-vySm?)u;~Qkz?Js9|y+deGaxgEP z|6hI4S>j`02P5)+!6jF*aOyBqFEdrGw2d&%;Z+=;3`JnT>%tEa&C}Vz^GSS7ARHf&GYaTLs<=_NNSIhgtXgWz%L7 zwW=(73{$DilodtIWkW8Z89NZouLG7}hU?TXGYIr$gN@FNW?9!^!Cu8SuJZ!R!8s7p{SuT-d=v4K(%F@os1Qavz(M7VncLRk=4T}n9 z>^#!(b&dY}&=|WV;(TJ#rci5RNn@v}>p+sO_+Z48?y|DJ8-^Q!CNX+RY+i)<{9E9m ztNH)jef-QGdHQkOy|TzwR&noi)3)UWhm0NVn}58pQ>DvMwgTJ#=eqcu6K_{%p7E&9c3w@n+IYNV|?(r@ky|ue*=7ZAu>RW|>h3*4ybT;pv`K0IEj@WhQR^6O!ha=0M zbVt|K-O@W7DMgwMTCgBFVOtr>b*)}*xio!6n@5qGAbeL?o3QL@Z)559yt!=?4{YM1 zx`q7-Ytr&V@s_wrclMaZ^3^{rxp#e0>W1Feo73CZoLQM~9d|jiqoyYG@7VnOtra_7 zLwZ}Vy=RY2n0ku7k+OQmrz;9ir=+$RmD~Ki*RZTKY&n@|NZ0)FNt?U1IjU)W!>H_Uob*rTty zsxMD;*JgcIel513Epkq`<>>rz<1=eNs5?@8JQ41EWyEOUT72}!oP!Jh(gB+#i#kXw GUiBZ;`8Zkt literal 0 HcmV?d00001 diff --git a/solr/webapp/web/js/main.js b/solr/webapp/web/js/main.js index 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.js index 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 '
  • Overview
  • ' + "\n" + '
  • Analysis
  • ' + "\n" + - '
  • Config
  • ' + "\n" + '
  • Dataimport
  • ' + "\n" + '
  • Documents
  • ' + "\n" + '
  • Files
  • ' + "\n" + @@ -372,7 +371,6 @@ var solr_admin = function( app_config ) '
  • Plugins / Stats
  • ' + "\n" + '
  • Query
  • ' + "\n" + '
  • Replication
  • ' + "\n" + - '
  • Schema
  • ' + "\n" + '
  • Schema Browser
  • ' ) .show(); diff --git a/solr/webapp/web/js/scripts/file.js b/solr/webapp/web/js/scripts/file.js deleted file mode 100644 index 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( '
    Loading ...
    ' ); - }, - complete : function( xhr, text_status ) - { - var code = $( - '
    ' +
    -                xhr.responseText.esc() +
    -                '
    ' - ); - this.html( code ); - - if( 'success' === text_status ) - { - hljs.highlightBlock( code.get(0) ); - } - } - } - ); - } - ); - } -); \ No newline at end of file diff --git a/solr/webapp/web/js/scripts/files.js b/solr/webapp/web/js/scripts/files.js index 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( '' + + xhr.responseText.esc() + + '' + ); + $( '.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 file diff --git a/solr/webapp/web/tpl/file.html b/solr/webapp/web/tpl/file.html deleted file mode 100755 index 25fa03dcf87..00000000000 --- a/solr/webapp/web/tpl/file.html +++ /dev/null @@ -1,23 +0,0 @@ - -
    - - - -
    - -
    \ No newline at end of file diff --git a/solr/webapp/web/tpl/files.html b/solr/webapp/web/tpl/files.html index 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.
    - +
    -

    The requested file does (not yet) exist. Save file or Upload new file will create it.

    + -
    - - +
    + + + -
    -
    - +
    -
    +
    - +
    Loading …
    -
    - -
    +
    -
    +
    + +

    The requested file does (not yet) exist. Save file or Upload new file will create it.

    + +
    + + + +
    + +
    + +
    + +
    + + + +
    + +
    + +
    + +