[pgAdmin][RM4559] Updating a trigger on EPAS server throws browser error

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

Attached is the patch to fix the issue where tree node path is not updated
for EPAS triggers when trigger OID changes.

-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
RM4559.patch (application/octet-stream, 919 B)
diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js
index f0388f7e..13775595 100644
--- a/web/pgadmin/static/js/tree/tree.js
+++ b/web/pgadmin/static/js/tree/tree.js
@@ -246,11 +246,14 @@ export class Tree {
   register($treeJQuery) {
     $treeJQuery.on('acitree', function (event, api, item, eventName) {
       if (api.isItem(item)) {
-        if (eventName === 'added') {
+        /* If the id of node is changed, the path should also be changed */
+        if (eventName === 'added' || eventName === 'idset') {
           const id = api.getId(item);
           const data = api.itemData(item);
 
-          this.prepareDraggable(data, item);
+          if(eventName === 'added') {
+            this.prepareDraggable(data, item);
+          }
 
           const parentId = this.translateTreeNodeIdFromACITree(api.parent(item));
           this.addNewNode(id, data, item, parentId);
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.