public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin4][RM#3457] [EPAS] Debugger: Unable to debug the procedure which is under the Package node
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin4][RM#3457] [EPAS] Debugger: Unable to debug the procedure which is under the Package node
@ 2018-06-29 13:43 Murtuza Zabuawala <[email protected]>
2018-06-29 14:20 ` Re: [pgAdmin4][RM#3457] [EPAS] Debugger: Unable to debug the procedure which is under the Package node Dave Page <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Murtuza Zabuawala @ 2018-06-29 13:43 UTC (permalink / raw)
To: pgadmin-hackers
Hi,
PFA patch to fix the issue which is EPAS specific where the user is not
able to debug the procedure in the package.
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachments:
[application/octet-stream] RM_3457.diff (6.9K, 3-RM_3457.diff)
download | inline diff:
diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py
index b3448b9..f24942d 100644
--- a/web/pgadmin/tools/debugger/__init__.py
+++ b/web/pgadmin/tools/debugger/__init__.py
@@ -1240,6 +1240,8 @@ def execute_debugger_query(trans_id, query_type):
update_session_debugger_transaction(trans_id, session_obj)
status, result = conn.execute_async(sql)
+ if not status:
+ internal_server_error(errormsg=result)
return make_json_response(
data={'status': status, 'result': result}
)
@@ -1969,6 +1971,16 @@ def poll_end_execution_result(trans_id):
if statusmsg and statusmsg == 'SELECT 1':
statusmsg = ''
status, result = conn.poll()
+ if not status:
+ status = 'ERROR'
+ return make_json_response(
+ info=gettext("Execution completed with an error."),
+ data={
+ 'status': status,
+ 'status_message': result
+ }
+ )
+
session_function_data = session['functionData'][str(trans_id)]
if status == ASYNC_OK and \
not session_function_data['is_func'] and\
@@ -1996,7 +2008,7 @@ def poll_end_execution_result(trans_id):
if 'ERROR' in result:
status = 'ERROR'
return make_json_response(
- info=gettext("Execution completed with error"),
+ info=gettext("Execution completed with an error."),
data={
'status': status,
'status_message': result
@@ -2084,7 +2096,9 @@ def poll_result(trans_id):
if conn.connected():
status, result = conn.poll()
- if status == ASYNC_OK and result is not None:
+ if not status:
+ status = 'ERROR'
+ elif status == ASYNC_OK and result is not None:
status = 'Success'
columns, result = convert_data_to_dict(conn, result)
else:
diff --git a/web/pgadmin/tools/debugger/static/js/debugger.js b/web/pgadmin/tools/debugger/static/js/debugger.js
index 14c2ccf..b1a2929 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger.js
@@ -2,10 +2,11 @@ define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'underscore.string', 'alertify', 'sources/pgadmin', 'pgadmin.browser',
'backbone', 'pgadmin.backgrid', 'codemirror', 'pgadmin.backform',
- 'pgadmin.tools.debugger.ui', 'wcdocker', 'pgadmin.browser.frame',
+ 'pgadmin.tools.debugger.ui', 'pgadmin.tools.debugger.utils',
+ 'wcdocker', 'pgadmin.browser.frame',
], function(
gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
- CodeMirror, Backform, get_function_arguments
+ CodeMirror, Backform, get_function_arguments, debuggerUtils
) {
var pgTools = pgAdmin.Tools = pgAdmin.Tools || {},
wcDocker = window.wcDocker;
@@ -337,7 +338,7 @@ define([
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
- 'func_id': treeInfo.procedure._id,
+ 'func_id': debuggerUtils.getProcedureId(treeInfo),
}
);
} else if (d._type == 'trigger_function') {
@@ -482,7 +483,7 @@ define([
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
- 'func_id': treeInfo.procedure._id,
+ 'func_id': debuggerUtils.getProcedureId(treeInfo),
}
);
}
diff --git a/web/pgadmin/tools/debugger/static/js/debugger_utils.js b/web/pgadmin/tools/debugger/static/js/debugger_utils.js
index 63d0232..843b6a4 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger_utils.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger_utils.js
@@ -18,6 +18,19 @@ function setFocusToDebuggerEditor(editor, command) {
}
}
+function getProcedureId(treeInfoObject) {
+ let objectId;
+ if(treeInfoObject) {
+ if (treeInfoObject.procedure && treeInfoObject.procedure._id) {
+ objectId = treeInfoObject.procedure._id;
+ } else if (treeInfoObject.edbproc && treeInfoObject.edbproc._id) {
+ objectId = treeInfoObject.edbproc._id;
+ }
+ }
+ return objectId;
+}
+
module.exports = {
setFocusToDebuggerEditor: setFocusToDebuggerEditor,
+ getProcedureId: getProcedureId,
};
diff --git a/web/regression/javascript/debugger_utils_spec.js b/web/regression/javascript/debugger_utils_spec.js
index 65f95dd..b70cd72 100644
--- a/web/regression/javascript/debugger_utils_spec.js
+++ b/web/regression/javascript/debugger_utils_spec.js
@@ -7,9 +7,12 @@
//
//////////////////////////////////////////////////////////////////////////
-import { setFocusToDebuggerEditor } from '../../pgadmin/tools/debugger/static/js/debugger_utils';
+import {
+ setFocusToDebuggerEditor,
+ getProcedureId,
+} from '../../pgadmin/tools/debugger/static/js/debugger_utils';
-describe('debuggerUtils', function () {
+describe('setFocusToDebuggerEditor', function () {
let editor;
editor = jasmine.createSpyObj('editor', ['focus']);
@@ -23,22 +26,60 @@ describe('debuggerUtils', function () {
keyCode: 13,
};
- describe('debuggerUtils', function () {
+ describe('setFocusToDebuggerEditor', function () {
it('returns undefined if no command is passed', function () {
expect(setFocusToDebuggerEditor(editor, null)).toEqual(undefined);
});
});
- describe('debuggerUtils', function () {
+ describe('setFocusToDebuggerEditor', function () {
it('should call focus on editor', function () {
setFocusToDebuggerEditor(editor, enter_key);
expect(editor.focus).toHaveBeenCalled();
});
});
- describe('debuggerUtils', function () {
+ describe('setFocusToDebuggerEditor', function () {
it('should not call focus on editor and returns undefined', function () {
expect(setFocusToDebuggerEditor(editor, tab_key)).toEqual(undefined);
});
});
});
+
+describe('getProcedureId', function () {
+ let treeInfroProc = {
+ 'procedure': {
+ '_id': 123,
+ },
+ };
+ let treeInfroInvalidProcId = {
+ 'procedure': {
+ '_id': null,
+ },
+ };
+ let treeInfroEdbProc = {
+ 'edbproc': {
+ '_id': 321,
+ },
+ };
+ let fakeTreeInfro;
+
+ describe('Should return proper object id', function () {
+ it('returns valid procedure id', function () {
+ expect(getProcedureId(treeInfroProc)).toBe(123);
+ });
+
+ it('returns valid edbproc id', function () {
+ expect(getProcedureId(treeInfroEdbProc)).toBe(321);
+ });
+
+ it('returns undefined for fake tree info', function () {
+ expect(getProcedureId(fakeTreeInfro)).toBe(undefined);
+ });
+
+ it('returns undefined for invalid procedure id', function () {
+ expect(getProcedureId(treeInfroInvalidProcId)).toBe(undefined);
+ });
+ });
+});
+
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin4][RM#3457] [EPAS] Debugger: Unable to debug the procedure which is under the Package node
2018-06-29 13:43 [pgAdmin4][RM#3457] [EPAS] Debugger: Unable to debug the procedure which is under the Package node Murtuza Zabuawala <[email protected]>
@ 2018-06-29 14:20 ` Dave Page <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Page @ 2018-06-29 14:20 UTC (permalink / raw)
To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers
Thanks, patch applied.
On Fri, Jun 29, 2018 at 2:43 PM, Murtuza Zabuawala <
[email protected]> wrote:
> Hi,
>
> PFA patch to fix the issue which is EPAS specific where the user is not
> able to debug the procedure in the package.
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: 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] 2+ messages in thread
end of thread, other threads:[~2018-06-29 14:20 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-29 13:43 [pgAdmin4][RM#3457] [EPAS] Debugger: Unable to debug the procedure which is under the Package node Murtuza Zabuawala <[email protected]>
2018-06-29 14:20 ` 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