Re: [pgAdmin4][Patch]: RM 3284 - F5 key not working consistently

2018-05-02 Thread Akshay Joshi
Thanks patch applied.

On Wed, May 2, 2018 at 11:16 AM, Khushboo Vashi <
khushboo.va...@enterprisedb.com> wrote:

> Hi Akshay,
>
> Please find the attached patch which fixes the linter issues.
>
> Thanks,
> Khushboo
>
> On Wed, May 2, 2018 at 11:10 AM, Akshay Joshi <
> akshay.jo...@enterprisedb.com> wrote:
>
>> Hi Joao
>>
>> Linter fails for 'parse_shortcut_value_spec.js' file:
>>
>> $ node pga_eslint.js
>>
>>
>> /Users/akshay/Development/pgadmin4/web/regression/javascript
>> /parse_shortcut_value_spec.js
>>
>>13:4   error  Expected indentation of 2 spaces but found 3  indent
>>
>>14:7   error  Expected indentation of 5 spaces but found 6  indent
>>
>>21:26  error  Missing trailing comma
>> comma-dangle
>>
>>22:12  error  Missing trailing comma
>> comma-dangle
>>
>>26:4   error  Expected indentation of 2 spaces but found 3  indent
>>
>>27:7   error  Expected indentation of 5 spaces but found 6  indent
>>
>>34:26  error  Missing trailing comma
>> comma-dangle
>>
>>35:12  error  Missing trailing comma
>> comma-dangle
>>
>>39:4   error  Expected indentation of 2 spaces but found 3  indent
>>
>>40:7   error  Expected indentation of 5 spaces but found 6  indent
>>
>>47:25  error  Missing trailing comma
>> comma-dangle
>>
>>48:12  error  Missing trailing comma
>> comma-dangle
>>
>>52:4   error  Expected indentation of 2 spaces but found 3  indent
>>
>>53:7   error  Expected indentation of 5 spaces but found 6  indent
>>
>>60:25  error  Missing trailing comma
>> comma-dangle
>>
>>61:12  error  Missing trailing comma
>> comma-dangle
>>
>>65:4   error  Expected indentation of 2 spaces but found 3  indent
>>
>>66:7   error  Expected indentation of 5 spaces but found 6  indent
>>
>>73:25  error  Missing trailing comma
>> comma-dangle
>>
>>74:12  error  Missing trailing comma
>> comma-dangle
>>
>>78:4   error  Expected indentation of 2 spaces but found 3  indent
>>
>>79:7   error  Expected indentation of 5 spaces but found 6  indent
>>
>>86:25  error  Missing trailing comma
>> comma-dangle
>>
>>87:12  error  Missing trailing comma
>> comma-dangle
>>
>>91:4   error  Expected indentation of 2 spaces but found 3  indent
>>
>>92:7   error  Expected indentation of 5 spaces but found 6  indent
>>
>>99:25  error  Missing trailing comma
>> comma-dangle
>>
>>   100:12  error  Missing trailing comma
>> comma-dangle
>>
>>   104:4   error  Expected indentation of 2 spaces but found 3  indent
>>
>>   105:7   error  Expected indentation of 5 spaces but found 6  indent
>>
>>   112:25  error  Missing trailing comma
>> comma-dangle
>>
>>   113:12  error  Missing trailing comma
>> comma-dangle
>>
>>
>> *✖ 32 problems (32 errors, 0 warnings)*
>>
>>
>>
>>
>> On Mon, Apr 30, 2018 at 8:10 PM, Joao De Almeida Pereira <
>> jdealmeidapere...@pivotal.io> wrote:
>>
>>> Hi there,
>>>
>>> We weren't able to see these functions get called. Perhaps we're missing
>>> something.
>>>
>>> Thanks,
>>> Joao && Anthony
>>>
>>> On Mon, Apr 30, 2018 at 2:48 AM Khushboo Vashi <
>>> khushboo.va...@enterprisedb.com> wrote:
>>>
 Hi Joao,

 The patches look good however I have noticed that you
 deleted attachShortcut and attachDialogTabNavigatorShortcut functions
 from keyboard.js, any specific reason for that?

 Thanks,
 Khushboo

 On Fri, Apr 27, 2018 at 3:11 AM, Joao De Almeida Pereira <
 jdealmeidapere...@pivotal.io> wrote:

> Hi Khushboo,
>
> I did some changes on your patch:
>  0001 - Your original patch
>  0002 - Convert keyboard.js to ES6
>  0003 - Refactoring of the keyboard.js file(some one letter variables
> and other code)
>
>
>
> Thanks
> Joao
>
> On Thu, Apr 26, 2018 at 5:34 AM Khushboo Vashi <
> khushboo.va...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> Please find the attached patch to fix the RM #3284 : F5 key not
>> working consistently.
>>
>> - Added the configurable keyboard shortcut (default F5) to refresh
>> the browser tree nodes.
>>
>>
>> Thanks,
>> Khushboo
>>
>

>>
>>
>> --
>> *Akshay Joshi*
>>
>> *Sr. Software Architect *
>>
>>
>>
>> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>>
>
>


-- 
*Akshay Joshi*

*Sr. Software Architect *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


Re: [pgAdmin4][Patch]: RM 3284 - F5 key not working consistently

2018-05-01 Thread Khushboo Vashi
Hi Akshay,

Please find the attached patch which fixes the linter issues.

Thanks,
Khushboo

On Wed, May 2, 2018 at 11:10 AM, Akshay Joshi  wrote:

> Hi Joao
>
> Linter fails for 'parse_shortcut_value_spec.js' file:
>
> $ node pga_eslint.js
>
>
> /Users/akshay/Development/pgadmin4/web/regression/
> javascript/parse_shortcut_value_spec.js
>
>13:4   error  Expected indentation of 2 spaces but found 3  indent
>
>14:7   error  Expected indentation of 5 spaces but found 6  indent
>
>21:26  error  Missing trailing comma
> comma-dangle
>
>22:12  error  Missing trailing comma
> comma-dangle
>
>26:4   error  Expected indentation of 2 spaces but found 3  indent
>
>27:7   error  Expected indentation of 5 spaces but found 6  indent
>
>34:26  error  Missing trailing comma
> comma-dangle
>
>35:12  error  Missing trailing comma
> comma-dangle
>
>39:4   error  Expected indentation of 2 spaces but found 3  indent
>
>40:7   error  Expected indentation of 5 spaces but found 6  indent
>
>47:25  error  Missing trailing comma
> comma-dangle
>
>48:12  error  Missing trailing comma
> comma-dangle
>
>52:4   error  Expected indentation of 2 spaces but found 3  indent
>
>53:7   error  Expected indentation of 5 spaces but found 6  indent
>
>60:25  error  Missing trailing comma
> comma-dangle
>
>61:12  error  Missing trailing comma
> comma-dangle
>
>65:4   error  Expected indentation of 2 spaces but found 3  indent
>
>66:7   error  Expected indentation of 5 spaces but found 6  indent
>
>73:25  error  Missing trailing comma
> comma-dangle
>
>74:12  error  Missing trailing comma
> comma-dangle
>
>78:4   error  Expected indentation of 2 spaces but found 3  indent
>
>79:7   error  Expected indentation of 5 spaces but found 6  indent
>
>86:25  error  Missing trailing comma
> comma-dangle
>
>87:12  error  Missing trailing comma
> comma-dangle
>
>91:4   error  Expected indentation of 2 spaces but found 3  indent
>
>92:7   error  Expected indentation of 5 spaces but found 6  indent
>
>99:25  error  Missing trailing comma
> comma-dangle
>
>   100:12  error  Missing trailing comma
> comma-dangle
>
>   104:4   error  Expected indentation of 2 spaces but found 3  indent
>
>   105:7   error  Expected indentation of 5 spaces but found 6  indent
>
>   112:25  error  Missing trailing comma
> comma-dangle
>
>   113:12  error  Missing trailing comma
> comma-dangle
>
>
> *✖ 32 problems (32 errors, 0 warnings)*
>
>
>
>
> On Mon, Apr 30, 2018 at 8:10 PM, Joao De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Hi there,
>>
>> We weren't able to see these functions get called. Perhaps we're missing
>> something.
>>
>> Thanks,
>> Joao && Anthony
>>
>> On Mon, Apr 30, 2018 at 2:48 AM Khushboo Vashi <
>> khushboo.va...@enterprisedb.com> wrote:
>>
>>> Hi Joao,
>>>
>>> The patches look good however I have noticed that you
>>> deleted attachShortcut and attachDialogTabNavigatorShortcut functions
>>> from keyboard.js, any specific reason for that?
>>>
>>> Thanks,
>>> Khushboo
>>>
>>> On Fri, Apr 27, 2018 at 3:11 AM, Joao De Almeida Pereira <
>>> jdealmeidapere...@pivotal.io> wrote:
>>>
 Hi Khushboo,

 I did some changes on your patch:
  0001 - Your original patch
  0002 - Convert keyboard.js to ES6
  0003 - Refactoring of the keyboard.js file(some one letter variables
 and other code)



 Thanks
 Joao

 On Thu, Apr 26, 2018 at 5:34 AM Khushboo Vashi <
 khushboo.va...@enterprisedb.com> wrote:

