mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-17 16:34:44 -05: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
|
// Return if event is fired from child element
|
||||||
if (event.target !== context) return;
|
if (event.target !== context) return;
|
||||||
if (view && view.model && view.model.sessChanged()) {
|
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;
|
break;
|
||||||
case keyCode.F1:
|
case keyCode.F1:
|
||||||
@@ -1161,20 +1164,25 @@ define(
|
|||||||
iframe.openURL(that.dialogHelp);
|
iframe.openURL(that.dialogHelp);
|
||||||
}.bind(panel),
|
}.bind(panel),
|
||||||
|
|
||||||
onSave = function(view) {
|
onSave = function(view, saveBtn) {
|
||||||
var m = view.model,
|
var m = view.model,
|
||||||
d = m.toJSON(true),
|
d = m.toJSON(true),
|
||||||
|
|
||||||
// Generate a timer for the request
|
// Generate a timer for the request
|
||||||
timer = setTimeout(function(){
|
timer = setTimeout(function(){
|
||||||
$('.obj_properties').addClass('show_progress');
|
$('.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)) {
|
if (d && !_.isEmpty(d)) {
|
||||||
m.save({}, {
|
m.save({}, {
|
||||||
attrs: d,
|
attrs: d,
|
||||||
validate: false,
|
validate: false,
|
||||||
cache: false,
|
cache: false,
|
||||||
|
wait: true,
|
||||||
success: function() {
|
success: function() {
|
||||||
onSaveFunc.call();
|
onSaveFunc.call();
|
||||||
// Hide progress cursor
|
// Hide progress cursor
|
||||||
@@ -1209,6 +1217,8 @@ define(
|
|||||||
// Hide progress cursor
|
// Hide progress cursor
|
||||||
$('.obj_properties').removeClass('show_progress');
|
$('.obj_properties').removeClass('show_progress');
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
|
if(saveBtn)
|
||||||
|
$(saveBtn).prop('disabled', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1307,7 +1317,7 @@ define(
|
|||||||
register: function(btn) {
|
register: function(btn) {
|
||||||
// Save the changes
|
// Save the changes
|
||||||
btn.click(function() {
|
btn.click(function() {
|
||||||
onSave.call(this, view);
|
onSave.call(this, view, btn);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
|
|||||||
Reference in New Issue
Block a user