public inbox for [email protected]help / color / mirror / Atom feed
PATCH: To fix the issue displaying composite result types in debugger (pgAdmin4) 3+ messages / 3 participants [nested] [flat]
* PATCH: To fix the issue displaying composite result types in debugger (pgAdmin4) @ 2016-09-20 09:46 Murtuza Zabuawala <[email protected]> 0 siblings, 2 replies; 3+ messages in thread From: Murtuza Zabuawala @ 2016-09-20 09:46 UTC (permalink / raw) To: pgadmin-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" }); ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PATCH: To fix the issue displaying composite result types in debugger (pgAdmin4) @ 2016-09-20 10:18 Neel Patel <[email protected]> parent: Murtuza Zabuawala <[email protected]> 1 sibling, 0 replies; 3+ messages in thread From: Neel Patel @ 2016-09-20 10:18 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers Hi Murtuza, Sure. I will review it. Thanks, Neel Patel On Tue, Sep 20, 2016 at 3:16 PM, Murtuza Zabuawala < [email protected]> wrote: > 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 > > ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PATCH: To fix the issue displaying composite result types in debugger (pgAdmin4) @ 2016-09-20 10:28 Dave Page <[email protected]> parent: Murtuza Zabuawala <[email protected]> 1 sibling, 0 replies; 3+ messages in thread From: Dave Page @ 2016-09-20 10:28 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers Thanks - applied. On Tue, Sep 20, 2016 at 10:46 AM, Murtuza Zabuawala <[email protected]> wrote: > 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 > -- 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] 3+ messages in thread
end of thread, other threads:[~2016-09-20 10:28 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-09-20 09:46 PATCH: To fix the issue displaying composite result types in debugger (pgAdmin4) Murtuza Zabuawala <[email protected]> 2016-09-20 10:18 ` Neel Patel <[email protected]> 2016-09-20 10:28 ` 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