SOLR-7687 'Files' tab in the new Admin UI doesn't load up

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1687735 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Upayavira 2015-06-26 10:12:07 +00:00
parent 522de68c54
commit 3232d71340
1 changed files with 13 additions and 3 deletions

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", html: "xml", json: "text", css: "css"}; var languages = {js: "javascript", xml:"xml", xsl:"xml", vm: "xml", html: "xml", json: "text", css: "css"};
solrAdminApp.controller('FilesController', solrAdminApp.controller('FilesController',
function($scope, $rootScope, $routeParams, $location, Files) { function($scope, $rootScope, $routeParams, $location, Files) {
@ -30,8 +30,14 @@ solrAdminApp.controller('FilesController',
$scope.refresh = function () { $scope.refresh = function () {
var process = function (path, tree) { var process = function (path, tree) {
var params = {core: $routeParams.core};
if (path.slice(-1) == '/') {
params.file = path.slice(0, -1);
} else if (path!='') {
params.file = path;
}
Files.list({core: $routeParams.core, file: path}, function (data) { Files.list(params, function (data) {
for (var file in data.files) { for (var file in data.files) {
var filedata = data.files[file]; var filedata = data.files[file];
var state = undefined; var state = undefined;
@ -68,7 +74,11 @@ 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);
$scope.lang = languages[extension] || "text"; if (contentType.indexOf("text/plain") && data.data.indexOf("<?xml") || data.data.indexOf("<!--")) {
$scope.lang = "xml";
} else {
$scope.lang = languages[extension] || "text";
}
}); });
} }
}; };