> Hi,
>
> Please find the attached patch to fix the RM #3284 : F5 key not
> working consistently.
>
> - Added the configurable keyboard shortcut (default F5) to refresh the
> browser tree nodes.
>
>
> Thanks,
> Khushboo
>

>>>
>
>
> --
> *Akshay Joshi*
>
> *Sr. Software Architect *
>
>
>
> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>
diff --git a/web/regression/javascript/parse_shortcut_value_spec.js b/web/regression/javascript/parse_shortcut_value_spec.js
new file mode 100644
index 000..4a801aa
--- /dev/null
+++ b/web/regression/javascript/parse_shortcut_value_spec.js
@@ -0,0 +1,117 @@
+/
+//
+// pgAdmin 4 - PostgreSQL Tools
+//
+// Copyright (C) 2013 - 2018, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+//
+
+import { parseShortcutValue } from 'sources/utils';
+
+describe('parseShortcutValue', function () {
+  describe('when short cut is F5', function () {
+it('returns f5', function () {
+  expect(parseShortcutValue({
+alt: false,
+control: false,
+shift: false,
+key: {
+  char: 'F5',
+  key_code: 116,
+},
+  })).toEqual('f5');
+});
+  });
+  describe('when short 

Re: [pgAdmin4][Patch]: RM 3284 - F5 key not working consistently

2018-05-01 Thread Akshay Joshi
Hi Joao

Linter fails for 'parse_shortcut_value_spec.js' file:

$ node pga_eslint.js


/Users/akshay/Development/pgadmin4/web/regression/javascript/parse_shortcut_value_spec.js

   13:4   error  Expected indentation of 2 spaces but found 3  indent

   14:7   error  Expected indentation of 5 spaces but found 6  indent

   21:26  error  Missing trailing commacomma-dangle

   22:12  error  Missing trailing commacomma-dangle

   26:4   error  Expected indentation of 2 spaces but found 3  indent

   27:7   error  Expected indentation of 5 spaces but found 6  indent

   34:26  error  Missing trailing commacomma-dangle

   35:12  error  Missing trailing commacomma-dangle

   39:4   error  Expected indentation of 2 spaces but found 3  indent

   40:7   error  Expected indentation of 5 spaces but found 6  indent

   47:25  error  Missing trailing commacomma-dangle

   48:12  error  Missing trailing commacomma-dangle

   52:4   error  Expected indentation of 2 spaces but found 3  indent

   53:7   error  Expected indentation of 5 spaces but found 6  indent

   60:25  error  Missing trailing commacomma-dangle

   61:12  error  Missing trailing commacomma-dangle

   65:4   error  Expected indentation of 2 spaces but found 3  indent

   66:7   error  Expected indentation of 5 spaces but found 6  indent

   73:25  error  Missing trailing commacomma-dangle

   74:12  error  Missing trailing commacomma-dangle

   78:4   error  Expected indentation of 2 spaces but found 3  indent

   79:7   error  Expected indentation of 5 spaces but found 6  indent

   86:25  error  Missing trailing commacomma-dangle

   87:12  error  Missing trailing commacomma-dangle

   91:4   error  Expected indentation of 2 spaces but found 3  indent

   92:7   error  Expected indentation of 5 spaces but found 6  indent

   99:25  error  Missing trailing commacomma-dangle

  100:12  error  Missing trailing commacomma-dangle

  104:4   error  Expected indentation of 2 spaces but found 3  indent

  105:7   error  Expected indentation of 5 spaces but found 6  indent

  112:25  error  Missing trailing commacomma-dangle

  113:12  error  Missing trailing commacomma-dangle


*✖ 32 problems (32 errors, 0 warnings)*




On Mon, Apr 30, 2018 at 8:10 PM, Joao De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hi there,
>
> We weren't able to see these functions get called. Perhaps we're missing
> something.
>
> Thanks,
> Joao && Anthony
>
> On Mon, Apr 30, 2018 at 2:48 AM Khushboo Vashi <
> khushboo.va...@enterprisedb.com> wrote:
>
>> Hi Joao,
>>
>> The patches look good however I have noticed that you
>> deleted attachShortcut and attachDialogTabNavigatorShortcut functions
>> from keyboard.js, any specific reason for that?
>>
>> Thanks,
>> Khushboo
>>
>> On Fri, Apr 27, 2018 at 3:11 AM, Joao De Almeida Pereira <
>> jdealmeidapere...@pivotal.io> wrote:
>>
>>> Hi Khushboo,
>>>
>>> I did some changes on your patch:
>>>  0001 - Your original patch
>>>  0002 - Convert keyboard.js to ES6
>>>  0003 - Refactoring of the keyboard.js file(some one letter variables
>>> and other code)
>>>
>>>
>>>
>>> Thanks
>>> Joao
>>>
>>> On Thu, Apr 26, 2018 at 5:34 AM Khushboo Vashi <
>>> khushboo.va...@enterprisedb.com> wrote:
>>>
 Hi,

 Please find the attached patch to fix the RM #3284 : F5 key not working
 consistently.

 - Added the configurable keyboard shortcut (default F5) to refresh the
 browser tree nodes.


 Thanks,
 Khushboo

>>>
>>


-- 
*Akshay Joshi*

*Sr. Software Architect *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


Re: [pgAdmin4][Patch]: RM 3284 - F5 key not working consistently

2018-04-30 Thread Khushboo Vashi
Hi Joao,

The patches look good however I have noticed that you
deleted attachShortcut and attachDialogTabNavigatorShortcut functions from
keyboard.js, any specific reason for that?

Thanks,
Khushboo

On Fri, Apr 27, 2018 at 3:11 AM, Joao De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hi Khushboo,
>
> I did some changes on your patch:
>  0001 - Your original patch
>  0002 - Convert keyboard.js to ES6
>  0003 - Refactoring of the keyboard.js file(some one letter variables and
> other code)
>
>
>
> Thanks
> Joao
>
> On Thu, Apr 26, 2018 at 5:34 AM Khushboo Vashi <
> khushboo.va...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> Please find the attached patch to fix the RM #3284 : F5 key not working
>> consistently.
>>
>> - Added the configurable keyboard shortcut (default F5) to refresh the
>> browser tree nodes.
>>
>>
>> Thanks,
>> Khushboo
>>
>


Re: [pgAdmin4][Patch]: RM 3284 - F5 key not working consistently

2018-04-26 Thread Joao De Almeida Pereira
Hi Khushboo,

I did some changes on your patch:
 0001 - Your original patch
 0002 - Convert keyboard.js to ES6
 0003 - Refactoring of the keyboard.js file(some one letter variables and
other code)



Thanks
Joao

On Thu, Apr 26, 2018 at 5:34 AM Khushboo Vashi <
khushboo.va...@enterprisedb.com> wrote:

> Hi,
>
> Please find the attached patch to fix the RM #3284 : F5 key not working
> consistently.
>
> - Added the configurable keyboard shortcut (default F5) to refresh the
> browser tree nodes.
>
>
> Thanks,
> Khushboo
>


0001-RM_3284_v1.patch
Description: Binary data


0002-Convert-keyboard.js-to-ES6.patch
Description: Binary data


0003-Refactoring-of-keyboard.js.patch
Description: Binary data


[pgAdmin4][Patch]: RM 3284 - F5 key not working consistently

2018-04-26 Thread Khushboo Vashi
Hi,

Please find the attached patch to fix the RM #3284 : F5 key not working
consistently.

- Added the configurable keyboard shortcut (default F5) to refresh the
browser tree nodes.


Thanks,
Khushboo
diff --git a/web/pgadmin/browser/register_browser_preferences.py b/web/pgadmin/browser/register_browser_preferences.py
index 178af6b..3c2da91 100644
--- a/web/pgadmin/browser/register_browser_preferences.py
+++ b/web/pgadmin/browser/register_browser_preferences.py
@@ -291,3 +291,18 @@ def register_browser_preferences(self):
 category_label=gettext('Keyboard shortcuts'),
 fields=fields
 )
+
+self.preference.register(
+'keyboard_shortcuts',
+'sub_menu_refresh',
+gettext('Refresh browser tree node'),
+'keyboardshortcut',
+{
+'alt': False,
+'shift': False,
+'control': False,
+'key': {'key_code': 116, 'char': 'F5'}
+},
+category_label=gettext('Keyboard shortcuts'),
+fields=fields
+)
diff --git a/web/pgadmin/browser/static/js/keyboard.js b/web/pgadmin/browser/static/js/keyboard.js
index 5c71b80..37fd61f 100644
--- a/web/pgadmin/browser/static/js/keyboard.js
+++ b/web/pgadmin/browser/static/js/keyboard.js
@@ -24,6 +24,7 @@ function(_, S, pgAdmin, $, Mousetrap, commonUtils, dialogTabNavigator) {
   'sub_menu_properties': commonUtils.parseShortcutValue(pgBrowser.get_preference('browser', 'sub_menu_properties').value),
   'sub_menu_create': commonUtils.parseShortcutValue(pgBrowser.get_preference('browser', 'sub_menu_create').value),
   'sub_menu_delete': commonUtils.parseShortcutValue(pgBrowser.get_preference('browser', 'sub_menu_delete').value),
+  'sub_menu_refresh': commonUtils.parseShortcutValue(pgBrowser.get_preference('browser', 'sub_menu_refresh').value),
   'context_menu': commonUtils.parseShortcutValue(pgBrowser.get_preference('browser', 'context_menu').value),
   'direct_debugging': commonUtils.parseShortcutValue(pgBrowser.get_preference('browser', 'direct_debugging').value),
 };
@@ -41,6 +42,7 @@ function(_, S, pgAdmin, $, Mousetrap, commonUtils, dialogTabNavigator) {
   'bindSubMenuProperties': {'shortcuts': this.keyboardShortcut.sub_menu_properties}, // Sub menu - Edit Properties,
   'bindSubMenuCreate': {'shortcuts': this.keyboardShortcut.sub_menu_create}, // Sub menu - Create Object,
   'bindSubMenuDelete': {'shortcuts': this.keyboardShortcut.sub_menu_delete}, // Sub menu - Delete object,
+  'bindSubMenuRefresh': {'shortcuts': this.keyboardShortcut.sub_menu_refresh, 'bindElem': '#tree'}, // Sub menu - Refresh object,
   'bindContextMenu': {'shortcuts': this.keyboardShortcut.context_menu}, // Sub menu - Open context menu,
   'bindDirectDebugging': {'shortcuts': this.keyboardShortcut.direct_debugging}, // Sub menu - Direct Debugging
 };
@@ -221,6 +223,13 @@ function(_, S, pgAdmin, $, Mousetrap, commonUtils, dialogTabNavigator) {
   // Call delete object callback
   pgAdmin.Browser.Node.callbacks.delete_obj.call(pgAdmin.Browser.Nodes[tree.t.itemData(tree.i)._type]);
 },
+bindSubMenuRefresh: function(e) {
+  e.preventDefault();
+  var tree = pgBrowser.keyboardNavigation.getTreeDetails();
+
+  // Call refresh object callback
+  pgAdmin.Browser.Node.callbacks.refresh.call(pgAdmin.Browser.Nodes[tree.t.itemData(tree.i)._type]);
+},
 bindContextMenu: function(e) {
   var tree = this.getTreeDetails(),
 left = $(e.srcElement).find('.aciTreeEntry').position().left + 70,
@@ -263,5 +272,5 @@ function(_, S, pgAdmin, $, Mousetrap, commonUtils, dialogTabNavigator) {
 },
   });
 
-  return pgAdmin.keyboardNavigation;
+  return pgAdmin.Browser.keyboardNavigation;
 });
diff --git a/web/pgadmin/static/js/utils.js b/web/pgadmin/static/js/utils.js
index 026297f..879bbd0 100644
--- a/web/pgadmin/static/js/utils.js
+++ b/web/pgadmin/static/js/utils.js
@@ -12,7 +12,7 @@ export function parseShortcutValue(obj) {
   if (obj.alt) { shortcut += 'alt+'; }
   if (obj.shift) { shortcut += 'shift+'; }
   if (obj.control) { shortcut += 'ctrl+'; }
-  shortcut += String.fromCharCode(obj.key.key_code).toLowerCase();
+  shortcut += obj.key.char.toLowerCase();
   return shortcut;
 }
 
diff --git a/web/regression/javascript/parse_shortcut_value_spec.js b/web/regression/javascript/parse_shortcut_value_spec.js
new file mode 100644
index 000..dc20c3e
--- /dev/null
+++ b/web/regression/javascript/parse_shortcut_value_spec.js
@@ -0,0 +1,117 @@
+/
+//
+// pgAdmin 4 - PostgreSQL Tools
+//
+// Copyright (C) 2013 - 2018, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+//
+
+import { parseShortcutValue } from 'sources/utils';
+
+describe('parseShortcutValue', function () {
+