diff --git a/docs/en_US/release_notes_9_3.rst b/docs/en_US/release_notes_9_3.rst index 1ade30d83..b9aece942 100644 --- a/docs/en_US/release_notes_9_3.rst +++ b/docs/en_US/release_notes_9_3.rst @@ -41,4 +41,5 @@ Bug fixes | `Issue #8628 `_ - Change the shortcut for canceling a running query as it conflicts with the shortcut to open a new query tool. | `Issue #8630 `_ - Fixed an issue where filtering on a view caused an error. | `Issue #8632 `_ - Fixed an issue where the query tool went blank when converting history dates to the appropriate locale format. + | `Issue #8636 `_ - Ensure that the server list is alphabetically sorted in the Query Tool/PSQL workspace. | `Issue #8651 `_ - Fixed an issue where the user management tab is not opening in the classic layout. diff --git a/web/pgadmin/browser/static/js/withCheckPermission.js b/web/pgadmin/browser/static/js/withCheckPermission.js index 7f118ef8c..3460c2b83 100644 --- a/web/pgadmin/browser/static/js/withCheckPermission.js +++ b/web/pgadmin/browser/static/js/withCheckPermission.js @@ -14,6 +14,7 @@ import gettext from 'sources/gettext'; export default function withCheckPermission(options, callback) { // Check if the user has permission to access the menu item return ()=>{ + options = options ?? {}; // if the permission are not provided then no restrictions. if(!options.permission || (options.permission && current_user.permissions?.includes(options.permission))) { callback(); diff --git a/web/pgadmin/misc/workspaces/static/js/AdHocConnection.jsx b/web/pgadmin/misc/workspaces/static/js/AdHocConnection.jsx index a42e9d893..7e3ac8546 100644 --- a/web/pgadmin/misc/workspaces/static/js/AdHocConnection.jsx +++ b/web/pgadmin/misc/workspaces/static/js/AdHocConnection.jsx @@ -33,7 +33,7 @@ import { getRandomInt } from '../../../../static/js/utils'; import { useWorkspace } from './WorkspaceProvider'; class AdHocConnectionSchema extends BaseUISchema { - constructor(connectExistingServer, initValues={}) { + constructor(connectExistingServer, pgAdmin, initValues={}) { super({ sid: null, did: null, @@ -58,6 +58,7 @@ class AdHocConnectionSchema extends BaseUISchema { this.dbs = []; this.api = getApiInstance(); this.connectExistingServer = connectExistingServer; + this.pgAdmin = pgAdmin; this.paramSchema = new VariableSchema(getConnectionParameters, null, null, ['name', 'keyword', 'value']); } @@ -84,12 +85,17 @@ class AdHocConnectionSchema extends BaseUISchema { } getServerList() { + let obj = this; if(this.groupedServers?.length != 0) { return Promise.resolve(this.groupedServers); } return new Promise((resolve, reject)=>{ this.api.get(url_for('sqleditor.get_new_connection_servers')) .then(({data: respData})=>{ + // Sort the server list + respData.data.result.server_list.Servers.sort(function (a, b) { + return obj.pgAdmin.natural_sort(a.label, b.label); + }); let groupedOptions = []; _.forIn(respData.data.result.server_list, (v, k)=>{ if(v.length == 0) { @@ -499,7 +505,7 @@ export default function AdHocConnection({mode}) { saveBtnName = gettext('Connect & Open PSQL'); } - let adHocConObj = useMemo(() => new AdHocConnectionSchema(connectExistingServer), []); + let adHocConObj = useMemo(() => new AdHocConnectionSchema(connectExistingServer, pgAdmin), []); useEffect(()=>{ if(currentWorkspace == mode) adHocConObj.refreshServerList();