public inbox for [email protected]  
help / color / mirror / Atom feed
From: Surinder Kumar <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: Listing of files/folders not sorted alphabetically in Storage Manager
Date: Fri, 7 Oct 2016 13:18:41 +0530
Message-ID: <CAM5-9D8sNyL=Y0DMmM5gPCvYhy0dPiyxjjqddwZEgAoPhWG3kw@mail.gmail.com> (raw)
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-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+'">';


view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin4][Patch]: Listing of files/folders not sorted alphabetically in Storage Manager
  In-Reply-To: <CAM5-9D8sNyL=Y0DMmM5gPCvYhy0dPiyxjjqddwZEgAoPhWG3kw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox