public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pradip Parkale <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM7305]: Dashboard Server Activity showing old queries as active, not always showing current queries
Date: Wed, 27 Apr 2022 18:09:52 +0530
Message-ID: <CAJ9T6SvXHgbv71FR9d5_QberE1tiwi=9zBEV+7nfKMtTEnhkWQ@mail.gmail.com> (raw)

Hi Hackers,

Please find the attached patch for #7305 Dashboard Server Activity showing
old queries as active, not always showing current queries.

As well, I fixed the issue where the value of the search was resetting
after clicking the checkbox
-- 
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation


Attachments:

  [application/octet-stream] RM7305.patch (2.1K, 3-RM7305.patch)
  download | inline diff:
diff --git a/web/pgadmin/dashboard/static/js/Dashboard.jsx b/web/pgadmin/dashboard/static/js/Dashboard.jsx
index ebf4c082b..384c6ce91 100644
--- a/web/pgadmin/dashboard/static/js/Dashboard.jsx
+++ b/web/pgadmin/dashboard/static/js/Dashboard.jsx
@@ -353,18 +353,16 @@ export default function Dashboard({
             onClick={(e) => {
               e.preventDefault();
               row.toggleRowExpanded(!row.isExpanded);
-              if(!(row.id in schemaDict)){
-                let schema = new ActiveQuery({
-                  query: row.original.query,
-                  backend_type: row.original.backend_type,
-                  state_change: row.original.state_change,
-                  query_start: row.original.query_start,
-                });
-                setSchemaDict(prevState => ({
-                  ...prevState,
-                  [row.id]: schema
-                }));
-              }
+              let schema = new ActiveQuery({
+                query: row.original.query,
+                backend_type: row.original.backend_type,
+                state_change: row.original.state_change,
+                query_start: row.original.query_start,
+              });
+              setSchemaDict(prevState => ({
+                ...prevState,
+                [row.id]: schema
+              }));
             }}
             disabled={!canEditRow}
             aria-label="View the active session details"
diff --git a/web/pgadmin/static/js/components/PgTable.jsx b/web/pgadmin/static/js/components/PgTable.jsx
index b3e99f740..2dfec657f 100644
--- a/web/pgadmin/static/js/components/PgTable.jsx
+++ b/web/pgadmin/static/js/components/PgTable.jsx
@@ -228,12 +228,12 @@ export default function PgTable({ columns, data, isSelectRow, caveTable=true, ..
   const tableRef = React.useRef();
   const rowHeights = React.useRef({});
 
-  // Reset Search vakue in tab changed.
+  // Reset Search vakue on tab changes.
   React.useEffect(()=>{
     setSearchVal('');
     rowHeights.current = {};
     tableRef.current?.resetAfterIndex(0);
-  }, [columns]);
+  }, [data]);
 
   function getRowHeight(index) {
     return rowHeights.current[index] || ROW_HEIGHT;


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: [pgAdmin][RM7305]: Dashboard Server Activity showing old queries as active, not always showing current queries
  In-Reply-To: <CAJ9T6SvXHgbv71FR9d5_QberE1tiwi=9zBEV+7nfKMtTEnhkWQ@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