diff --git a/docs/en_US/release_notes_6_0.rst b/docs/en_US/release_notes_6_0.rst index d384739fd..baaa8301b 100644 --- a/docs/en_US/release_notes_6_0.rst +++ b/docs/en_US/release_notes_6_0.rst @@ -33,3 +33,4 @@ Bug fixes | `Issue #6736 `_ - Fixed an issue where Refresh view options are not working for materialized view. | `Issue #6755 `_ - Fixed keyerror issue in schema diff for 'attnum' and 'edit_types' parameter. | `Issue #6759 `_ - Ensure that RLS names should not be editable in the collection node of properties tab. +| `Issue #6834 `_ - Ensure that SQL help should work for EPAS servers. diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py index 084fb178a..79d08fac9 100644 --- a/web/pgadmin/browser/__init__.py +++ b/web/pgadmin/browser/__init__.py @@ -796,9 +796,6 @@ def utils(): pg_help_path_pref = prefs.preference('pg_help_path') pg_help_path = pg_help_path_pref.get() - edbas_help_path_pref = prefs.preference('edbas_help_path') - edbas_help_path = edbas_help_path_pref.get() - # Get sqleditor options prefs = Preferences.module('sqleditor') @@ -837,7 +834,6 @@ def utils(): layout=layout, jssnippets=snippets, pg_help_path=pg_help_path, - edbas_help_path=edbas_help_path, editor_tab_size=editor_tab_size, editor_use_spaces=editor_use_spaces, editor_wrap_code=editor_wrap_code, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/static/js/package.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/static/js/package.js index 811a76745..bf55a6dff 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/static/js/package.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/static/js/package.js @@ -36,6 +36,7 @@ define('pgadmin.node.package', [ if (!pgBrowser.Nodes['package']) { pgBrowser.Nodes['package'] = schemaChild.SchemaChildNode.extend({ type: 'package', + epasHelp: true, dialogHelp: url_for('help.static', {'filename': 'package_dialog.html'}), label: gettext('Package'), collection_type: 'coll-package', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js index 5fd3b3283..31755af80 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js @@ -33,6 +33,7 @@ define('pgadmin.node.synonym', [ if (!pgBrowser.Nodes['synonym']) { pgAdmin.Browser.Nodes['synonym'] = schemaChild.SchemaChildNode.extend({ type: 'synonym', + epasHelp: true, dialogHelp: url_for('help.static', {'filename': 'synonym_dialog.html'}), label: gettext('Synonym'), collection_type: 'coll-synonym', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js index cac03d252..2a095bcc2 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js @@ -42,8 +42,7 @@ define('pgadmin.node.compound_trigger', [ hasSQL: true, hasDepends: true, width: pgBrowser.stdW.sm + 'px', - sqlAlterHelp: 'sql-altertcompoundtrigger.html', - sqlCreateHelp: 'sql-createcompoundtrigger.html', + epasHelp: true, dialogHelp: url_for('help.static', {'filename': 'compound_trigger_dialog.html'}), url_jump_after_node: 'schema', Init: function() { diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js b/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js index 95a53b03a..cf9bb4a70 100644 --- a/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js +++ b/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js @@ -32,6 +32,7 @@ define('pgadmin.node.resource_group', [ pgBrowser.Nodes['resource_group'] = pgBrowser.Node.extend({ parent_type: 'server', type: 'resource_group', + epasHelp: true, dialogHelp: url_for('help.static', {'filename': 'resource_group_dialog.html'}), label: gettext('Resource Group'), hasSQL: true, diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index dfbbfe67d..108dc4d86 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -854,11 +854,7 @@ define('pgadmin.browser', [ // Construct the URL var server = pgBrowser.tree.getTreeNodeHierarchy(item).server; var baseUrl = pgBrowser.utils.pg_help_path; - if (server.server_type == 'ppas') { - baseUrl = pgBrowser.utils.edbas_help_path; - } - - var fullUrl = help.getHelpUrl(baseUrl, url, server.version, server.server_type); + var fullUrl = help.getHelpUrl(baseUrl, url, server.version); 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 16dc4f97e..411397384 100644 --- a/web/pgadmin/browser/static/js/node.js +++ b/web/pgadmin/browser/static/js/node.js @@ -92,6 +92,7 @@ define('pgadmin.browser.node', [ sqlAlterHelp: '', sqlCreateHelp: '', dialogHelp: '', + epasHelp: false, title: function(o, d) { return o.label + (d ? (' - ' + d.label) : ''); @@ -1265,7 +1266,7 @@ define('pgadmin.browser.node', [ tooltip: gettext('SQL help for this object type.'), extraClasses: ['btn-primary-icon', 'btn-primary-icon', 'm-1'], icon: 'fa fa-info', - disabled: (that.sqlAlterHelp == '' && that.sqlCreateHelp == '') ? true : false, + disabled: (that.sqlAlterHelp == '' && that.sqlCreateHelp == '' && !that.epasHelp) ? true : false, register: function(btn) { btn.on('click',() => { onSqlHelp(); @@ -1281,20 +1282,21 @@ define('pgadmin.browser.node', [ var server = pgBrowser.tree.getTreeNodeHierarchy(item).server; var url = pgBrowser.utils.pg_help_path; - if (server.server_type == 'ppas') { - url = pgBrowser.utils.edbas_help_path; - } - var fullUrl = ''; - if (that.sqlCreateHelp == '' && that.sqlAlterHelp != '') { - 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, server.server_type); + + if (server.server_type == 'ppas' && that.epasHelp) { + fullUrl = help.getEPASHelpUrl(server.version); } else { - if (view.model.isNew()) { - fullUrl = help.getHelpUrl(url, that.sqlCreateHelp, server.version, server.server_type); + if (that.sqlCreateHelp == '' && that.sqlAlterHelp != '') { + fullUrl = help.getHelpUrl(url, that.sqlAlterHelp, server.version); + } else if (that.sqlCreateHelp != '' && that.sqlAlterHelp == '') { + fullUrl = help.getHelpUrl(url, that.sqlCreateHelp, server.version); } else { - fullUrl = help.getHelpUrl(url, that.sqlAlterHelp, server.version, server.server_type); + if (view.model.isNew()) { + fullUrl = help.getHelpUrl(url, that.sqlCreateHelp, server.version); + } else { + fullUrl = help.getHelpUrl(url, that.sqlAlterHelp, server.version); + } } } @@ -1558,7 +1560,7 @@ define('pgadmin.browser.node', [ tooltip: gettext('SQL help for this object type.'), extraClasses: ['btn-primary-icon', 'pull-left', 'mx-1'], icon: 'fa fa-info', - disabled: (that.sqlAlterHelp == '' && that.sqlCreateHelp == '') ? true : false, + disabled: (that.sqlAlterHelp == '' && that.sqlCreateHelp == '' && !that.epasHelp) ? true : false, register: function(btn) { btn.on('click',() => { onSqlHelp(); diff --git a/web/pgadmin/browser/static/js/node_view.jsx b/web/pgadmin/browser/static/js/node_view.jsx index c94928689..f9063c0e7 100644 --- a/web/pgadmin/browser/static/js/node_view.jsx +++ b/web/pgadmin/browser/static/js/node_view.jsx @@ -12,7 +12,7 @@ import ReactDOM from 'react-dom'; import pgAdmin from 'sources/pgadmin'; import getApiInstance from 'sources/api_instance'; -import {getHelpUrl} from 'pgadmin.help'; +import {getHelpUrl, getEPASHelpUrl} from 'pgadmin.help'; import SchemaView from 'sources/SchemaView'; import { generateNodeUrl } from './node_ajax'; import Alertify from 'pgadmin.alertifyjs'; @@ -96,20 +96,21 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo if(isSqlHelp) { let server = treeNodeInfo.server; let url = pgAdmin.Browser.utils.pg_help_path; - if (server.server_type == 'ppas') { - url = pgAdmin.Browser.utils.edbas_help_path; - } - let fullUrl = ''; - if (nodeObj.sqlCreateHelp == '' && nodeObj.sqlAlterHelp != '') { - fullUrl = getHelpUrl(url, nodeObj.sqlAlterHelp, server.version, server.server_type); - } else if (nodeObj.sqlCreateHelp != '' && nodeObj.sqlAlterHelp == '') { - fullUrl = getHelpUrl(url, nodeObj.sqlCreateHelp, server.version, server.server_type); + + if (server.server_type == 'ppas' && nodeObj.epasHelp) { + fullUrl = getEPASHelpUrl(server.version); } else { - if (isNew) { - fullUrl = getHelpUrl(url, nodeObj.sqlCreateHelp, server.version, server.server_type); + if (nodeObj.sqlCreateHelp == '' && nodeObj.sqlAlterHelp != '') { + fullUrl = getHelpUrl(url, nodeObj.sqlAlterHelp, server.version); + } else if (nodeObj.sqlCreateHelp != '' && nodeObj.sqlAlterHelp == '') { + fullUrl = getHelpUrl(url, nodeObj.sqlCreateHelp, server.version); } else { - fullUrl = getHelpUrl(url, nodeObj.sqlAlterHelp, server.version, server.server_type); + if (isNew) { + fullUrl = getHelpUrl(url, nodeObj.sqlCreateHelp, server.version); + } else { + fullUrl = getHelpUrl(url, nodeObj.sqlAlterHelp, server.version); + } } } @@ -195,7 +196,7 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo confirmOnCloseReset={confirmOnCloseReset} hasSQL={nodeObj.hasSQL && (actionType === 'create' || actionType === 'edit')} getSQLValue={getSQLValue} - disableSqlHelp={nodeObj.sqlAlterHelp == '' && nodeObj.sqlCreateHelp == ''} + disableSqlHelp={nodeObj.sqlAlterHelp == '' && nodeObj.sqlCreateHelp == '' && !nodeObj.epasHelp} disableDialogHelp={nodeObj.dialogHelp == undefined || nodeObj.dialogHelp == ''} />, container); } diff --git a/web/pgadmin/browser/templates/browser/js/utils.js b/web/pgadmin/browser/templates/browser/js/utils.js index eb62bb8b0..7c80f9229 100644 --- a/web/pgadmin/browser/templates/browser/js/utils.js +++ b/web/pgadmin/browser/templates/browser/js/utils.js @@ -70,7 +70,6 @@ define('pgadmin.browser.utils', pgBrowser.utils = { layout: '{{ layout }}', pg_help_path: '{{ pg_help_path }}', - edbas_help_path: '{{ edbas_help_path }}', tabSize: '{{ editor_tab_size }}', wrapCode: '{{ editor_wrap_code }}' == 'True', useSpaces: '{{ editor_use_spaces }}', diff --git a/web/pgadmin/help/__init__.py b/web/pgadmin/help/__init__.py index a0106ad41..ea4ea17f6 100644 --- a/web/pgadmin/help/__init__.py +++ b/web/pgadmin/help/__init__.py @@ -63,18 +63,6 @@ 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/edb-docs/d/postgresql/reference/' - 'manual/$VERSION$/', - category_label=gettext('Help'), - help_str=gettext( - 'Path to the EDB Advanced Server documentation. $VERSION$ ' - 'will be replaced with the major.minor version number.' - ) - ) - def get_exposed_url_endpoints(self): """ Returns the list of URLs exposed to the client. diff --git a/web/pgadmin/help/static/js/help.js b/web/pgadmin/help/static/js/help.js index 6e457f80c..e67d1dc3b 100644 --- a/web/pgadmin/help/static/js/help.js +++ b/web/pgadmin/help/static/js/help.js @@ -7,17 +7,13 @@ // ////////////////////////////////////////////////////////////////////////// -export function getHelpUrl(base_path, file, version, server_type) { +export function getHelpUrl(base_path, file, version) { var major = Math.floor(version / 10000), minor = Math.floor(version / 100) - (major * 100), - subminor = version - ((major * 10000) + (minor * 100)), url = '', replace_string = 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) { + if (major >= 10) { // Handle the version number format change in PG 10+ replace_string = major; } @@ -30,3 +26,21 @@ export function getHelpUrl(base_path, file, version, server_type) { return url + file; } + +export function getEPASHelpUrl(version) { + var major = Math.floor(version / 10000), + minor = Math.floor(version / 100) - (major * 100), + epasHelp11Plus = 'https://www.enterprisedb.com/docs/epas/$VERSION$/epas_compat_sql/', + epasHelp = 'https://www.enterprisedb.com/docs/epas/$VERSION$/', + url = ''; + + url = epasHelp11Plus.replace('$VERSION$', major); + + if (major == 10) { + url = epasHelp.replace('$VERSION$', major); + } else if (major < 10) { + url = epasHelp.replace('$VERSION$', major + '.' + minor); + } + + return url; +} diff --git a/web/regression/javascript/help/help_spec.js b/web/regression/javascript/help/help_spec.js index b82fe6406..5415f252d 100644 --- a/web/regression/javascript/help/help_spec.js +++ b/web/regression/javascript/help/help_spec.js @@ -51,45 +51,5 @@ describe('Test help functions', function() { 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/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/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 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 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'); - }); }); });