public inbox for [email protected]  
help / color / mirror / Atom feed
From: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch] - RM #6882 - Object browser tree table columns display order
Date: Tue, 12 Oct 2021 12:29:56 +0530
Message-ID: <CAFOhELdzO-HZd+no-JOx=+0hen5pwDFfyHiBy3WWWdoOxmQaCg@mail.gmail.com> (raw)

Hi,

Please find the attached patch to fix the RM #6882 - Object browser tree
table columns display order.

Thanks,
Khushboo


Attachments:

  [application/octet-stream] RM_6882.patch (1.1K, 3-RM_6882.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 823428149..999d2b955 100644
--- a/web/pgadmin/static/js/tree/tree_init.tsx
+++ b/web/pgadmin/static/js/tree/tree_init.tsx
@@ -14,6 +14,7 @@ import {Tree} from './tree';
 
 import { IBasicFileSystemHost } from 'react-aspen';
 import { ManageTreeNodes } from './tree_nodes'
+import { Directory } from 'react-aspen'
 
 var initBrowserTree = async (pgBrowser) => {
   const MOUNT_POINT = '/browser'
@@ -30,6 +31,19 @@ var initBrowserTree = async (pgBrowser) => {
       let nodes = await mtree.readNode(path);
       return nodes;
     },
+    sortComparator: (a: FileEntry | Directory, b: FileEntry | Directory) => {
+      // No nee to sort columns
+      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
+	},
   }
 
   // Create Node


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 #6882 - Object browser tree table columns display order
  In-Reply-To: <CAFOhELdzO-HZd+no-JOx=+0hen5pwDFfyHiBy3WWWdoOxmQaCg@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