mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1) Fixed an issue where the Save button is enabled by default in Macro. Fixes #5905
2) Remove extra line after Manage Macros menu while clearing all macros. Fixes #5906 3) Ensure that 'Clear All Rows' should not work if there is no existing macro available and the user does not specify any value. Fixes #5907 4) Fixed an issue where the server is disconnected error message displayed if the user creates Macro with invalid SQL. Fixes #5929
This commit is contained in:
committed by
Akshay Joshi
parent
b3ca172f3a
commit
9bee91b6f6
@@ -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 = {
|
||||
<a class="dropdown-item" id="btn-manage-macros" href="#" tabindex="0">
|
||||
<span> ${gettext('Manage Macros...')} </span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="dropdown-divider"></li>`;
|
||||
</li>`;
|
||||
|
||||
let macro_list_tmpl = '';
|
||||
_.each(macros, function(m) {
|
||||
if (m.name) {
|
||||
str += `<li>
|
||||
macro_list_tmpl += `<li>
|
||||
<a class="dropdown-item btn-macro" data-macro-id="${m.id}" href="#" tabindex="0">
|
||||
<span> ${_.escape(m.name)} </span>
|
||||
<span> (${m.key_label}) </span>
|
||||
@@ -285,6 +288,7 @@ let MacroDialog = {
|
||||
}
|
||||
});
|
||||
|
||||
if (macro_list_tmpl.length > 0) str += '<li class="dropdown-divider"></li>' + macro_list_tmpl;
|
||||
$($.find('div.btn-group.mr-1.user_macros ul.dropdown-menu')).html($(str));
|
||||
|
||||
self.close(); // Close the dialog now
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user