public inbox for [email protected]help / color / mirror / Atom feed
[pgAdmin4][Patch]: Listing of files/folders not sorted alphabetically in Storage Manager 4+ messages / 2 participants [nested] [flat]
* [pgAdmin4][Patch]: Listing of files/folders not sorted alphabetically in Storage Manager @ 2016-10-07 07:48 Surinder Kumar <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Surinder Kumar @ 2016-10-07 07:48 UTC (permalink / raw) To: pgadmin-hackers Hi, *Issues fixed:* 1) Listing of files/folders not sorted alphabetically. 2) Some file names are truncated despite the fact that there is plenty of room to be displayed. *Not Fixed:* In Table mode, clicking on Name bar makes no difference. As discussed with Ashesh we are not implementing it now. It requires a lot of changes with current implementation. Please find attached patch and review. Thanks, Surinder Kumar -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM1792.patch (3.2K, 3-RM1792.patch) download | inline diff: diff --git a/web/pgadmin/misc/file_manager/__init__.py b/web/pgadmin/misc/file_manager/__init__.py index e262208..c52a5ba 100644 --- a/web/pgadmin/misc/file_manager/__init__.py +++ b/web/pgadmin/misc/file_manager/__init__.py @@ -441,7 +441,12 @@ class Filemanager(object): orig_path = unquote(orig_path) try: - for f in sorted(os.listdir(orig_path)): + def custom_sort(x, y): + return y.lower() > x.lower() + + mylist = [x for x in sorted(os.listdir(orig_path), + cmp=custom_sort)] + for f in mylist: protected = 0 system_path = os.path.join(os.path.join(orig_path, f)) diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js index 8d891fd..3acd2ff 100755 --- a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js +++ b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js @@ -236,7 +236,7 @@ var setUploader = function(path) { // template for creating new folder folder_div = - "<li class='cap_downloadcap_deletecap_select_filecap_select_foldercap_renamecap_createcap_upload'>" + + "<li class='cap_download cap_delete cap_select_file cap_select_folder cap_rename cap_create cap_upload'>" + "<div class='clip'><span data-alt='' class='fa fa-folder-open fm_folder'></span></div>" + "<p><input type='text' class='fm_file_rename'><span title=''>New_Folder</span></p>" + "<span class='meta size'></span><span class='meta created'></span><span class='meta modified'></span></li>"; @@ -686,7 +686,9 @@ var getFolderInfo = function(path, file_type) { if (!_.isEmpty(data)) { if ($('.fileinfo').data('view') == 'grid') { result += '<ul id="contents" class="grid">'; - Object.keys(data).forEach(function (key) { + Object.keys(data).sort(function keyOrder(x, y) { + return (x.toLowerCase() > y.toLowerCase()); + }).forEach(function (key) { var props = (data[key]).Properties, cap_classes = ""; @@ -760,7 +762,9 @@ var getFolderInfo = function(path, file_type) { result += '<span>' + lg.modified + '</span></th></tr></thead>'; result += '<tbody>'; - Object.keys(data).forEach(function (key) { + Object.keys(data).sort(function keyOrder(x, y) { + return (x.toLowerCase() > y.toLowerCase()); + }).forEach(function (key) { var path = encodeURI((data[key]).Path), props = (data[key]).Properties, cap_classes = "", cap, class_type; @@ -787,8 +791,8 @@ var getFolderInfo = function(path, file_type) { result += '<tr class="' + cap_classes + '">'; var fm_filename = (data[key]).Filename; - if (fm_filename.length > 15 ) { - fm_filename = (data[key]).Filename.substr(0, 10) +'...'; + if (fm_filename.length > 48) { + fm_filename = (data[key]).Filename.substr(0, 48) +'...'; } result += '<td title="' + path + '" class="'+class_type+'">'; ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgAdmin4][Patch]: Listing of files/folders not sorted alphabetically in Storage Manager @ 2016-10-07 11:40 Dave Page <[email protected]> parent: Surinder Kumar <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Dave Page @ 2016-10-07 11:40 UTC (permalink / raw) To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers Hi The patch fixes the filename length issue, but does not seem to resolve the sorting. Please see the attached screenshot. On Fri, Oct 7, 2016 at 8:48 AM, Surinder Kumar <[email protected]> wrote: > Hi, > > Issues fixed: > 1) Listing of files/folders not sorted alphabetically. > 2) Some file names are truncated despite the fact that there is plenty of > room to be displayed. > > Not Fixed: > In Table mode, clicking on Name bar makes no difference. > As discussed with Ashesh we are not implementing it now. It requires a lot > of changes with current implementation. > > Please find attached patch and review. > > Thanks, > Surinder Kumar > > > -- > Sent via pgadmin-hackers mailing list ([email protected]) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgadmin-hackers > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [image/png] Screen Shot 2016-10-07 at 12.38.50.png (99.5K, 2-Screen%20Shot%202016-10-07%20at%2012.38.50.png) download | view image ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgAdmin4][Patch]: Listing of files/folders not sorted alphabetically in Storage Manager @ 2016-10-17 07:32 Surinder Kumar <[email protected]> parent: Dave Page <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Surinder Kumar @ 2016-10-17 07:32 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers Hi Dave, As we have already been using natural sort in pgAdmin4 for sorting browser tree nodes. So I have used the same for sorting Storage Manager's filesystem. Please find updated patch and let me know for comments. On Fri, Oct 7, 2016 at 5:10 PM, Dave Page <[email protected]> wrote: > Hi > > The patch fixes the filename length issue, but does not seem to > resolve the sorting. Please see the attached screenshot. > > On Fri, Oct 7, 2016 at 8:48 AM, Surinder Kumar > <[email protected]> wrote: > > Hi, > > > > Issues fixed: > > 1) Listing of files/folders not sorted alphabetically. > > 2) Some file names are truncated despite the fact that there is plenty of > > room to be displayed. > > > > Not Fixed: > > In Table mode, clicking on Name bar makes no difference. > > As discussed with Ashesh we are not implementing it now. It requires a > lot > > of changes with current implementation. > > > > Please find attached patch and review. > > > > Thanks, > > Surinder Kumar > > > > > > -- > > Sent via pgadmin-hackers mailing list ([email protected]) > > To make changes to your subscription: > > http://www.postgresql.org/mailpref/pgadmin-hackers > > > > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM1792_v1.patch (3.9K, 3-RM1792_v1.patch) download | inline diff: diff --git a/web/pgadmin/misc/file_manager/__init__.py b/web/pgadmin/misc/file_manager/__init__.py index e262208..5c6a908 100644 --- a/web/pgadmin/misc/file_manager/__init__.py +++ b/web/pgadmin/misc/file_manager/__init__.py @@ -415,7 +415,7 @@ class Filemanager(object): except: drive_size = 0 protected = 1 if drive_size == 0 else 0 - files[drive] = { + files[file_name] = { "Filename": file_name, "Path": path, "file_type": 'drive', @@ -441,7 +441,12 @@ class Filemanager(object): orig_path = unquote(orig_path) try: - for f in sorted(os.listdir(orig_path)): + def custom_sort(x, y): + return y.lower() > x.lower() + + mylist = [x for x in sorted(os.listdir(orig_path), + cmp=custom_sort)] + for f in mylist: protected = 0 system_path = os.path.join(os.path.join(orig_path, f)) @@ -474,7 +479,7 @@ class Filemanager(object): continue # create a list of files and folders - files[user_path] = { + files[f] = { "Filename": f, "Path": user_path, "file_type": file_extension, diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js index 1bf7cd6..f1a5ef4 100755 --- a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js +++ b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js @@ -236,7 +236,7 @@ var setUploader = function(path) { // template for creating new folder folder_div = - "<li class='cap_downloadcap_deletecap_select_filecap_select_foldercap_renamecap_createcap_upload'>" + + "<li class='cap_download cap_delete cap_select_file cap_select_folder cap_rename cap_create cap_upload'>" + "<div class='clip'><span data-alt='' class='fa fa-folder-open fm_folder'></span></div>" + "<p><input type='text' class='fm_file_rename'><span title=''>New_Folder</span></p>" + "<span class='meta size'></span><span class='meta created'></span><span class='meta modified'></span></li>"; @@ -686,7 +686,9 @@ var getFolderInfo = function(path, file_type) { if (!_.isEmpty(data)) { if ($('.fileinfo').data('view') == 'grid') { result += '<ul id="contents" class="grid">'; - Object.keys(data).forEach(function (key) { + Object.keys(data).sort(function keyOrder(x, y) { + return pgAdmin.natural_sort(x.toLowerCase(), y.toLowerCase()); + }).forEach(function (key) { var props = (data[key]).Properties, cap_classes = ""; @@ -760,7 +762,9 @@ var getFolderInfo = function(path, file_type) { result += '<span>' + lg.modified + '</span></th></tr></thead>'; result += '<tbody>'; - Object.keys(data).forEach(function (key) { + Object.keys(data).sort(function keyOrder(x, y) { + return pgAdmin.natural_sort(x.toLowerCase(), y.toLowerCase()); + }).forEach(function (key) { var path = encodeURI((data[key]).Path), props = (data[key]).Properties, cap_classes = "", cap, class_type; @@ -787,8 +791,8 @@ var getFolderInfo = function(path, file_type) { result += '<tr class="' + cap_classes + '">'; var fm_filename = (data[key]).Filename; - if (fm_filename.length > 15 ) { - fm_filename = (data[key]).Filename.substr(0, 10) +'...'; + if (fm_filename.length > 48) { + fm_filename = (data[key]).Filename.substr(0, 48) +'...'; } result += '<td title="' + path + '" class="'+class_type+'">'; ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgAdmin4][Patch]: Listing of files/folders not sorted alphabetically in Storage Manager @ 2016-10-18 10:40 Dave Page <[email protected]> parent: Surinder Kumar <[email protected]> 0 siblings, 0 replies; 4+ messages in thread From: Dave Page @ 2016-10-18 10:40 UTC (permalink / raw) To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers Thanks, applied. On Mon, Oct 17, 2016 at 8:32 AM, Surinder Kumar <[email protected]> wrote: > Hi Dave, > > As we have already been using natural sort in pgAdmin4 for sorting browser > tree nodes. So I have used the same for sorting Storage Manager's > filesystem. > Please find updated patch and let me know for comments. > > On Fri, Oct 7, 2016 at 5:10 PM, Dave Page <[email protected]> wrote: >> >> Hi >> >> The patch fixes the filename length issue, but does not seem to >> resolve the sorting. Please see the attached screenshot. >> >> On Fri, Oct 7, 2016 at 8:48 AM, Surinder Kumar >> <[email protected]> wrote: >> > Hi, >> > >> > Issues fixed: >> > 1) Listing of files/folders not sorted alphabetically. >> > 2) Some file names are truncated despite the fact that there is plenty >> > of >> > room to be displayed. >> > >> > Not Fixed: >> > In Table mode, clicking on Name bar makes no difference. >> > As discussed with Ashesh we are not implementing it now. It requires a >> > lot >> > of changes with current implementation. >> > >> > Please find attached patch and review. >> > >> > Thanks, >> > Surinder Kumar >> > >> > >> > -- >> > Sent via pgadmin-hackers mailing list ([email protected]) >> > To make changes to your subscription: >> > http://www.postgresql.org/mailpref/pgadmin-hackers >> > >> >> >> >> -- >> Dave Page >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake >> >> EnterpriseDB UK: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company > > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2016-10-18 10:40 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-10-07 07:48 [pgAdmin4][Patch]: Listing of files/folders not sorted alphabetically in Storage Manager Surinder Kumar <[email protected]> 2016-10-07 11:40 ` Dave Page <[email protected]> 2016-10-17 07:32 ` Surinder Kumar <[email protected]> 2016-10-18 10:40 ` Dave Page <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox