public inbox for [email protected]help / color / mirror / Atom feed
[pgAdmin4][RM3849] Ask to save unsaved query changes stopped working 11+ messages / 3 participants [nested] [flat]
* [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working @ 2019-01-21 07:54 Aditya Toshniwal <[email protected]> 0 siblings, 1 reply; 11+ messages in thread From: Aditya Toshniwal @ 2019-01-21 07:54 UTC (permalink / raw) To: pgadmin-hackers Hi Hackers, Attached is the patch to throw alert warning when user reloads or closes the browser. Kindly review. -- Thanks and Regards, Aditya Toshniwal Software Engineer | EnterpriseDB Software Solutions | Pune "Don't Complain about Heat, Plant a tree" Attachments: [application/octet-stream] RM3849.patch (5.0K, 3-RM3849.patch) download | inline diff: diff --git a/web/config.py b/web/config.py index 5184b323..f81ee4bf 100644 --- a/web/config.py +++ b/web/config.py @@ -409,6 +409,12 @@ SUPPORT_SSH_TUNNEL = True # Set to False to disable password saving. ALLOW_SAVE_TUNNEL_PASSWORD = False + +########################################################################## +# Disable alert message when pgAdmin is reloaded or browser is closed +########################################################################## +DISABLE_BEFOREUNLOAD_MESSAGE = False + ########################################################################## # Local config settings ########################################################################## diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py index 1649b2bc..2a96810a 100644 --- a/web/pgadmin/__init__.py +++ b/web/pgadmin/__init__.py @@ -190,6 +190,16 @@ def create_app(app_name=None): # change operation so we will open the same password change page again. config.SECURITY_POST_CHANGE_VIEW = 'browser.change_password' + # While running test cases, + # Set SQLITE_PATH to TEST_SQLITE_PATH + # Disable browser reload warning + if ( + 'PGADMIN_TESTING_MODE' in os.environ and + os.environ['PGADMIN_TESTING_MODE'] == '1' + ): + config.SQLITE_PATH = config.TEST_SQLITE_PATH + config.DISABLE_BEFOREUNLOAD_MESSAGE = True + """Create the Flask application, startup logging and dynamically load additional modules (blueprints) that are found in this directory.""" app = PgAdmin(__name__, static_url_path='/static') @@ -214,13 +224,6 @@ def create_app(app_name=None): logger = logging.getLogger('werkzeug') logger.setLevel(logging.INFO) - # Set SQLITE_PATH to TEST_SQLITE_PATH while running test cases - if ( - 'PGADMIN_TESTING_MODE' in os.environ and - os.environ['PGADMIN_TESTING_MODE'] == '1' - ): - config.SQLITE_PATH = config.TEST_SQLITE_PATH - # Ensure the various working directories exist from pgadmin.setup import create_app_data_directory, db_upgrade create_app_data_directory(config) diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py index b77514e6..f34e5455 100644 --- a/web/pgadmin/browser/__init__.py +++ b/web/pgadmin/browser/__init__.py @@ -621,7 +621,8 @@ def utils(): editor_indent_with_tabs=editor_indent_with_tabs, app_name=config.APP_NAME, pg_libpq_version=pg_libpq_version, - support_ssh_tunnel=config.SUPPORT_SSH_TUNNEL + support_ssh_tunnel=config.SUPPORT_SSH_TUNNEL, + disable_beforeunload_message=config.DISABLE_BEFOREUNLOAD_MESSAGE, ), 200, {'Content-Type': 'application/x-javascript'}) diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index cc2ea056..0dc7b5c1 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -1991,10 +1991,17 @@ define('pgadmin.browser', [ pgAdmin.Browser.editor_shortcut_keys.Tab = 'insertSoftTab'; } - $(window).on('beforeunload', function() { + $(window).on('beforeunload', function(e) { let pref = pgBrowser.get_preference('browser', 'browser_tree_state_save_interval'); if (!_.isUndefined(pref) && pref.value !== -1) pgAdmin.Browser.browserTreeState.save_state(); + + if(!pgBrowser.utils.disable_beforeunload_message) { + /* This message will not be displayed in Chrome, Firefox, Safari as they have disabled it*/ + let msg = S(gettext('Are you sure you want to close the %s browser?')).sprintf(pgBrowser.utils.app_name).value(); + e.originalEvent.returnValue = msg; + return msg; + } }); return pgAdmin.Browser; diff --git a/web/pgadmin/browser/templates/browser/js/utils.js b/web/pgadmin/browser/templates/browser/js/utils.js index eac96b14..298c1354 100644 --- a/web/pgadmin/browser/templates/browser/js/utils.js +++ b/web/pgadmin/browser/templates/browser/js/utils.js @@ -36,7 +36,7 @@ define('pgadmin.browser.utils', app_name: '{{ app_name }}', pg_libpq_version: {{pg_libpq_version|e}}, support_ssh_tunnel: '{{ support_ssh_tunnel }}' == 'True', - + disable_beforeunload_message: '{{disable_beforeunload_message}}' == 'True', counter: {total: 0, loaded: 0}, registerScripts: function (ctx) { // There are some scripts which needed to be loaded immediately, diff --git a/web/setup.py b/web/setup.py index 194c1e35..b43bd5c1 100644 --- a/web/setup.py +++ b/web/setup.py @@ -397,9 +397,14 @@ if __name__ == '__main__': args, extra = parser.parse_known_args() config.SETTINGS_SCHEMA_VERSION = SCHEMA_VERSION + + # While running test cases, + # Set SQLITE_PATH to TEST_SQLITE_PATH + # Disable browser reload warning if "PGADMIN_TESTING_MODE" in os.environ and \ os.environ["PGADMIN_TESTING_MODE"] == "1": config.SQLITE_PATH = config.TEST_SQLITE_PATH + config.DISABLE_BEFOREUNLOAD_MESSAGE = True # What to do? if args.dump_servers is not None: ^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working @ 2019-01-22 06:27 Akshay Joshi <[email protected]> parent: Aditya Toshniwal <[email protected]> 0 siblings, 1 reply; 11+ messages in thread From: Akshay Joshi @ 2019-01-22 06:27 UTC (permalink / raw) To: Aditya Toshniwal <[email protected]>; Dave Page <[email protected]>; +Cc: pgadmin-hackers Hi Aditya Below are my review comments: - You have added new config parameter "*DISABLE_BEFOREUNLOAD_MESSAGE*" to make this request configurable, should it be the part of preferences setting instead of configuration? @Dave can you please comment on this. - Name "*DISABLE_BEFOREUNLOAD_MESSAGE"* is not clear as users perspective, can you please change it to some meaningful name. Apart from that code looks good to me. On Mon, Jan 21, 2019 at 1:24 PM Aditya Toshniwal < [email protected]> wrote: > Hi Hackers, > > Attached is the patch to throw alert warning when user reloads or closes > the browser. > > Kindly review. > > -- > Thanks and Regards, > Aditya Toshniwal > Software Engineer | EnterpriseDB Software Solutions | Pune > "Don't Complain about Heat, Plant a tree" > -- *Akshay Joshi* *Sr. Software Architect * *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working @ 2019-01-22 09:31 Dave Page <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 1 reply; 11+ messages in thread From: Dave Page @ 2019-01-22 09:31 UTC (permalink / raw) To: Akshay Joshi <[email protected]>; +Cc: Aditya Toshniwal <[email protected]>; pgadmin-hackers Hi On Tue, Jan 22, 2019 at 6:27 AM Akshay Joshi <[email protected]> wrote: > > Hi Aditya > > Below are my review comments: > > You have added new config parameter "DISABLE_BEFOREUNLOAD_MESSAGE" to make this request configurable, should it be the part of preferences setting instead of configuration? @Dave can you please comment on this. That does seem like something that should be a per-user preference, not a global config option. > Name "DISABLE_BEFOREUNLOAD_MESSAGE" is not clear as users perspective, can you please change it to some meaningful name. > > Apart from that code looks good to me. > > On Mon, Jan 21, 2019 at 1:24 PM Aditya Toshniwal <[email protected]> wrote: >> >> Hi Hackers, >> >> Attached is the patch to throw alert warning when user reloads or closes the browser. >> >> Kindly review. >> >> -- >> Thanks and Regards, >> Aditya Toshniwal >> Software Engineer | EnterpriseDB Software Solutions | Pune >> "Don't Complain about Heat, Plant a tree" > > > > -- > Akshay Joshi > Sr. Software Architect > > > Phone: +91 20-3058-9517 > Mobile: +91 976-788-8246 -- Dave Page VP, Chief Architect, Tools & Installers EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company Blog: http://pgsnake.blogspot.com Twitter: @pgsnake ^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working @ 2019-01-22 11:54 Aditya Toshniwal <[email protected]> parent: Dave Page <[email protected]> 0 siblings, 1 reply; 11+ messages in thread From: Aditya Toshniwal @ 2019-01-22 11:54 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: Akshay Joshi <[email protected]>; pgadmin-hackers Any suggestions on preferences name/desc ? On Tue, Jan 22, 2019 at 3:01 PM Dave Page <[email protected]> wrote: > Hi > > On Tue, Jan 22, 2019 at 6:27 AM Akshay Joshi > <[email protected]> wrote: > > > > Hi Aditya > > > > Below are my review comments: > > > > You have added new config parameter "DISABLE_BEFOREUNLOAD_MESSAGE" to > make this request configurable, should it be the part of preferences > setting instead of configuration? @Dave can you please comment on this. > > That does seem like something that should be a per-user preference, > not a global config option. > > > Name "DISABLE_BEFOREUNLOAD_MESSAGE" is not clear as users perspective, > can you please change it to some meaningful name. > > > > Apart from that code looks good to me. > > > > On Mon, Jan 21, 2019 at 1:24 PM Aditya Toshniwal < > [email protected]> wrote: > >> > >> Hi Hackers, > >> > >> Attached is the patch to throw alert warning when user reloads or > closes the browser. > >> > >> Kindly review. > >> > >> -- > >> Thanks and Regards, > >> Aditya Toshniwal > >> Software Engineer | EnterpriseDB Software Solutions | Pune > >> "Don't Complain about Heat, Plant a tree" > > > > > > > > -- > > Akshay Joshi > > Sr. Software Architect > > > > > > Phone: +91 20-3058-9517 > > Mobile: +91 976-788-8246 > > > > -- > Dave Page > VP, Chief Architect, Tools & Installers > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > -- Thanks and Regards, Aditya Toshniwal Software Engineer | EnterpriseDB Software Solutions | Pune "Don't Complain about Heat, Plant a tree" ^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working @ 2019-01-22 11:57 Dave Page <[email protected]> parent: Aditya Toshniwal <[email protected]> 0 siblings, 1 reply; 11+ messages in thread From: Dave Page @ 2019-01-22 11:57 UTC (permalink / raw) To: Aditya Toshniwal <[email protected]>; +Cc: Akshay Joshi <[email protected]>; pgadmin-hackers On Tue, Jan 22, 2019 at 11:54 AM Aditya Toshniwal <[email protected]> wrote: > > Any suggestions on preferences name/desc ? Name: "Confirm on close" Desc: "Confirm closure of the browser or browser tab is intended before proceeding." > On Tue, Jan 22, 2019 at 3:01 PM Dave Page <[email protected]> wrote: >> >> Hi >> >> On Tue, Jan 22, 2019 at 6:27 AM Akshay Joshi >> <[email protected]> wrote: >> > >> > Hi Aditya >> > >> > Below are my review comments: >> > >> > You have added new config parameter "DISABLE_BEFOREUNLOAD_MESSAGE" to make this request configurable, should it be the part of preferences setting instead of configuration? @Dave can you please comment on this. >> >> That does seem like something that should be a per-user preference, >> not a global config option. >> >> > Name "DISABLE_BEFOREUNLOAD_MESSAGE" is not clear as users perspective, can you please change it to some meaningful name. >> > >> > Apart from that code looks good to me. >> > >> > On Mon, Jan 21, 2019 at 1:24 PM Aditya Toshniwal <[email protected]> wrote: >> >> >> >> Hi Hackers, >> >> >> >> Attached is the patch to throw alert warning when user reloads or closes the browser. >> >> >> >> Kindly review. >> >> >> >> -- >> >> Thanks and Regards, >> >> Aditya Toshniwal >> >> Software Engineer | EnterpriseDB Software Solutions | Pune >> >> "Don't Complain about Heat, Plant a tree" >> > >> > >> > >> > -- >> > Akshay Joshi >> > Sr. Software Architect >> > >> > >> > Phone: +91 20-3058-9517 >> > Mobile: +91 976-788-8246 >> >> >> >> -- >> Dave Page >> VP, Chief Architect, Tools & Installers >> EnterpriseDB: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake > > > > -- > Thanks and Regards, > Aditya Toshniwal > Software Engineer | EnterpriseDB Software Solutions | Pune > "Don't Complain about Heat, Plant a tree" -- Dave Page VP, Chief Architect, Tools & Installers EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company Blog: http://pgsnake.blogspot.com Twitter: @pgsnake ^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working @ 2019-01-22 12:01 Aditya Toshniwal <[email protected]> parent: Dave Page <[email protected]> 0 siblings, 1 reply; 11+ messages in thread From: Aditya Toshniwal @ 2019-01-22 12:01 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: Akshay Joshi <[email protected]>; pgadmin-hackers On Tue, Jan 22, 2019 at 5:27 PM Dave Page <[email protected]> wrote: > On Tue, Jan 22, 2019 at 11:54 AM Aditya Toshniwal > <[email protected]> wrote: > > > > Any suggestions on preferences name/desc ? > > Name: "Confirm on close" > Desc: "Confirm closure of the browser or browser tab is intended > before proceeding." > It also warns on refresh. > > > > On Tue, Jan 22, 2019 at 3:01 PM Dave Page <[email protected]> > wrote: > >> > >> Hi > >> > >> On Tue, Jan 22, 2019 at 6:27 AM Akshay Joshi > >> <[email protected]> wrote: > >> > > >> > Hi Aditya > >> > > >> > Below are my review comments: > >> > > >> > You have added new config parameter "DISABLE_BEFOREUNLOAD_MESSAGE" to > make this request configurable, should it be the part of preferences > setting instead of configuration? @Dave can you please comment on this. > >> > >> That does seem like something that should be a per-user preference, > >> not a global config option. > >> > >> > Name "DISABLE_BEFOREUNLOAD_MESSAGE" is not clear as users > perspective, can you please change it to some meaningful name. > >> > > >> > Apart from that code looks good to me. > >> > > >> > On Mon, Jan 21, 2019 at 1:24 PM Aditya Toshniwal < > [email protected]> wrote: > >> >> > >> >> Hi Hackers, > >> >> > >> >> Attached is the patch to throw alert warning when user reloads or > closes the browser. > >> >> > >> >> Kindly review. > >> >> > >> >> -- > >> >> Thanks and Regards, > >> >> Aditya Toshniwal > >> >> Software Engineer | EnterpriseDB Software Solutions | Pune > >> >> "Don't Complain about Heat, Plant a tree" > >> > > >> > > >> > > >> > -- > >> > Akshay Joshi > >> > Sr. Software Architect > >> > > >> > > >> > Phone: +91 20-3058-9517 > >> > Mobile: +91 976-788-8246 > >> > >> > >> > >> -- > >> Dave Page > >> VP, Chief Architect, Tools & Installers > >> EnterpriseDB: http://www.enterprisedb.com > >> The Enterprise PostgreSQL Company > >> > >> Blog: http://pgsnake.blogspot.com > >> Twitter: @pgsnake > > > > > > > > -- > > Thanks and Regards, > > Aditya Toshniwal > > Software Engineer | EnterpriseDB Software Solutions | Pune > > "Don't Complain about Heat, Plant a tree" > > > > -- > Dave Page > VP, Chief Architect, Tools & Installers > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > -- Thanks and Regards, Aditya Toshniwal Software Engineer | EnterpriseDB Software Solutions | Pune "Don't Complain about Heat, Plant a tree" ^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working @ 2019-01-22 12:08 Dave Page <[email protected]> parent: Aditya Toshniwal <[email protected]> 0 siblings, 1 reply; 11+ messages in thread From: Dave Page @ 2019-01-22 12:08 UTC (permalink / raw) To: Aditya Toshniwal <[email protected]>; +Cc: Akshay Joshi <[email protected]>; pgadmin-hackers On Tue, Jan 22, 2019 at 12:01 PM Aditya Toshniwal <[email protected]> wrote: > > > > On Tue, Jan 22, 2019 at 5:27 PM Dave Page <[email protected]> wrote: >> >> On Tue, Jan 22, 2019 at 11:54 AM Aditya Toshniwal >> <[email protected]> wrote: >> > >> > Any suggestions on preferences name/desc ? >> >> Name: "Confirm on close" >> Desc: "Confirm closure of the browser or browser tab is intended >> before proceeding." > > It also warns on refresh. Name: "Confirm on close or refresh" Desc: "Confirm closure or refresh of the browser or browser tab is intended before proceeding." >> >> >> >> > On Tue, Jan 22, 2019 at 3:01 PM Dave Page <[email protected]> wrote: >> >> >> >> Hi >> >> >> >> On Tue, Jan 22, 2019 at 6:27 AM Akshay Joshi >> >> <[email protected]> wrote: >> >> > >> >> > Hi Aditya >> >> > >> >> > Below are my review comments: >> >> > >> >> > You have added new config parameter "DISABLE_BEFOREUNLOAD_MESSAGE" to make this request configurable, should it be the part of preferences setting instead of configuration? @Dave can you please comment on this. >> >> >> >> That does seem like something that should be a per-user preference, >> >> not a global config option. >> >> >> >> > Name "DISABLE_BEFOREUNLOAD_MESSAGE" is not clear as users perspective, can you please change it to some meaningful name. >> >> > >> >> > Apart from that code looks good to me. >> >> > >> >> > On Mon, Jan 21, 2019 at 1:24 PM Aditya Toshniwal <[email protected]> wrote: >> >> >> >> >> >> Hi Hackers, >> >> >> >> >> >> Attached is the patch to throw alert warning when user reloads or closes the browser. >> >> >> >> >> >> Kindly review. >> >> >> >> >> >> -- >> >> >> Thanks and Regards, >> >> >> Aditya Toshniwal >> >> >> Software Engineer | EnterpriseDB Software Solutions | Pune >> >> >> "Don't Complain about Heat, Plant a tree" >> >> > >> >> > >> >> > >> >> > -- >> >> > Akshay Joshi >> >> > Sr. Software Architect >> >> > >> >> > >> >> > Phone: +91 20-3058-9517 >> >> > Mobile: +91 976-788-8246 >> >> >> >> >> >> >> >> -- >> >> Dave Page >> >> VP, Chief Architect, Tools & Installers >> >> EnterpriseDB: http://www.enterprisedb.com >> >> The Enterprise PostgreSQL Company >> >> >> >> Blog: http://pgsnake.blogspot.com >> >> Twitter: @pgsnake >> > >> > >> > >> > -- >> > Thanks and Regards, >> > Aditya Toshniwal >> > Software Engineer | EnterpriseDB Software Solutions | Pune >> > "Don't Complain about Heat, Plant a tree" >> >> >> >> -- >> Dave Page >> VP, Chief Architect, Tools & Installers >> EnterpriseDB: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake > > > > -- > Thanks and Regards, > Aditya Toshniwal > Software Engineer | EnterpriseDB Software Solutions | Pune > "Don't Complain about Heat, Plant a tree" -- Dave Page VP, Chief Architect, Tools & Installers EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company Blog: http://pgsnake.blogspot.com Twitter: @pgsnake ^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working @ 2019-01-22 12:58 Aditya Toshniwal <[email protected]> parent: Dave Page <[email protected]> 0 siblings, 1 reply; 11+ messages in thread From: Aditya Toshniwal @ 2019-01-22 12:58 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: Akshay Joshi <[email protected]>; pgadmin-hackers Hi Hackers, Attached is the revised patch. The warning occurrence is configurable from Preferences > Browser > Display. Kindly review. On Tue, Jan 22, 2019 at 5:38 PM Dave Page <[email protected]> wrote: > On Tue, Jan 22, 2019 at 12:01 PM Aditya Toshniwal > <[email protected]> wrote: > > > > > > > > On Tue, Jan 22, 2019 at 5:27 PM Dave Page <[email protected]> > wrote: > >> > >> On Tue, Jan 22, 2019 at 11:54 AM Aditya Toshniwal > >> <[email protected]> wrote: > >> > > >> > Any suggestions on preferences name/desc ? > >> > >> Name: "Confirm on close" > >> Desc: "Confirm closure of the browser or browser tab is intended > >> before proceeding." > > > > It also warns on refresh. > > Name: "Confirm on close or refresh" > Desc: "Confirm closure or refresh of the browser or browser tab is > intended before proceeding." > > >> > >> > >> > >> > On Tue, Jan 22, 2019 at 3:01 PM Dave Page <[email protected]> > wrote: > >> >> > >> >> Hi > >> >> > >> >> On Tue, Jan 22, 2019 at 6:27 AM Akshay Joshi > >> >> <[email protected]> wrote: > >> >> > > >> >> > Hi Aditya > >> >> > > >> >> > Below are my review comments: > >> >> > > >> >> > You have added new config parameter "DISABLE_BEFOREUNLOAD_MESSAGE" > to make this request configurable, should it be the part of preferences > setting instead of configuration? @Dave can you please comment on this. > >> >> > >> >> That does seem like something that should be a per-user preference, > >> >> not a global config option. > >> >> > >> >> > Name "DISABLE_BEFOREUNLOAD_MESSAGE" is not clear as users > perspective, can you please change it to some meaningful name. > >> >> > > >> >> > Apart from that code looks good to me. > >> >> > > >> >> > On Mon, Jan 21, 2019 at 1:24 PM Aditya Toshniwal < > [email protected]> wrote: > >> >> >> > >> >> >> Hi Hackers, > >> >> >> > >> >> >> Attached is the patch to throw alert warning when user reloads or > closes the browser. > >> >> >> > >> >> >> Kindly review. > >> >> >> > >> >> >> -- > >> >> >> Thanks and Regards, > >> >> >> Aditya Toshniwal > >> >> >> Software Engineer | EnterpriseDB Software Solutions | Pune > >> >> >> "Don't Complain about Heat, Plant a tree" > >> >> > > >> >> > > >> >> > > >> >> > -- > >> >> > Akshay Joshi > >> >> > Sr. Software Architect > >> >> > > >> >> > > >> >> > Phone: +91 20-3058-9517 > >> >> > Mobile: +91 976-788-8246 > >> >> > >> >> > >> >> > >> >> -- > >> >> Dave Page > >> >> VP, Chief Architect, Tools & Installers > >> >> EnterpriseDB: http://www.enterprisedb.com > >> >> The Enterprise PostgreSQL Company > >> >> > >> >> Blog: http://pgsnake.blogspot.com > >> >> Twitter: @pgsnake > >> > > >> > > >> > > >> > -- > >> > Thanks and Regards, > >> > Aditya Toshniwal > >> > Software Engineer | EnterpriseDB Software Solutions | Pune > >> > "Don't Complain about Heat, Plant a tree" > >> > >> > >> > >> -- > >> Dave Page > >> VP, Chief Architect, Tools & Installers > >> EnterpriseDB: http://www.enterprisedb.com > >> The Enterprise PostgreSQL Company > >> > >> Blog: http://pgsnake.blogspot.com > >> Twitter: @pgsnake > > > > > > > > -- > > Thanks and Regards, > > Aditya Toshniwal > > Software Engineer | EnterpriseDB Software Solutions | Pune > > "Don't Complain about Heat, Plant a tree" > > > > -- > Dave Page > VP, Chief Architect, Tools & Installers > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > -- Thanks and Regards, Aditya Toshniwal Software Engineer | EnterpriseDB Software Solutions | Pune "Don't Complain about Heat, Plant a tree" Attachments: [application/x-patch] RM3849_v2.patch (6.1K, 3-RM3849_v2.patch) download | inline diff: diff --git a/web/pgadmin/browser/register_browser_preferences.py b/web/pgadmin/browser/register_browser_preferences.py index 5bee817e..c7ea8126 100644 --- a/web/pgadmin/browser/register_browser_preferences.py +++ b/web/pgadmin/browser/register_browser_preferences.py @@ -38,6 +38,16 @@ def register_browser_preferences(self): ) ) + self.preference.register( + 'display', 'confirm_on_refresh_close', + gettext("Confirm on close or refresh ?"), 'boolean', + True, category_label=gettext('Display'), + help_str=gettext( + 'Confirm closure or refresh of the browser or browser tab is ' + 'intended before proceeding.' + ) + ) + self.table_row_count_threshold = self.preference.register( 'properties', 'table_row_count_threshold', gettext("Count rows if estimated less than"), 'integer', 2000, diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index cc2ea056..2accd182 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -1991,10 +1991,18 @@ define('pgadmin.browser', [ pgAdmin.Browser.editor_shortcut_keys.Tab = 'insertSoftTab'; } - $(window).on('beforeunload', function() { - let pref = pgBrowser.get_preference('browser', 'browser_tree_state_save_interval'); - if (!_.isUndefined(pref) && pref.value !== -1) + $(window).on('beforeunload', function(e) { + let tree_save_interval = pgBrowser.get_preference('browser', 'browser_tree_state_save_interval'), + confirm_on_refresh_close = pgBrowser.get_preference('browser', 'confirm_on_refresh_close'); + if (!_.isUndefined(tree_save_interval) && tree_save_interval.value !== -1) pgAdmin.Browser.browserTreeState.save_state(); + + if(confirm_on_refresh_close.value) { + /* This message will not be displayed in Chrome, Firefox, Safari as they have disabled it*/ + let msg = S(gettext('Are you sure you want to close the %s browser?')).sprintf(pgBrowser.utils.app_name).value(); + e.originalEvent.returnValue = msg; + return msg; + } }); return pgAdmin.Browser; diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py index b75e18a0..deee7a4f 100644 --- a/web/regression/python_test_utils/test_utils.py +++ b/web/regression/python_test_utils/test_utils.py @@ -649,55 +649,73 @@ def get_db_server(sid): def set_preference(default_binary_path): conn = sqlite3.connect(config.TEST_SQLITE_PATH) cur = conn.cursor() - perf = Preferences.module('paths') - server_types = default_binary_path.keys() + paths_pref = Preferences.module('paths') + server_types = default_binary_path.keys() for server in server_types: - path_pref = perf.preference('{0}_bin_dir'.format(server)) + pref_bin_path = paths_pref.preference('{0}_bin_dir'.format(server)) user_pref = cur.execute( 'SELECT pid, uid FROM user_preferences ' - 'where pid=%s' % path_pref.pid + 'where pid=%s' % pref_bin_path.pid ) user_pref_data = user_pref.fetchone() if user_pref_data: cur.execute( 'UPDATE user_preferences SET value = ? WHERE pid = ?', - (default_binary_path[server], path_pref.pid) + (default_binary_path[server], pref_bin_path.pid) ) else: - params = (path_pref.pid, 1, default_binary_path[server]) + params = (pref_bin_path.pid, 1, default_binary_path[server]) cur.execute( 'INSERT INTO user_preferences(pid, uid, value)' ' VALUES (?,?,?)', params ) - conn.commit() - conn.close() + browser_pref = Preferences.module('browser') + # Disable tree state save for tests + pref_tree_state_save_interval = \ + browser_pref.preference('browser_tree_state_save_interval') -def disable_tree_state_save(): - conn = sqlite3.connect(config.TEST_SQLITE_PATH) - cur = conn.cursor() - pref = Preferences.module('browser')\ - .preference('browser_tree_state_save_interval') + user_pref = cur.execute( + 'SELECT pid, uid FROM user_preferences ' + 'where pid=?', (pref_tree_state_save_interval.pid,) + ) + + if len(user_pref.fetchall()) == 0: + cur.execute( + 'INSERT INTO user_preferences(pid, uid, value)' + ' VALUES (?,?,?)', (pref_tree_state_save_interval.pid, 1, -1) + ) + else: + cur.execute( + 'UPDATE user_preferences' + ' SET VALUE = ?' + ' WHERE PID = ?', (-1, pref_tree_state_save_interval.pid) + ) + + # Disable reload warning on browser + pref_confirm_on_refresh_close = \ + browser_pref.preference('confirm_on_refresh_close') user_pref = cur.execute( 'SELECT pid, uid FROM user_preferences ' - 'where pid=?', (pref.pid,) + 'where pid=?', (pref_confirm_on_refresh_close.pid,) ) if len(user_pref.fetchall()) == 0: cur.execute( 'INSERT INTO user_preferences(pid, uid, value)' - ' VALUES (?,?,?)', (pref.pid, 1, -1) + ' VALUES (?,?,?)', (pref_confirm_on_refresh_close.pid, 1, 'False') ) else: cur.execute( 'UPDATE user_preferences' ' SET VALUE = ?' - ' WHERE PID = ?', (-1, pref.pid) + ' WHERE PID = ?', ('False', pref_confirm_on_refresh_close.pid) ) + conn.commit() conn.close() diff --git a/web/regression/runtests.py b/web/regression/runtests.py index 0284753c..4faf70c6 100644 --- a/web/regression/runtests.py +++ b/web/regression/runtests.py @@ -419,9 +419,6 @@ if __name__ == '__main__': if server['default_binary_paths'] is not None: test_utils.set_preference(server['default_binary_paths']) - # Disable tree state saving - test_utils.disable_tree_state_save() - suite = get_suite(test_module_list, server, test_client, ^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working @ 2019-01-23 05:49 Akshay Joshi <[email protected]> parent: Aditya Toshniwal <[email protected]> 0 siblings, 1 reply; 11+ messages in thread From: Akshay Joshi @ 2019-01-23 05:49 UTC (permalink / raw) To: Aditya Toshniwal <[email protected]>; +Cc: Dave Page <[email protected]>; pgadmin-hackers Hi Aditya Found one issue you have remove the function "*disable_tree_state_save*" from "*web/regression/python_test_utils/test_utils.py*" and move that code into " *set_preference*" function and it is called from " *web/regression/runtests.py*" which is conditional, so please correct that behaviour. On Tue, Jan 22, 2019 at 6:28 PM Aditya Toshniwal < [email protected]> wrote: > Hi Hackers, > > Attached is the revised patch. The warning occurrence is configurable from > Preferences > Browser > Display. > > Kindly review. > > On Tue, Jan 22, 2019 at 5:38 PM Dave Page <[email protected]> > wrote: > >> On Tue, Jan 22, 2019 at 12:01 PM Aditya Toshniwal >> <[email protected]> wrote: >> > >> > >> > >> > On Tue, Jan 22, 2019 at 5:27 PM Dave Page <[email protected]> >> wrote: >> >> >> >> On Tue, Jan 22, 2019 at 11:54 AM Aditya Toshniwal >> >> <[email protected]> wrote: >> >> > >> >> > Any suggestions on preferences name/desc ? >> >> >> >> Name: "Confirm on close" >> >> Desc: "Confirm closure of the browser or browser tab is intended >> >> before proceeding." >> > >> > It also warns on refresh. >> >> Name: "Confirm on close or refresh" >> Desc: "Confirm closure or refresh of the browser or browser tab is >> intended before proceeding." >> >> >> >> >> >> >> >> >> > On Tue, Jan 22, 2019 at 3:01 PM Dave Page < >> [email protected]> wrote: >> >> >> >> >> >> Hi >> >> >> >> >> >> On Tue, Jan 22, 2019 at 6:27 AM Akshay Joshi >> >> >> <[email protected]> wrote: >> >> >> > >> >> >> > Hi Aditya >> >> >> > >> >> >> > Below are my review comments: >> >> >> > >> >> >> > You have added new config parameter >> "DISABLE_BEFOREUNLOAD_MESSAGE" to make this request configurable, should it >> be the part of preferences setting instead of configuration? @Dave can you >> please comment on this. >> >> >> >> >> >> That does seem like something that should be a per-user preference, >> >> >> not a global config option. >> >> >> >> >> >> > Name "DISABLE_BEFOREUNLOAD_MESSAGE" is not clear as users >> perspective, can you please change it to some meaningful name. >> >> >> > >> >> >> > Apart from that code looks good to me. >> >> >> > >> >> >> > On Mon, Jan 21, 2019 at 1:24 PM Aditya Toshniwal < >> [email protected]> wrote: >> >> >> >> >> >> >> >> Hi Hackers, >> >> >> >> >> >> >> >> Attached is the patch to throw alert warning when user reloads >> or closes the browser. >> >> >> >> >> >> >> >> Kindly review. >> >> >> >> >> >> >> >> -- >> >> >> >> Thanks and Regards, >> >> >> >> Aditya Toshniwal >> >> >> >> Software Engineer | EnterpriseDB Software Solutions | Pune >> >> >> >> "Don't Complain about Heat, Plant a tree" >> >> >> > >> >> >> > >> >> >> > >> >> >> > -- >> >> >> > Akshay Joshi >> >> >> > Sr. Software Architect >> >> >> > >> >> >> > >> >> >> > Phone: +91 20-3058-9517 >> >> >> > Mobile: +91 976-788-8246 >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> >> Dave Page >> >> >> VP, Chief Architect, Tools & Installers >> >> >> EnterpriseDB: http://www.enterprisedb.com >> >> >> The Enterprise PostgreSQL Company >> >> >> >> >> >> Blog: http://pgsnake.blogspot.com >> >> >> Twitter: @pgsnake >> >> > >> >> > >> >> > >> >> > -- >> >> > Thanks and Regards, >> >> > Aditya Toshniwal >> >> > Software Engineer | EnterpriseDB Software Solutions | Pune >> >> > "Don't Complain about Heat, Plant a tree" >> >> >> >> >> >> >> >> -- >> >> Dave Page >> >> VP, Chief Architect, Tools & Installers >> >> EnterpriseDB: http://www.enterprisedb.com >> >> The Enterprise PostgreSQL Company >> >> >> >> Blog: http://pgsnake.blogspot.com >> >> Twitter: @pgsnake >> > >> > >> > >> > -- >> > Thanks and Regards, >> > Aditya Toshniwal >> > Software Engineer | EnterpriseDB Software Solutions | Pune >> > "Don't Complain about Heat, Plant a tree" >> >> >> >> -- >> Dave Page >> VP, Chief Architect, Tools & Installers >> EnterpriseDB: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake >> > > > -- > Thanks and Regards, > Aditya Toshniwal > Software Engineer | EnterpriseDB Software Solutions | Pune > "Don't Complain about Heat, Plant a tree" > -- *Akshay Joshi* *Sr. Software Architect * *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working @ 2019-01-23 06:02 Aditya Toshniwal <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 1 reply; 11+ messages in thread From: Aditya Toshniwal @ 2019-01-23 06:02 UTC (permalink / raw) To: Akshay Joshi <[email protected]>; +Cc: Dave Page <[email protected]>; pgadmin-hackers Hi Hackers, PFA revised patch as per review. On Wed, Jan 23, 2019 at 11:20 AM Akshay Joshi <[email protected]> wrote: > Hi Aditya > > Found one issue you have remove the function "*disable_tree_state_save*" from > "*web/regression/python_test_utils/test_utils.py*" and move that code > into "*set_preference*" function and it is called from " > *web/regression/runtests.py*" which is conditional, so please correct > that behaviour. > > On Tue, Jan 22, 2019 at 6:28 PM Aditya Toshniwal < > [email protected]> wrote: > >> Hi Hackers, >> >> Attached is the revised patch. The warning occurrence is configurable >> from Preferences > Browser > Display. >> >> Kindly review. >> >> On Tue, Jan 22, 2019 at 5:38 PM Dave Page <[email protected]> >> wrote: >> >>> On Tue, Jan 22, 2019 at 12:01 PM Aditya Toshniwal >>> <[email protected]> wrote: >>> > >>> > >>> > >>> > On Tue, Jan 22, 2019 at 5:27 PM Dave Page <[email protected]> >>> wrote: >>> >> >>> >> On Tue, Jan 22, 2019 at 11:54 AM Aditya Toshniwal >>> >> <[email protected]> wrote: >>> >> > >>> >> > Any suggestions on preferences name/desc ? >>> >> >>> >> Name: "Confirm on close" >>> >> Desc: "Confirm closure of the browser or browser tab is intended >>> >> before proceeding." >>> > >>> > It also warns on refresh. >>> >>> Name: "Confirm on close or refresh" >>> Desc: "Confirm closure or refresh of the browser or browser tab is >>> intended before proceeding." >>> >>> >> >>> >> >>> >> >>> >> > On Tue, Jan 22, 2019 at 3:01 PM Dave Page < >>> [email protected]> wrote: >>> >> >> >>> >> >> Hi >>> >> >> >>> >> >> On Tue, Jan 22, 2019 at 6:27 AM Akshay Joshi >>> >> >> <[email protected]> wrote: >>> >> >> > >>> >> >> > Hi Aditya >>> >> >> > >>> >> >> > Below are my review comments: >>> >> >> > >>> >> >> > You have added new config parameter >>> "DISABLE_BEFOREUNLOAD_MESSAGE" to make this request configurable, should it >>> be the part of preferences setting instead of configuration? @Dave can you >>> please comment on this. >>> >> >> >>> >> >> That does seem like something that should be a per-user preference, >>> >> >> not a global config option. >>> >> >> >>> >> >> > Name "DISABLE_BEFOREUNLOAD_MESSAGE" is not clear as users >>> perspective, can you please change it to some meaningful name. >>> >> >> > >>> >> >> > Apart from that code looks good to me. >>> >> >> > >>> >> >> > On Mon, Jan 21, 2019 at 1:24 PM Aditya Toshniwal < >>> [email protected]> wrote: >>> >> >> >> >>> >> >> >> Hi Hackers, >>> >> >> >> >>> >> >> >> Attached is the patch to throw alert warning when user reloads >>> or closes the browser. >>> >> >> >> >>> >> >> >> Kindly review. >>> >> >> >> >>> >> >> >> -- >>> >> >> >> Thanks and Regards, >>> >> >> >> Aditya Toshniwal >>> >> >> >> Software Engineer | EnterpriseDB Software Solutions | Pune >>> >> >> >> "Don't Complain about Heat, Plant a tree" >>> >> >> > >>> >> >> > >>> >> >> > >>> >> >> > -- >>> >> >> > Akshay Joshi >>> >> >> > Sr. Software Architect >>> >> >> > >>> >> >> > >>> >> >> > Phone: +91 20-3058-9517 >>> >> >> > Mobile: +91 976-788-8246 >>> >> >> >>> >> >> >>> >> >> >>> >> >> -- >>> >> >> Dave Page >>> >> >> VP, Chief Architect, Tools & Installers >>> >> >> EnterpriseDB: http://www.enterprisedb.com >>> >> >> The Enterprise PostgreSQL Company >>> >> >> >>> >> >> Blog: http://pgsnake.blogspot.com >>> >> >> Twitter: @pgsnake >>> >> > >>> >> > >>> >> > >>> >> > -- >>> >> > Thanks and Regards, >>> >> > Aditya Toshniwal >>> >> > Software Engineer | EnterpriseDB Software Solutions | Pune >>> >> > "Don't Complain about Heat, Plant a tree" >>> >> >>> >> >>> >> >>> >> -- >>> >> Dave Page >>> >> VP, Chief Architect, Tools & Installers >>> >> EnterpriseDB: http://www.enterprisedb.com >>> >> The Enterprise PostgreSQL Company >>> >> >>> >> Blog: http://pgsnake.blogspot.com >>> >> Twitter: @pgsnake >>> > >>> > >>> > >>> > -- >>> > Thanks and Regards, >>> > Aditya Toshniwal >>> > Software Engineer | EnterpriseDB Software Solutions | Pune >>> > "Don't Complain about Heat, Plant a tree" >>> >>> >>> >>> -- >>> Dave Page >>> VP, Chief Architect, Tools & Installers >>> EnterpriseDB: http://www.enterprisedb.com >>> The Enterprise PostgreSQL Company >>> >>> Blog: http://pgsnake.blogspot.com >>> Twitter: @pgsnake >>> >> >> >> -- >> Thanks and Regards, >> Aditya Toshniwal >> Software Engineer | EnterpriseDB Software Solutions | Pune >> "Don't Complain about Heat, Plant a tree" >> > > > -- > *Akshay Joshi* > > *Sr. Software Architect * > > > > *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* > -- Thanks and Regards, Aditya Toshniwal Software Engineer | EnterpriseDB Software Solutions | Pune "Don't Complain about Heat, Plant a tree" Attachments: [application/octet-stream] RM3849_v3.patch (7.0K, 3-RM3849_v3.patch) download | inline diff: diff --git a/web/pgadmin/browser/register_browser_preferences.py b/web/pgadmin/browser/register_browser_preferences.py index 5bee817e..c7ea8126 100644 --- a/web/pgadmin/browser/register_browser_preferences.py +++ b/web/pgadmin/browser/register_browser_preferences.py @@ -38,6 +38,16 @@ def register_browser_preferences(self): ) ) + self.preference.register( + 'display', 'confirm_on_refresh_close', + gettext("Confirm on close or refresh ?"), 'boolean', + True, category_label=gettext('Display'), + help_str=gettext( + 'Confirm closure or refresh of the browser or browser tab is ' + 'intended before proceeding.' + ) + ) + self.table_row_count_threshold = self.preference.register( 'properties', 'table_row_count_threshold', gettext("Count rows if estimated less than"), 'integer', 2000, diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index cc2ea056..2accd182 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -1991,10 +1991,18 @@ define('pgadmin.browser', [ pgAdmin.Browser.editor_shortcut_keys.Tab = 'insertSoftTab'; } - $(window).on('beforeunload', function() { - let pref = pgBrowser.get_preference('browser', 'browser_tree_state_save_interval'); - if (!_.isUndefined(pref) && pref.value !== -1) + $(window).on('beforeunload', function(e) { + let tree_save_interval = pgBrowser.get_preference('browser', 'browser_tree_state_save_interval'), + confirm_on_refresh_close = pgBrowser.get_preference('browser', 'confirm_on_refresh_close'); + if (!_.isUndefined(tree_save_interval) && tree_save_interval.value !== -1) pgAdmin.Browser.browserTreeState.save_state(); + + if(confirm_on_refresh_close.value) { + /* This message will not be displayed in Chrome, Firefox, Safari as they have disabled it*/ + let msg = S(gettext('Are you sure you want to close the %s browser?')).sprintf(pgBrowser.utils.app_name).value(); + e.originalEvent.returnValue = msg; + return msg; + } }); return pgAdmin.Browser; diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py index b75e18a0..7163192c 100644 --- a/web/regression/python_test_utils/test_utils.py +++ b/web/regression/python_test_utils/test_utils.py @@ -646,58 +646,77 @@ def get_db_server(sid): return connection -def set_preference(default_binary_path): +def configure_preferences(default_binary_path=None): conn = sqlite3.connect(config.TEST_SQLITE_PATH) cur = conn.cursor() - perf = Preferences.module('paths') - server_types = default_binary_path.keys() - - for server in server_types: - path_pref = perf.preference('{0}_bin_dir'.format(server)) - user_pref = cur.execute( - 'SELECT pid, uid FROM user_preferences ' - 'where pid=%s' % path_pref.pid - ) - user_pref_data = user_pref.fetchone() - if user_pref_data: - cur.execute( - 'UPDATE user_preferences SET value = ? WHERE pid = ?', - (default_binary_path[server], path_pref.pid) - ) - else: - params = (path_pref.pid, 1, default_binary_path[server]) - cur.execute( - 'INSERT INTO user_preferences(pid, uid, value)' - ' VALUES (?,?,?)', params + if default_binary_path is not None: + paths_pref = Preferences.module('paths') + server_types = default_binary_path.keys() + for server in server_types: + pref_bin_path = paths_pref.preference('{0}_bin_dir'.format(server)) + user_pref = cur.execute( + 'SELECT pid, uid FROM user_preferences ' + 'where pid=%s' % pref_bin_path.pid ) - conn.commit() - conn.close() + user_pref_data = user_pref.fetchone() + if user_pref_data: + cur.execute( + 'UPDATE user_preferences SET value = ? WHERE pid = ?', + (default_binary_path[server], pref_bin_path.pid) + ) + else: + params = (pref_bin_path.pid, 1, default_binary_path[server]) + cur.execute( + 'INSERT INTO user_preferences(pid, uid, value)' + ' VALUES (?,?,?)', params + ) + browser_pref = Preferences.module('browser') -def disable_tree_state_save(): - conn = sqlite3.connect(config.TEST_SQLITE_PATH) - cur = conn.cursor() - pref = Preferences.module('browser')\ - .preference('browser_tree_state_save_interval') + # Disable tree state save for tests + pref_tree_state_save_interval = \ + browser_pref.preference('browser_tree_state_save_interval') + + user_pref = cur.execute( + 'SELECT pid, uid FROM user_preferences ' + 'where pid=?', (pref_tree_state_save_interval.pid,) + ) + + if len(user_pref.fetchall()) == 0: + cur.execute( + 'INSERT INTO user_preferences(pid, uid, value)' + ' VALUES (?,?,?)', (pref_tree_state_save_interval.pid, 1, -1) + ) + else: + cur.execute( + 'UPDATE user_preferences' + ' SET VALUE = ?' + ' WHERE PID = ?', (-1, pref_tree_state_save_interval.pid) + ) + + # Disable reload warning on browser + pref_confirm_on_refresh_close = \ + browser_pref.preference('confirm_on_refresh_close') user_pref = cur.execute( 'SELECT pid, uid FROM user_preferences ' - 'where pid=?', (pref.pid,) + 'where pid=?', (pref_confirm_on_refresh_close.pid,) ) if len(user_pref.fetchall()) == 0: cur.execute( 'INSERT INTO user_preferences(pid, uid, value)' - ' VALUES (?,?,?)', (pref.pid, 1, -1) + ' VALUES (?,?,?)', (pref_confirm_on_refresh_close.pid, 1, 'False') ) else: cur.execute( 'UPDATE user_preferences' ' SET VALUE = ?' - ' WHERE PID = ?', (-1, pref.pid) + ' WHERE PID = ?', ('False', pref_confirm_on_refresh_close.pid) ) + conn.commit() conn.close() diff --git a/web/regression/runtests.py b/web/regression/runtests.py index 0284753c..b023703d 100644 --- a/web/regression/runtests.py +++ b/web/regression/runtests.py @@ -415,12 +415,9 @@ if __name__ == '__main__': test_utils.drop_database(connection, test_db_name) # Create database test_utils.create_database(server, test_db_name) - - if server['default_binary_paths'] is not None: - test_utils.set_preference(server['default_binary_paths']) - - # Disable tree state saving - test_utils.disable_tree_state_save() + # Configure preferences for the test cases + test_utils.configure_preferences( + default_binary_path=server['default_binary_paths']) suite = get_suite(test_module_list, server, ^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working @ 2019-01-23 06:28 Akshay Joshi <[email protected]> parent: Aditya Toshniwal <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Akshay Joshi @ 2019-01-23 06:28 UTC (permalink / raw) To: Aditya Toshniwal <[email protected]>; +Cc: Dave Page <[email protected]>; pgadmin-hackers Thanks patch applied. On Wed, Jan 23, 2019 at 11:32 AM Aditya Toshniwal < [email protected]> wrote: > Hi Hackers, > > PFA revised patch as per review. > > On Wed, Jan 23, 2019 at 11:20 AM Akshay Joshi < > [email protected]> wrote: > >> Hi Aditya >> >> Found one issue you have remove the function "*disable_tree_state_save*" from >> "*web/regression/python_test_utils/test_utils.py*" and move that code >> into "*set_preference*" function and it is called from " >> *web/regression/runtests.py*" which is conditional, so please correct >> that behaviour. >> >> On Tue, Jan 22, 2019 at 6:28 PM Aditya Toshniwal < >> [email protected]> wrote: >> >>> Hi Hackers, >>> >>> Attached is the revised patch. The warning occurrence is configurable >>> from Preferences > Browser > Display. >>> >>> Kindly review. >>> >>> On Tue, Jan 22, 2019 at 5:38 PM Dave Page <[email protected]> >>> wrote: >>> >>>> On Tue, Jan 22, 2019 at 12:01 PM Aditya Toshniwal >>>> <[email protected]> wrote: >>>> > >>>> > >>>> > >>>> > On Tue, Jan 22, 2019 at 5:27 PM Dave Page <[email protected]> >>>> wrote: >>>> >> >>>> >> On Tue, Jan 22, 2019 at 11:54 AM Aditya Toshniwal >>>> >> <[email protected]> wrote: >>>> >> > >>>> >> > Any suggestions on preferences name/desc ? >>>> >> >>>> >> Name: "Confirm on close" >>>> >> Desc: "Confirm closure of the browser or browser tab is intended >>>> >> before proceeding." >>>> > >>>> > It also warns on refresh. >>>> >>>> Name: "Confirm on close or refresh" >>>> Desc: "Confirm closure or refresh of the browser or browser tab is >>>> intended before proceeding." >>>> >>>> >> >>>> >> >>>> >> >>>> >> > On Tue, Jan 22, 2019 at 3:01 PM Dave Page < >>>> [email protected]> wrote: >>>> >> >> >>>> >> >> Hi >>>> >> >> >>>> >> >> On Tue, Jan 22, 2019 at 6:27 AM Akshay Joshi >>>> >> >> <[email protected]> wrote: >>>> >> >> > >>>> >> >> > Hi Aditya >>>> >> >> > >>>> >> >> > Below are my review comments: >>>> >> >> > >>>> >> >> > You have added new config parameter >>>> "DISABLE_BEFOREUNLOAD_MESSAGE" to make this request configurable, should it >>>> be the part of preferences setting instead of configuration? @Dave can you >>>> please comment on this. >>>> >> >> >>>> >> >> That does seem like something that should be a per-user >>>> preference, >>>> >> >> not a global config option. >>>> >> >> >>>> >> >> > Name "DISABLE_BEFOREUNLOAD_MESSAGE" is not clear as users >>>> perspective, can you please change it to some meaningful name. >>>> >> >> > >>>> >> >> > Apart from that code looks good to me. >>>> >> >> > >>>> >> >> > On Mon, Jan 21, 2019 at 1:24 PM Aditya Toshniwal < >>>> [email protected]> wrote: >>>> >> >> >> >>>> >> >> >> Hi Hackers, >>>> >> >> >> >>>> >> >> >> Attached is the patch to throw alert warning when user reloads >>>> or closes the browser. >>>> >> >> >> >>>> >> >> >> Kindly review. >>>> >> >> >> >>>> >> >> >> -- >>>> >> >> >> Thanks and Regards, >>>> >> >> >> Aditya Toshniwal >>>> >> >> >> Software Engineer | EnterpriseDB Software Solutions | Pune >>>> >> >> >> "Don't Complain about Heat, Plant a tree" >>>> >> >> > >>>> >> >> > >>>> >> >> > >>>> >> >> > -- >>>> >> >> > Akshay Joshi >>>> >> >> > Sr. Software Architect >>>> >> >> > >>>> >> >> > >>>> >> >> > Phone: +91 20-3058-9517 >>>> >> >> > Mobile: +91 976-788-8246 >>>> >> >> >>>> >> >> >>>> >> >> >>>> >> >> -- >>>> >> >> Dave Page >>>> >> >> VP, Chief Architect, Tools & Installers >>>> >> >> EnterpriseDB: http://www.enterprisedb.com >>>> >> >> The Enterprise PostgreSQL Company >>>> >> >> >>>> >> >> Blog: http://pgsnake.blogspot.com >>>> >> >> Twitter: @pgsnake >>>> >> > >>>> >> > >>>> >> > >>>> >> > -- >>>> >> > Thanks and Regards, >>>> >> > Aditya Toshniwal >>>> >> > Software Engineer | EnterpriseDB Software Solutions | Pune >>>> >> > "Don't Complain about Heat, Plant a tree" >>>> >> >>>> >> >>>> >> >>>> >> -- >>>> >> Dave Page >>>> >> VP, Chief Architect, Tools & Installers >>>> >> EnterpriseDB: http://www.enterprisedb.com >>>> >> The Enterprise PostgreSQL Company >>>> >> >>>> >> Blog: http://pgsnake.blogspot.com >>>> >> Twitter: @pgsnake >>>> > >>>> > >>>> > >>>> > -- >>>> > Thanks and Regards, >>>> > Aditya Toshniwal >>>> > Software Engineer | EnterpriseDB Software Solutions | Pune >>>> > "Don't Complain about Heat, Plant a tree" >>>> >>>> >>>> >>>> -- >>>> Dave Page >>>> VP, Chief Architect, Tools & Installers >>>> EnterpriseDB: http://www.enterprisedb.com >>>> The Enterprise PostgreSQL Company >>>> >>>> Blog: http://pgsnake.blogspot.com >>>> Twitter: @pgsnake >>>> >>> >>> >>> -- >>> Thanks and Regards, >>> Aditya Toshniwal >>> Software Engineer | EnterpriseDB Software Solutions | Pune >>> "Don't Complain about Heat, Plant a tree" >>> >> >> >> -- >> *Akshay Joshi* >> >> *Sr. Software Architect * >> >> >> >> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* >> > > > -- > Thanks and Regards, > Aditya Toshniwal > Software Engineer | EnterpriseDB Software Solutions | Pune > "Don't Complain about Heat, Plant a tree" > -- *Akshay Joshi* *Sr. Software Architect * *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2019-01-23 06:28 UTC | newest] Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-01-21 07:54 [pgAdmin4][RM3849] Ask to save unsaved query changes stopped working Aditya Toshniwal <[email protected]> 2019-01-22 06:27 ` Akshay Joshi <[email protected]> 2019-01-22 09:31 ` Dave Page <[email protected]> 2019-01-22 11:54 ` Aditya Toshniwal <[email protected]> 2019-01-22 11:57 ` Dave Page <[email protected]> 2019-01-22 12:01 ` Aditya Toshniwal <[email protected]> 2019-01-22 12:08 ` Dave Page <[email protected]> 2019-01-22 12:58 ` Aditya Toshniwal <[email protected]> 2019-01-23 05:49 ` Akshay Joshi <[email protected]> 2019-01-23 06:02 ` Aditya Toshniwal <[email protected]> 2019-01-23 06:28 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox