Fixed browser tree sort order regression issue. Fixes #6912

This commit is contained in:
Khushboo Vashi 2021-10-16 12:54:44 +05:30 committed by Akshay Joshi
parent 5b411caabe
commit a908ef7c61
2 changed files with 9 additions and 9 deletions

View File

@ -38,3 +38,4 @@ Bug fixes
| `Issue #6900 <https://redmine.postgresql.org/issues/6900>`_ - Fixed an issue where exclusion constraint cannot be created from table dialog if the access method name is changed once. | `Issue #6900 <https://redmine.postgresql.org/issues/6900>`_ - Fixed an issue where exclusion constraint cannot be created from table dialog if the access method name is changed once.
| `Issue #6905 <https://redmine.postgresql.org/issues/6905>`_ - Fixed an issue where the users are unable to load the databases behind an HTTP reverse proxy. | `Issue #6905 <https://redmine.postgresql.org/issues/6905>`_ - Fixed an issue where the users are unable to load the databases behind an HTTP reverse proxy.
| `Issue #6908 <https://redmine.postgresql.org/issues/6908>`_ - Fixed an issue where each click to refresh the collection node, the number of objects decreasing by tens or more. | `Issue #6908 <https://redmine.postgresql.org/issues/6908>`_ - Fixed an issue where each click to refresh the collection node, the number of objects decreasing by tens or more.
| `Issue #6912 <https://redmine.postgresql.org/issues/6912>`_ - Fixed browser tree sort order regression issue.

View File

@ -13,8 +13,9 @@ import { FileTreeX, TreeModelX } from 'pgadmin4-tree';
import {Tree} from './tree'; import {Tree} from './tree';
import { IBasicFileSystemHost } from 'react-aspen'; import { IBasicFileSystemHost } from 'react-aspen';
import { ManageTreeNodes } from './tree_nodes' import { ManageTreeNodes } from './tree_nodes';
import { Directory } from 'react-aspen' import { Directory } from 'react-aspen';
import pgAdmin from 'sources/pgadmin';
var initBrowserTree = async (pgBrowser) => { var initBrowserTree = async (pgBrowser) => {
const MOUNT_POINT = '/browser' const MOUNT_POINT = '/browser'
@ -36,13 +37,11 @@ var initBrowserTree = async (pgBrowser) => {
if (a._metadata && a._metadata.data._type == 'column') return 0; if (a._metadata && a._metadata.data._type == 'column') return 0;
// Sort alphabetically // Sort alphabetically
if (a.constructor === b.constructor) { if (a.constructor === b.constructor) {
return a.fileName > b.fileName ? 1 return pgAdmin.natural_sort(a.fileName, b.fileName);
: a.fileName < b.fileName ? -1 }
: 0 return a.constructor === Directory ? -1
} : b.constructor === Directory ? 1
return a.constructor === Directory ? -1 : 0
: b.constructor === Directory ? 1
: 0
}, },
} }