public inbox for [email protected]  
help / color / mirror / Atom feed
From: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: RM 3702 - pgAdmin dashboard showing the oid for the user-defined tables and table names for the catalog tables in locks monitoring window
Date: Fri, 4 Jan 2019 14:48:43 +0530
Message-ID: <CAFOhELfb36xY8iDBGuqGwGau0cXV_ZxQhSoBp=WLF4fFadwahA@mail.gmail.com> (raw)

Hi,

Please find the attached patch to fix RM #3702 - pgAdmin dashboard showing
the oid for the user-defined tables and table names for the catalog tables
in locks monitoring window.

Dashboard > Server Activity > Locks - shows the table oid in the 'Target
relation' column instead of table name.

The attached patch fixes this issue for the database level but not for the
server level.  The reason for this is, at the server level we fetch the
data from the pg_locks with the maintenance database, so it can not fetch
the pg_class relation for the other database tables (relation::regclass).

Please find the attached screen-shots for the issue and the fix and let me
know if there is any other way to fix this.

Thanks,
Khushboo


Attachments:

  [image/png] Table_lock_after.png (1.0M, 3-Table_lock_after.png)
  download | view image

  [image/png] Table_lock_before.png (442.7K, 4-Table_lock_before.png)
  download | view image

  [application/octet-stream] RM_3702.patch (2.3K, 5-RM_3702.patch)
  download | inline diff:
diff --git a/web/pgadmin/dashboard/__init__.py b/web/pgadmin/dashboard/__init__.py
index 5d14fa7d..9a0118c8 100644
--- a/web/pgadmin/dashboard/__init__.py
+++ b/web/pgadmin/dashboard/__init__.py
@@ -219,25 +219,10 @@ def check_precondition(f):
                             " to view the graph.")
                 )
 
-        g.conn = g.manager.connection()
-
-        # If DB not connected then return error to browser
-        if not g.conn.connected():
-            if f.__name__ in stats_type:
-                return precondition_required(
-                    gettext("Please connect to the selected server"
-                            " to view the table.")
-                )
-            else:
-                return precondition_required(
-                    gettext("Please connect to the selected server"
-                            " to view the graph.")
-                )
-
         if 'did' in kwargs:
-            db_conn = g.manager.connection(did=kwargs['did'])
+            g.conn = g.manager.connection(did=kwargs['did'])
             # If the selected DB not connected then return error to browser
-            if not db_conn.connected():
+            if not g.conn.connected():
                 if f.__name__ in stats_type:
                     return precondition_required(
                         gettext("Please connect to the selected database"
@@ -248,6 +233,21 @@ def check_precondition(f):
                         gettext("Please connect to the selected database to"
                                 " view the graph.")
                     )
+        else:
+            g.conn = g.manager.connection()
+
+            # If DB not connected then return error to browser
+            if not g.conn.connected():
+                if f.__name__ in stats_type:
+                    return precondition_required(
+                        gettext("Please connect to the selected server"
+                                " to view the table.")
+                    )
+                else:
+                    return precondition_required(
+                        gettext("Please connect to the selected server"
+                                " to view the graph.")
+                    )
 
         # Set template path for sql scripts
         g.server_type = g.manager.server_type


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][Patch]: RM 3702 - pgAdmin dashboard showing the oid for the user-defined tables and table names for the catalog tables in locks monitoring window
  In-Reply-To: <CAFOhELfb36xY8iDBGuqGwGau0cXV_ZxQhSoBp=WLF4fFadwahA@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