public inbox for [email protected]help / color / mirror / Atom feed
PATCH: To fix the issue in Debugger module (pgAdmin4) 21+ messages / 3 participants [nested] [flat]
* PATCH: To fix the issue in Debugger module (pgAdmin4) @ 2016-09-26 10:09 Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Murtuza Zabuawala @ 2016-09-26 10:09 UTC (permalink / raw) To: pgadmin-hackers Hi, PFA patch to fix the issue where it was not disabling buttons after execution gets finished. RM#1227 *Issue:* If user clicks on buttons after execution is complete then it was throwing error, expected behaviour was all button should gets disabled except execute button. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM_1227.patch (2.4K, 3-RM_1227.patch) download | inline diff: diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py index f7d0e7b..ab22023 100644 --- a/web/pgadmin/tools/debugger/__init__.py +++ b/web/pgadmin/tools/debugger/__init__.py @@ -1343,8 +1343,14 @@ def poll_end_execution_result(trans_id): if conn.connected(): statusmsg = conn.status_message() status, result, col_info = conn.poll() - if status == ASYNC_OK and session['functionData'][str(trans_id)]['language'] == 'edbspl': + if status == ASYNC_OK and \ + not session['functionData'][str(trans_id)]['is_func'] and \ + session['functionData'][str(trans_id)]['language'] == 'edbspl': status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg + return make_json_response(success=1, info=gettext("Execution Completed."), data={'status': status, 'status_message': statusmsg}) if result: @@ -1354,6 +1360,10 @@ def poll_end_execution_result(trans_id): data={'status': status, 'status_message': result}) else: status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg + columns = [] # Check column info is available or not if col_info is not None and len(col_info) > 0: diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js index 7ec5e95..b6bec9d 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js @@ -405,7 +405,8 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.dbmsMessages.$elem.text(res.data.status_message); + if(res.data.status_message) + pgTools.DirectDebug.messages_panel.$container.find('.messages').val(res.data.status_message); // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> @ 2016-09-26 11:38 ` Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Dave Page @ 2016-09-26 11:38 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers Hi On Mon, Sep 26, 2016 at 11:09 AM, Murtuza Zabuawala <[email protected]> wrote: > Hi, > > PFA patch to fix the issue where it was not disabling buttons after > execution gets finished. > RM#1227 > > Issue: > If user clicks on buttons after execution is complete then it was throwing > error, expected behaviour was all button should gets disabled except execute > button. This is an improvement I think, but not complete: - The info messages are now shown, but: - Not until execution ends, which limits their usefulness for additional debugging. Not sure if that's easily changeable though. - The line breaks in messages are displaying like this: "INFO: Employee 1 not found <br>SELECT 1" - The first execution of the function worked OK, but following the second execution, I again saw: "Debugger: Step into execution error" as I stepped out of the RETURN statement on line 18. Thanks. -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> @ 2016-09-26 12:14 ` Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Murtuza Zabuawala @ 2016-09-26 12:14 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers On Mon, Sep 26, 2016 at 5:08 PM, Dave Page <[email protected]> wrote: > Hi > > On Mon, Sep 26, 2016 at 11:09 AM, Murtuza Zabuawala > <[email protected]> wrote: > > Hi, > > > > PFA patch to fix the issue where it was not disabling buttons after > > execution gets finished. > > RM#1227 > > > > Issue: > > If user clicks on buttons after execution is complete then it was > throwing > > error, expected behaviour was all button should gets disabled except > execute > > button. > > This is an improvement I think, but not complete: > > - The info messages are now shown, but: > - Not until execution ends, which limits their usefulness for > additional debugging. Not sure if that's easily changeable though. - The line breaks in messages are displaying like this: "INFO: > Employee 1 not found <br>SELECT 1" > It's showing properly on my side, Please clear browser cache & try again. > - The first execution of the function worked OK, but following the > second execution, I again saw: "Debugger: Step into execution error" > as I stepped out of the RETURN statement on line 18. > This is transient issue, so need more debugging. > > Thanks. > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> @ 2016-09-26 12:28 ` Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Murtuza Zabuawala @ 2016-09-26 12:28 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers Hi Dave, PFA updated patch to fix `<br>` tag display. Please clear cache & try again with this updated patch. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Mon, Sep 26, 2016 at 5:44 PM, Murtuza Zabuawala < [email protected]> wrote: > > > On Mon, Sep 26, 2016 at 5:08 PM, Dave Page <[email protected]> wrote: > >> Hi >> >> On Mon, Sep 26, 2016 at 11:09 AM, Murtuza Zabuawala >> <[email protected]> wrote: >> > Hi, >> > >> > PFA patch to fix the issue where it was not disabling buttons after >> > execution gets finished. >> > RM#1227 >> > >> > Issue: >> > If user clicks on buttons after execution is complete then it was >> throwing >> > error, expected behaviour was all button should gets disabled except >> execute >> > button. >> >> This is an improvement I think, but not complete: >> >> - The info messages are now shown, but: >> - Not until execution ends, which limits their usefulness for >> additional debugging. Not sure if that's easily changeable though. > > - The line breaks in messages are displaying like this: "INFO: >> Employee 1 not found <br>SELECT 1" >> > It's showing properly on my side, Please clear browser cache & try again. > >> - The first execution of the function worked OK, but following the >> second execution, I again saw: "Debugger: Step into execution error" >> as I stepped out of the RETURN statement on line 18. >> > This is transient issue, so need more debugging. > > >> >> Thanks. >> >> -- >> Dave Page >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake >> >> EnterpriseDB UK: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> > > -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM_1227_v1.patch (3.4K, 3-RM_1227_v1.patch) download | inline diff: diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py index f7d0e7b..ab22023 100644 --- a/web/pgadmin/tools/debugger/__init__.py +++ b/web/pgadmin/tools/debugger/__init__.py @@ -1343,8 +1343,14 @@ def poll_end_execution_result(trans_id): if conn.connected(): statusmsg = conn.status_message() status, result, col_info = conn.poll() - if status == ASYNC_OK and session['functionData'][str(trans_id)]['language'] == 'edbspl': + if status == ASYNC_OK and \ + not session['functionData'][str(trans_id)]['is_func'] and \ + session['functionData'][str(trans_id)]['language'] == 'edbspl': status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg + return make_json_response(success=1, info=gettext("Execution Completed."), data={'status': status, 'status_message': statusmsg}) if result: @@ -1354,6 +1360,10 @@ def poll_end_execution_result(trans_id): data={'status': status, 'status_message': result}) else: status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg + columns = [] # Check column info is available or not if col_info is not None and len(col_info) > 0: diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js index 7ec5e95..68b5589 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js @@ -405,7 +405,8 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.dbmsMessages.$elem.text(res.data.status_message); + if(res.data.status_message) + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(res.data.status_message); // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -433,7 +434,7 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(res.data.status_message); // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -467,7 +468,7 @@ define( function() { } ); - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(res.data.status_message); pgTools.DirectDebug.messages_panel.focus(); // Execution completed so disable the buttons other than "Continue/Start" button because user can still ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> @ 2016-09-26 12:54 ` Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Dave Page @ 2016-09-26 12:54 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers On Mon, Sep 26, 2016 at 1:28 PM, Murtuza Zabuawala <[email protected]> wrote: > Hi Dave, > > PFA updated patch to fix `<br>` tag display. > Please clear cache & try again with this updated patch. OK, that fixes the display issue. Regarding the error message, on this execution I noticed the following exception: 2016-09-26 13:52:48,181: INFO werkzeug: 127.0.0.1 - - [26/Sep/2016 13:52:48] "GET /debugger/poll_end_execution_result/3629301/ HTTP/1.1" 500 - Traceback (most recent call last): File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__ return self.wsgi_app(environ, start_response) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1567, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app response = self.full_dispatch_request() File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request rv = self.dispatch_request() File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view return func(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/debugger/__init__.py", line 1365, in poll_end_execution_result statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg TypeError: cannot concatenate 'str' and 'NoneType' objects -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> @ 2016-09-27 06:40 ` Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Murtuza Zabuawala @ 2016-09-27 06:40 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers Hi Dave, PFA updated patch to fix mentioned issue as well as incremental msgs updates in Messages Tab. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Mon, Sep 26, 2016 at 6:24 PM, Dave Page <[email protected]> wrote: > On Mon, Sep 26, 2016 at 1:28 PM, Murtuza Zabuawala > <[email protected]> wrote: > > Hi Dave, > > > > PFA updated patch to fix `<br>` tag display. > > Please clear cache & try again with this updated patch. > > OK, that fixes the display issue. Regarding the error message, on this > execution I noticed the following exception: > > 2016-09-26 13:52:48,181: INFO werkzeug: 127.0.0.1 - - [26/Sep/2016 > 13:52:48] "GET /debugger/poll_end_execution_result/3629301/ HTTP/1.1" > 500 - > Traceback (most recent call last): > File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site- > packages/flask/app.py", > line 2000, in __call__ > return self.wsgi_app(environ, start_response) > File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site- > packages/flask/app.py", > line 1991, in wsgi_app > response = self.make_response(self.handle_exception(e)) > File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site- > packages/flask/app.py", > line 1567, in handle_exception > reraise(exc_type, exc_value, tb) > File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site- > packages/flask/app.py", > line 1988, in wsgi_app > response = self.full_dispatch_request() > File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site- > packages/flask/app.py", > line 1641, in full_dispatch_request > rv = self.handle_user_exception(e) > File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site- > packages/flask/app.py", > line 1544, in handle_user_exception > reraise(exc_type, exc_value, tb) > File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site- > packages/flask/app.py", > line 1639, in full_dispatch_request > rv = self.dispatch_request() > File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site- > packages/flask/app.py", > line 1625, in dispatch_request > return self.view_functions[rule.endpoint](**req.view_args) > File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site- > packages/flask_login.py", > line 792, in decorated_view > return func(*args, **kwargs) > File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/debugger/__init__.py", > line 1365, in poll_end_execution_result > statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg > TypeError: cannot concatenate 'str' and 'NoneType' objects > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM_1227_v2.patch (6.7K, 3-RM_1227_v2.patch) download | inline diff: diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py index f7d0e7b..6543b13 100644 --- a/web/pgadmin/tools/debugger/__init__.py +++ b/web/pgadmin/tools/debugger/__init__.py @@ -1343,8 +1343,16 @@ def poll_end_execution_result(trans_id): if conn.connected(): statusmsg = conn.status_message() status, result, col_info = conn.poll() - if status == ASYNC_OK and session['functionData'][str(trans_id)]['language'] == 'edbspl': + if status == ASYNC_OK and \ + not session['functionData'][str(trans_id)]['is_func'] and \ + session['functionData'][str(trans_id)]['language'] == 'edbspl': status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + if statusmsg and statusmsg == 'SELECT 1': + statusmsg = '' + statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg if statusmsg is not None else '' + return make_json_response(success=1, info=gettext("Execution Completed."), data={'status': status, 'status_message': statusmsg}) if result: @@ -1354,6 +1362,12 @@ def poll_end_execution_result(trans_id): data={'status': status, 'status_message': result}) else: status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + if statusmsg and statusmsg == 'SELECT 1': + statusmsg = '' + statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg if statusmsg is not None else '' + columns = [] # Check column info is available or not if col_info is not None and len(col_info) > 0: @@ -1369,6 +1383,12 @@ def poll_end_execution_result(trans_id): 'col_info': columns, 'status_message': statusmsg}) else: status = 'Busy' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + if statusmsg and statusmsg == 'SELECT 1': + statusmsg = '' + statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg if statusmsg is not None else '' + return make_json_response(data={'status': status, 'result': result, 'status_message': statusmsg}) else: status = 'NotConnected' result = gettext('Not connected to server or connection with the server has been closed.') diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js index 452617b..babd00c 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js @@ -392,6 +392,7 @@ define( url: baseUrl, method: 'GET', success: function(res) { + var old_msgs='', new_msgs=''; if (res.data.status === 'Success') { if(res.data.result == undefined ) { /* @@ -411,7 +412,15 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.dbmsMessages.$elem.text(res.data.status_message); + if (res.data.status_message) { + old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html(); + if(old_msgs) { + new_msgs = (old_msgs + '\n' + res.data.status_message).replace(/(?:\r\n|\r|\n)/g, '<br />'); + } else { + new_msgs = res.data.status_message; + } + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs); + } // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -439,7 +448,15 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + if (res.data.status_message) { + old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html(); + if(old_msgs) { + new_msgs = (old_msgs + '\n' + res.data.status_message).replace(/(?:\r\n|\r|\n)/g, '<br />'); + } else { + new_msgs = res.data.status_message; + } + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs); + } // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -454,6 +471,16 @@ define( else if (res.data.status === 'Busy') { // If status is Busy then poll the result by recursive call to the poll function //self.poll_end_execution_result(trans_id); + // Update the message tab of the debugger + if(res.data.status_message) { + old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html(); + if(old_msgs) { + new_msgs = (old_msgs + '\n' + res.data.status_message).replace(/(?:\r\n|\r|\n)/g, '<br />'); + } else { + new_msgs = res.data.status_message; + } + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs); + } } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -473,7 +500,16 @@ define( function() { } ); - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + if (res.data.status_message) { + old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html(); + if(old_msgs) { + new_msgs = (old_msgs + '\n' + res.data.status_message).replace(/(?:\r\n|\r|\n)/g, '<br />'); + } else { + new_msgs = res.data.status_message; + } + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs); + } + pgTools.DirectDebug.messages_panel.focus(); // Execution completed so disable the buttons other than "Continue/Start" button because user can still ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> @ 2016-10-03 12:35 ` Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Dave Page @ 2016-10-03 12:35 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers Hi On Tue, Sep 27, 2016 at 7:40 AM, Murtuza Zabuawala <[email protected]> wrote: > Hi Dave, > > PFA updated patch to fix mentioned issue as well as incremental msgs updates > in Messages Tab. This doesn't seem to work well. In pgAdmin 4 I get the following: ==== SELECT 1 INFO: EMPNO ENAME INFO: ----- ------- SELECT 1 SELECT 1 SELECT 1 INFO: 7369 SMITH SELECT 1 SELECT 1 INFO: 7499 ALLEN SELECT 1 SELECT 1 INFO: 7521 WARD SELECT 1 SELECT 1 INFO: 7566 JONES SELECT 1 SELECT 1 INFO: 7654 MARTIN SELECT 1 INFO: 7698 BLAKE SELECT 1 SELECT 1 SELECT 1 INFO: 7782 CLARK SELECT 1 SELECT 1 INFO: 7788 SCOTT SELECT 1 SELECT 1 INFO: 7839 KING SELECT 1 SELECT 1 INFO: 7844 TURNER SELECT 1 SELECT 1 INFO: 7876 ADAMS SELECT 1 INFO: 7900 JAMES SELECT 1 SELECT 1 INFO: 7902 FORD SELECT 1 SELECT 1 SELECT 1 INFO: 7934 MILLER SELECT 1 SELECT 1 SELECT 1 SELECT 1 ==== Whilst in pgAdmin III I get: ==== INFO: EMPNO ENAME INFO: ----- ------- INFO: 7369 SMITH INFO: 7499 ALLEN INFO: 7521 WARD INFO: 7566 JONES INFO: 7654 MARTIN INFO: 7698 BLAKE INFO: 7782 CLARK INFO: 7788 SCOTT INFO: 7839 KING INFO: 7844 TURNER INFO: 7876 ADAMS INFO: 7900 JAMES INFO: 7902 FORD INFO: 7934 MILLER SELECT 1 ==== Sidenote: pgAdmin III uses a fixed-width font for this output which works far better than pgAdmin 4's variable width font. -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> @ 2016-10-05 12:09 ` Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Murtuza Zabuawala @ 2016-10-05 12:09 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers Hi Dave, PFA updated patch for the same. RM#1227 Please review. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Mon, Oct 3, 2016 at 6:05 PM, Dave Page <[email protected]> wrote: > Hi > > On Tue, Sep 27, 2016 at 7:40 AM, Murtuza Zabuawala > <[email protected]> wrote: > > Hi Dave, > > > > PFA updated patch to fix mentioned issue as well as incremental msgs > updates > > in Messages Tab. > > This doesn't seem to work well. In pgAdmin 4 I get the following: > > ==== > SELECT 1 > INFO: EMPNO ENAME > > > INFO: ----- ------- > > > SELECT 1 > SELECT 1 > SELECT 1 > INFO: 7369 SMITH > > > SELECT 1 > SELECT 1 > INFO: 7499 ALLEN > > > SELECT 1 > SELECT 1 > INFO: 7521 WARD > > > SELECT 1 > SELECT 1 > INFO: 7566 JONES > > > SELECT 1 > SELECT 1 > INFO: 7654 MARTIN > > > SELECT 1 > INFO: 7698 BLAKE > > > SELECT 1 > SELECT 1 > SELECT 1 > INFO: 7782 CLARK > > > SELECT 1 > SELECT 1 > INFO: 7788 SCOTT > > > SELECT 1 > SELECT 1 > INFO: 7839 KING > > > SELECT 1 > SELECT 1 > INFO: 7844 TURNER > > > SELECT 1 > SELECT 1 > INFO: 7876 ADAMS > > > SELECT 1 > INFO: 7900 JAMES > > > SELECT 1 > SELECT 1 > INFO: 7902 FORD > > > SELECT 1 > SELECT 1 > SELECT 1 > INFO: 7934 MILLER > > > SELECT 1 > SELECT 1 > SELECT 1 > SELECT 1 > ==== > > Whilst in pgAdmin III I get: > > ==== > INFO: EMPNO ENAME > INFO: ----- ------- > INFO: 7369 SMITH > INFO: 7499 ALLEN > INFO: 7521 WARD > INFO: 7566 JONES > INFO: 7654 MARTIN > INFO: 7698 BLAKE > INFO: 7782 CLARK > INFO: 7788 SCOTT > INFO: 7839 KING > INFO: 7844 TURNER > INFO: 7876 ADAMS > INFO: 7900 JAMES > INFO: 7902 FORD > INFO: 7934 MILLER > SELECT 1 > ==== > > Sidenote: pgAdmin III uses a fixed-width font for this output which > works far better than pgAdmin 4's variable width font. > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM_1227_v3.patch (6.6K, 3-RM_1227_v3.patch) download | inline diff: diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py index f7d0e7b..f9d1f36 100644 --- a/web/pgadmin/tools/debugger/__init__.py +++ b/web/pgadmin/tools/debugger/__init__.py @@ -1342,9 +1342,18 @@ def poll_end_execution_result(trans_id): if conn.connected(): statusmsg = conn.status_message() + if statusmsg and statusmsg == 'SELECT 1': + statusmsg = '' status, result, col_info = conn.poll() - if status == ASYNC_OK and session['functionData'][str(trans_id)]['language'] == 'edbspl': + if status == ASYNC_OK and \ + not session['functionData'][str(trans_id)]['is_func'] and \ + session['functionData'][str(trans_id)]['language'] == 'edbspl': status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + statusmsg = "<br>".join(additional_msgs) + "<br>" + \ + statusmsg if statusmsg is not None else '' return make_json_response(success=1, info=gettext("Execution Completed."), data={'status': status, 'status_message': statusmsg}) if result: @@ -1354,6 +1363,12 @@ def poll_end_execution_result(trans_id): data={'status': status, 'status_message': result}) else: status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + statusmsg = "<br>".join(additional_msgs) + "<br>" + \ + statusmsg if statusmsg is not None else '' + columns = [] # Check column info is available or not if col_info is not None and len(col_info) > 0: @@ -1369,6 +1384,14 @@ def poll_end_execution_result(trans_id): 'col_info': columns, 'status_message': statusmsg}) else: status = 'Busy' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + statusmsg = "<br>".join(additional_msgs) + "<br>" + \ + statusmsg if statusmsg is not None else '' + return make_json_response(data={ + 'status': status, 'result': result, 'status_message': statusmsg + }) else: status = 'NotConnected' result = gettext('Not connected to server or connection with the server has been closed.') diff --git a/web/pgadmin/tools/debugger/static/css/debugger.css b/web/pgadmin/tools/debugger/static/css/debugger.css index 4386775..e1177a8 100644 --- a/web/pgadmin/tools/debugger/static/css/debugger.css +++ b/web/pgadmin/tools/debugger/static/css/debugger.css @@ -67,3 +67,14 @@ .CodeMirror-foldgutter-folded:after { content: "\25B6"; } + +/* To make font same as Query tool in messages tab */ +.messages { + white-space: pre-wrap; + font-family: monospace; + padding-top: 5px; + padding-left: 10px; + overflow: auto; + height: 100%; + font-size: 0.925em; +} \ No newline at end of file diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js index 452617b..2e018d2 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js @@ -363,6 +363,20 @@ define( }, + // This function will update messages tab + update_messages: function(msg) { + var old_msgs='', new_msgs=''; + old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html(); + if(old_msgs) { + new_msgs = (old_msgs + '\n' + msg) + .replace(/(?:\r\n|\r|\n)/g, '<br />') // Newlines with <br> + .replace(/(<br\ ?\/?>)+/g, '<br />'); // multiple <br> with single <br> + } else { + new_msgs = msg; + } + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs); + }, + /* For the direct debugging, we need to check weather the functions execution is completed or not. After completion of the debugging, we will stop polling the result until new execution starts. @@ -411,7 +425,9 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.dbmsMessages.$elem.text(res.data.status_message); + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -439,7 +455,9 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -454,6 +472,10 @@ define( else if (res.data.status === 'Busy') { // If status is Busy then poll the result by recursive call to the poll function //self.poll_end_execution_result(trans_id); + // Update the message tab of the debugger + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -473,7 +495,11 @@ define( function() { } ); - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + // Update the message tab of the debugger + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } + pgTools.DirectDebug.messages_panel.focus(); // Execution completed so disable the buttons other than "Continue/Start" button because user can still ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> @ 2016-10-05 13:59 ` Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Dave Page @ 2016-10-05 13:59 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers OK, that's much better. I think I've figured out what's causing the remaining execution error as well - we're not disabling the buttons until we get a response from the server, so if you click too quickly, you make multiple requests at once. I tested this by adding a "SELECT pg_sleep(2);" to a loop in a function. If you can fix that as well, then I think we can call this issue fixed. Thanks! On Wed, Oct 5, 2016 at 1:09 PM, Murtuza Zabuawala <[email protected]> wrote: > Hi Dave, > > PFA updated patch for the same. > RM#1227 > > Please review. > > > -- > Regards, > Murtuza Zabuawala > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > On Mon, Oct 3, 2016 at 6:05 PM, Dave Page <[email protected]> wrote: >> >> Hi >> >> On Tue, Sep 27, 2016 at 7:40 AM, Murtuza Zabuawala >> <[email protected]> wrote: >> > Hi Dave, >> > >> > PFA updated patch to fix mentioned issue as well as incremental msgs >> > updates >> > in Messages Tab. >> >> This doesn't seem to work well. In pgAdmin 4 I get the following: >> >> ==== >> SELECT 1 >> INFO: EMPNO ENAME >> >> >> INFO: ----- ------- >> >> >> SELECT 1 >> SELECT 1 >> SELECT 1 >> INFO: 7369 SMITH >> >> >> SELECT 1 >> SELECT 1 >> INFO: 7499 ALLEN >> >> >> SELECT 1 >> SELECT 1 >> INFO: 7521 WARD >> >> >> SELECT 1 >> SELECT 1 >> INFO: 7566 JONES >> >> >> SELECT 1 >> SELECT 1 >> INFO: 7654 MARTIN >> >> >> SELECT 1 >> INFO: 7698 BLAKE >> >> >> SELECT 1 >> SELECT 1 >> SELECT 1 >> INFO: 7782 CLARK >> >> >> SELECT 1 >> SELECT 1 >> INFO: 7788 SCOTT >> >> >> SELECT 1 >> SELECT 1 >> INFO: 7839 KING >> >> >> SELECT 1 >> SELECT 1 >> INFO: 7844 TURNER >> >> >> SELECT 1 >> SELECT 1 >> INFO: 7876 ADAMS >> >> >> SELECT 1 >> INFO: 7900 JAMES >> >> >> SELECT 1 >> SELECT 1 >> INFO: 7902 FORD >> >> >> SELECT 1 >> SELECT 1 >> SELECT 1 >> INFO: 7934 MILLER >> >> >> SELECT 1 >> SELECT 1 >> SELECT 1 >> SELECT 1 >> ==== >> >> Whilst in pgAdmin III I get: >> >> ==== >> INFO: EMPNO ENAME >> INFO: ----- ------- >> INFO: 7369 SMITH >> INFO: 7499 ALLEN >> INFO: 7521 WARD >> INFO: 7566 JONES >> INFO: 7654 MARTIN >> INFO: 7698 BLAKE >> INFO: 7782 CLARK >> INFO: 7788 SCOTT >> INFO: 7839 KING >> INFO: 7844 TURNER >> INFO: 7876 ADAMS >> INFO: 7900 JAMES >> INFO: 7902 FORD >> INFO: 7934 MILLER >> SELECT 1 >> ==== >> >> Sidenote: pgAdmin III uses a fixed-width font for this output which >> works far better than pgAdmin 4's variable width font. >> >> -- >> 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 -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> @ 2016-10-06 09:05 ` Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Murtuza Zabuawala @ 2016-10-06 09:05 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers Hi Dave, PFA updated patch with suggestion given. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Wed, Oct 5, 2016 at 7:29 PM, Dave Page <[email protected]> wrote: > OK, that's much better. I think I've figured out what's causing the > remaining execution error as well - we're not disabling the buttons > until we get a response from the server, so if you click too quickly, > you make multiple requests at once. I tested this by adding a "SELECT > pg_sleep(2);" to a loop in a function. > > If you can fix that as well, then I think we can call this issue fixed. > > Thanks! > > On Wed, Oct 5, 2016 at 1:09 PM, Murtuza Zabuawala > <[email protected]> wrote: > > Hi Dave, > > > > PFA updated patch for the same. > > RM#1227 > > > > Please review. > > > > > > -- > > Regards, > > Murtuza Zabuawala > > EnterpriseDB: http://www.enterprisedb.com > > The Enterprise PostgreSQL Company > > > > On Mon, Oct 3, 2016 at 6:05 PM, Dave Page <[email protected]> wrote: > >> > >> Hi > >> > >> On Tue, Sep 27, 2016 at 7:40 AM, Murtuza Zabuawala > >> <[email protected]> wrote: > >> > Hi Dave, > >> > > >> > PFA updated patch to fix mentioned issue as well as incremental msgs > >> > updates > >> > in Messages Tab. > >> > >> This doesn't seem to work well. In pgAdmin 4 I get the following: > >> > >> ==== > >> SELECT 1 > >> INFO: EMPNO ENAME > >> > >> > >> INFO: ----- ------- > >> > >> > >> SELECT 1 > >> SELECT 1 > >> SELECT 1 > >> INFO: 7369 SMITH > >> > >> > >> SELECT 1 > >> SELECT 1 > >> INFO: 7499 ALLEN > >> > >> > >> SELECT 1 > >> SELECT 1 > >> INFO: 7521 WARD > >> > >> > >> SELECT 1 > >> SELECT 1 > >> INFO: 7566 JONES > >> > >> > >> SELECT 1 > >> SELECT 1 > >> INFO: 7654 MARTIN > >> > >> > >> SELECT 1 > >> INFO: 7698 BLAKE > >> > >> > >> SELECT 1 > >> SELECT 1 > >> SELECT 1 > >> INFO: 7782 CLARK > >> > >> > >> SELECT 1 > >> SELECT 1 > >> INFO: 7788 SCOTT > >> > >> > >> SELECT 1 > >> SELECT 1 > >> INFO: 7839 KING > >> > >> > >> SELECT 1 > >> SELECT 1 > >> INFO: 7844 TURNER > >> > >> > >> SELECT 1 > >> SELECT 1 > >> INFO: 7876 ADAMS > >> > >> > >> SELECT 1 > >> INFO: 7900 JAMES > >> > >> > >> SELECT 1 > >> SELECT 1 > >> INFO: 7902 FORD > >> > >> > >> SELECT 1 > >> SELECT 1 > >> SELECT 1 > >> INFO: 7934 MILLER > >> > >> > >> SELECT 1 > >> SELECT 1 > >> SELECT 1 > >> SELECT 1 > >> ==== > >> > >> Whilst in pgAdmin III I get: > >> > >> ==== > >> INFO: EMPNO ENAME > >> INFO: ----- ------- > >> INFO: 7369 SMITH > >> INFO: 7499 ALLEN > >> INFO: 7521 WARD > >> INFO: 7566 JONES > >> INFO: 7654 MARTIN > >> INFO: 7698 BLAKE > >> INFO: 7782 CLARK > >> INFO: 7788 SCOTT > >> INFO: 7839 KING > >> INFO: 7844 TURNER > >> INFO: 7876 ADAMS > >> INFO: 7900 JAMES > >> INFO: 7902 FORD > >> INFO: 7934 MILLER > >> SELECT 1 > >> ==== > >> > >> Sidenote: pgAdmin III uses a fixed-width font for this output which > >> works far better than pgAdmin 4's variable width font. > >> > >> -- > >> 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 > -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM_1227_v4.patch (12.6K, 3-RM_1227_v4.patch) download | inline diff: diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py index f7d0e7b..f9d1f36 100644 --- a/web/pgadmin/tools/debugger/__init__.py +++ b/web/pgadmin/tools/debugger/__init__.py @@ -1342,9 +1342,18 @@ def poll_end_execution_result(trans_id): if conn.connected(): statusmsg = conn.status_message() + if statusmsg and statusmsg == 'SELECT 1': + statusmsg = '' status, result, col_info = conn.poll() - if status == ASYNC_OK and session['functionData'][str(trans_id)]['language'] == 'edbspl': + if status == ASYNC_OK and \ + not session['functionData'][str(trans_id)]['is_func'] and \ + session['functionData'][str(trans_id)]['language'] == 'edbspl': status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + statusmsg = "<br>".join(additional_msgs) + "<br>" + \ + statusmsg if statusmsg is not None else '' return make_json_response(success=1, info=gettext("Execution Completed."), data={'status': status, 'status_message': statusmsg}) if result: @@ -1354,6 +1363,12 @@ def poll_end_execution_result(trans_id): data={'status': status, 'status_message': result}) else: status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + statusmsg = "<br>".join(additional_msgs) + "<br>" + \ + statusmsg if statusmsg is not None else '' + columns = [] # Check column info is available or not if col_info is not None and len(col_info) > 0: @@ -1369,6 +1384,14 @@ def poll_end_execution_result(trans_id): 'col_info': columns, 'status_message': statusmsg}) else: status = 'Busy' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + statusmsg = "<br>".join(additional_msgs) + "<br>" + \ + statusmsg if statusmsg is not None else '' + return make_json_response(data={ + 'status': status, 'result': result, 'status_message': statusmsg + }) else: status = 'NotConnected' result = gettext('Not connected to server or connection with the server has been closed.') diff --git a/web/pgadmin/tools/debugger/static/css/debugger.css b/web/pgadmin/tools/debugger/static/css/debugger.css index 4386775..e1177a8 100644 --- a/web/pgadmin/tools/debugger/static/css/debugger.css +++ b/web/pgadmin/tools/debugger/static/css/debugger.css @@ -67,3 +67,14 @@ .CodeMirror-foldgutter-folded:after { content: "\25B6"; } + +/* To make font same as Query tool in messages tab */ +.messages { + white-space: pre-wrap; + font-family: monospace; + padding-top: 5px; + padding-left: 10px; + overflow: auto; + height: 100%; + font-size: 0.925em; +} \ No newline at end of file diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js index 452617b..478fcff 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js @@ -363,6 +363,20 @@ define( }, + // This function will update messages tab + update_messages: function(msg) { + var old_msgs='', new_msgs=''; + old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html(); + if(old_msgs) { + new_msgs = (old_msgs + '\n' + msg) + .replace(/(?:\r\n|\r|\n)/g, '<br />') // Newlines with <br> + .replace(/(<br\ ?\/?>)+/g, '<br />'); // multiple <br> with single <br> + } else { + new_msgs = msg; + } + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs); + }, + /* For the direct debugging, we need to check weather the functions execution is completed or not. After completion of the debugging, we will stop polling the result until new execution starts. @@ -411,7 +425,9 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.dbmsMessages.$elem.text(res.data.status_message); + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -420,6 +436,7 @@ define( self.enable('step_into', false); self.enable('toggle_breakpoint', false); self.enable('clear_all_breakpoints', false); + self.enable('continue', true); } else { // Call function to create and update local variables .... @@ -439,7 +456,9 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -448,12 +467,17 @@ define( self.enable('step_into', false); self.enable('toggle_breakpoint', false); self.enable('clear_all_breakpoints', false); + self.enable('continue', true); } } } else if (res.data.status === 'Busy') { // If status is Busy then poll the result by recursive call to the poll function //self.poll_end_execution_result(trans_id); + // Update the message tab of the debugger + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -473,7 +497,11 @@ define( function() { } ); - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + // Update the message tab of the debugger + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } + pgTools.DirectDebug.messages_panel.focus(); // Execution completed so disable the buttons other than "Continue/Start" button because user can still @@ -498,7 +526,15 @@ define( Restart: function(trans_id) { - var baseUrl = "{{ url_for('debugger.index') }}" + "restart/" + trans_id; + var self = this, + baseUrl = "{{ url_for('debugger.index') }}" + "restart/" + trans_id; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); + $.ajax({ url: baseUrl, @@ -546,6 +582,12 @@ define( // Continue the execution until the next breakpoint Continue: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); //Check first if previous execution was completed or not if (pgTools.DirectDebug.direct_execution_completed && @@ -583,6 +625,12 @@ define( Step_over: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); // Make ajax call to listen the database message var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "step_over"; @@ -613,6 +661,12 @@ define( Step_into: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); // Make ajax call to listen the database message var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "step_into"; @@ -643,6 +697,12 @@ define( Stop: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); // Make ajax call to listen the database message var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "abort_target"; @@ -665,12 +725,8 @@ define( ); //Disable the buttons other than continue button. If user wants to again then it should allow to debug again... - self.enable('stop', false); - self.enable('step_over', false); - self.enable('step_into', false); - self.enable('continue', false); - self.enable('toggle_breakpoint', false); - self.enable('clear_all_breakpoints', false); + self.enable('continue', true); + } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -688,6 +744,13 @@ define( toggle_breakpoint: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); + var info = pgTools.DirectDebug.editor.lineInfo(self.active_line_no); var baseUrl = ''; @@ -720,6 +783,12 @@ define( return marker; }()); } + self.enable('stop', true); + self.enable('step_over', true); + self.enable('step_into', true); + self.enable('toggle_breakpoint', true); + self.enable('clear_all_breakpoints', true); + self.enable('continue', true); } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -736,14 +805,20 @@ define( }, clear_all_breakpoint: function(trans_id) { - var self = this; - - var br_list = self.GetBreakpointInformation(trans_id); + var self = this, + br_list = self.GetBreakpointInformation(trans_id); // If there is no break point to clear then we should return from here. if ((br_list.length == 1) && (br_list[0].linenumber == -1)) return; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); + var breakpoint_list = new Array(); for (i = 0; i < br_list.length; i++) { @@ -771,6 +846,12 @@ define( } } } + self.enable('stop', true); + self.enable('step_over', true); + self.enable('step_into', true); + self.enable('toggle_breakpoint', true); + self.enable('clear_all_breakpoints', true); + self.enable('continue', true); }, error: function(e) { Alertify.alert( ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> @ 2016-10-07 10:46 ` Dave Page <[email protected]> 2016-10-07 11:42 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Dave Page @ 2016-10-07 10:46 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers Hi It still seems buggy. I started debugging list_emp() from our sample DB, and just hit Step Into a few times randomly. It got as far as the pg_sleep call I added, then never returned so I couldn't proceed. See attached screenshot. On Thu, Oct 6, 2016 at 10:05 AM, Murtuza Zabuawala <[email protected]> wrote: > Hi Dave, > > PFA updated patch with suggestion given. > > -- > Regards, > Murtuza Zabuawala > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > On Wed, Oct 5, 2016 at 7:29 PM, Dave Page <[email protected]> wrote: >> >> OK, that's much better. I think I've figured out what's causing the >> remaining execution error as well - we're not disabling the buttons >> until we get a response from the server, so if you click too quickly, >> you make multiple requests at once. I tested this by adding a "SELECT >> pg_sleep(2);" to a loop in a function. >> >> If you can fix that as well, then I think we can call this issue fixed. >> >> Thanks! >> >> On Wed, Oct 5, 2016 at 1:09 PM, Murtuza Zabuawala >> <[email protected]> wrote: >> > Hi Dave, >> > >> > PFA updated patch for the same. >> > RM#1227 >> > >> > Please review. >> > >> > >> > -- >> > Regards, >> > Murtuza Zabuawala >> > EnterpriseDB: http://www.enterprisedb.com >> > The Enterprise PostgreSQL Company >> > >> > On Mon, Oct 3, 2016 at 6:05 PM, Dave Page <[email protected]> wrote: >> >> >> >> Hi >> >> >> >> On Tue, Sep 27, 2016 at 7:40 AM, Murtuza Zabuawala >> >> <[email protected]> wrote: >> >> > Hi Dave, >> >> > >> >> > PFA updated patch to fix mentioned issue as well as incremental msgs >> >> > updates >> >> > in Messages Tab. >> >> >> >> This doesn't seem to work well. In pgAdmin 4 I get the following: >> >> >> >> ==== >> >> SELECT 1 >> >> INFO: EMPNO ENAME >> >> >> >> >> >> INFO: ----- ------- >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7369 SMITH >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7499 ALLEN >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7521 WARD >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7566 JONES >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7654 MARTIN >> >> >> >> >> >> SELECT 1 >> >> INFO: 7698 BLAKE >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7782 CLARK >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7788 SCOTT >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7839 KING >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7844 TURNER >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7876 ADAMS >> >> >> >> >> >> SELECT 1 >> >> INFO: 7900 JAMES >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7902 FORD >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> SELECT 1 >> >> INFO: 7934 MILLER >> >> >> >> >> >> SELECT 1 >> >> SELECT 1 >> >> SELECT 1 >> >> SELECT 1 >> >> ==== >> >> >> >> Whilst in pgAdmin III I get: >> >> >> >> ==== >> >> INFO: EMPNO ENAME >> >> INFO: ----- ------- >> >> INFO: 7369 SMITH >> >> INFO: 7499 ALLEN >> >> INFO: 7521 WARD >> >> INFO: 7566 JONES >> >> INFO: 7654 MARTIN >> >> INFO: 7698 BLAKE >> >> INFO: 7782 CLARK >> >> INFO: 7788 SCOTT >> >> INFO: 7839 KING >> >> INFO: 7844 TURNER >> >> INFO: 7876 ADAMS >> >> INFO: 7900 JAMES >> >> INFO: 7902 FORD >> >> INFO: 7934 MILLER >> >> SELECT 1 >> >> ==== >> >> >> >> Sidenote: pgAdmin III uses a fixed-width font for this output which >> >> works far better than pgAdmin 4's variable width font. >> >> >> >> -- >> >> 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 > > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [image/png] Screen Shot 2016-10-07 at 11.44.34.png (218.7K, 2-Screen%20Shot%202016-10-07%20at%2011.44.34.png) download | view image ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> @ 2016-10-07 11:42 ` Murtuza Zabuawala <[email protected]> 2016-10-07 11:53 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Murtuza Zabuawala @ 2016-10-07 11:42 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers Hi Dave, I faced the same issue when I initially tried that, but then as per Neel suggestion I changed SELECT pg_sleep() to PERFORM pg_sleep() in function. You will face the same in pgAdmin3 if you use select pg_sleep() in your function the debug call never returns from DB server. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Fri, Oct 7, 2016 at 4:16 PM, Dave Page <[email protected]> wrote: > Hi > > It still seems buggy. I started debugging list_emp() from our sample > DB, and just hit Step Into a few times randomly. It got as far as the > pg_sleep call I added, then never returned so I couldn't proceed. See > attached screenshot. > > > On Thu, Oct 6, 2016 at 10:05 AM, Murtuza Zabuawala > <[email protected]> wrote: > > Hi Dave, > > > > PFA updated patch with suggestion given. > > > > -- > > Regards, > > Murtuza Zabuawala > > EnterpriseDB: http://www.enterprisedb.com > > The Enterprise PostgreSQL Company > > > > On Wed, Oct 5, 2016 at 7:29 PM, Dave Page <[email protected]> wrote: > >> > >> OK, that's much better. I think I've figured out what's causing the > >> remaining execution error as well - we're not disabling the buttons > >> until we get a response from the server, so if you click too quickly, > >> you make multiple requests at once. I tested this by adding a "SELECT > >> pg_sleep(2);" to a loop in a function. > >> > >> If you can fix that as well, then I think we can call this issue fixed. > >> > >> Thanks! > >> > >> On Wed, Oct 5, 2016 at 1:09 PM, Murtuza Zabuawala > >> <[email protected]> wrote: > >> > Hi Dave, > >> > > >> > PFA updated patch for the same. > >> > RM#1227 > >> > > >> > Please review. > >> > > >> > > >> > -- > >> > Regards, > >> > Murtuza Zabuawala > >> > EnterpriseDB: http://www.enterprisedb.com > >> > The Enterprise PostgreSQL Company > >> > > >> > On Mon, Oct 3, 2016 at 6:05 PM, Dave Page <[email protected]> wrote: > >> >> > >> >> Hi > >> >> > >> >> On Tue, Sep 27, 2016 at 7:40 AM, Murtuza Zabuawala > >> >> <[email protected]> wrote: > >> >> > Hi Dave, > >> >> > > >> >> > PFA updated patch to fix mentioned issue as well as incremental > msgs > >> >> > updates > >> >> > in Messages Tab. > >> >> > >> >> This doesn't seem to work well. In pgAdmin 4 I get the following: > >> >> > >> >> ==== > >> >> SELECT 1 > >> >> INFO: EMPNO ENAME > >> >> > >> >> > >> >> INFO: ----- ------- > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7369 SMITH > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7499 ALLEN > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7521 WARD > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7566 JONES > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7654 MARTIN > >> >> > >> >> > >> >> SELECT 1 > >> >> INFO: 7698 BLAKE > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7782 CLARK > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7788 SCOTT > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7839 KING > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7844 TURNER > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7876 ADAMS > >> >> > >> >> > >> >> SELECT 1 > >> >> INFO: 7900 JAMES > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7902 FORD > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> SELECT 1 > >> >> INFO: 7934 MILLER > >> >> > >> >> > >> >> SELECT 1 > >> >> SELECT 1 > >> >> SELECT 1 > >> >> SELECT 1 > >> >> ==== > >> >> > >> >> Whilst in pgAdmin III I get: > >> >> > >> >> ==== > >> >> INFO: EMPNO ENAME > >> >> INFO: ----- ------- > >> >> INFO: 7369 SMITH > >> >> INFO: 7499 ALLEN > >> >> INFO: 7521 WARD > >> >> INFO: 7566 JONES > >> >> INFO: 7654 MARTIN > >> >> INFO: 7698 BLAKE > >> >> INFO: 7782 CLARK > >> >> INFO: 7788 SCOTT > >> >> INFO: 7839 KING > >> >> INFO: 7844 TURNER > >> >> INFO: 7876 ADAMS > >> >> INFO: 7900 JAMES > >> >> INFO: 7902 FORD > >> >> INFO: 7934 MILLER > >> >> SELECT 1 > >> >> ==== > >> >> > >> >> Sidenote: pgAdmin III uses a fixed-width font for this output which > >> >> works far better than pgAdmin 4's variable width font. > >> >> > >> >> -- > >> >> 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 > > > > > > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 11:42 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> @ 2016-10-07 11:53 ` Dave Page <[email protected]> 2016-10-07 12:02 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Dave Page @ 2016-10-07 11:53 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers On Fri, Oct 7, 2016 at 12:42 PM, Murtuza Zabuawala <[email protected]> wrote: > Hi Dave, > > I faced the same issue when I initially tried that, but then as per Neel > suggestion I changed SELECT pg_sleep() to PERFORM pg_sleep() in function. > You will face the same in pgAdmin3 if you use select pg_sleep() in your > function the debug call never returns from DB server. In which case, doesn't that imply the debugger is missing critical debug info? If I run the query in the query tool, I get: ==== INFO: EMPNO ENAME INFO: ----- ------- ERROR: query has no destination for result data HINT: If you want to discard the results of a SELECT, use PERFORM instead. CONTEXT: PL/pgSQL function list_emp() line 11 at SQL statement Query returned successfully in 2 secs. ==== It seems to me that the debugger should be able to give the same error. Regardless of that, I'll test with PERFORM. Thanks. -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 11:42 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 11:53 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> @ 2016-10-07 12:02 ` Dave Page <[email protected]> 2016-10-20 08:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Dave Page @ 2016-10-07 12:02 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers On Fri, Oct 7, 2016 at 12:53 PM, Dave Page <[email protected]> wrote: > On Fri, Oct 7, 2016 at 12:42 PM, Murtuza Zabuawala > <[email protected]> wrote: >> Hi Dave, >> >> I faced the same issue when I initially tried that, but then as per Neel >> suggestion I changed SELECT pg_sleep() to PERFORM pg_sleep() in function. >> You will face the same in pgAdmin3 if you use select pg_sleep() in your >> function the debug call never returns from DB server. > > In which case, doesn't that imply the debugger is missing critical > debug info? If I run the query in the query tool, I get: > > ==== > INFO: EMPNO ENAME > INFO: ----- ------- > ERROR: query has no destination for result data > HINT: If you want to discard the results of a SELECT, use PERFORM instead. > CONTEXT: PL/pgSQL function list_emp() line 11 at SQL statement > > > Query returned successfully in 2 secs. > ==== > > It seems to me that the debugger should be able to give the same error. > > Regardless of that, I'll test with PERFORM. Which I just did - and whilst it seemed to be fine when stepping through, after a few iterations I hit the continue button, at which point it froze again on "PERFORM pg_sleep(2)", didn't print any more of the 14 names in the emp table, and didn't return :-( -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 11:42 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 11:53 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 12:02 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> @ 2016-10-20 08:14 ` Murtuza Zabuawala <[email protected]> 2016-10-21 11:18 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Murtuza Zabuawala @ 2016-10-20 08:14 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers Hi Dave, PFA updated patch for the same. *Issue:* We were not properly fetching result from server in case of direct debugging when we restart debugging of same object. Thanks to Neel for helping in this issue. Please review. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Fri, Oct 7, 2016 at 5:32 PM, Dave Page <[email protected]> wrote: > On Fri, Oct 7, 2016 at 12:53 PM, Dave Page <[email protected]> wrote: > > On Fri, Oct 7, 2016 at 12:42 PM, Murtuza Zabuawala > > <[email protected]> wrote: > >> Hi Dave, > >> > >> I faced the same issue when I initially tried that, but then as per Neel > >> suggestion I changed SELECT pg_sleep() to PERFORM pg_sleep() in > function. > >> You will face the same in pgAdmin3 if you use select pg_sleep() in your > >> function the debug call never returns from DB server. > > > > In which case, doesn't that imply the debugger is missing critical > > debug info? If I run the query in the query tool, I get: > > > > ==== > > INFO: EMPNO ENAME > > INFO: ----- ------- > > ERROR: query has no destination for result data > > HINT: If you want to discard the results of a SELECT, use PERFORM > instead. > > CONTEXT: PL/pgSQL function list_emp() line 11 at SQL statement > > > > > > Query returned successfully in 2 secs. > > ==== > > > > It seems to me that the debugger should be able to give the same error. > > > > Regardless of that, I'll test with PERFORM. > > Which I just did - and whilst it seemed to be fine when stepping > through, after a few iterations I hit the continue button, at which > point it froze again on "PERFORM pg_sleep(2)", didn't print any more > of the 14 names in the emp table, and didn't return :-( > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM_1227_v7.patch (16.0K, 3-RM_1227_v7.patch) download | inline diff: diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py index 7d83ecb..ce36c6f 100644 --- a/web/pgadmin/tools/debugger/__init__.py +++ b/web/pgadmin/tools/debugger/__init__.py @@ -1354,9 +1354,18 @@ def poll_end_execution_result(trans_id): if conn.connected(): statusmsg = conn.status_message() + if statusmsg and statusmsg == 'SELECT 1': + statusmsg = '' status, result, col_info = conn.poll() - if status == ASYNC_OK and session['functionData'][str(trans_id)]['language'] == 'edbspl': + if status == ASYNC_OK and \ + not session['functionData'][str(trans_id)]['is_func'] and \ + session['functionData'][str(trans_id)]['language'] == 'edbspl': status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + statusmsg = "<br>".join(additional_msgs) + "<br>" + \ + statusmsg if statusmsg is not None else '' return make_json_response(success=1, info=gettext("Execution Completed."), data={'status': status, 'status_message': statusmsg}) if result: @@ -1366,6 +1375,12 @@ def poll_end_execution_result(trans_id): data={'status': status, 'status_message': result}) else: status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + statusmsg = "<br>".join(additional_msgs) + "<br>" + \ + statusmsg if statusmsg is not None else '' + columns = [] # Check column info is available or not if col_info is not None and len(col_info) > 0: @@ -1381,6 +1396,14 @@ def poll_end_execution_result(trans_id): 'col_info': columns, 'status_message': statusmsg}) else: status = 'Busy' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + statusmsg = "<br>".join(additional_msgs) + "<br>" + \ + statusmsg if statusmsg is not None else '' + return make_json_response(data={ + 'status': status, 'result': result, 'status_message': statusmsg + }) else: status = 'NotConnected' result = gettext('Not connected to server or connection with the server has been closed.') diff --git a/web/pgadmin/tools/debugger/static/css/debugger.css b/web/pgadmin/tools/debugger/static/css/debugger.css index 4386775..e1177a8 100644 --- a/web/pgadmin/tools/debugger/static/css/debugger.css +++ b/web/pgadmin/tools/debugger/static/css/debugger.css @@ -67,3 +67,14 @@ .CodeMirror-foldgutter-folded:after { content: "\25B6"; } + +/* To make font same as Query tool in messages tab */ +.messages { + white-space: pre-wrap; + font-family: monospace; + padding-top: 5px; + padding-left: 10px; + overflow: auto; + height: 100%; + font-size: 0.925em; +} \ No newline at end of file diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js index 452617b..6ff88c5 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js @@ -164,6 +164,9 @@ define( // Call function to create and update local variables .... self.GetStackInformation(trans_id); + if (pgTools.DirectDebug.debug_type) { + self.poll_end_execution_result(trans_id); + } } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -194,6 +197,13 @@ define( // Call function to create and update local variables self.AddLocalVariables(res.data.result); self.AddParameters(res.data.result); + // If debug function is restarted then again start listener to read the updated messages. + if (pgTools.DirectDebug.debug_restarted) { + if (pgTools.DirectDebug.debug_type) { + self.poll_end_execution_result(trans_id); + } + pgTools.DirectDebug.debug_restarted = false; + } } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -363,6 +373,20 @@ define( }, + // This function will update messages tab + update_messages: function(msg) { + var old_msgs='', new_msgs=''; + old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html(); + if(old_msgs) { + new_msgs = (old_msgs + '\n' + msg) + .replace(/(?:\r\n|\r|\n)/g, '<br />') // Newlines with <br> + .replace(/(<br\ ?\/?>)+/g, '<br />'); // multiple <br> with single <br> + } else { + new_msgs = msg; + } + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs); + }, + /* For the direct debugging, we need to check weather the functions execution is completed or not. After completion of the debugging, we will stop polling the result until new execution starts. @@ -411,7 +435,9 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.dbmsMessages.$elem.text(res.data.status_message); + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -420,6 +446,7 @@ define( self.enable('step_into', false); self.enable('toggle_breakpoint', false); self.enable('clear_all_breakpoints', false); + self.enable('continue', true); } else { // Call function to create and update local variables .... @@ -439,7 +466,9 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -448,12 +477,17 @@ define( self.enable('step_into', false); self.enable('toggle_breakpoint', false); self.enable('clear_all_breakpoints', false); + self.enable('continue', true); } } } else if (res.data.status === 'Busy') { // If status is Busy then poll the result by recursive call to the poll function - //self.poll_end_execution_result(trans_id); + self.poll_end_execution_result(trans_id); + // Update the message tab of the debugger + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -473,7 +507,11 @@ define( function() { } ); - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + // Update the message tab of the debugger + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } + pgTools.DirectDebug.messages_panel.focus(); // Execution completed so disable the buttons other than "Continue/Start" button because user can still @@ -483,6 +521,7 @@ define( self.enable('step_into', false); self.enable('toggle_breakpoint', false); self.enable('clear_all_breakpoints', false); + self.enable('continue', true); } }, error: function(e) { @@ -498,13 +537,24 @@ define( Restart: function(trans_id) { - var baseUrl = "{{ url_for('debugger.index') }}" + "restart/" + trans_id; + var self = this, + baseUrl = "{{ url_for('debugger.index') }}" + "restart/" + trans_id; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); + $.ajax({ url: baseUrl, success: function(res) { // Restart the same function debugging with previous arguments var restart_dbg = res.data.restart_debug ? 1 : 0; + if (restart_dbg) { + pgTools.DirectDebug.debug_restarted = true; + } /* Need to check if restart debugging really require to open the input dialog ? @@ -522,6 +572,9 @@ define( url: baseUrl, method: 'GET', success: function(res) { + if (pgTools.DirectDebug.debug_type) { + self.poll_end_execution_result(trans_id); + } }, error: function(e) { Alertify.alert( @@ -546,6 +599,12 @@ define( // Continue the execution until the next breakpoint Continue: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); //Check first if previous execution was completed or not if (pgTools.DirectDebug.direct_execution_completed && @@ -562,9 +621,6 @@ define( success: function(res) { if (res.data.status) { self.poll_result(trans_id); - if (pgTools.DirectDebug.debug_type) { - self.poll_end_execution_result(trans_id); - } } else { Alertify.alert( @@ -583,6 +639,12 @@ define( Step_over: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); // Make ajax call to listen the database message var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "step_over"; @@ -593,9 +655,6 @@ define( success: function(res) { if (res.data.status) { self.poll_result(trans_id); - if (pgTools.DirectDebug.debug_type) { - self.poll_end_execution_result(trans_id); - } } else { Alertify.alert( @@ -613,6 +672,12 @@ define( Step_into: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); // Make ajax call to listen the database message var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "step_into"; @@ -623,9 +688,6 @@ define( success: function(res) { if (res.data.status) { self.poll_result(trans_id); - if (pgTools.DirectDebug.debug_type) { - self.poll_end_execution_result(trans_id); - } } else { Alertify.alert( @@ -643,6 +705,12 @@ define( Stop: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); // Make ajax call to listen the database message var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "abort_target"; @@ -665,12 +733,8 @@ define( ); //Disable the buttons other than continue button. If user wants to again then it should allow to debug again... - self.enable('stop', false); - self.enable('step_over', false); - self.enable('step_into', false); - self.enable('continue', false); - self.enable('toggle_breakpoint', false); - self.enable('clear_all_breakpoints', false); + self.enable('continue', true); + } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -688,6 +752,13 @@ define( toggle_breakpoint: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); + var info = pgTools.DirectDebug.editor.lineInfo(self.active_line_no); var baseUrl = ''; @@ -720,6 +791,12 @@ define( return marker; }()); } + self.enable('stop', true); + self.enable('step_over', true); + self.enable('step_into', true); + self.enable('toggle_breakpoint', true); + self.enable('clear_all_breakpoints', true); + self.enable('continue', true); } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -736,14 +813,20 @@ define( }, clear_all_breakpoint: function(trans_id) { - var self = this; - - var br_list = self.GetBreakpointInformation(trans_id); + var self = this, + br_list = self.GetBreakpointInformation(trans_id); // If there is no break point to clear then we should return from here. if ((br_list.length == 1) && (br_list[0].linenumber == -1)) return; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); + var breakpoint_list = new Array(); for (i = 0; i < br_list.length; i++) { @@ -771,6 +854,12 @@ define( } } } + self.enable('stop', true); + self.enable('step_over', true); + self.enable('step_into', true); + self.enable('toggle_breakpoint', true); + self.enable('clear_all_breakpoints', true); + self.enable('continue', true); }, error: function(e) { Alertify.alert( @@ -1204,6 +1293,7 @@ define( this.first_time_indirect_debug = false; this.direct_execution_completed = false; this.polling_timeout_idle = false; + this.debug_restarted = false; var docker = this.docker = new wcDocker( '#container', { ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 11:42 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 11:53 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 12:02 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-20 08:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> @ 2016-10-21 11:18 ` Dave Page <[email protected]> 2016-10-21 11:32 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Neel Patel <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Dave Page @ 2016-10-21 11:18 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers Hi There are still issues I'm afraid: - When execution stops, we seem to keep polling for more results indefinitely. - When executing for a second time, the messages tab isn't cleared, and new messages don't seem to be appended to it either. I would expect the tab to be cleared. On Thu, Oct 20, 2016 at 9:14 AM, Murtuza Zabuawala <[email protected]> wrote: > Hi Dave, > > PFA updated patch for the same. > > Issue: > We were not properly fetching result from server in case of direct debugging > when we restart debugging of same object. > > Thanks to Neel for helping in this issue. > > Please review. > > -- > Regards, > Murtuza Zabuawala > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > On Fri, Oct 7, 2016 at 5:32 PM, Dave Page <[email protected]> wrote: >> >> On Fri, Oct 7, 2016 at 12:53 PM, Dave Page <[email protected]> wrote: >> > On Fri, Oct 7, 2016 at 12:42 PM, Murtuza Zabuawala >> > <[email protected]> wrote: >> >> Hi Dave, >> >> >> >> I faced the same issue when I initially tried that, but then as per >> >> Neel >> >> suggestion I changed SELECT pg_sleep() to PERFORM pg_sleep() in >> >> function. >> >> You will face the same in pgAdmin3 if you use select pg_sleep() in your >> >> function the debug call never returns from DB server. >> > >> > In which case, doesn't that imply the debugger is missing critical >> > debug info? If I run the query in the query tool, I get: >> > >> > ==== >> > INFO: EMPNO ENAME >> > INFO: ----- ------- >> > ERROR: query has no destination for result data >> > HINT: If you want to discard the results of a SELECT, use PERFORM >> > instead. >> > CONTEXT: PL/pgSQL function list_emp() line 11 at SQL statement >> > >> > >> > Query returned successfully in 2 secs. >> > ==== >> > >> > It seems to me that the debugger should be able to give the same error. >> > >> > Regardless of that, I'll test with PERFORM. >> >> Which I just did - and whilst it seemed to be fine when stepping >> through, after a few iterations I hit the continue button, at which >> point it froze again on "PERFORM pg_sleep(2)", didn't print any more >> of the 14 names in the emp table, and didn't return :-( >> >> -- >> 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 -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 11:42 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 11:53 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 12:02 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-20 08:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-21 11:18 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> @ 2016-10-21 11:32 ` Neel Patel <[email protected]> 2016-10-21 11:33 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Neel Patel @ 2016-10-21 11:32 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: Murtuza Zabuawala <[email protected]>; pgadmin-hackers Hi, On Fri, Oct 21, 2016 at 4:48 PM, Dave Page <[email protected]> wrote: > Hi > > There are still issues I'm afraid: > > - When execution stops, we seem to keep polling for more results > indefinitely. > Do you mean after completion of first successful debugging ? If yes, we are polling because user can start same function for debugging again and we have to listen for the result set for that session. > > - When executing for a second time, the messages tab isn't cleared, > and new messages don't seem to be appended to it either. I would > expect the tab to be cleared. > Ok. We will fix this issue. > > On Thu, Oct 20, 2016 at 9:14 AM, Murtuza Zabuawala > <[email protected]> wrote: > > Hi Dave, > > > > PFA updated patch for the same. > > > > Issue: > > We were not properly fetching result from server in case of direct > debugging > > when we restart debugging of same object. > > > > Thanks to Neel for helping in this issue. > > > > Please review. > > > > -- > > Regards, > > Murtuza Zabuawala > > EnterpriseDB: http://www.enterprisedb.com > > The Enterprise PostgreSQL Company > > > > On Fri, Oct 7, 2016 at 5:32 PM, Dave Page <[email protected]> wrote: > >> > >> On Fri, Oct 7, 2016 at 12:53 PM, Dave Page <[email protected]> wrote: > >> > On Fri, Oct 7, 2016 at 12:42 PM, Murtuza Zabuawala > >> > <[email protected]> wrote: > >> >> Hi Dave, > >> >> > >> >> I faced the same issue when I initially tried that, but then as per > >> >> Neel > >> >> suggestion I changed SELECT pg_sleep() to PERFORM pg_sleep() in > >> >> function. > >> >> You will face the same in pgAdmin3 if you use select pg_sleep() in > your > >> >> function the debug call never returns from DB server. > >> > > >> > In which case, doesn't that imply the debugger is missing critical > >> > debug info? If I run the query in the query tool, I get: > >> > > >> > ==== > >> > INFO: EMPNO ENAME > >> > INFO: ----- ------- > >> > ERROR: query has no destination for result data > >> > HINT: If you want to discard the results of a SELECT, use PERFORM > >> > instead. > >> > CONTEXT: PL/pgSQL function list_emp() line 11 at SQL statement > >> > > >> > > >> > Query returned successfully in 2 secs. > >> > ==== > >> > > >> > It seems to me that the debugger should be able to give the same > error. > >> > > >> > Regardless of that, I'll test with PERFORM. > >> > >> Which I just did - and whilst it seemed to be fine when stepping > >> through, after a few iterations I hit the continue button, at which > >> point it froze again on "PERFORM pg_sleep(2)", didn't print any more > >> of the 14 names in the emp table, and didn't return :-( > >> > >> -- > >> 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 > > > -- > Sent via pgadmin-hackers mailing list ([email protected]) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgadmin-hackers > ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 11:42 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 11:53 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 12:02 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-20 08:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-21 11:18 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-21 11:32 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Neel Patel <[email protected]> @ 2016-10-21 11:33 ` Dave Page <[email protected]> 2016-10-21 12:27 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Neel Patel <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Dave Page @ 2016-10-21 11:33 UTC (permalink / raw) To: Neel Patel <[email protected]>; +Cc: Murtuza Zabuawala <[email protected]>; pgadmin-hackers Hi On Fri, Oct 21, 2016 at 12:32 PM, Neel Patel <[email protected]> wrote: > Hi, > > > On Fri, Oct 21, 2016 at 4:48 PM, Dave Page <[email protected]> wrote: >> >> Hi >> >> There are still issues I'm afraid: >> >> - When execution stops, we seem to keep polling for more results >> indefinitely. > > Do you mean after completion of first successful debugging ? > If yes, we are polling because user can start same function for debugging > again and we have to listen for the result set for that session. Yes (or the second). But shouldn't we stop polling until debugging is restarted? >> >> >> - When executing for a second time, the messages tab isn't cleared, >> and new messages don't seem to be appended to it either. I would >> expect the tab to be cleared. > > > Ok. We will fix this issue. >> >> >> On Thu, Oct 20, 2016 at 9:14 AM, Murtuza Zabuawala >> <[email protected]> wrote: >> > Hi Dave, >> > >> > PFA updated patch for the same. >> > >> > Issue: >> > We were not properly fetching result from server in case of direct >> > debugging >> > when we restart debugging of same object. >> > >> > Thanks to Neel for helping in this issue. >> > >> > Please review. >> > >> > -- >> > Regards, >> > Murtuza Zabuawala >> > EnterpriseDB: http://www.enterprisedb.com >> > The Enterprise PostgreSQL Company >> > >> > On Fri, Oct 7, 2016 at 5:32 PM, Dave Page <[email protected]> wrote: >> >> >> >> On Fri, Oct 7, 2016 at 12:53 PM, Dave Page <[email protected]> wrote: >> >> > On Fri, Oct 7, 2016 at 12:42 PM, Murtuza Zabuawala >> >> > <[email protected]> wrote: >> >> >> Hi Dave, >> >> >> >> >> >> I faced the same issue when I initially tried that, but then as per >> >> >> Neel >> >> >> suggestion I changed SELECT pg_sleep() to PERFORM pg_sleep() in >> >> >> function. >> >> >> You will face the same in pgAdmin3 if you use select pg_sleep() in >> >> >> your >> >> >> function the debug call never returns from DB server. >> >> > >> >> > In which case, doesn't that imply the debugger is missing critical >> >> > debug info? If I run the query in the query tool, I get: >> >> > >> >> > ==== >> >> > INFO: EMPNO ENAME >> >> > INFO: ----- ------- >> >> > ERROR: query has no destination for result data >> >> > HINT: If you want to discard the results of a SELECT, use PERFORM >> >> > instead. >> >> > CONTEXT: PL/pgSQL function list_emp() line 11 at SQL statement >> >> > >> >> > >> >> > Query returned successfully in 2 secs. >> >> > ==== >> >> > >> >> > It seems to me that the debugger should be able to give the same >> >> > error. >> >> > >> >> > Regardless of that, I'll test with PERFORM. >> >> >> >> Which I just did - and whilst it seemed to be fine when stepping >> >> through, after a few iterations I hit the continue button, at which >> >> point it froze again on "PERFORM pg_sleep(2)", didn't print any more >> >> of the 14 names in the emp table, and didn't return :-( >> >> >> >> -- >> >> 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 >> >> >> -- >> Sent via pgadmin-hackers mailing list ([email protected]) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgadmin-hackers > > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 11:42 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 11:53 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 12:02 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-20 08:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-21 11:18 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-21 11:32 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Neel Patel <[email protected]> 2016-10-21 11:33 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> @ 2016-10-21 12:27 ` Neel Patel <[email protected]> 2016-11-11 12:02 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Neel Patel @ 2016-10-21 12:27 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: Murtuza Zabuawala <[email protected]>; pgadmin-hackers Hi, On Fri, Oct 21, 2016 at 5:03 PM, Dave Page <[email protected]> wrote: > Hi > > On Fri, Oct 21, 2016 at 12:32 PM, Neel Patel > <[email protected]> wrote: > > Hi, > > > > > > On Fri, Oct 21, 2016 at 4:48 PM, Dave Page <[email protected]> wrote: > >> > >> Hi > >> > >> There are still issues I'm afraid: > >> > >> - When execution stops, we seem to keep polling for more results > >> indefinitely. > > > > Do you mean after completion of first successful debugging ? > > If yes, we are polling because user can start same function for debugging > > again and we have to listen for the result set for that session. > > Yes (or the second). But shouldn't we stop polling until debugging is > restarted? > I think yes, that can be done. > > >> > >> > >> - When executing for a second time, the messages tab isn't cleared, > >> and new messages don't seem to be appended to it either. I would > >> expect the tab to be cleared. > > > > > > Ok. We will fix this issue. > >> > >> > >> On Thu, Oct 20, 2016 at 9:14 AM, Murtuza Zabuawala > >> <[email protected]> wrote: > >> > Hi Dave, > >> > > >> > PFA updated patch for the same. > >> > > >> > Issue: > >> > We were not properly fetching result from server in case of direct > >> > debugging > >> > when we restart debugging of same object. > >> > > >> > Thanks to Neel for helping in this issue. > >> > > >> > Please review. > >> > > >> > -- > >> > Regards, > >> > Murtuza Zabuawala > >> > EnterpriseDB: http://www.enterprisedb.com > >> > The Enterprise PostgreSQL Company > >> > > >> > On Fri, Oct 7, 2016 at 5:32 PM, Dave Page <[email protected]> wrote: > >> >> > >> >> On Fri, Oct 7, 2016 at 12:53 PM, Dave Page <[email protected]> > wrote: > >> >> > On Fri, Oct 7, 2016 at 12:42 PM, Murtuza Zabuawala > >> >> > <[email protected]> wrote: > >> >> >> Hi Dave, > >> >> >> > >> >> >> I faced the same issue when I initially tried that, but then as > per > >> >> >> Neel > >> >> >> suggestion I changed SELECT pg_sleep() to PERFORM pg_sleep() in > >> >> >> function. > >> >> >> You will face the same in pgAdmin3 if you use select pg_sleep() in > >> >> >> your > >> >> >> function the debug call never returns from DB server. > >> >> > > >> >> > In which case, doesn't that imply the debugger is missing critical > >> >> > debug info? If I run the query in the query tool, I get: > >> >> > > >> >> > ==== > >> >> > INFO: EMPNO ENAME > >> >> > INFO: ----- ------- > >> >> > ERROR: query has no destination for result data > >> >> > HINT: If you want to discard the results of a SELECT, use PERFORM > >> >> > instead. > >> >> > CONTEXT: PL/pgSQL function list_emp() line 11 at SQL statement > >> >> > > >> >> > > >> >> > Query returned successfully in 2 secs. > >> >> > ==== > >> >> > > >> >> > It seems to me that the debugger should be able to give the same > >> >> > error. > >> >> > > >> >> > Regardless of that, I'll test with PERFORM. > >> >> > >> >> Which I just did - and whilst it seemed to be fine when stepping > >> >> through, after a few iterations I hit the continue button, at which > >> >> point it froze again on "PERFORM pg_sleep(2)", didn't print any more > >> >> of the 14 names in the emp table, and didn't return :-( > >> >> > >> >> -- > >> >> 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 > >> > >> > >> -- > >> Sent via pgadmin-hackers mailing list ([email protected]) > >> To make changes to your subscription: > >> http://www.postgresql.org/mailpref/pgadmin-hackers > > > > > > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 11:42 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 11:53 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 12:02 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-20 08:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-21 11:18 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-21 11:32 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Neel Patel <[email protected]> 2016-10-21 11:33 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-21 12:27 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Neel Patel <[email protected]> @ 2016-11-11 12:02 ` Murtuza Zabuawala <[email protected]> 2016-11-11 14:25 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 0 siblings, 1 reply; 21+ messages in thread From: Murtuza Zabuawala @ 2016-11-11 12:02 UTC (permalink / raw) To: Neel Patel <[email protected]>; +Cc: Dave Page <[email protected]>; pgadmin-hackers Hi Dave, PFA updated patch, Both of the issues pointed by you in last email are addressed in this patch. Please review. RM#1227 -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Fri, Oct 21, 2016 at 5:57 PM, Neel Patel <[email protected]> wrote: > Hi, > > > On Fri, Oct 21, 2016 at 5:03 PM, Dave Page <[email protected]> wrote: > >> Hi >> >> On Fri, Oct 21, 2016 at 12:32 PM, Neel Patel >> <[email protected]> wrote: >> > Hi, >> > >> > >> > On Fri, Oct 21, 2016 at 4:48 PM, Dave Page <[email protected]> wrote: >> >> >> >> Hi >> >> >> >> There are still issues I'm afraid: >> >> >> >> - When execution stops, we seem to keep polling for more results >> >> indefinitely. >> > >> > Do you mean after completion of first successful debugging ? >> > If yes, we are polling because user can start same function for >> debugging >> > again and we have to listen for the result set for that session. >> > Yes (or the second). But shouldn't we stop polling until debugging is >> restarted? >> > > Fixed > I think yes, that can be done. > >> >> >> >> >> >> >> - When executing for a second time, the messages tab isn't cleared, >> >> and new messages don't seem to be appended to it either. I would >> >> expect the tab to be cleared. >> > >> > Fixed > > >> > Ok. We will fix this issue. >> >> >> >> >> >> On Thu, Oct 20, 2016 at 9:14 AM, Murtuza Zabuawala >> >> <[email protected]> wrote: >> >> > Hi Dave, >> >> > >> >> > PFA updated patch for the same. >> >> > >> >> > Issue: >> >> > We were not properly fetching result from server in case of direct >> >> > debugging >> >> > when we restart debugging of same object. >> >> > >> >> > Thanks to Neel for helping in this issue. >> >> > >> >> > Please review. >> >> > >> >> > -- >> >> > Regards, >> >> > Murtuza Zabuawala >> >> > EnterpriseDB: http://www.enterprisedb.com >> >> > The Enterprise PostgreSQL Company >> >> > >> >> > On Fri, Oct 7, 2016 at 5:32 PM, Dave Page <[email protected]> wrote: >> >> >> >> >> >> On Fri, Oct 7, 2016 at 12:53 PM, Dave Page <[email protected]> >> wrote: >> >> >> > On Fri, Oct 7, 2016 at 12:42 PM, Murtuza Zabuawala >> >> >> > <[email protected]> wrote: >> >> >> >> Hi Dave, >> >> >> >> >> >> >> >> I faced the same issue when I initially tried that, but then as >> per >> >> >> >> Neel >> >> >> >> suggestion I changed SELECT pg_sleep() to PERFORM pg_sleep() in >> >> >> >> function. >> >> >> >> You will face the same in pgAdmin3 if you use select pg_sleep() >> in >> >> >> >> your >> >> >> >> function the debug call never returns from DB server. >> >> >> > >> >> >> > In which case, doesn't that imply the debugger is missing critical >> >> >> > debug info? If I run the query in the query tool, I get: >> >> >> > >> >> >> > ==== >> >> >> > INFO: EMPNO ENAME >> >> >> > INFO: ----- ------- >> >> >> > ERROR: query has no destination for result data >> >> >> > HINT: If you want to discard the results of a SELECT, use PERFORM >> >> >> > instead. >> >> >> > CONTEXT: PL/pgSQL function list_emp() line 11 at SQL statement >> >> >> > >> >> >> > >> >> >> > Query returned successfully in 2 secs. >> >> >> > ==== >> >> >> > >> >> >> > It seems to me that the debugger should be able to give the same >> >> >> > error. >> >> >> > >> >> >> > Regardless of that, I'll test with PERFORM. >> >> >> >> >> >> Which I just did - and whilst it seemed to be fine when stepping >> >> >> through, after a few iterations I hit the continue button, at which >> >> >> point it froze again on "PERFORM pg_sleep(2)", didn't print any more >> >> >> of the 14 names in the emp table, and didn't return :-( >> >> >> >> >> >> -- >> >> >> 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 >> >> >> >> >> >> -- >> >> Sent via pgadmin-hackers mailing list ([email protected]) >> >> To make changes to your subscription: >> >> http://www.postgresql.org/mailpref/pgadmin-hackers >> > >> > >> >> >> >> -- >> Dave Page >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake >> >> EnterpriseDB UK: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> > > -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM_1227_v8.patch (17.7K, 3-RM_1227_v8.patch) download | inline diff: diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py index 7d83ecb..24d00ad 100644 --- a/web/pgadmin/tools/debugger/__init__.py +++ b/web/pgadmin/tools/debugger/__init__.py @@ -1354,9 +1354,22 @@ def poll_end_execution_result(trans_id): if conn.connected(): statusmsg = conn.status_message() + if statusmsg and statusmsg == 'SELECT 1': + statusmsg = '' status, result, col_info = conn.poll() - if status == ASYNC_OK and session['functionData'][str(trans_id)]['language'] == 'edbspl': + if status == ASYNC_OK and \ + not session['functionData'][str(trans_id)]['is_func'] and \ + session['functionData'][str(trans_id)]['language'] == 'edbspl': status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + additional_msgs = "<br>".join(additional_msgs) + if statusmsg: + statusmsg = additional_msgs + "<br>" + statusmsg + else: + statusmsg = additional_msgs + return make_json_response(success=1, info=gettext("Execution Completed."), data={'status': status, 'status_message': statusmsg}) if result: @@ -1366,6 +1379,15 @@ def poll_end_execution_result(trans_id): data={'status': status, 'status_message': result}) else: status = 'Success' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + additional_msgs = "<br>".join(additional_msgs) + if statusmsg: + statusmsg = additional_msgs + "<br>" + statusmsg + else: + statusmsg = additional_msgs + columns = [] # Check column info is available or not if col_info is not None and len(col_info) > 0: @@ -1381,6 +1403,17 @@ def poll_end_execution_result(trans_id): 'col_info': columns, 'status_message': statusmsg}) else: status = 'Busy' + additional_msgs = conn.messages() + if len(additional_msgs) > 0: + additional_msgs = [msg.strip("\n") for msg in additional_msgs] + additional_msgs = "<br>".join(additional_msgs) + if statusmsg: + statusmsg = additional_msgs + "<br>" + statusmsg + else: + statusmsg = additional_msgs + return make_json_response(data={ + 'status': status, 'result': result, 'status_message': statusmsg + }) else: status = 'NotConnected' result = gettext('Not connected to server or connection with the server has been closed.') diff --git a/web/pgadmin/tools/debugger/static/css/debugger.css b/web/pgadmin/tools/debugger/static/css/debugger.css index 4386775..e1177a8 100644 --- a/web/pgadmin/tools/debugger/static/css/debugger.css +++ b/web/pgadmin/tools/debugger/static/css/debugger.css @@ -67,3 +67,14 @@ .CodeMirror-foldgutter-folded:after { content: "\25B6"; } + +/* To make font same as Query tool in messages tab */ +.messages { + white-space: pre-wrap; + font-family: monospace; + padding-top: 5px; + padding-left: 10px; + overflow: auto; + height: 100%; + font-size: 0.925em; +} \ No newline at end of file diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js index 452617b..2c5d05d 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js @@ -164,6 +164,9 @@ define( // Call function to create and update local variables .... self.GetStackInformation(trans_id); + if (pgTools.DirectDebug.debug_type) { + self.poll_end_execution_result(trans_id); + } } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -194,6 +197,13 @@ define( // Call function to create and update local variables self.AddLocalVariables(res.data.result); self.AddParameters(res.data.result); + // If debug function is restarted then again start listener to read the updated messages. + if (pgTools.DirectDebug.debug_restarted) { + if (pgTools.DirectDebug.debug_type) { + self.poll_end_execution_result(trans_id); + } + pgTools.DirectDebug.debug_restarted = false; + } } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -245,6 +255,12 @@ define( */ poll_result: function(trans_id) { var self = this; + + // Do we need to pool? + if(!pgTools.DirectDebug.is_polling_required){ + return; + } + // Make ajax call to listen the database message var baseUrl = "{{ url_for('debugger.index') }}" + "poll_result/" + trans_id; @@ -363,13 +379,32 @@ define( }, + // This function will update messages tab + update_messages: function(msg) { + var old_msgs='', new_msgs=''; + old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html(); + if(old_msgs) { + new_msgs = (old_msgs + '\n' + msg) + .replace(/(?:\r\n|\r|\n)/g, '<br />') // Newlines with <br> + .replace(/(<br\ ?\/?>)+/g, '<br />'); // multiple <br> with single <br> + } else { + new_msgs = msg; + } + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs); + }, + /* For the direct debugging, we need to check weather the functions execution is completed or not. After completion of the debugging, we will stop polling the result until new execution starts. */ poll_end_execution_result: function(trans_id) { var self = this; - //return; + + // Do we need to pool? + if(!pgTools.DirectDebug.is_polling_required){ + return; + } + // Make ajax call to listen the database message var baseUrl = "{{ url_for('debugger.index') }}" + "poll_end_execution_result/" + trans_id; @@ -411,7 +446,9 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.dbmsMessages.$elem.text(res.data.status_message); + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -420,6 +457,10 @@ define( self.enable('step_into', false); self.enable('toggle_breakpoint', false); self.enable('clear_all_breakpoints', false); + self.enable('continue', true); + // Stop further pooling + pgTools.DirectDebug.is_polling_required = false; + } else { // Call function to create and update local variables .... @@ -439,7 +480,9 @@ define( ); // Update the message tab of the debugger - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } // Execution completed so disable the buttons other than "Continue/Start" button because user can still // start the same execution again. @@ -448,12 +491,20 @@ define( self.enable('step_into', false); self.enable('toggle_breakpoint', false); self.enable('clear_all_breakpoints', false); + self.enable('continue', true); + + // Stop further pooling + pgTools.DirectDebug.is_polling_required = false; } } } else if (res.data.status === 'Busy') { // If status is Busy then poll the result by recursive call to the poll function - //self.poll_end_execution_result(trans_id); + self.poll_end_execution_result(trans_id); + // Update the message tab of the debugger + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -473,7 +524,11 @@ define( function() { } ); - pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message); + // Update the message tab of the debugger + if (res.data.status_message) { + self.update_messages(res.data.status_message); + } + pgTools.DirectDebug.messages_panel.focus(); // Execution completed so disable the buttons other than "Continue/Start" button because user can still @@ -483,6 +538,10 @@ define( self.enable('step_into', false); self.enable('toggle_breakpoint', false); self.enable('clear_all_breakpoints', false); + self.enable('continue', true); + + // Stop further pooling + pgTools.DirectDebug.is_polling_required = false; } }, error: function(e) { @@ -498,7 +557,17 @@ define( Restart: function(trans_id) { - var baseUrl = "{{ url_for('debugger.index') }}" + "restart/" + trans_id; + var self = this, + baseUrl = "{{ url_for('debugger.index') }}" + "restart/" + trans_id; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); + + // Clear msg tab + pgTools.DirectDebug.messages_panel.$container.find('.messages').html(''); $.ajax({ url: baseUrl, @@ -506,6 +575,15 @@ define( // Restart the same function debugging with previous arguments var restart_dbg = res.data.restart_debug ? 1 : 0; + // Start pooling again + pgTools.DirectDebug.is_polling_required = true; + self.poll_end_execution_result(trans_id); + self.poll_result(trans_id); + + if (restart_dbg) { + pgTools.DirectDebug.debug_restarted = true; + } + /* Need to check if restart debugging really require to open the input dialog ? If yes then we will get the previous arguments from database and populate the input dialog @@ -522,6 +600,9 @@ define( url: baseUrl, method: 'GET', success: function(res) { + if (pgTools.DirectDebug.debug_type) { + self.poll_end_execution_result(trans_id); + } }, error: function(e) { Alertify.alert( @@ -546,6 +627,12 @@ define( // Continue the execution until the next breakpoint Continue: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); //Check first if previous execution was completed or not if (pgTools.DirectDebug.direct_execution_completed && @@ -562,9 +649,6 @@ define( success: function(res) { if (res.data.status) { self.poll_result(trans_id); - if (pgTools.DirectDebug.debug_type) { - self.poll_end_execution_result(trans_id); - } } else { Alertify.alert( @@ -583,6 +667,12 @@ define( Step_over: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); // Make ajax call to listen the database message var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "step_over"; @@ -593,9 +683,6 @@ define( success: function(res) { if (res.data.status) { self.poll_result(trans_id); - if (pgTools.DirectDebug.debug_type) { - self.poll_end_execution_result(trans_id); - } } else { Alertify.alert( @@ -613,6 +700,12 @@ define( Step_into: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); // Make ajax call to listen the database message var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "step_into"; @@ -623,9 +716,6 @@ define( success: function(res) { if (res.data.status) { self.poll_result(trans_id); - if (pgTools.DirectDebug.debug_type) { - self.poll_end_execution_result(trans_id); - } } else { Alertify.alert( @@ -643,6 +733,12 @@ define( Stop: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', true); // Make ajax call to listen the database message var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "abort_target"; @@ -665,12 +761,8 @@ define( ); //Disable the buttons other than continue button. If user wants to again then it should allow to debug again... - self.enable('stop', false); - self.enable('step_over', false); - self.enable('step_into', false); - self.enable('continue', false); - self.enable('toggle_breakpoint', false); - self.enable('clear_all_breakpoints', false); + self.enable('continue', true); + } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -688,6 +780,13 @@ define( toggle_breakpoint: function(trans_id) { var self = this; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); + var info = pgTools.DirectDebug.editor.lineInfo(self.active_line_no); var baseUrl = ''; @@ -720,6 +819,12 @@ define( return marker; }()); } + self.enable('stop', true); + self.enable('step_over', true); + self.enable('step_into', true); + self.enable('toggle_breakpoint', true); + self.enable('clear_all_breakpoints', true); + self.enable('continue', true); } else if (res.data.status === 'NotConnected') { Alertify.alert( @@ -736,14 +841,20 @@ define( }, clear_all_breakpoint: function(trans_id) { - var self = this; - - var br_list = self.GetBreakpointInformation(trans_id); + var self = this, + br_list = self.GetBreakpointInformation(trans_id); // If there is no break point to clear then we should return from here. if ((br_list.length == 1) && (br_list[0].linenumber == -1)) return; + self.enable('stop', false); + self.enable('step_over', false); + self.enable('step_into', false); + self.enable('toggle_breakpoint', false); + self.enable('clear_all_breakpoints', false); + self.enable('continue', false); + var breakpoint_list = new Array(); for (i = 0; i < br_list.length; i++) { @@ -771,6 +882,12 @@ define( } } } + self.enable('stop', true); + self.enable('step_over', true); + self.enable('step_into', true); + self.enable('toggle_breakpoint', true); + self.enable('clear_all_breakpoints', true); + self.enable('continue', true); }, error: function(e) { Alertify.alert( @@ -1204,6 +1321,8 @@ define( this.first_time_indirect_debug = false; this.direct_execution_completed = false; this.polling_timeout_idle = false; + this.debug_restarted = false; + this.is_polling_required = true; // Flag to stop unwanted ajax calls var docker = this.docker = new wcDocker( '#container', { ^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: PATCH: To fix the issue in Debugger module (pgAdmin4) 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-26 12:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-09-27 06:40 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-05 12:09 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-06 09:05 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 11:42 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-07 11:53 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-07 12:02 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-20 08:14 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-10-21 11:18 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-21 11:32 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Neel Patel <[email protected]> 2016-10-21 11:33 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Dave Page <[email protected]> 2016-10-21 12:27 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Neel Patel <[email protected]> 2016-11-11 12:02 ` Re: PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> @ 2016-11-11 14:25 ` Dave Page <[email protected]> 0 siblings, 0 replies; 21+ messages in thread From: Dave Page @ 2016-11-11 14:25 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: Neel Patel <[email protected]>; pgadmin-hackers Thanks - committed with minor changes to hide the busy cursor when execution completes and to fix some comments. On Fri, Nov 11, 2016 at 12:02 PM, Murtuza Zabuawala <[email protected]> wrote: > Hi Dave, > > PFA updated patch, Both of the issues pointed by you in last email are > addressed in this patch. > Please review. > > RM#1227 > > > -- > Regards, > Murtuza Zabuawala > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > On Fri, Oct 21, 2016 at 5:57 PM, Neel Patel <[email protected]> > wrote: >> >> Hi, >> >> >> On Fri, Oct 21, 2016 at 5:03 PM, Dave Page <[email protected]> wrote: >>> >>> Hi >>> >>> On Fri, Oct 21, 2016 at 12:32 PM, Neel Patel >>> <[email protected]> wrote: >>> > Hi, >>> > >>> > >>> > On Fri, Oct 21, 2016 at 4:48 PM, Dave Page <[email protected]> wrote: >>> >> >>> >> Hi >>> >> >>> >> There are still issues I'm afraid: >>> >> >>> >> - When execution stops, we seem to keep polling for more results >>> >> indefinitely. >>> > >>> > Do you mean after completion of first successful debugging ? >>> > If yes, we are polling because user can start same function for >>> > debugging >>> > again and we have to listen for the result set for that session. >>> >>> Yes (or the second). But shouldn't we stop polling until debugging is >>> restarted? >> >> > > Fixed >> >> I think yes, that can be done. >>> >>> >>> >> >>> >> >>> >> - When executing for a second time, the messages tab isn't cleared, >>> >> and new messages don't seem to be appended to it either. I would >>> >> expect the tab to be cleared. >>> > > > Fixed >>> >>> > >>> > Ok. We will fix this issue. >>> >> >>> >> >>> >> On Thu, Oct 20, 2016 at 9:14 AM, Murtuza Zabuawala >>> >> <[email protected]> wrote: >>> >> > Hi Dave, >>> >> > >>> >> > PFA updated patch for the same. >>> >> > >>> >> > Issue: >>> >> > We were not properly fetching result from server in case of direct >>> >> > debugging >>> >> > when we restart debugging of same object. >>> >> > >>> >> > Thanks to Neel for helping in this issue. >>> >> > >>> >> > Please review. >>> >> > >>> >> > -- >>> >> > Regards, >>> >> > Murtuza Zabuawala >>> >> > EnterpriseDB: http://www.enterprisedb.com >>> >> > The Enterprise PostgreSQL Company >>> >> > >>> >> > On Fri, Oct 7, 2016 at 5:32 PM, Dave Page <[email protected]> wrote: >>> >> >> >>> >> >> On Fri, Oct 7, 2016 at 12:53 PM, Dave Page <[email protected]> >>> >> >> wrote: >>> >> >> > On Fri, Oct 7, 2016 at 12:42 PM, Murtuza Zabuawala >>> >> >> > <[email protected]> wrote: >>> >> >> >> Hi Dave, >>> >> >> >> >>> >> >> >> I faced the same issue when I initially tried that, but then as >>> >> >> >> per >>> >> >> >> Neel >>> >> >> >> suggestion I changed SELECT pg_sleep() to PERFORM pg_sleep() in >>> >> >> >> function. >>> >> >> >> You will face the same in pgAdmin3 if you use select pg_sleep() >>> >> >> >> in >>> >> >> >> your >>> >> >> >> function the debug call never returns from DB server. >>> >> >> > >>> >> >> > In which case, doesn't that imply the debugger is missing >>> >> >> > critical >>> >> >> > debug info? If I run the query in the query tool, I get: >>> >> >> > >>> >> >> > ==== >>> >> >> > INFO: EMPNO ENAME >>> >> >> > INFO: ----- ------- >>> >> >> > ERROR: query has no destination for result data >>> >> >> > HINT: If you want to discard the results of a SELECT, use >>> >> >> > PERFORM >>> >> >> > instead. >>> >> >> > CONTEXT: PL/pgSQL function list_emp() line 11 at SQL statement >>> >> >> > >>> >> >> > >>> >> >> > Query returned successfully in 2 secs. >>> >> >> > ==== >>> >> >> > >>> >> >> > It seems to me that the debugger should be able to give the same >>> >> >> > error. >>> >> >> > >>> >> >> > Regardless of that, I'll test with PERFORM. >>> >> >> >>> >> >> Which I just did - and whilst it seemed to be fine when stepping >>> >> >> through, after a few iterations I hit the continue button, at which >>> >> >> point it froze again on "PERFORM pg_sleep(2)", didn't print any >>> >> >> more >>> >> >> of the 14 names in the emp table, and didn't return :-( >>> >> >> >>> >> >> -- >>> >> >> 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 >>> >> >>> >> >>> >> -- >>> >> Sent via pgadmin-hackers mailing list ([email protected]) >>> >> To make changes to your subscription: >>> >> http://www.postgresql.org/mailpref/pgadmin-hackers >>> > >>> > >>> >>> >>> >>> -- >>> 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 -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 21+ messages in thread
end of thread, other threads:[~2016-11-11 14:25 UTC | newest] Thread overview: 21+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-09-26 10:09 PATCH: To fix the issue in Debugger module (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-26 11:38 ` Dave Page <[email protected]> 2016-09-26 12:14 ` Murtuza Zabuawala <[email protected]> 2016-09-26 12:28 ` Murtuza Zabuawala <[email protected]> 2016-09-26 12:54 ` Dave Page <[email protected]> 2016-09-27 06:40 ` Murtuza Zabuawala <[email protected]> 2016-10-03 12:35 ` Dave Page <[email protected]> 2016-10-05 12:09 ` Murtuza Zabuawala <[email protected]> 2016-10-05 13:59 ` Dave Page <[email protected]> 2016-10-06 09:05 ` Murtuza Zabuawala <[email protected]> 2016-10-07 10:46 ` Dave Page <[email protected]> 2016-10-07 11:42 ` Murtuza Zabuawala <[email protected]> 2016-10-07 11:53 ` Dave Page <[email protected]> 2016-10-07 12:02 ` Dave Page <[email protected]> 2016-10-20 08:14 ` Murtuza Zabuawala <[email protected]> 2016-10-21 11:18 ` Dave Page <[email protected]> 2016-10-21 11:32 ` Neel Patel <[email protected]> 2016-10-21 11:33 ` Dave Page <[email protected]> 2016-10-21 12:27 ` Neel Patel <[email protected]> 2016-11-11 12:02 ` Murtuza Zabuawala <[email protected]> 2016-11-11 14:25 ` Dave Page <[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