Ensure that columns should be displayed in the order of creation instead of alphabetical order in the browser tree. Fixes #6882

This commit is contained in:
Khushboo Vashi 2021-10-12 14:37:06 +05:30 committed by Akshay Joshi
parent 2ced82c7b3
commit ca40add29b
2 changed files with 15 additions and 0 deletions

View File

@ -22,3 +22,4 @@ Bug fixes
| `Issue #6754 <https://redmine.postgresql.org/issues/6754>`_ - Ensure that query highlighting color in the query tool should be less intensive.
| `Issue #6797 <https://redmine.postgresql.org/issues/6797>`_ - Remove an extra blank line at the start of the SQL for function, procedure, and trigger function.
| `Issue #6828 <https://redmine.postgresql.org/issues/6828>`_ - Fixed an issue where the tree is not scrolling to the object selected from the search result.
| `Issue #6882 <https://redmine.postgresql.org/issues/6882>`_ - Ensure that columns should be displayed in the order of creation instead of alphabetical order in the browser tree.

View File

@ -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