diff --git a/docs/en_US/release_notes_4_22.rst b/docs/en_US/release_notes_4_22.rst index b2442742a..0305aca11 100644 --- a/docs/en_US/release_notes_4_22.rst +++ b/docs/en_US/release_notes_4_22.rst @@ -29,6 +29,7 @@ Bug fixes | `Issue #3694 `_ - Gracefully informed the user that the database is already connected when they click on "Connect Database...". | `Issue #4033 `_ - Fixed an issue where clicking on the cross button of the alert box on the login page is not working. +| `Issue #4099 `_ - Fixed the SQL help issue for EDB Postgres Advanced Server. | `Issue #4223 `_ - Ensure that maintenance job should be worked properly for indexes under a materialized view. | `Issue #4279 `_ - Ensure that file browse "home" button should point to $HOME rather than /. | `Issue #4840 `_ - Ensure that 'With OID' option should be disabled while taking backup of database server version 12 and above. diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py index 9266cdbcf..9f62a2c23 100644 --- a/web/pgadmin/browser/server_groups/servers/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/__init__.py @@ -866,7 +866,10 @@ class ServerNode(PGChildNodeView): connected=connected, server_type=manager.server_type if manager and manager.server_type - else 'pg' + else 'pg', + version=manager.version + if manager and manager.version + else None ) ) diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index f0518a49a..2a96396fd 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -860,7 +860,7 @@ define('pgadmin.browser', [ baseUrl = pgBrowser.utils.edbas_help_path; } - var fullUrl = help.getHelpUrl(baseUrl, url, server.version); + var fullUrl = help.getHelpUrl(baseUrl, url, server.version, server.server_type); window.open(fullUrl, 'postgres_help'); } else if(type == 'dialog_help') { diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js index 5211a8078..f3a927efa 100644 --- a/web/pgadmin/browser/static/js/node.js +++ b/web/pgadmin/browser/static/js/node.js @@ -1257,14 +1257,14 @@ define('pgadmin.browser.node', [ var fullUrl = ''; if (that.sqlCreateHelp == '' && that.sqlAlterHelp != '') { - fullUrl = help.getHelpUrl(url, that.sqlAlterHelp, server.version); + fullUrl = help.getHelpUrl(url, that.sqlAlterHelp, server.version, server.server_type); } else if (that.sqlCreateHelp != '' && that.sqlAlterHelp == '') { - fullUrl = help.getHelpUrl(url, that.sqlCreateHelp, server.version); + fullUrl = help.getHelpUrl(url, that.sqlCreateHelp, server.version, server.server_type); } else { if (view.model.isNew()) { - fullUrl = help.getHelpUrl(url, that.sqlCreateHelp, server.version); + fullUrl = help.getHelpUrl(url, that.sqlCreateHelp, server.version, server.server_type); } else { - fullUrl = help.getHelpUrl(url, that.sqlAlterHelp, server.version); + fullUrl = help.getHelpUrl(url, that.sqlAlterHelp, server.version, server.server_type); } } diff --git a/web/pgadmin/help/__init__.py b/web/pgadmin/help/__init__.py index 1cc7a5a92..9520ef3fa 100644 --- a/web/pgadmin/help/__init__.py +++ b/web/pgadmin/help/__init__.py @@ -66,7 +66,8 @@ class HelpModule(PgAdminModule): self.edbas_help_path = self.help_preference.register( 'help', 'edbas_help_path', gettext("EDB Advanced Server Help Path"), 'text', - 'https://www.enterprisedb.com/docs/en/$VERSION$/pg/', + 'https://www.enterprisedb.com/edb-docs/d/postgresql/reference/' + 'manual/$VERSION$/', category_label=gettext('Help'), help_str=gettext( 'Path to the EDB Advanced Server documentation. $VERSION$ ' diff --git a/web/pgadmin/help/static/js/help.js b/web/pgadmin/help/static/js/help.js index 02ad06c07..816fbf461 100644 --- a/web/pgadmin/help/static/js/help.js +++ b/web/pgadmin/help/static/js/help.js @@ -7,18 +7,23 @@ // ////////////////////////////////////////////////////////////////////////// -export function getHelpUrl(base_path, file, version) { +export function getHelpUrl(base_path, file, version, server_type) { var major = Math.floor(version / 10000), minor = Math.floor(version / 100) - (major * 100), - url = ''; + subminor = version - ((major * 10000) + (minor * 100)), + url = '', + replace_string = major + '.' + minor; - // Handle the version number format change in PG 10+ - if (major >= 10) { - url = base_path.replace('$VERSION$', major); - } else { - url = base_path.replace('$VERSION$', major + '.' + minor); + // Handle the version number format change in EPAS 9.6 and below + if (server_type == 'ppas' && major < 10) { + replace_string = major + '.' + minor + '.' + subminor; + } else if (server_type == 'pg' && major >= 10) { + // Handle the version number format change in PG 10+ + replace_string = major; } + url = base_path.replace('$VERSION$', replace_string); + if (url.substr(-1) != '/') { url = url + '/'; } diff --git a/web/regression/javascript/help/help_spec.js b/web/regression/javascript/help/help_spec.js index b22125c69..65b1b3302 100644 --- a/web/regression/javascript/help/help_spec.js +++ b/web/regression/javascript/help/help_spec.js @@ -14,43 +14,82 @@ describe('Test help functions', function() { // PG 9.6 docs it('it should be able to return a correct URL for PG 9.6 docs with a trailing slash', function() { - expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$/', 'index.html', 90600)).toEqual('https://www.postgresql.org/docs/9.6/index.html'); + expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$/', 'index.html', 90600, 'pg')).toEqual('https://www.postgresql.org/docs/9.6/index.html'); }); // PG 10 docs it('it should be able to return a correct URL for PG 10 docs with a trailing slash', function() { - expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$/', 'index.html', 100000)).toEqual('https://www.postgresql.org/docs/10/index.html'); + expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$/', 'index.html', 100000, 'pg')).toEqual('https://www.postgresql.org/docs/10/index.html'); + }); + + // PG 11 docs + it('it should be able to return a correct URL for PG 11 docs with a trailing slash', function() { + expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$/', 'index.html', 110000, 'pg')).toEqual('https://www.postgresql.org/docs/11/index.html'); + }); + + // PG 12 docs + it('it should be able to return a correct URL for PG 12 docs with a trailing slash', function() { + expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$/', 'index.html', 120000, 'pg')).toEqual('https://www.postgresql.org/docs/12/index.html'); }); // PG 9.6 docs it('it should be able to return a correct URL for PG 9.6 docs without a trailing slash', function() { - expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$', 'index.html', 90600)).toEqual('https://www.postgresql.org/docs/9.6/index.html'); + expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$', 'index.html', 90600, 'pg')).toEqual('https://www.postgresql.org/docs/9.6/index.html'); }); // PG 10 docs it('it should be able to return a correct URL for PG 10 docs without a trailing slash', function() { - expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$', 'index.html', 100000)).toEqual('https://www.postgresql.org/docs/10/index.html'); + expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$', 'index.html', 100000, 'pg')).toEqual('https://www.postgresql.org/docs/10/index.html'); + }); + + // PG 11 docs + it('it should be able to return a correct URL for PG 11 docs without a trailing slash', function() { + expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$', 'index.html', 110500, 'pg')).toEqual('https://www.postgresql.org/docs/11/index.html'); + }); + + // PG 12 docs + it('it should be able to return a correct URL for PG 12 docs without a trailing slash', function() { + expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$', 'index.html', 121000, 'pg')).toEqual('https://www.postgresql.org/docs/12/index.html'); }); // EPAS 9.6 docs it('it should be able to return a correct URL for EPAS 9.6 docs with a trailing slash', function() { - expect(getHelpUrl('https://www.enterprisedb.com/docs/en/$VERSION$/pg/', 'index.html', 90600)).toEqual('https://www.enterprisedb.com/docs/en/9.6/pg/index.html'); + expect(getHelpUrl('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/$VERSION$/', 'index.html', 90600, 'ppas')).toEqual('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/9.6.0/index.html'); }); // EPAS 10 docs it('it should be able to return a correct URL for EPAS 10 docs with a trailing slash', function() { - expect(getHelpUrl('https://www.enterprisedb.com/docs/en/$VERSION$/pg/', 'index.html', 100000)).toEqual('https://www.enterprisedb.com/docs/en/10/pg/index.html'); + expect(getHelpUrl('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/$VERSION$/', 'index.html', 100000, 'ppas')).toEqual('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/10.0/index.html'); }); - // EPAS 9.6 docs - it('it should be able to return a correct URL for EPAS 9.6 docs without a trailing slash', function() { - expect(getHelpUrl('https://www.enterprisedb.com/docs/en/$VERSION$/pg', 'index.html', 90600)).toEqual('https://www.enterprisedb.com/docs/en/9.6/pg/index.html'); + // EPAS 11 docs + it('it should be able to return a correct URL for EPAS 11 docs with a trailing slash', function() { + expect(getHelpUrl('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/$VERSION$/', 'index.html', 110000, 'ppas')).toEqual('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/11.0/index.html'); }); - // EPAS 10 docs - it('it should be able to return a correct URL for EPAS 10 docs without a trailing slash', function() { - expect(getHelpUrl('https://www.enterprisedb.com/docs/en/$VERSION$/pg', 'index.html', 100000)).toEqual('https://www.enterprisedb.com/docs/en/10/pg/index.html'); + // EPAS 12 docs + it('it should be able to return a correct URL for EPAS 12 docs with a trailing slash', function() { + expect(getHelpUrl('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/$VERSION$/', 'index.html', 120000, 'ppas')).toEqual('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/12.0/index.html'); }); + // EPAS 9.6.15 docs + it('it should be able to return a correct URL for EPAS 9.6.15 docs without a trailing slash', function() { + expect(getHelpUrl('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/$VERSION$', 'index.html', 90615, 'ppas')).toEqual('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/9.6.15/index.html'); + }); + + // EPAS 10.13 docs + it('it should be able to return a correct URL for EPAS 10.13 docs without a trailing slash', function() { + expect(getHelpUrl('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/$VERSION$', 'index.html', 101300, 'ppas')).toEqual('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/10.13/index.html'); + }); + + // EPAS 11.5 docs + it('it should be able to return a correct URL for EPAS 11.5 docs without a trailing slash', function() { + expect(getHelpUrl('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/$VERSION$', 'index.html', 110500, 'ppas')).toEqual('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/11.5/index.html'); + }); + + // EPAS 12.3 docs + it('it should be able to return a correct URL for EPAS 12.3 docs without a trailing slash', function() { + expect(getHelpUrl('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/$VERSION$', 'index.html', 120300, 'ppas')).toEqual('https://www.enterprisedb.com/edb-docs/d/postgresql/reference/manual/12.3/index.html'); + }); }); });