SOLR-14549: Fix listing of Files in a Directory on Solr Admin UI

* Ensure that jstree can update data behind the scenes
* Fix file jstree object to represent open/closed correctly
* Upgrade jstree to 3.3.10 for compatibility with JQuery 3.5.x

Closes #1989
This commit is contained in:
Kevin Risden 2020-10-15 16:00:11 -04:00
parent 3bc873e6d4
commit 6ac5747d76
No known key found for this signature in database
GPG Key ID: 040FAE3292C5F73F
9 changed files with 23 additions and 16 deletions

View File

@ -274,6 +274,8 @@ Bug Fixes
* SOLR-14483: Fix empty drop down for adding replica in Admin UI (Sayan Das via Eric Pugh)
* SOLR-14549: Fix listing of Files in a Directory on Solr Admin UI (Kevin Risden)
Other Changes
---------------------

View File

@ -38,7 +38,7 @@ This product includes jquery.form Javascript library created by Mike Alsup
Copyright 2006-2014 (c) M. Alsup, https://github.com/malsup/form/
This product includes the jstree Javascript library created by Ivan Bozhanov
Copyright (c) 2013-2014 Ivan Bozhanov, https://github.com/vakata/jstree
Copyright (c) 2013-2020 Ivan Bozhanov, https://github.com/vakata/jstree
This product includes jquery.timeago.js Javascript library by Ryan McGeary
Copyright (c) 2008-2014, Ryan McGeary, https://github.com/rmm5t/jquery-timeago

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -315,12 +315,17 @@ solrAdminApp.config([
var treeConfig = {
'core' : {
'animation' : 0,
'data': scope.data,
'worker': false
}
};
var tree = $(element).jstree(treeConfig);
// This is done to ensure that the data can be refreshed if it is updated behind the scenes.
// Putting the data in the treeConfig makes it stack and doesn't update.
$(element).jstree(true).settings.core.data = scope.data;
$(element).jstree(true).refresh();
$(element).jstree('open_node','li:first');
if (tree) {
element.bind("select_node.jstree", function (event, data) {

View File

@ -31,9 +31,9 @@ solrAdminApp.controller('FilesController',
var process = function (path, tree) {
var params = {core: $routeParams.core};
if (path.slice(-1) == '/') {
if (path.slice(-1) === '/') {
params.file = path.slice(0, -1);
} else if (path!='') {
} else if (path!=='') {
params.file = path;
}
@ -48,10 +48,10 @@ solrAdminApp.controller('FilesController',
if (filedata.directory) {
file = file + "/";
if ($scope.file && $scope.file.indexOf(path + file) == 0) {
state = "open";
if ($scope.file && $scope.file.indexOf(path + file) === 0) {
state = {"opened": true};
} else {
state = "closed";
state = {"opened": false};
}
children = [];
process(path + file, children);
@ -68,9 +68,9 @@ solrAdminApp.controller('FilesController',
$scope.tree = [];
process("", $scope.tree);
if ($scope.file && $scope.file != '' && $scope.file.split('').pop()!='/') {
if ($scope.file && $scope.file !== '' && $scope.file.split('').pop()!=='/') {
var extension;
if ($scope.file == "managed-schema") {
if ($scope.file === "managed-schema") {
extension = contentTypeMap['xml'];
} else {
extension = $scope.file.match( /\.(\w+)$/)[1] || '';

File diff suppressed because one or more lines are too long