diff --git a/docs/en_US/release_notes_4_30.rst b/docs/en_US/release_notes_4_30.rst index 7874bd7c8..c31a16c1c 100644 --- a/docs/en_US/release_notes_4_30.rst +++ b/docs/en_US/release_notes_4_30.rst @@ -27,6 +27,10 @@ Bug fixes | `Issue #5571 `_ - Added support for expression in exclusion constraints. | `Issue #5829 `_ - Fixed incorrect log information for AUTHENTICATION_SOURCES. | `Issue #5875 `_ - Ensure that the 'template1' database should not be visible after pg_upgrade. +| `Issue #5905 `_ - Fixed an issue where the Save button is enabled by default in Macro. +| `Issue #5906 `_ - Remove extra line after Manage Macros menu while clearing all macros. +| `Issue #5907 `_ - Ensure that 'Clear All Rows' should not work if there is no existing macro available and the user does not specify any value. +| `Issue #5929 `_ - Fixed an issue where the server is disconnected error message displayed if the user creates Macro with invalid SQL. | `Issue #5965 `_ - Ensure that the macro query result should be download properly. | `Issue #5973 `_ - Added appropriate help message and a placeholder for letting users know about the account password expiry for Login/Group Role. | `Issue #5997 `_ - Updated Flask-BabelEx to the latest. diff --git a/tools/dependency_inventory.py b/tools/dependency_inventory.py index 8036f3b79..5128148f3 100644 --- a/tools/dependency_inventory.py +++ b/tools/dependency_inventory.py @@ -182,7 +182,7 @@ def dump_header(): print(textwrap.fill( "pgAdmin 4 is built on C++, Python and Javascript, and is " "dependent on various third party libraries. These are " - "automatically compiled from the system, requirements.txt." + "automatically compiled from the system, requirements.txt " "and packages.json and listed below.", width=79) + "\n") diff --git a/web/pgadmin/static/js/sqleditor/macro.js b/web/pgadmin/static/js/sqleditor/macro.js index c8f9292f3..74c7dab2d 100644 --- a/web/pgadmin/static/js/sqleditor/macro.js +++ b/web/pgadmin/static/js/sqleditor/macro.js @@ -194,6 +194,8 @@ let MacroDialog = { // We got the latest attributes of the object. Render the view // now. $container.append(self.view.render().$el); + self.__internal.buttons[2].element.disabled = true; + // Enable/disable save button and show/hide statusbar based on session self.view.listenTo(self.view.model, 'pgadmin-session:start', function() { @@ -272,11 +274,12 @@ let MacroDialog = { ${gettext('Manage Macros...')} - - `; + `; + + let macro_list_tmpl = ''; _.each(macros, function(m) { if (m.name) { - str += `
  • + macro_list_tmpl += `
  • ${_.escape(m.name)} (${m.key_label}) @@ -285,6 +288,7 @@ let MacroDialog = { } }); + if (macro_list_tmpl.length > 0) str += '
  • ' + macro_list_tmpl; $($.find('div.btn-group.mr-1.user_macros ul.dropdown-menu')).html($(str)); self.close(); // Close the dialog now diff --git a/web/pgadmin/static/js/sqleditor/macro_model.js b/web/pgadmin/static/js/sqleditor/macro_model.js index 4a9351a38..7886e63b7 100644 --- a/web/pgadmin/static/js/sqleditor/macro_model.js +++ b/web/pgadmin/static/js/sqleditor/macro_model.js @@ -126,18 +126,22 @@ export default function macroModel(transId) { var that = this; // We will check if row is deletable or not - Alertify.confirm( - gettext('Clear All Rows'), - gettext('Are you sure you wish to clear all rows?'), - function() { - _.each(that.collection.toJSON(), function(m) { - that.collection.get(m.id).set({'name': null, 'sql': null}); - }); - }, - function() { - return true; - } - ); + let macros = that.collection.toJSON().filter(m => m.name !== undefined && m.name !== null); + + if (macros.length > 0) { + Alertify.confirm( + gettext('Clear All Rows'), + gettext('Are you sure you wish to clear all rows?'), + function() { + _.each(that.collection.toJSON(), function(m) { + that.collection.get(m.id).set({'name': null, 'sql': null}); + }); + }, + function() { + return true; + } + ); + } }, render: function() { this.$el.empty(); diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index b374a53b0..21cb4c880 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -4376,6 +4376,8 @@ define('tools.querytool', [ // Find the next space from the character or end of line var error_line = self.gridView.query_tool_obj.getLine(error_line_no); + + if (_.isUndefined(error_line)) return; end_marker = error_line.indexOf(' ', start_marker); if (end_marker < 0) end_marker = error_line.length;