mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Add an option to request confirmation before cancelling changes on a Properties dialog. Fixes #4315
This commit is contained in:
committed by
Dave Page
parent
7408b8c8d9
commit
c25034a86d
@@ -1535,6 +1535,39 @@ define('pgadmin.browser.node', [
|
||||
onEdit = editInNewPanel.bind(panel);
|
||||
}
|
||||
if (panel.closeable()) {
|
||||
panel.on(wcDocker.EVENT.CLOSING, function() {
|
||||
var j = this.$container.find('.obj_properties').first(),
|
||||
view = j && j.data('obj-view'),
|
||||
self = this;
|
||||
|
||||
let confirm_on_properties_close = pgBrowser.get_preferences_for_module('browser').confirm_on_properties_close;
|
||||
if (view && view.model && confirm_on_properties_close) {
|
||||
if(view.model.sessChanged()){
|
||||
Alertify.confirm(
|
||||
gettext('Warning'),
|
||||
gettext('Changes will be lost. Are you sure you want to close the dialog?'),
|
||||
function() {
|
||||
setTimeout(function(){
|
||||
self.off(wcDocker.EVENT.CLOSING);
|
||||
self.close();
|
||||
}, 50);
|
||||
return true;
|
||||
},
|
||||
function() {
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('Yes'),
|
||||
cancel: gettext('No'),
|
||||
}).show();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}.bind(panel));
|
||||
|
||||
var onCloseFunc = function() {
|
||||
var j = this.$container.find('.obj_properties').first(),
|
||||
view = j && j.data('obj-view');
|
||||
|
||||
Reference in New Issue
Block a user