public inbox for [email protected]help / color / mirror / Atom feed
[pgAdmin4[RM#3935] Grant wizard fails to list down functions 6+ messages / 2 participants [nested] [flat]
* [pgAdmin4[RM#3935] Grant wizard fails to list down functions @ 2019-01-28 06:31 Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 6+ messages in thread From: Murtuza Zabuawala @ 2019-01-28 06:31 UTC (permalink / raw) To: pgadmin-hackers Hi, PFA patch to fix the issue where EPAS DB instance running with *no-redwood-compat* mode fails to list down functions objects in grant wizard due to 'char' -> 'int' type cast error. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company Attachments: [application/octet-stream] RM_3935.diff (1.5K, 3-RM_3935.diff) download | inline diff: diff --git a/web/pgadmin/tools/grant_wizard/templates/grant_wizard/ppas/11_plus/sql/function.sql b/web/pgadmin/tools/grant_wizard/templates/grant_wizard/ppas/11_plus/sql/function.sql index 1115b72e..577f8c98 100644 --- a/web/pgadmin/tools/grant_wizard/templates/grant_wizard/ppas/11_plus/sql/function.sql +++ b/web/pgadmin/tools/grant_wizard/templates/grant_wizard/ppas/11_plus/sql/function.sql @@ -21,7 +21,7 @@ WHERE pronamespace = {{ node_id }}::oid AND typname {{ 'NOT' if type != 'trigger_function' else '' }} IN ('trigger', 'event_trigger') AND pr.prokind = '{{ kind }}' - AND pr.protype = {{ 0 if type != 'procedure' else 1 }} + AND pr.protype = {{'0' if type != 'procedure' else '1'}}::char ORDER BY proname {% endif %} diff --git a/web/pgadmin/tools/grant_wizard/templates/grant_wizard/ppas/9.1_plus/sql/function.sql b/web/pgadmin/tools/grant_wizard/templates/grant_wizard/ppas/9.1_plus/sql/function.sql index 822134da..1fede48e 100644 --- a/web/pgadmin/tools/grant_wizard/templates/grant_wizard/ppas/9.1_plus/sql/function.sql +++ b/web/pgadmin/tools/grant_wizard/templates/grant_wizard/ppas/9.1_plus/sql/function.sql @@ -19,7 +19,7 @@ LEFT OUTER JOIN pg_description des ON (des.objoid=pr.oid AND des.classoid='pg_pr WHERE proisagg = FALSE AND pronamespace = {{ node_id }}::oid AND typname {{ 'NOT' if type != 'trigger_function' else '' }} IN ('trigger', 'event_trigger') - AND pr.protype = {{ 0 if type != 'procedure' else 1 }} + AND pr.protype = {{'0' if type != 'procedure' else '1'}}::char ORDER BY proname {% endif %} ^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [pgAdmin4[RM#3935] Grant wizard fails to list down functions @ 2019-01-28 07:18 Akshay Joshi <[email protected]> parent: Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 6+ messages in thread From: Akshay Joshi @ 2019-01-28 07:18 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers Thanks patch applied. On Mon, Jan 28, 2019 at 12:01 PM Murtuza Zabuawala < [email protected]> wrote: > Hi, > > PFA patch to fix the issue where EPAS DB instance running with > *no-redwood-compat* mode fails to list down functions objects in grant > wizard due to 'char' -> 'int' type cast error. > > > -- > Regards, > Murtuza Zabuawala > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > -- *Akshay Joshi* *Sr. Software Architect * *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [pgAdmin4[RM#3935] Grant wizard fails to list down functions @ 2019-01-28 09:19 Murtuza Zabuawala <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 1 reply; 6+ messages in thread From: Murtuza Zabuawala @ 2019-01-28 09:19 UTC (permalink / raw) To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers Hi, PFA minor patch, To display an error on UI when there is a backend error for the grant wizard request. Please review. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Mon, Jan 28, 2019 at 12:48 PM Akshay Joshi <[email protected]> wrote: > Thanks patch applied. > > On Mon, Jan 28, 2019 at 12:01 PM Murtuza Zabuawala < > [email protected]> wrote: > >> Hi, >> >> PFA patch to fix the issue where EPAS DB instance running with >> *no-redwood-compat* mode fails to list down functions objects in grant >> wizard due to 'char' -> 'int' type cast error. >> >> >> -- >> Regards, >> Murtuza Zabuawala >> EnterpriseDB: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> >> > > -- > *Akshay Joshi* > > *Sr. Software Architect * > > > > *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* > Attachments: [application/octet-stream] RM_3935_show_error_on_UI.diff (1.4K, 3-RM_3935_show_error_on_UI.diff) download | inline diff: diff --git a/web/pgadmin/static/scss/_alert.scss b/web/pgadmin/static/scss/_alert.scss index e8676b8c..f5082c37 100644 --- a/web/pgadmin/static/scss/_alert.scss +++ b/web/pgadmin/static/scss/_alert.scss @@ -21,7 +21,8 @@ display: inline-block; } -.alert.alert-info { +.alert.alert-info, +.alert.alert-danger { padding: 0.5rem; } diff --git a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js index 85d78da2..ee9e0c45 100644 --- a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js +++ b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js @@ -612,6 +612,18 @@ define([ $('.wizard-progress-bar p').html(''); $('.wizard-progress-bar').hide(); }, + error: function(m, xhr) { + let msg; + if (xhr && xhr.responseJSON && xhr.responseJSON.errormsg) { + msg = xhr.responseJSON.errormsg; + } + + if(!msg) { + msg = gettext('Unable to fetch the database objects due to an error'); + } + $('.wizard-progress-bar p').removeClass('alert-info').addClass('alert-danger'); + $('.wizard-progress-bar p').text(msg); + }, reset: true, }, this); ^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [pgAdmin4[RM#3935] Grant wizard fails to list down functions @ 2019-01-28 11:08 Akshay Joshi <[email protected]> parent: Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 6+ messages in thread From: Akshay Joshi @ 2019-01-28 11:08 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers Hi Murtuza Here are my review comments: - Exact error should be logged in the log file and on GUI we should show message like "Unable to fetch <function/table> object". - Message should be shown in the status bar. - If there is an error to fetch one kind of object, we should show other objects. On Mon, Jan 28, 2019 at 2:49 PM Murtuza Zabuawala < [email protected]> wrote: > Hi, > > PFA minor patch, To display an error on UI when there is a backend error > for the grant wizard request. > Please review. > > -- > Regards, > Murtuza Zabuawala > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > > > On Mon, Jan 28, 2019 at 12:48 PM Akshay Joshi < > [email protected]> wrote: > >> Thanks patch applied. >> >> On Mon, Jan 28, 2019 at 12:01 PM Murtuza Zabuawala < >> [email protected]> wrote: >> >>> Hi, >>> >>> PFA patch to fix the issue where EPAS DB instance running with >>> *no-redwood-compat* mode fails to list down functions objects in grant >>> wizard due to 'char' -> 'int' type cast error. >>> >>> >>> -- >>> Regards, >>> Murtuza Zabuawala >>> EnterpriseDB: http://www.enterprisedb.com >>> The Enterprise PostgreSQL Company >>> >>> >> >> -- >> *Akshay Joshi* >> >> *Sr. Software Architect * >> >> >> >> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* >> > -- *Akshay Joshi* *Sr. Software Architect * *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [pgAdmin4[RM#3935] Grant wizard fails to list down functions @ 2019-01-30 09:40 Murtuza Zabuawala <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 1 reply; 6+ messages in thread From: Murtuza Zabuawala @ 2019-01-30 09:40 UTC (permalink / raw) To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers Hi, On Mon, Jan 28, 2019 at 4:38 PM Akshay Joshi <[email protected]> wrote: > Hi Murtuza > > Here are my review comments: > > - Exact error should be logged in the log file and on GUI we should > show message like "Unable to fetch <function/table> object". > > Fixed > > - Message should be shown in the status bar. > > Fixed > > - If there is an error to fetch one kind of object, we should show > other objects. > > Fixed. Please find the updated patch. Regards, Murtuza > > On Mon, Jan 28, 2019 at 2:49 PM Murtuza Zabuawala < > [email protected]> wrote: > >> Hi, >> >> PFA minor patch, To display an error on UI when there is a backend error >> for the grant wizard request. >> Please review. >> >> -- >> Regards, >> Murtuza Zabuawala >> EnterpriseDB: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> >> >> >> On Mon, Jan 28, 2019 at 12:48 PM Akshay Joshi < >> [email protected]> wrote: >> >>> Thanks patch applied. >>> >>> On Mon, Jan 28, 2019 at 12:01 PM Murtuza Zabuawala < >>> [email protected]> wrote: >>> >>>> Hi, >>>> >>>> PFA patch to fix the issue where EPAS DB instance running with >>>> *no-redwood-compat* mode fails to list down functions objects in grant >>>> wizard due to 'char' -> 'int' type cast error. >>>> >>>> >>>> -- >>>> Regards, >>>> Murtuza Zabuawala >>>> EnterpriseDB: http://www.enterprisedb.com >>>> The Enterprise PostgreSQL Company >>>> >>>> >>> >>> -- >>> *Akshay Joshi* >>> >>> *Sr. Software Architect * >>> >>> >>> >>> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* >>> >> > > -- > *Akshay Joshi* > > *Sr. Software Architect * > > > > *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* > Attachments: [image/png] Screen Shot 2019-01-30 at 2.52.03 PM.png (236.4K, 3-Screen%20Shot%202019-01-30%20at%202.52.03%20PM.png) download | view image [application/octet-stream] RM_3935_UI_error_handling.diff (6.2K, 4-RM_3935_UI_error_handling.diff) download | inline diff: diff --git a/web/pgadmin/static/scss/_alert.scss b/web/pgadmin/static/scss/_alert.scss index e8676b8c..f5082c37 100644 --- a/web/pgadmin/static/scss/_alert.scss +++ b/web/pgadmin/static/scss/_alert.scss @@ -21,7 +21,8 @@ display: inline-block; } -.alert.alert-info { +.alert.alert-info, +.alert.alert-danger { padding: 0.5rem; } diff --git a/web/pgadmin/tools/grant_wizard/__init__.py b/web/pgadmin/tools/grant_wizard/__init__.py index 6ef374b1..6ca37204 100644 --- a/web/pgadmin/tools/grant_wizard/__init__.py +++ b/web/pgadmin/tools/grant_wizard/__init__.py @@ -191,6 +191,8 @@ def properties(sid, did, node_id, node_type): server_prop = server_info res_data = [] + failed_objects = [] + msg = None manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(sid) conn = manager.connection(did=did) @@ -231,11 +233,11 @@ def properties(sid, did, node_id, node_type): node_id=node_id, type='function') status, res = conn.execute_dict(SQL) - if not status: - return internal_server_error(errormsg=res) - - res_data.extend(res['rows']) + current_app.logger.error(res) + failed_objects.append('function') + else: + res_data.extend(res['rows']) # Fetch procedures only if server type is EPAS or PG >= 11 if (len(server_prop) > 0 and @@ -250,9 +252,10 @@ def properties(sid, did, node_id, node_type): status, res = conn.execute_dict(SQL) if not status: - return internal_server_error(errormsg=res) - - res_data.extend(res['rows']) + current_app.logger.error(res) + failed_objects.append('procedure') + else: + res_data.extend(res['rows']) # Fetch trigger functions if ntype in ['schema', 'trigger_function']: @@ -262,9 +265,10 @@ def properties(sid, did, node_id, node_type): status, res = conn.execute_dict(SQL) if not status: - return internal_server_error(errormsg=res) - - res_data.extend(res['rows']) + current_app.logger.error(res) + failed_objects.append('trigger function') + else: + res_data.extend(res['rows']) # Fetch Sequences against schema if ntype in ['schema', 'sequence']: @@ -274,8 +278,10 @@ def properties(sid, did, node_id, node_type): status, res = conn.execute_dict(SQL) if not status: - return internal_server_error(errormsg=res) - res_data.extend(res['rows']) + current_app.logger.error(res) + failed_objects.append('sequence') + else: + res_data.extend(res['rows']) # Fetch Tables against schema if ntype in ['schema', 'table']: @@ -285,9 +291,10 @@ def properties(sid, did, node_id, node_type): status, res = conn.execute_dict(SQL) if not status: - return internal_server_error(errormsg=res) - - res_data.extend(res['rows']) + current_app.logger.error(res) + failed_objects.append('table') + else: + res_data.extend(res['rows']) # Fetch Views against schema if ntype in ['schema', 'view']: @@ -297,9 +304,10 @@ def properties(sid, did, node_id, node_type): status, res = conn.execute_dict(SQL) if not status: - return internal_server_error(errormsg=res) - - res_data.extend(res['rows']) + current_app.logger.error(res) + failed_objects.append('view') + else: + res_data.extend(res['rows']) # Fetch Materialzed Views against schema if ntype in ['schema', 'mview']: @@ -309,12 +317,19 @@ def properties(sid, did, node_id, node_type): status, res = conn.execute_dict(SQL) if not status: - return internal_server_error(errormsg=res) - - res_data.extend(res['rows']) + current_app.logger.error(res) + failed_objects.append('materialized view') + else: + res_data.extend(res['rows']) + + if len(failed_objects) > 0: + msg = gettext('Unable to fetch the {} objects'.format( + ",".join(failed_objects)) + ) - return ajax_response( - response=res_data, + return make_json_response( + result=res_data, + info=msg, status=200 ) diff --git a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js index 85d78da2..4dd904b4 100644 --- a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js +++ b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js @@ -608,9 +608,28 @@ define([ $('.wizard-progress-bar p').show(); coll.fetch({ - success: function() { + success: function(c, xhr) { $('.wizard-progress-bar p').html(''); $('.wizard-progress-bar').hide(); + c.set(xhr.result, {parse: true}); + // If some objects failed while fetching then we will notify the user + if (xhr && xhr.info && xhr.info !== '') { + $('.pg-prop-status-bar .alert-text').html(xhr.info); + $('.pg-prop-status-bar').css('visibility', 'visible'); + } + }, + error: function(m, xhr) { + // If the main request fails as whole then + let msg; + if (xhr && xhr.responseJSON && xhr.responseJSON.errormsg) { + msg = xhr.responseJSON.errormsg; + } + + if(!msg) { + msg = gettext('Unable to fetch the database objects due to an error'); + } + $('.wizard-progress-bar p').removeClass('alert-info').addClass('alert-danger'); + $('.wizard-progress-bar p').text(msg); }, reset: true, }, this); ^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [pgAdmin4[RM#3935] Grant wizard fails to list down functions @ 2019-01-30 11:10 Akshay Joshi <[email protected]> parent: Murtuza Zabuawala <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Akshay Joshi @ 2019-01-30 11:10 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers Thanks patch applied. On Wed, Jan 30, 2019 at 3:10 PM Murtuza Zabuawala < [email protected]> wrote: > Hi, > > On Mon, Jan 28, 2019 at 4:38 PM Akshay Joshi < > [email protected]> wrote: > >> Hi Murtuza >> >> Here are my review comments: >> >> - Exact error should be logged in the log file and on GUI we should >> show message like "Unable to fetch <function/table> object". >> >> Fixed > >> >> - Message should be shown in the status bar. >> >> Fixed > >> >> - If there is an error to fetch one kind of object, we should show >> other objects. >> >> Fixed. > > > Please find the updated patch. > > > Regards, > Murtuza > >> >> On Mon, Jan 28, 2019 at 2:49 PM Murtuza Zabuawala < >> [email protected]> wrote: >> >>> Hi, >>> >>> PFA minor patch, To display an error on UI when there is a backend error >>> for the grant wizard request. >>> Please review. >>> >>> -- >>> Regards, >>> Murtuza Zabuawala >>> EnterpriseDB: http://www.enterprisedb.com >>> The Enterprise PostgreSQL Company >>> >>> >>> >>> On Mon, Jan 28, 2019 at 12:48 PM Akshay Joshi < >>> [email protected]> wrote: >>> >>>> Thanks patch applied. >>>> >>>> On Mon, Jan 28, 2019 at 12:01 PM Murtuza Zabuawala < >>>> [email protected]> wrote: >>>> >>>>> Hi, >>>>> >>>>> PFA patch to fix the issue where EPAS DB instance running with >>>>> *no-redwood-compat* mode fails to list down functions objects in >>>>> grant wizard due to 'char' -> 'int' type cast error. >>>>> >>>>> >>>>> -- >>>>> Regards, >>>>> Murtuza Zabuawala >>>>> EnterpriseDB: http://www.enterprisedb.com >>>>> The Enterprise PostgreSQL Company >>>>> >>>>> >>>> >>>> -- >>>> *Akshay Joshi* >>>> >>>> *Sr. Software Architect * >>>> >>>> >>>> >>>> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* >>>> >>> >> >> -- >> *Akshay Joshi* >> >> *Sr. Software Architect * >> >> >> >> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* >> > -- *Akshay Joshi* *Sr. Software Architect * *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2019-01-30 11:10 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-01-28 06:31 [pgAdmin4[RM#3935] Grant wizard fails to list down functions Murtuza Zabuawala <[email protected]> 2019-01-28 07:18 ` Akshay Joshi <[email protected]> 2019-01-28 09:19 ` Murtuza Zabuawala <[email protected]> 2019-01-28 11:08 ` Akshay Joshi <[email protected]> 2019-01-30 09:40 ` Murtuza Zabuawala <[email protected]> 2019-01-30 11:10 ` 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