mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Prevent multiple connections to new slow-to-respond servers being initiated in error. Fixes #2928
This commit is contained in:
committed by
Dave Page
parent
49dfd6fe31
commit
e21f1e3291
@@ -937,7 +937,10 @@ define(
|
||||
// Return if event is fired from child element
|
||||
if (event.target !== context) return;
|
||||
if (view && view.model && view.model.sessChanged()) {
|
||||
onSave.call(this, view);
|
||||
var btn = $(event.target).closest('.obj_properties')
|
||||
.find('.pg-prop-btn-group')
|
||||
.find('button.btn-primary');
|
||||
onSave.call(this, view, btn);
|
||||
}
|
||||
break;
|
||||
case keyCode.F1:
|
||||
@@ -1161,20 +1164,25 @@ define(
|
||||
iframe.openURL(that.dialogHelp);
|
||||
}.bind(panel),
|
||||
|
||||
onSave = function(view) {
|
||||
onSave = function(view, saveBtn) {
|
||||
var m = view.model,
|
||||
d = m.toJSON(true),
|
||||
|
||||
// Generate a timer for the request
|
||||
timer = setTimeout(function(){
|
||||
$('.obj_properties').addClass('show_progress');
|
||||
}, 1000);
|
||||
}, 1000),
|
||||
saveBtn = saveBtn;
|
||||
|
||||
// Prevent subsequent save operation by disabling Save button
|
||||
if(saveBtn)
|
||||
$(saveBtn).prop('disabled', true);
|
||||
|
||||
if (d && !_.isEmpty(d)) {
|
||||
m.save({}, {
|
||||
attrs: d,
|
||||
validate: false,
|
||||
cache: false,
|
||||
wait: true,
|
||||
success: function() {
|
||||
onSaveFunc.call();
|
||||
// Hide progress cursor
|
||||
@@ -1209,6 +1217,8 @@ define(
|
||||
// Hide progress cursor
|
||||
$('.obj_properties').removeClass('show_progress');
|
||||
clearTimeout(timer);
|
||||
if(saveBtn)
|
||||
$(saveBtn).prop('disabled', false);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1307,7 +1317,7 @@ define(
|
||||
register: function(btn) {
|
||||
// Save the changes
|
||||
btn.click(function() {
|
||||
onSave.call(this, view);
|
||||
onSave.call(this, view, btn);
|
||||
});
|
||||
}
|
||||
},{
|
||||
|
||||
Reference in New Issue
Block a user