[pgAdmin][RM3130] User can not open create new object dialogue with alt+shift+n key on collection node

Aditya Toshniwal <[email protected]>
Newsgroups gmane.comp.db.postgresql.pgadmin.devel
Message-ID <CAM9w-_kBNG08dMacAexy9xdEgG8dbdCQ2Zn=VUjHt3TDi3BvTA@mail.gmail.com>
Hi Hackers,

Attached is the patch to fix create object shortcut on collection nodes.
Kindly review.

-- 
Thanks and Regards,
Aditya Toshniwal
Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
RM3130.patch (application/octet-stream, 1 KB)
diff --git a/web/pgadmin/browser/static/js/keyboard.js b/web/pgadmin/browser/static/js/keyboard.js
index 3958e8cf5..1a402da8d 100644
--- a/web/pgadmin/browser/static/js/keyboard.js
+++ b/web/pgadmin/browser/static/js/keyboard.js
@@ -273,13 +273,20 @@ _.extend(pgBrowser.keyboardNavigation, {
   },
   bindSubMenuCreate: function() {
     const tree = this.getTreeDetails();
-
-    if (!tree.d || pgAdmin.Browser.Nodes[tree.t.itemData(tree.i)._type].collection_node === true)
+    let node_obj = pgAdmin.Browser.Nodes[tree.t.itemData(tree.i)._type];
+    if (!tree.d){
       return;
+    } else if(node_obj.collection_node === true) {
+      if(node_obj.node) {
+        node_obj = pgAdmin.Browser.Nodes[node_obj.node];
+      } else {
+        return;
+      }
+    }
 
     // Open properties dialog in edit mode
     pgAdmin.Browser.Node.callbacks.show_obj_properties.call(
-      pgAdmin.Browser.Nodes[tree.t.itemData(tree.i)._type], {action: 'create'}
+      node_obj, {action: 'create', item: tree.i}
     );
   },
   bindSubMenuDelete: function() {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.