[pgAdmin4][Patch]: Switching between Tabs resets table viewport to first row in gird - Query tool
Hi, PFA patch to fix the issue where while switching the tabs in query tool resets the position of the table viewport to the first row. RM#2875 *Steps:* 1) Open query tool 2) Execute: select * from generate_series(1, 1000) as "column-1"; 3) Scroll till the End OR till ~250 row 4) Click on 'Explain' Tab 5) Go back to 'Data output' Tab -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index 9a0c3de..df9e980 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -914,7 +914,8 @@ define('tools.querytool', [ // fetch asynchronous setTimeout(self.fetch_next.bind(self)); } - }) + }); + // Resize SlickGrid when window resize $(window).resize(function () { // Resize grid only when 'Data Output' panel is visible. @@ -1022,9 +1023,31 @@ define('tools.querytool', [ /* This function is responsible to render output grid */ grid_resize: function (grid) { - var h = $($('#editor-panel').find('.wcFrame')[1]).height() - 35; - $('#datagrid').css({'height': h + 'px'}); + var prev_height = $('#datagrid').height(), +h = $($('#editor-panel').find('.wcFrame')[1]).height() - 35, +prev_viewport = grid.getViewport(), +prev_cell = grid.getActiveCell(); + + // Apply css only if necessary, To avoid DOM operation + if (prev_height != h) { +$('#datagrid').css({'height': h + 'px'}); + } + grid.resizeCanvas(); + + /* + * Lets scroll to previously displayed rows + * If there is an active cell from user then we have to go to that cell + */ + if(prev_cell) { +grid.scrollCellIntoView(prev_cell.row, prev_cell.cell); + } else { +/* + * Display approximate viewport but we do not have any exact cell information + * to display so we will start displaying from first column only + */ +grid.scrollRowIntoView(prev_viewport.bottom) + } }, /* This function is responsible to create and render the
pgAdmin 4 commit: Improve clarity of the boolean checkbox.
Improve clarity of the boolean checkbox. Branch -- master Details --- https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=f0db93cefd80d7671aa3434c1cfb45295b437983 Author: Murtuza Zabuawala Modified Files -- web/pgadmin/static/css/bootstrap.overrides.css | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-)
pgAdmin 4 commit: Ensure newly added rows cannot be editted until we ha
Ensure newly added rows cannot be editted until we have key values. Fixes #RM2886 Branch -- master Details --- https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=1bc318f0913dd4b960bb113fe7a3b0d0ec2e6771 Author: Murtuza Zabuawala Modified Files -- web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 27 -- 1 file changed, 15 insertions(+), 12 deletions(-)
Re: [pgAdmin4][Patch]: To fix issues in Boolean editor
Thanks, both applied! On Wed, Nov 22, 2017 at 5:30 AM, Murtuza Zabuawala < murtuza.zabuaw...@enterprisedb.com> wrote: > Hi Dave, > > On Tue, Nov 21, 2017 at 10:53 PM, Dave Page wrote: > >> Hi >> >> On Tue, Nov 21, 2017 at 1:17 PM, Murtuza Zabuawala < >> murtuza.zabuaw...@enterprisedb.com> wrote: >> >>> Hi Dave, >>> >>> PFA updated patch. >>> >>> On Tue, Nov 21, 2017 at 4:16 PM, Dave Page wrote: >>> HI On Tue, Nov 21, 2017 at 6:16 AM, Murtuza Zabuawala < murtuza.zabuaw...@enterprisedb.com> wrote: > Hi Dave, > > PFA updated patch with custom tristate boolean editor for SlickGrid to > make it compatible with Qt runtime. > I have tested it web mode & also modified the feature test accordingly. > > Also thanks to Neel for testing the patch with latest runtime code. > Cool - so a few thoughts... - Can we make the null symbol a question mark? >>> instead of question mark we will make square >>> gray color >>> . >>> >> >> Sorry - I just realised this is not good from an accessibility >> perspective as users may not be able to distinguish between the white and >> gray in-fill. I've made it include a ? as well. >> > > I have enhanced the the visibility of '?' > little bit > more > , attaching the patch if you prefer it that way. > > > >> >> >>> - I think the feature tests should be enhanced to ensure we verify the clickthrough sequence of the new control. I don't think we need a new test - maybe just an enhancement to the existing editor test? >>> Done >>> >>> >> >> Thanks - patch applied. >> >> >>> - With a table of the definition shown below, if I add a row with a default value for the ID, and false, true, null and hit save, then immediately (without refreshing) try to change the first boolean value to true and hit save, then I get the following error: UPDATE public.bools SET b1 = %(b1)s::boolean WHERE ; 2017-11-21 10:34:57,378: ERROR pgadmin: Failed to execute query (execute_void) for the server #1 - DB:postgres (Query-id: 4249364): Error Message:ERROR: syntax error at or near ";" LINE 3: ; Table: CREATE TABLE public.bools ( id integer NOT NULL DEFAULT nextval('bools_id_seq'::regclass), b1 boolean, b2 boolean, b3 boolean, CONSTRAINT bools_pkey PRIMARY KEY (id) ) This issue is not related to given editor changes. >>> I have opened the separate ticket for the issue >>> https://redmine.postgresql.org/issues/2886 >>> >> >> OK, thanks. >> > Also attached patch for RM#2886, the issue was due to incorrect > conditional logic, As per the current implementation the newly added row > should gets disabled if it is saved with default primary key value until > gird reloaded with actual PK for updation but due to > incorrect condition > it was enable in this case. > >> >> >> -- >> 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
Re: [pgAdmin4][Patch]: To fix issues in Boolean editor
On Wed, Nov 22, 2017 at 5:46 AM, Ashesh Vashi wrote: > On Wed, Nov 22, 2017 at 11:00 AM, Murtuza Zabuawala enterprisedb.com> wrote: > >> Hi Dave, >> >> On Tue, Nov 21, 2017 at 10:53 PM, Dave Page wrote: >> >>> Hi >>> >>> On Tue, Nov 21, 2017 at 1:17 PM, Murtuza Zabuawala < >>> murtuza.zabuaw...@enterprisedb.com> wrote: >>> Hi Dave, PFA updated patch. On Tue, Nov 21, 2017 at 4:16 PM, Dave Page wrote: > HI > > On Tue, Nov 21, 2017 at 6:16 AM, Murtuza Zabuawala < > murtuza.zabuaw...@enterprisedb.com> wrote: > >> Hi Dave, >> >> PFA updated patch with custom tristate boolean editor for SlickGrid >> to make it compatible with Qt runtime. >> I have tested it web mode & also modified the feature test >> accordingly. >> >> Also thanks to Neel for testing the patch with latest runtime code. >> > > Cool - so a few thoughts... > > - Can we make the null symbol a question mark? > instead of question mark we will make square gray color . >>> >>> Sorry - I just realised this is not good from an accessibility >>> perspective as users may not be able to distinguish between the white and >>> gray in-fill. I've made it include a ? as well. >>> >> >> I have enhanced the the visibility of '?' >> little bit >> more >> , attaching the patch if you prefer it that way. >> > > In the call, Dave suggested that, we should have: > Cross (×, i.e. ×) for False > Check (√, i.e. √) for True > Empty (∅, i.e. ∅) for Null. > > We discussed it, which I think - Murtuza missed due to connectivity > issue, during the call. > > Dave - thoughts? > What we have now seems to work nicely, and I believe is quite clear. -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
pgAdmin 4 commit: Honour whitespace properly in the data grid. Fixes #2
Honour whitespace properly in the data grid. Fixes #2880 Branch -- master Details --- https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=fdb4fa454a121fb43c6643c608e6ec3419880a0c Author: Murtuza Zabuawala Modified Files -- web/pgadmin/tools/sqleditor/static/css/sqleditor.css | 4 1 file changed, 4 insertions(+)
Re: [pgAdmin4][Patch]: To display leading whitespace properly in columns - Query tool
Thanks, applied. On Wed, Nov 22, 2017 at 7:34 AM, Murtuza Zabuawala < murtuza.zabuaw...@enterprisedb.com> wrote: > Hi, > > PFA minor patch to fix the issue where user were not able to see leading > whitespace in their columns. > RM#2880 > > -- > Regards, > Murtuza Zabuawala > EnterpriseDB: 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
Re: [pgAdmin4][Patch]: Switching between Tabs resets table viewport to first row in gird - Query tool
Hi On Wed, Nov 22, 2017 at 3:18 PM, Murtuza Zabuawala < murtuza.zabuaw...@enterprisedb.com> wrote: > Hi, > > PFA patch to fix the issue where while switching the tabs in query tool > resets the position of the table viewport to the first row. > RM#2875 > > *Steps:* > 1) Open query tool > 2) Execute: > select * from generate_series(1, 1000) as "column-1"; > 3) Scroll till the End OR till ~250 row > 4) Click on 'Explain' Tab > 5) Go back to 'Data output' Tab > Hmm, minor issue; each time I return the to data tab, the data moves up two rows! It's almost like it's calculating the viewport taking into account the row header (e.g. row 250 is visible immediate below the header), but then re-positioning without taking it into account (e.g. row 250 is aligned with the top of the row header, thus making row 252 the first visible one). -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
[pgAdmin4][Patch]: RM-2859: Can't create new user
Hi, Please find the attached patch to fix RM #2859: Can't create new user. The "User Management" dialogue footer was overlapping the back-grid table which has been fixed. Thanks, Khushboo diff --git a/web/pgadmin/static/css/bootstrap.overrides.css b/web/pgadmin/static/css/bootstrap.overrides.css index 73b4fc7..a64e85b 100755 --- a/web/pgadmin/static/css/bootstrap.overrides.css +++ b/web/pgadmin/static/css/bootstrap.overrides.css @@ -1177,7 +1177,7 @@ form[name="change_password_form"] .help-block { .user_management { margin: 0 10px !important; width: calc(100% - 20px); - height: 100%; + height: calc(100% - 40px); overflow: hidden; } @@ -1187,7 +1187,7 @@ form[name="change_password_form"] .help-block { .user_management table { display: block; - height: 100%; + height: calc(100% - 10px); overflow: auto; border: 0 none; } diff --git a/web/pgadmin/tools/user_management/static/js/user_management.js b/web/pgadmin/tools/user_management/static/js/user_management.js index ffdf8b2..ee8701a 100644 --- a/web/pgadmin/tools/user_management/static/js/user_management.js +++ b/web/pgadmin/tools/user_management/static/js/user_management.js @@ -386,6 +386,7 @@ define([ // clear our backform model/view this.view.remove({data: true, internal: true, silent: true}); this.$content.remove(); +this.$footer.remove(); } } }, @@ -404,9 +405,9 @@ define([ '', '', '', -''].join("\n")), - $footer = $(footerTpl()), - $statusBar = $footer.find('.pg-prop-status-bar'), +''].join("\n")); + self.$footer = $(footerTpl()); + var $statusBar = self.$footer.find('.pg-prop-status-bar'), UserRow = Backgrid.Row.extend({ userInvalidColor: "lightYellow", @@ -558,12 +559,14 @@ define([ this.$content = $("").append( headerTpl(data)).append($gridBody -).append($footer); +); $(this.elements.body.childNodes[0]).addClass( 'alertify_tools_dialog_backgrid_properties'); this.elements.content.appendChild(this.$content[0]); +this.elements.content.appendChild(this.$footer[0]); + // Render Search Filter $('.search_users').append(
Fix for RM2845: Make "Save changes" prompt configurable
Hi, Please find attached patch to fix RM2845 -- *Harshal Dhumal* *Sr. Software Engineer* EnterpriseDB India: http://www.enterprisedb.com The Enterprise PostgreSQL Company diff --git a/web/pgadmin/tools/datagrid/__init__.py b/web/pgadmin/tools/datagrid/__init__.py index c37e5d3..eaa1850 100644 --- a/web/pgadmin/tools/datagrid/__init__.py +++ b/web/pgadmin/tools/datagrid/__init__.py @@ -216,6 +216,11 @@ def panel(trans_id, is_query_tool, editor_title): else: new_browser_tab = 'false' +if is_query_tool == 'true': +prompt_save_changes = pref.preference('prompt_save_query_changes').get() +else: +prompt_save_changes = pref.preference('prompt_save_data_changes').get() + # Fetch the server details # bgcolor = None @@ -243,7 +248,10 @@ def panel(trans_id, is_query_tool, editor_title): server_type=server_type, client_platform=user_agent.platform, bgcolor=bgcolor, -fgcolor=fgcolor +fgcolor=fgcolor, +# convert python boolean value to equivalent js boolean literal before +# passing it to html template. +prompt_save_changes='true' if prompt_save_changes else 'false' ) diff --git a/web/pgadmin/tools/datagrid/templates/datagrid/index.html b/web/pgadmin/tools/datagrid/templates/datagrid/index.html index 05e0986..ff4368d 100644 --- a/web/pgadmin/tools/datagrid/templates/datagrid/index.html +++ b/web/pgadmin/tools/datagrid/templates/datagrid/index.html @@ -369,6 +369,6 @@ // Start the query tool. sqlEditorController.start({{ is_query_tool }}, "{{ editor_title }}", -script_sql, {{ is_new_browser_tab }}, "{{ server_type }}"); +script_sql, {{ is_new_browser_tab }}, "{{ server_type }}", {{ prompt_save_changes }}); }); {% endblock %} diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py index d360d91..a4b83d4 100644 --- a/web/pgadmin/tools/sqleditor/__init__.py +++ b/web/pgadmin/tools/sqleditor/__init__.py @@ -235,6 +235,26 @@ class SqlEditorModule(PgAdminModule): ) ) +self.show_prompt_save_query_changes = self.preference.register( +'Options', 'prompt_save_query_changes', +gettext("Prompt to save unsaved query changes?"), 'boolean', True, +category_label=gettext('Options'), +help_str=gettext( +'Specifies whether or not to prompt user to save unsaved ' +'query on query tool exit.' +) +) + +self.show_prompt_save_data_changes = self.preference.register( +'Options', 'prompt_save_data_changes', +gettext("Prompt to save unsaved data changes?"), 'boolean', True, +category_label=gettext('Options'), +help_str=gettext( +'Specifies whether or not to prompt user to save unsaved ' +'data on data grid exit.' +) +) + self.csv_quoting = self.preference.register( 'CSV_output', 'csv_quoting', gettext("CSV quoting"), 'options', 'strings', diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index ba0ce67..68f953a 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -243,25 +243,28 @@ define('tools.querytool', [ // Listen on the panel closed event and notify user to save modifications. _.each(window.top.pgAdmin.Browser.docker.findPanels('frm_datagrid'), function (p) { if (p.isVisible()) { -p.on(wcDocker.EVENT.CLOSING, function () { - // Only if we can edit data then perform this check - var notify = false, msg; - if (self.handler.can_edit) { -var data_store = self.handler.data_store; -if (data_store && (_.size(data_store.added) || - _.size(data_store.updated))) { - msg = gettext("The data has changed. Do you want to save changes?"); +if(self.handler.prompt_save_changes) { + p.on(wcDocker.EVENT.CLOSING, function () { +// Only if we can edit data then perform this check +var notify = false, msg; +if (self.handler.can_edit) { + var data_store = self.handler.data_store; + if (data_store && (_.size(data_store.added) || +_.size(data_store.updated))) { +msg = gettext("The data has changed. Do you want to save changes?"); +notify = true; + } +} else if (self.handler.is_query_tool && self.handler.is_query_changed) { + msg = gettext("The text has changed. Do you want to save changes?"); notify = true; } - } else if (self.handle