You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kr...@apache.org on 2020/10/19 13:46:51 UTC

[lucene-solr] branch branch_8_7 updated: SOLR-14549: Fix listing of Files in a Directory on Solr Admin UI

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch branch_8_7
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8_7 by this push:
     new d5531e9  SOLR-14549: Fix listing of Files in a Directory on Solr Admin UI
d5531e9 is described below

commit d5531e9b7f98a535bf952fabc4f5c07ffbfe6406
Author: Kevin Risden <kr...@apache.org>
AuthorDate: Thu Oct 15 16:00:11 2020 -0400

    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
---
 solr/CHANGES.txt                                 |   2 ++
 solr/NOTICE.txt                                  |   2 +-
 solr/webapp/web/css/angular/jstree.style.min.css |   2 +-
 solr/webapp/web/img/jstree/32px.png              | Bin 5667 -> 5660 bytes
 solr/webapp/web/img/jstree/40px.png              | Bin 2218 -> 2215 bytes
 solr/webapp/web/img/jstree/throbber.gif          | Bin 1464 -> 1464 bytes
 solr/webapp/web/js/angular/app.js                |   7 ++++++-
 solr/webapp/web/js/angular/controllers/files.js  |  14 +++++++-------
 solr/webapp/web/libs/jstree.min.js               |  12 ++++++------
 9 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 11917d6..15d61ba 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -270,6 +270,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
 ---------------------
 
diff --git a/solr/NOTICE.txt b/solr/NOTICE.txt
index f5d6fcc..087e79f 100644
--- a/solr/NOTICE.txt
+++ b/solr/NOTICE.txt
@@ -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
diff --git a/solr/webapp/web/css/angular/jstree.style.min.css b/solr/webapp/web/css/angular/jstree.style.min.css
index 831148b..e4afd3b 100644
--- a/solr/webapp/web/css/angular/jstree.style.min.css
+++ b/solr/webapp/web/css/angular/jstree.style.min.css
@@ -21,4 +21,4 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 
 */
-.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:black;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:n [...]
+.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:black;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:n [...]
diff --git a/solr/webapp/web/img/jstree/32px.png b/solr/webapp/web/img/jstree/32px.png
index 4357b91..ca6af20 100644
Binary files a/solr/webapp/web/img/jstree/32px.png and b/solr/webapp/web/img/jstree/32px.png differ
diff --git a/solr/webapp/web/img/jstree/40px.png b/solr/webapp/web/img/jstree/40px.png
index d025522..2a3fcb9 100644
Binary files a/solr/webapp/web/img/jstree/40px.png and b/solr/webapp/web/img/jstree/40px.png differ
diff --git a/solr/webapp/web/img/jstree/throbber.gif b/solr/webapp/web/img/jstree/throbber.gif
index 64c8eeb..cf06c1a 100644
Binary files a/solr/webapp/web/img/jstree/throbber.gif and b/solr/webapp/web/img/jstree/throbber.gif differ
diff --git a/solr/webapp/web/js/angular/app.js b/solr/webapp/web/js/angular/app.js
index 7e6150c..d2db740 100644
--- a/solr/webapp/web/js/angular/app.js
+++ b/solr/webapp/web/js/angular/app.js
@@ -335,12 +335,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) {
diff --git a/solr/webapp/web/js/angular/controllers/files.js b/solr/webapp/web/js/angular/controllers/files.js
index c81fce9..76f7dd3 100644
--- a/solr/webapp/web/js/angular/controllers/files.js
+++ b/solr/webapp/web/js/angular/controllers/files.js
@@ -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] || '';
diff --git a/solr/webapp/web/libs/jstree.min.js b/solr/webapp/web/libs/jstree.min.js
index 7135471..1ae101e 100644
--- a/solr/webapp/web/libs/jstree.min.js
+++ b/solr/webapp/web/libs/jstree.min.js
@@ -21,9 +21,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 
 */
-/*! jsTree - v3.3.8 - 2019-04-29 - (MIT) */
-!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a,b){"use strict";if(!a.jstree){var c=0,d=!1,e=!1,f=!1,g=[],h=a("script:last").attr("src"),i=window.document;a.jstree={version:"3.3.8",defaults:{plugins:[]},plugins:{},path:h&&-1!==h.indexOf("/")?h.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},a.jstree.create=functi [...]
-if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=e),l.li_attr.id||(l.li_attr.id=l.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(l.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,g=a.children.length;g>f;f++)h=this._parse_model_from_json(a.children[f],l.id,d),i=j[h],l.children.push(h),i.children_d.length&&(l.children_d=l.children_d.concat(i.children_d));l.children_d=l.children.concat(l.children_d)}return a&&a.children& [...]
-is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id,old_instance:s,new_instance:this}),m.id},cut:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g);return c.length?(d=c,f=this,e="move_node",void this.trigger("cut",{node:b})):!1},copy:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var  [...]
-d.icon&&(e+=-1!==d.icon.indexOf("/")||-1!==d.icon.indexOf(".")?" style='background:url(\""+d.icon+"\") center center no-repeat' ":" class='"+d.icon+"' "),e+="></i><span class='vakata-contextmenu-sep'>&#160;</span>"),e+=(a.isFunction(d.label)?d.label({item:b,reference:c.reference,element:c.element}):d.label)+(d.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+d.shortcut+'">'+(d.shortcut_label||"")+"</span>":"")+"</a>",d.submenu&&(g=a.vakata.context._parse( [...]
-c&&c.no_id&&(delete j[f].id,j[f].li_attr&&j[f].li_attr.id&&delete j[f].li_attr.id,j[f].a_attr&&j[f].a_attr.id&&delete j[f].a_attr.id);else j.type=j.id&&h[j.id]&&h[j.id].type?h[j.id].type:"default",c&&c.no_id&&(j=this._delete_ids(j));return j},this._delete_ids=function(b){if(a.isArray(b)){for(var c=0,d=b.length;d>c;c++)b[c]=this._delete_ids(b[c]);return b}return delete b.id,b.li_attr&&b.li_attr.id&&delete b.li_attr.id,b.a_attr&&b.a_attr.id&&delete b.a_attr.id,b.children&&a.isArray(b.child [...]
+/*! jsTree - v3.3.10 - 2020-06-16 - (MIT) */
+!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a,b){"use strict";if(!a.jstree){var c=0,d=!1,e=!1,f=!1,g=[],h=a("script:last").attr("src"),i=window.document,j=window.setImmediate,k=window.Promise;!j&&k&&(j=function(a,b){k.resolve(b).then(a)}),a.jstree={version:"3.3.10",defaults:{plugins:[]},plugins:{},path:h&&-1!==h.indexOf("/")?h.replace(/\/[^\/]+$/,"") [...]
+if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(l.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(l.li_attr[f]=a.li_attr[f]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=e),l.li_attr.id||(l.li_attr.id=l.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(l.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,g=a.children.length;g>f;f++)h=this [...]
+!p)return!1;for(m=this.get_node(p),c&&c.state&&c.state.loaded===!1&&(m.state.loaded=!1),l=[],l.push(p),l=l.concat(m.children_d),this.trigger("model",{nodes:l,parent:r.id}),n=0,o=r.parents.length;o>n;n++)this._model.data[r.parents[n]].children_d=this._model.data[r.parents[n]].children_d.concat(l);for(l=[],n=0,o=r.children.length;o>n;n++)l[n>=e?n+1:n]=r.children[n];return l[e]=m.id,r.children=l,r.children_d.push(m.id),r.children_d=r.children_d.concat(m.children_d),r.id===a.jstree.root&&(th [...]
+item:b,reference:c.reference,element:c.element}))&&b.action?b.action.call(null,{item:b,reference:c.reference,element:c.element,position:{x:c.position_x,y:c.position_y}}):!1},_parse:function(b,d){if(!b)return!1;d||(c.html="",c.items=[]);var e="",f=!1,g;return d&&(e+="<ul>"),a.each(b,function(b,d){return d?(c.items.push(d),!f&&d.separator_before&&(e+="<li class='vakata-context-separator'><a href='#' "+(a.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>"),f=!1, [...]
+e[f[h]].type=j,e[f[h]].icon===!0&&g[j].icon!==b&&(e[f[h]].icon=g[j].icon),g[j].li_attr!==b&&"object"==typeof g[j].li_attr)for(k in g[j].li_attr)if(g[j].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].li_attr[k]===b?e[f[h]].li_attr[k]=g[j].li_attr[k]:"class"===k&&(e[f[h]].li_attr["class"]=g[j].li_attr["class"]+" "+e[f[h]].li_attr["class"])}if(g[j].a_attr!==b&&"object"==typeof g[j].a_attr)for(k in g[j].a_attr)if(g[j].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].a_attr[k]= [...]