public inbox for [email protected]  
help / color / mirror / Atom feed
From: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch] - RM #6912 - pgadmin 6.0: browser tree sort order regression
Date: Fri, 15 Oct 2021 16:09:26 +0530
Message-ID: <CAFOhELcFug_1N5m=VSEC4_usYXr145hNXEyph8ip7-RhduVtQw@mail.gmail.com> (raw)

Hi,

Please find the attached patch to fix the RM #6912 - pgadmin 6.0: browser
tree sort order regression.

Thanks,
Khushboo


Attachments:

  [application/octet-stream] RM_6912.patch (1.3K, 3-RM_6912.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/tree/tree_init.tsx b/web/pgadmin/static/js/tree/tree_init.tsx
index a9a6892e3..89a25fe2e 100644
--- a/web/pgadmin/static/js/tree/tree_init.tsx
+++ b/web/pgadmin/static/js/tree/tree_init.tsx
@@ -13,8 +13,9 @@ import { FileTreeX, TreeModelX } from 'pgadmin4-tree';
 import {Tree} from './tree';
 
 import { IBasicFileSystemHost } from 'react-aspen';
-import { ManageTreeNodes } from './tree_nodes'
-import { Directory } from 'react-aspen'
+import { ManageTreeNodes } from './tree_nodes';
+import { Directory } from 'react-aspen';
+import pgAdmin from 'sources/pgadmin';
 
 var initBrowserTree = async (pgBrowser) => {
   const MOUNT_POINT = '/browser'
@@ -36,13 +37,11 @@ var initBrowserTree = async (pgBrowser) => {
       if (a._metadata && a._metadata.data._type == 'column') return 0;
       // Sort alphabetically
       if (a.constructor === b.constructor) {
-        return a.fileName > b.fileName ? 1
-          : a.fileName < b.fileName ? -1
-          : 0
-        }
-        return a.constructor === Directory ? -1
-          : b.constructor === Directory ? 1
-          : 0
+        return pgAdmin.natural_sort(a.fileName, b.fileName);
+      }
+      return a.constructor === Directory ? -1
+        : b.constructor === Directory ? 1
+        : 0
 	},
   }
 


view thread (2+ 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] - RM #6912 - pgadmin 6.0: browser tree sort order regression
  In-Reply-To: <CAFOhELcFug_1N5m=VSEC4_usYXr145hNXEyph8ip7-RhduVtQw@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