SOLR-6992: Fix Files UI to show the managed-schema file as well

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1719261 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Varun Thacker 2015-12-11 05:38:38 +00:00
parent 60dca1b4f9
commit 5e03927a8c
4 changed files with 16 additions and 16 deletions

View File

@ -239,6 +239,9 @@ Bug Fixes
* SOLR-8401: Windows start script fails when executed from a different drive.
(Nicolas Gavalda via Erick Erickson)
* SOLR-6992: Fix "Files" UI to show the managed-schema file as well.
(Shawn Heisey, Varun Thacker)
Other Changes
----------------------

View File

@ -275,19 +275,6 @@ public class ShowFileRequestHandler extends RequestHandlerBase
}
return true;
}
// Make sure that if the schema is managed, we don't allow editing. Don't really want to put
// this in the init since we're not entirely sure when the managed schema will get initialized relative to this
// handler.
SolrCore core = req.getCore();
IndexSchema schema = core.getLatestSchema();
if (schema instanceof ManagedIndexSchema) {
String managed = schema.getResourceName();
if (fname.equalsIgnoreCase(managed)) {
return true;
}
}
return false;
}

View File

@ -71,7 +71,12 @@ solrAdminApp.controller('FilesController',
process("", $scope.tree);
if ($scope.file && $scope.file != '' && $scope.file.split('').pop()!='/') {
var extension = $scope.file.match( /\.(\w+)$/)[1] || '';
var extension;
if ($scope.file == "managed-schema") {
extension = contentTypeMap['xml'];
} else {
extension = $scope.file.match( /\.(\w+)$/)[1] || '';
}
var contentType = (contentTypeMap[extension] || 'text/plain' ) + ';charset=utf-8';
Files.get({core: $routeParams.core, file: $scope.file, contentType: contentType}, function(data) {

View File

@ -163,8 +163,13 @@ sammy.get
var endpoint = file_endpoint + '?file=' + selected_file;
var content_type_map = { xml : 'text/xml', html : 'text/html', js : 'text/javascript', json : 'application/json', 'css' : 'text/css' };
var file_ext = selected_file.match( /\.(\w+)$/ );
endpoint += '&contentType=' + ( content_type_map[ file_ext[1] || '' ] || 'text/plain' ) + ';charset=utf-8';
if (selected_file == 'managed-schema') {
endpoint += '&contentType=' + 'text/xml' + ';charset=utf-8';
} else {
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;