SOLR-9002: Fix type mapping for JSON and text

This is for the Admin UI's collection/File screen
This commit is contained in:
Alexandre Rafalovitch 2016-08-14 08:03:43 +10:00
parent c9faa102f9
commit 97dc5a2a0b
3 changed files with 8 additions and 3 deletions

View File

@ -211,6 +211,9 @@ Bug Fixes
* SOLR-8715: Admin UI's Schema screen now works for fields with stored=false and some content indexed (Alexandre Rafalovitch) * SOLR-8715: Admin UI's Schema screen now works for fields with stored=false and some content indexed (Alexandre Rafalovitch)
* SOLR-8911: In Admin UI, enable scrolling for overflowing Versions and JVM property values * SOLR-8911: In Admin UI, enable scrolling for overflowing Versions and JVM property values
* SOLR-9002: Admin UI now correctly displays json and text files in the collection/Files screen
Optimizations Optimizations
---------------------- ----------------------

View File

@ -16,7 +16,7 @@
*/ */
var contentTypeMap = { xml : 'text/xml', html : 'text/html', js : 'text/javascript', json : 'application/json', 'css' : 'text/css' }; var contentTypeMap = { xml : 'text/xml', html : 'text/html', js : 'text/javascript', json : 'application/json', 'css' : 'text/css' };
var languages = {js: "javascript", xml:"xml", xsl:"xml", vm: "xml", html: "xml", json: "text", css: "css"}; var languages = {js: "javascript", xml:"xml", xsl:"xml", vm: "xml", html: "xml", json: "json", css: "css"};
solrAdminApp.controller('FilesController', solrAdminApp.controller('FilesController',
function($scope, $rootScope, $routeParams, $location, Files, Constants) { function($scope, $rootScope, $routeParams, $location, Files, Constants) {
@ -82,10 +82,10 @@ solrAdminApp.controller('FilesController',
Files.get({core: $routeParams.core, file: $scope.file, contentType: contentType}, function(data) { Files.get({core: $routeParams.core, file: $scope.file, contentType: contentType}, function(data) {
$scope.content = data.data; $scope.content = data.data;
$scope.url = $scope.baseurl + data.config.url + "?" + $.param(data.config.params); $scope.url = $scope.baseurl + data.config.url + "?" + $.param(data.config.params);
if (contentType.indexOf("text/plain") && data.data.indexOf("<?xml") || data.data.indexOf("<!--")) { if (contentType.indexOf("text/plain") && (data.data.indexOf("<?xml")>=0) || data.data.indexOf("<!--")>=0) {
$scope.lang = "xml"; $scope.lang = "xml";
} else { } else {
$scope.lang = languages[extension] || "text"; $scope.lang = languages[extension] || "txt";
} }
}); });
} }

View File

@ -207,6 +207,8 @@ solrAdminServices.factory('System',
"list": {}, "list": {},
"get": {method: "GET", interceptor: { "get": {method: "GET", interceptor: {
response: function(config) {return config;} response: function(config) {return config;}
}, transformResponse: function(data) {
return data;
}} }}
}); });
}]) }])