public inbox for [email protected]  
help / color / mirror / Atom feed
From: Rahul Shirsat <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [Patch][pgAdmin] RM4203 Rename Database by another user
Date: Mon, 7 Jun 2021 17:08:14 +0530
Message-ID: <CAKtn9dMP3DzvRqoLO1iYTATTftjF2Bw8YXLY5_xpDkbCjtUNwg@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDeUFmDmZwap03H+UT+F6JAPkjZdNA8j43Qp0Dz7U04bSg@mail.gmail.com>
References: <CAKtn9dPZQWV8aT+mW5DRU3dZYwKyKyanGST7-juuEdV4Dhp1AA@mail.gmail.com>
	<CANxoLDdvQGWZT7DbmMmssLxy3biY+--KeQx40AkTXzmp7kizLg@mail.gmail.com>
	<CAKtn9dOyM2ptVoAha3DhtbPzmeAEzZwbTF+amg_i3m2tYUs3wg@mail.gmail.com>
	<CANxoLDeUFmDmZwap03H+UT+F6JAPkjZdNA8j43Qp0Dz7U04bSg@mail.gmail.com>

Hi Akshay,

Please find the updated patch below for your reference. I have added an
extra check for verifying the database rename.
Sorry for the inconvenience caused.

On Tue, Jun 1, 2021 at 8:50 PM Akshay Joshi <[email protected]>
wrote:

> Thanks, the patch applied.
>
> On Sun, May 30, 2021 at 12:03 AM Rahul Shirsat <
> [email protected]> wrote:
>
>> Hi Akshay,
>>
>> On Thu, May 27, 2021 at 12:19 PM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Hi Rahul
>>>
>>> Following are the review comments:
>>>
>>>    - Why you have changed the order of the toolbar button on the
>>>    browser tree? It should not.
>>>
>>>                Changes were related to the wcDocker issue showing
>> reverse order buttons, so had to change in the pgAdmin app to reflect it
>> correctly.
>>
>>>
>>>    - *sqleditor.js (check_db_name_change function)*
>>>    - var declaration should be comma-separated instead of writing var,
>>>       again and again.
>>>
>>>                           Done.
>>
>>>
>>>    - Add proper comments.
>>>
>>>                           This too is taken care of.
>>
>>>
>>>    - Remove dots from the string "Database moved/renamed.."
>>>
>>>                           Done.
>>
>>>
>>>    - "Please note that the database you are working on has been moved
>>>       or renamed to ${data.actual_db_name}. Refresh databases in browser panel or
>>>       click OK to continue.." should be changed to "Current database has been
>>>       moved or renamed to ${data.actual_db_name}. Click on the OK button to
>>>       refresh the database name."
>>>
>>>                           Done.
>>                            Also have done some code refactoring.
>>
>>>
>>>
>>> On Wed, May 26, 2021 at 2:07 PM Rahul Shirsat <
>>> [email protected]> wrote:
>>>
>>>> Hi Hackers,
>>>>
>>>> Please find the attached patch which resolves the issue of renaming the
>>>> database by another user.
>>>>
>>>> A minor issue of navigation button alignment is also fixed in this
>>>> patch.
>>>>
>>>> --
>>>> *Rahul Shirsat*
>>>> Senior Software Engineer | EnterpriseDB Corporation.
>>>>
>>>
>>>
>>> --
>>> *Thanks & Regards*
>>> *Akshay Joshi*
>>> *pgAdmin Hacker | Principal Software Architect*
>>> *EDB Postgres <http://edbpostgres.com>*
>>>
>>> *Mobile: +91 976-788-8246*
>>>
>>
>>
>> --
>> *Rahul Shirsat*
>> Senior Software Engineer | EnterpriseDB Corporation.
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Principal Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>


-- 
*Rahul Shirsat*
Senior Software Engineer | EnterpriseDB Corporation.


Attachments:

  [application/x-patch] RM4203_v3.patch (1.6K, 3-RM4203_v3.patch)
  download | inline diff:
diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py
index 884cc8be0..780c0243f 100644
--- a/web/pgadmin/tools/sqleditor/__init__.py
+++ b/web/pgadmin/tools/sqleditor/__init__.py
@@ -505,6 +505,8 @@ def poll(trans_id):
 
     transaction_status = conn.transaction_status()
     data_obj['db_name'] = conn.db
+    data_obj['db_id'] = trans_obj.did \
+        if trans_obj is not None and hasattr(trans_obj, 'did') else 0
 
     return make_json_response(
         data={
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 33547223e..3e91f424a 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -5125,9 +5125,10 @@ define('tools.querytool', [
           tree_data = pgWindow.default.pgAdmin.Browser.treeMenu.translateTreeNodeIdFromACITree(selected_item),
           server_data = pgWindow.default.pgAdmin.Browser.treeMenu.findNode(tree_data.slice(0,2)),
           database_data = pgWindow.default.pgAdmin.Browser.treeMenu.findNode(tree_data.slice(0,4)),
-          db_name = database_data.data.label;
+          db_name = database_data.data.label,
+          db_did = database_data.data._id;
 
-        if(!_.isEqual(db_name, data.data_obj.db_name)) {
+        if(data.data_obj.db_id == db_did && !_.isEqual(db_name, data.data_obj.db_name)) {
 
           var message = `Current database has been moved or renamed to ${data.data_obj.db_name}. Click on the OK button to refresh the database name.`,
             title = self.url_params.title;


view thread (6+ 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], [email protected]
  Subject: Re: [Patch][pgAdmin] RM4203 Rename Database by another user
  In-Reply-To: <CAKtn9dMP3DzvRqoLO1iYTATTftjF2Bw8YXLY5_xpDkbCjtUNwg@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