public inbox for [email protected]
help / color / mirror / Atom feedFrom: Murtuza Zabuawala <[email protected]>
To: Dave Page <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: PATCH: To fix the issue in Debugger module (pgAdmin4)
Date: Wed, 5 Oct 2016 17:39:08 +0530
Message-ID: <CAKKotZRW4WF2gsaPu-cRZJmrAia0GiDTOhwDKQdUpBC5VRoVjQ@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxoyLMvyRpPSMztrUf0st7yGvyeYquOmyFabQzg6Czieh=Q@mail.gmail.com>
References: <CAKKotZQz6mGEiky_Szo91tzm_RFvwJTYGriTmuxVYrhcWi5nJg@mail.gmail.com>
<CA+OCxoxkphr1YF6F53j3sTreTMvoBOKqV+wjF6CnxoQ-SA+rzA@mail.gmail.com>
<CAKKotZRMetEEPzFTuqiw_8Vit2_STHSN22=K+5frJBu7=Jp6PQ@mail.gmail.com>
<CAKKotZQGdhiFrtNK0xz8OVLKOA2QCk_yfOZDFT+HEMfELzbk4A@mail.gmail.com>
<CA+OCxoyzS4_cST0qJ7CbmxqOry4wGZCQkoiLpcXgjr2N4snPQw@mail.gmail.com>
<CAKKotZSjyeZT_bS8_No-cEftRjqPPptLx+zV2+_DqV=KYZYRcw@mail.gmail.com>
<CA+OCxoyLMvyRpPSMztrUf0st7yGvyeYquOmyFabQzg6Czieh=Q@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-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
view thread (21+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: PATCH: To fix the issue in Debugger module (pgAdmin4)
In-Reply-To: <CAKKotZRW4WF2gsaPu-cRZJmrAia0GiDTOhwDKQdUpBC5VRoVjQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox