public inbox for [email protected]
help / color / mirror / Atom feedFrom: Aditya Toshniwal <[email protected]>
To: Dave Page <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin][RM4351] Confirm before close of properties dialog if changes not saved
Date: Wed, 30 Oct 2019 10:09:50 +0530
Message-ID: <CAM9w-_mByKngJX_tX2ED8JHgaEFXRpMuyZMTX5d=ww4DKZ2qow@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxozd=s4vL5w8yCH2oF_ZF0mrUY3n24oCLpwSsNgfU9t7aw@mail.gmail.com>
References: <CAM9w-_mq7LEmQGZiruSjNAkGnTGtXRAF+h6eM7syD4KF+0ovHQ@mail.gmail.com>
<CA+OCxozYJ8RQEBnfE3r-zAxccwY05F6CExocNsKs82w-7Y=pRQ@mail.gmail.com>
<CA+OCxozd=s4vL5w8yCH2oF_ZF0mrUY3n24oCLpwSsNgfU9t7aw@mail.gmail.com>
Hi,
On Tue, Oct 29, 2019 at 9:01 PM Dave Page <[email protected]> wrote:
> Hi
>
> I just found an, umm, embarrassing issue with this. It asks for the cancel
> confirmation even when pressing the OK button :-o
>
Tested all but missed the obvious. Bad miss :/
Attached is the patch to fix the issue.
>
> Can you fix that ASAP please?
>
> On Tue, Oct 29, 2019 at 2:35 PM Dave Page <[email protected]> wrote:
>
>> Thanks, applied.
>>
>> On Tue, Oct 29, 2019 at 6:40 AM Aditya Toshniwal <
>> [email protected]> wrote:
>>
>>> Hi Hackers,
>>>
>>> Attached is the patch to warn the user before closing an unsaved
>>> properties dialog.
>>> Additionally, I have added a preference option in Browser->Display where
>>> the user can disable this. Default is enabled.
>>> Docs updated.
>>>
>>> Kindly review.
>>>
>>> --
>>> Thanks and Regards,
>>> Aditya Toshniwal
>>> Sr. Software Engineer | EnterpriseDB India | Pune
>>> "Don't Complain about Heat, Plant a TREE"
>>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
--
Thanks and Regards,
Aditya Toshniwal
Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
Attachments:
[application/octet-stream] RM4351.part2.patch (2.7K, 3-RM4351.part2.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js
index 559caeffb..292d60c0d 100644
--- a/web/pgadmin/browser/static/js/node.js
+++ b/web/pgadmin/browser/static/js/node.js
@@ -1033,7 +1033,8 @@ define('pgadmin.browser.node', [
j = panel.$container.find('.obj_properties').first(),
view = j.data('obj-view'),
content = $('<div tabindex="1"></div>')
- .addClass('pg-prop-content col-12');
+ .addClass('pg-prop-content col-12'),
+ confirm_close = true;
// Handle key press events for Cancel, save and help button
var handleKeyDown = function(event, context) {
@@ -1042,7 +1043,7 @@ define('pgadmin.browser.node', [
switch (event.which) {
case keyCode.ESCAPE:
- closePanel();
+ closePanel(true);
break;
case keyCode.ENTER:
// Return if event is fired from child element
@@ -1400,7 +1401,7 @@ define('pgadmin.browser.node', [
btn.on('click',() => {
// Removing the action-mode
panel.$container.removeAttr('action-mode');
- onCancelFunc.call(arguments);
+ onCancelFunc.call(true);
});
},
}, {
@@ -1455,7 +1456,10 @@ define('pgadmin.browser.node', [
// Show contents before buttons
j.prepend(content);
}.bind(panel),
- closePanel = function() {
+ closePanel = function(confirm_close_flag) {
+ if(!_.isUndefined(confirm_close_flag)) {
+ confirm_close = confirm_close_flag;
+ }
// Closing this panel
this.close();
}.bind(panel),
@@ -1484,7 +1488,7 @@ define('pgadmin.browser.node', [
},
}
);
- closePanel();
+ closePanel(false);
},
saveNewNode = function(that) {
var panel = this,
@@ -1503,7 +1507,7 @@ define('pgadmin.browser.node', [
} catch (e) {
console.warn(e.stack || e);
}
- closePanel();
+ closePanel(false);
}.bind(panel, that),
editInNewPanel = function() {
// Open edit in separate panel
@@ -1541,7 +1545,7 @@ define('pgadmin.browser.node', [
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 (confirm_on_properties_close && confirm_close && view && view.model) {
if(view.model.sessChanged()){
Alertify.confirm(
gettext('Warning'),
view thread (10+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: [pgAdmin][RM4351] Confirm before close of properties dialog if changes not saved
In-Reply-To: <CAM9w-_mByKngJX_tX2ED8JHgaEFXRpMuyZMTX5d=ww4DKZ2qow@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox