public inbox for [email protected]
help / color / mirror / Atom feedFrom: Murtuza Zabuawala <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: PATCH: To fix the issue displaying composite result types in debugger (pgAdmin4)
Date: Tue, 20 Sep 2016 15:16:37 +0530
Message-ID: <CAKKotZSASdtaDZDYS-=uGrzMTBnutxQ_WvOf9mR13gUzHodEjA@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
PFA patch to fix the issue in debugger where we were not displaying result
properly in result tab for composite types.
RM#1662
@Neel,
Would you please review the patch?
*Issue:*
Column name key was hardcoded in dict causing overwriting other columns.
--
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_1662.patch (4.3K, 3-RM_1662.patch)
download | inline diff:
diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py
index 22cbd05..f7d0e7b 100644
--- a/web/pgadmin/tools/debugger/__init__.py
+++ b/web/pgadmin/tools/debugger/__init__.py
@@ -1342,7 +1342,7 @@ def poll_end_execution_result(trans_id):
if conn.connected():
statusmsg = conn.status_message()
- status, result, my_result = conn.poll()
+ status, result, col_info = conn.poll()
if status == ASYNC_OK and session['functionData'][str(trans_id)]['language'] == 'edbspl':
status = 'Success'
return make_json_response(success=1, info=gettext("Execution Completed."),
@@ -1354,14 +1354,19 @@ def poll_end_execution_result(trans_id):
data={'status': status, 'status_message': result})
else:
status = 'Success'
- data = {}
- for i in result:
- for k, v in i.items():
- data["name"] = k
- data.setdefault("value", []).append(v)
+ columns = []
+ # Check column info is available or not
+ if col_info is not None and len(col_info) > 0:
+ for col in col_info:
+ items = list(col.items())
+ column = dict()
+ column['name'] = items[0][1]
+ column['type_code'] = items[1][1]
+ columns.append(column)
return make_json_response(success=1, info=gettext("Execution Completed."),
- data={'status': status, 'result': data, 'status_message': statusmsg})
+ data={'status': status, 'result': result,
+ 'col_info': columns, 'status_message': statusmsg})
else:
status = 'Busy'
else:
diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js
index bd1f87e..7ec5e95 100644
--- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js
+++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js
@@ -417,9 +417,9 @@ define(
}
else {
// Call function to create and update local variables ....
- if (res.data.result.name != null) {
+ if (res.data.result != null) {
pgTools.DirectDebug.editor.removeLineClass(self.active_line_no, 'wrap', 'CodeMirror-activeline-background');
- self.AddResults(res.data.result);
+ self.AddResults(res.data.col_info, res.data.result);
pgTools.DirectDebug.results_panel.focus();
pgTools.DirectDebug.direct_execution_completed = true;
pgTools.DirectDebug.polling_timeout_idle = true;
@@ -846,7 +846,7 @@ define(
},
- AddResults: function(result) {
+ AddResults: function(columns, result) {
var self = this;
// Remove the existing created grid and update the result values
@@ -866,22 +866,23 @@ define(
model: DebuggerResultsModel
});
- resultGridCols = [
- {name: 'value', label:result.name, type:'text', editable: false, cell:'string'}
- ];
-
- var my_obj = [];
- if (result.value.length != 0)
- {
- for (i = 0; i < result.value.length; i++) {
- my_obj.push({ "value": result.value[i]});
- }
+ var resultGridCols = [];
+ if(_.size(columns)) {
+ _.each(columns, function(c) {
+ var column = {
+ type:'text',
+ editable: false,
+ cell:'string'
+ };
+ column['name'] = column['label'] = c.name;
+ resultGridCols.push(column);
+ });
}
// Initialize a new Grid instance
var result_grid = this.result_grid = new Backgrid.Grid({
columns: resultGridCols,
- collection: new ResultsCollection(my_obj),
+ collection: new ResultsCollection(result),
className: "backgrid table-bordered"
});
view thread (3+ 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]
Subject: Re: PATCH: To fix the issue displaying composite result types in debugger (pgAdmin4)
In-Reply-To: <CAKKotZSASdtaDZDYS-=uGrzMTBnutxQ_WvOf9mR13gUzHodEjA@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