public inbox for [email protected]
help / color / mirror / Atom feedFrom: Murtuza Zabuawala <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][RM#3153] Fix the issue in Debugger module
Date: Fri, 2 Mar 2018 16:35:26 +0530
Message-ID: <CAKKotZSpaXg-SwPRhgYwhcA2Yua+k12Trv4tVZWAniTCiOVG8g@mail.gmail.com> (raw)
Hi,
I have fixed below issues,
1) Fixed typo in accesskey assignment in html template.
2) Edit value in Grid using Tab key was not working and added test case for
the same.
I have created sub task for auto scrolling while step in and step over
button.
https://redmine.postgresql.org/issues/3166
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachments:
[application/octet-stream] RM_3153.diff (7.6K, 3-RM_3153.diff)
download | inline diff:
diff --git a/web/pgadmin/static/js/keyboard_shortcuts.js b/web/pgadmin/static/js/keyboard_shortcuts.js
index 91e45cd..b61365a 100644
--- a/web/pgadmin/static/js/keyboard_shortcuts.js
+++ b/web/pgadmin/static/js/keyboard_shortcuts.js
@@ -1,3 +1,12 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin 4 - PostgreSQL Tools
+//
+// Copyright (C) 2013 - 2018, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+//////////////////////////////////////////////////////////////////////////
+
import $ from 'jquery';
const PERIOD_KEY = 190,
diff --git a/web/pgadmin/tools/debugger/static/js/debugger_utils.js b/web/pgadmin/tools/debugger/static/js/debugger_utils.js
new file mode 100644
index 0000000..63d0232
--- /dev/null
+++ b/web/pgadmin/tools/debugger/static/js/debugger_utils.js
@@ -0,0 +1,23 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin 4 - PostgreSQL Tools
+//
+// Copyright (C) 2013 - 2018, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+//////////////////////////////////////////////////////////////////////////
+
+function setFocusToDebuggerEditor(editor, command) {
+ const TAB = 9;
+ if (!command)
+ return;
+ let key = command.which || command.keyCode;
+ // Keys other than Tab key
+ if (key !== TAB) {
+ editor.focus();
+ }
+}
+
+module.exports = {
+ setFocusToDebuggerEditor: setFocusToDebuggerEditor,
+};
diff --git a/web/pgadmin/tools/debugger/static/js/direct.js b/web/pgadmin/tools/debugger/static/js/direct.js
index 62cc0ba..52c9e66 100644
--- a/web/pgadmin/tools/debugger/static/js/direct.js
+++ b/web/pgadmin/tools/debugger/static/js/direct.js
@@ -2,10 +2,11 @@ define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'pgadmin.alertifyjs', 'sources/pgadmin', 'pgadmin.browser', 'backbone',
'pgadmin.backgrid', 'pgadmin.backform', 'sources/../bundle/codemirror',
- 'pgadmin.tools.debugger.ui', 'sources/keyboard_shortcuts', 'wcdocker',
+ 'pgadmin.tools.debugger.ui', 'sources/keyboard_shortcuts',
+ 'pgadmin.tools.debugger.utils', 'wcdocker',
], function(
gettext, url_for, $, _, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
- Backform, codemirror, debug_function_again, keyboardShortcuts
+ Backform, codemirror, debug_function_again, keyboardShortcuts, debuggerUtils
) {
var CodeMirror = codemirror.default,
@@ -185,7 +186,6 @@ define([
'CodeMirror-activeline-background'
);
}
-
// Call function to create and update local variables ....
self.GetStackInformation(trans_id);
if (pgTools.DirectDebug.debug_type) {
@@ -345,7 +345,6 @@ define([
'wrap', 'CodeMirror-activeline-background'
);
self.active_line_no = (res.data.result[0].linenumber - 2);
-
// Update the stack, local variables and parameters information
self.GetStackInformation(trans_id);
@@ -1211,8 +1210,10 @@ define([
});
variable_grid.collection.on(
- 'backgrid:edited', () => {
- pgTools.DirectDebug.editor.focus();
+ 'backgrid:edited', (ch1, ch2, command) => {
+ debuggerUtils.setFocusToDebuggerEditor(
+ pgTools.DirectDebug.editor, command
+ );
}
);
@@ -1294,8 +1295,10 @@ define([
});
param_grid.collection.on(
- 'backgrid:edited', () => {
- pgTools.DirectDebug.editor.focus();
+ 'backgrid:edited', (ch1, ch2, command) => {
+ debuggerUtils.setFocusToDebuggerEditor(
+ pgTools.DirectDebug.editor, command
+ );
}
);
@@ -1371,7 +1374,6 @@ define([
(res.data.result[0].linenumber - 2), 'wrap',
'CodeMirror-activeline-background'
);
-
// Call function to create and update local variables ....
self.GetLocalVariables(pgTools.DirectDebug.trans_id);
}
diff --git a/web/pgadmin/tools/debugger/templates/debugger/direct.html b/web/pgadmin/tools/debugger/templates/debugger/direct.html
index 2f748d9..58d97a0 100644
--- a/web/pgadmin/tools/debugger/templates/debugger/direct.html
+++ b/web/pgadmin/tools/debugger/templates/debugger/direct.html
@@ -52,8 +52,8 @@ try {
<i class="fa fa-outdent"></i>
</button>
<button type="button" class="btn btn-default btn-continue"
- title="{{ _('Continue/Start') }}{{ _(' (accesskey+{0})'.format(accesskey.toggle_breakpoint)) }}"
- accesskey="{{ accesskey.toggle_breakpoint }}"
+ title="{{ _('Continue/Start') }}{{ _(' (accesskey+{0})'.format(accesskey.start)) }}"
+ accesskey="{{ accesskey.start }}"
tabindex="0">
<i class="fa fa-play-circle"></i>
</button>
diff --git a/web/regression/javascript/debugger_utils_spec.js b/web/regression/javascript/debugger_utils_spec.js
new file mode 100644
index 0000000..3e6be97
--- /dev/null
+++ b/web/regression/javascript/debugger_utils_spec.js
@@ -0,0 +1,44 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin 4 - PostgreSQL Tools
+//
+// Copyright (C) 2013 - 2018, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+//////////////////////////////////////////////////////////////////////////
+
+import { setFocusToDebuggerEditor } from '../../pgadmin/tools/debugger/static/js/debugger_utils';
+
+describe('debuggerUtils', function () {
+ let editor;
+ editor = jasmine.createSpyObj('editor', ['focus']);
+
+ let tab_key = {
+ which: 9,
+ keyCode: 9,
+ }
+
+ let enter_key = {
+ which: 13,
+ keyCode: 13,
+ }
+
+ describe('debuggerUtils', function () {
+ it('returns undefined if no command is passed', function () {
+ expect(setFocusToDebuggerEditor(editor, null)).toEqual(undefined);
+ });
+ });
+
+ describe('debuggerUtils', function () {
+ it('should call focus on editor', function () {
+ setFocusToDebuggerEditor(editor, enter_key)
+ expect(editor.focus).toHaveBeenCalled();
+ });
+ });
+
+ describe('debuggerUtils', function () {
+ it('should not call focus on editor and returns undefined', function () {
+ expect(setFocusToDebuggerEditor(editor, tab_key)).toEqual(undefined);
+ });
+ });
+});
diff --git a/web/webpack.shim.js b/web/webpack.shim.js
index d36fe61..58b2604 100644
--- a/web/webpack.shim.js
+++ b/web/webpack.shim.js
@@ -230,6 +230,7 @@ var webpackShimConfig = {
'pgadmin.tools.import_export': path.join(__dirname, './pgadmin/tools/import_export/static/js/import_export'),
'pgadmin.node.view': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/view'),
'pgadmin.tools.debugger.ui': path.join(__dirname, './pgadmin/tools/debugger/static/js/debugger_ui'),
+ 'pgadmin.tools.debugger.utils': path.join(__dirname, './pgadmin/tools/debugger/static/js/debugger_utils'),
'pgadmin.node.pga_schedule': path.join(__dirname, './pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule'),
'pgadmin.node.catalog_object_column': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column'),
'pgadmin.browser.collection': path.join(__dirname, './pgadmin/browser/static/js/collection'),
view thread (2+ 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: [pgAdmin4][RM#3153] Fix the issue in Debugger module
In-Reply-To: <CAKKotZSpaXg-SwPRhgYwhcA2Yua+k12Trv4tVZWAniTCiOVG8g@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