public inbox for [email protected]  
help / color / mirror / Atom feed
From: Aditya Toshniwal <[email protected]>
To: Akshay Joshi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin][RM6131] Port query tool to React
Date: Mon, 25 Apr 2022 18:07:01 +0530
Message-ID: <CAM9w-_ngk8sm+VKZP7C-J=co+VgeTtLX5TVFArpg8LQbsGGoDA@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDdbw8Em301fA1mq2LAFqnxASjTkk-9P+GT1j1B3CJ4Z9w@mail.gmail.com>
References: <CAM9w-_=7+yaGeh=m=-jo8ZMtqQBVYeyKBFJgarGUU09Ff+w68w@mail.gmail.com>
	<CANxoLDdeFxtgGVAJZvyoCZ8kCFEHVCRyi2eBL35HqGuR6301AA@mail.gmail.com>
	<CAM9w-_kASJCjN1pHrMeTe3+eFc2DYDT7qdTCGj+EuhC54AxJNw@mail.gmail.com>
	<CAM9w-_=pGojP3aG_FY56BNJjZFK1ziOJrZXyVJ1COKtaFtqfpQ@mail.gmail.com>
	<CANxoLDc+cNawZ=LCbfU_2Cx4rCWkbfjMVfv8mmY=Wk7GSUjcJg@mail.gmail.com>
	<CAM9w-_mvwZ221u8ZnY7i4f_3ujKTyoJ3=4qiSEUdqAegScFxaw@mail.gmail.com>
	<CAM9w-_=F5vUWkeAL+52NfcQvf+W3MoLCa0Kac2N031qA9eet2g@mail.gmail.com>
	<CAM9w-_k4sam2RbKxgKKp2ceNBQQn72zAOU4W7uFGWD_CEWpWCQ@mail.gmail.com>
	<CAM9w-_m2m5WFOroN_mkbbT39mYHWWTXjniv=Vcqrxv6Y=+ZpfA@mail.gmail.com>
	<CANxoLDeKDRYY3Woq13MxOrL9Wcfkz5533iFtdLJqwZaDoCA4cA@mail.gmail.com>
	<CAM9w-_=HuBA6a1uZkPNyjLHqA3H-yHKoMsF4yv6=MU7Kd4=tdg@mail.gmail.com>
	<CANxoLDe-oXPfN-btVLjfaQLUiDm88++ezskK64Kn7261PNSROw@mail.gmail.com>
	<CAM9w-_kuvmj91hVoyW25MCJU0iOS7hX9xpUwSuSB4-U7sJc_2Q@mail.gmail.com>
	<CANxoLDdbw8Em301fA1mq2LAFqnxASjTkk-9P+GT1j1B3CJ4Z9w@mail.gmail.com>

Attached path fixes:

   1. Failed to fetch query history error sometimes.
   2. In copy paste row, if a copied row has [null], then those are pasted
   as empty string.
   3. When Dataoutput is empty, show an empty grid.
   4. Schema diff generate script button results in empty window. Fixes
   #7306.
   5. Detach the DataOutput panel > Try editing text cell > Text editor is
   hidden behind data output panel


On Fri, Apr 22, 2022 at 6:18 PM Akshay Joshi <[email protected]>
wrote:

> Thanks, the patch applied
>
> On Fri, Apr 22, 2022 at 6:02 PM Aditya Toshniwal <
> [email protected]> wrote:
>
>> Hi,
>>
>> Attached patch fixes:
>> 1. Add min width to panels.
>> 2. Fix issues related to New connection in query tool. Also fixed some
>> existing bugs related to this.
>>
>> Please review.
>>
>> On Wed, Apr 20, 2022 at 7:04 PM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Thanks, the patch applied.
>>>
>>> On Wed, Apr 20, 2022 at 6:31 PM Aditya Toshniwal <
>>> [email protected]> wrote:
>>>
>>>> Attached patch fixes following issues:
>>>>
>>>>
>>>>    1. Find/Replace both opens the same dialogue box.(by clicking menu
>>>>    option)
>>>>    2. Add New Server Connection > Server options keep loading(For
>>>>    multiple Server groups & should have some server)
>>>>    3. Fixed CSS issues of slickgrid at various places.
>>>>    4. Try to edit cell with char varying data type(which opens text
>>>>    editor, leave editor open) > Scroll result grid verticall so that ediot
>>>>    disappaears > Click on another cell > query edior shows white screen &
>>>>    refresh is the only option left.(TypeError: Cannot read properties of null
>>>>    (reading 'querySelector’) - Issue is not reproducible if you scroll
>>>>    horizontally
>>>>    5. C should be captial in ’<New connection…>'
>>>>    6. In pop title for New Connection, all words should be
>>>>    capital.(Add new connection)
>>>>    7. Explain > Analaysis tab > Column heading missing ROWS PLAN with
>>>>    cost & In explain only.
>>>>    8. Explain > Analaysis tab > with cost enabled > Upward arrow size
>>>>    does not match with font of number. Arrow is little bigger than number.
>>>>    9. Boolean default is not considered while ading new row.(try table
>>>>    from feature test defaults)
>>>>    10. In query history , when not query history present, warning icon
>>>>    size big. Match it to warning message - No history found
>>>>    11. Select table/db object > Open query tool from Tools menu > NOT
>>>>    FOUND error is shown. Existing issue, fixed.
>>>>    12. Any cell just open by clicking it > Do NOT change any thing >
>>>>    Click Ok > Cell is shown as edited.
>>>>
>>>> Please review.
>>>>
>>>> On Mon, Apr 18, 2022 at 12:54 PM Akshay Joshi <
>>>> [email protected]> wrote:
>>>>
>>>>> Thanks, the patch applied.
>>>>>
>>>>> On Mon, Apr 18, 2022 at 11:27 AM Aditya Toshniwal <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi,
>>>>>> Attached is the patch to fix the issues raised. Few of them are
>>>>>> pending and will send it later.
>>>>>> Fixed:
>>>>>>
>>>>>>    1. Add New Server Connection > Server options keep loading(For
>>>>>>    empty Server group).
>>>>>>    2. After clicking indent/Unindent(for all operations) for large
>>>>>>    query option left as it is till operation completes
>>>>>>    3. Also check sign beside options in Execute Option/Copy Header
>>>>>>    is little bit big
>>>>>>    4. In explain > Analysis tab does not show ROWS column
>>>>>>    5. In explain > Explain > analysis previous explain output is NOT
>>>>>>    cleared. New rows are appended. Same applies to the statistics tab.
>>>>>>    6. Update new query tool connection tool tip.(7289)
>>>>>>    7. Explain-Analyze > Loops column is empty.
>>>>>>    8. Explain-Analyze with Verbose & Costs > in ROW X columns upward
>>>>>>    arrows are missing.
>>>>>>    9. Explain-Analyze with all option checked > background colors
>>>>>>    are missing for timing.
>>>>>>    10. Explain-Analyze > Additional bullet is added before Hash Cond.
>>>>>>    11. Browser Tree > Filtered rows icon is not working.
>>>>>>    12. Create table with timestamp and default value as function
>>>>>>    now() > Add new row > Enter mandatory columns except column where default
>>>>>>    value is function(now()) > Click Save > New row added but column with
>>>>>>    default value has value [default]. not updated to actual value. / Default
>>>>>>    values are not considered for any column while adding a new entry.
>>>>>>    13. Disable execute options in View/Edit data.
>>>>>>    14. The Boolean column always shows null.
>>>>>>    15. In Query history Remove & Remove all buttons are stuck to
>>>>>>    each other.
>>>>>>    16. On Remove all, the right panel is empty.
>>>>>>    17. Create a column with boolean[]/ text[], Try to add a new
>>>>>>    entry from data grid, enter “” quotes > Click Ok > Now try edit cell > You
>>>>>>    can not change value.
>>>>>>    18. In query history - Select queries are suffixed by ’Save Data’
>>>>>>    icon
>>>>>>    19. Edit any table with PK > Try to insert duplicate PK > Error
>>>>>>    thrown > Correct pK value > Still old error shown > Not able to add new
>>>>>>    entry (This works when focus is moved from edited cell)
>>>>>>    20. Clicking arrows after opening dropdown options, does not
>>>>>>    collapse dropdown.
>>>>>>
>>>>>> I was not able to reproduce some of the bugs on webpack dev mode, but
>>>>>> reproducible on webpack prod mode bundles. After a lot of debugging it
>>>>>> turned out that webpack/babel transpile was changing the meaning of a piece
>>>>>> of code in prod mode. I tweaked the code then most issues were not
>>>>>> reproducible anymore.
>>>>>> That said, following issues were not reproducible and this fix could
>>>>>> be the reason:
>>>>>>
>>>>>>    1. Not able to load more than 1000 rows.
>>>>>>    2. Find/Replace both opens the same dialogue box.
>>>>>>    3. Try to edit cell with char varying data type(which opens text
>>>>>>    editor) > Scroll result grid > Click on another cell > query edior shows
>>>>>>    white screen & refresh is the only option left.(TypeError: Cannot read
>>>>>>    properties of null (reading 'querySelector')
>>>>>>    at getCellElement (sqleditor.js?ver=60800:1:995456))
>>>>>>    4. Generate script is not working for schema diff for tables with
>>>>>>    target only/ not working for any.(TypeError: Cannot read properties of
>>>>>>    undefined (reading 'database'))
>>>>>>    5. Query results are appended in the Notification tab.
>>>>>>    6. Panel name is NOT updated on opening file. Panel-name should
>>>>>>    be filename
>>>>>>    7. Open a file in query tool > Open another file > Check panel
>>>>>>    name > It is the first file name.
>>>>>>    8. Incorrect CSV downloaded (film table) when CSV quotes select
>>>>>>    single quote from preferences. *CSV generated at backend. No
>>>>>>    changes done.*
>>>>>>    9. In Data grid > Add New data to cell > without clicking on
>>>>>>    other cell click on Add New row > previous data is gone.
>>>>>>
>>>>>>
>>>>>> Please find the comment inline for other issues:
>>>>>>
>>>>>>    1. Small white line is added below Total rows status bar.
>>>>>>    This is an existing issue with wcDocker. It is somehow not
>>>>>>    getting the correct size for the query tool. You can verify this by opening
>>>>>>    query tool in new tab.
>>>>>>    2. In explain > Data output > Query Plan is editable.
>>>>>>    To be precise, the JSON editor is editable but does not allow
>>>>>>    saving it. This is inline with other editors like text editor which allows
>>>>>>    editing but no save.
>>>>>>    3. Color is NOT fainted in View/Edit data when query tool is NOT
>>>>>>    editable.
>>>>>>    This is inline with other places where the SQL is read only like
>>>>>>    the properties dialog SQL tab or the RE-SQL tab. Plus, greying out of SQL
>>>>>>    affects query readability.
>>>>>>    4. If data in result grid is edited & changes are reverted, then
>>>>>>    also Save button remain enabled/ Cell is shown in bold indicating data is
>>>>>>    edited.
>>>>>>    This is based on existing behaviour. A separate RM can be raised
>>>>>>    to have any improvement in this.
>>>>>>    5. When the Save button is disabled then 'Save as' should be
>>>>>>    disabled as well.
>>>>>>    Save and Save As are different in behaviour. You can change a
>>>>>>    file and save it. The save will be disabled but the user should be allowed.
>>>>>>    I also checked the behaviour of VS-Code and PyCharm. They never disable the
>>>>>>    "save as" button. After all, there is no harm in allowing a user to save as
>>>>>>    even if it is empty.
>>>>>>    6. Manage Macros - Help button is disabled. Remove SQL help
>>>>>>    button(Not sure).
>>>>>>    As I already mentioned in the review by Askhay, the existing help
>>>>>>    button opens the query tool help. Query tool help is already
>>>>>>    added on the toolbar and so this one is disabled.
>>>>>>    7. Macros defined in one database are shown for other databases
>>>>>>    also/even across servers.
>>>>>>    As per the existing design.
>>>>>>    8. Query tool notifier setting is missing in preferences.
>>>>>>    Previously, the total time and number of rows were shown in the
>>>>>>    notifier. And so, the notifier setting was added so that users can tweak it
>>>>>>    to keep it open for a longer time. Now, we do not show those details on the
>>>>>>    notifier since we have a fixed status bar for that. This setting is not
>>>>>>    relevant anymore.
>>>>>>
>>>>>>
>>>>>> Issues that need to be checked and pending:
>>>>>>
>>>>>>    1. Explain-Analyze with all option checked > Statistics tab > %
>>>>>>    of query is always 0 for node type. Need to check all the calculations.
>>>>>>    2. In the Result grid multiple rows can not be selected with
>>>>>>    shift + down arrow.
>>>>>>    3. In Geometry Viewer , map disappears if taken to bottom.
>>>>>>    4. Keyboard shortcut - Focus in query tool and try Previous/Next
>>>>>>    tab is Not working add quotes in query tool
>>>>>>    5. Keyboard shortcut Switch Panel is not working
>>>>>>
>>>>>>
>>>>>> On Thu, Apr 7, 2022 at 3:37 PM Aditya Toshniwal <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Please find an updated patch with PEP8 issues fixed.
>>>>>>>
>>>>>>> On Thu, Apr 7, 2022 at 3:12 PM Aditya Toshniwal <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Hi Hackers,
>>>>>>>>
>>>>>>>> Attached is updated patch which now also includes:
>>>>>>>> Can't copy and paste row correctly if first column contains no data
>>>>>>>> #7294
>>>>>>>>
>>>>>>>> On Tue, Apr 5, 2022 at 5:45 PM Aditya Toshniwal <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Hi Akshay,
>>>>>>>>>
>>>>>>>>> Thank you for doing such a detailed review. Please find my
>>>>>>>>> comments inline below and attached patch.
>>>>>>>>>
>>>>>>>>> On Thu, Mar 17, 2022 at 4:05 PM Akshay Joshi <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Aditya
>>>>>>>>>>
>>>>>>>>>> Following are the review comments:
>>>>>>>>>>
>>>>>>>>>> *GUI:*
>>>>>>>>>>
>>>>>>>>>>    - The Maximize/Minimize button on the panel should be
>>>>>>>>>>    consistent with other panels.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Scratch Pad is missing or is there any new setting to add a
>>>>>>>>>>    scratch pad?
>>>>>>>>>>
>>>>>>>>>> Added. The layout lib currently does not have a context menu on
>>>>>>>>> the header to add a panel. For now, you can use the reset layout button to
>>>>>>>>> add the scratch pad again if closed. Context menu can be added separately
>>>>>>>>> later. Reset layout will not refresh the page.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Press "Cmd + G" on Query Tool it opens the old search bar
>>>>>>>>>>    is it still valid
>>>>>>>>>>    - [image: Screenshot 2022-03-16 at 7.02.34 PM.png]
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    -
>>>>>>>>>>    - In case of any error, we should move the cursor to the
>>>>>>>>>>    error location. We are highlighting the error row but it should be scroll
>>>>>>>>>>    to that location in the editor.
>>>>>>>>>>
>>>>>>>>>> Existing behaviour. Improvement done.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Error highlighting color should be aligned with the theme,
>>>>>>>>>>    check the existing color.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Error highlighting color is not cleared when running the
>>>>>>>>>>    successful query. Run "SELECT * from pg_class123" and then run "SELECT *
>>>>>>>>>>    from pg_class".
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - *ToolBar buttons*:
>>>>>>>>>>       - When the Save button is disabled then 'Save as' should
>>>>>>>>>>       be disabled as well.
>>>>>>>>>>
>>>>>>>>>> This is not correct. A user should be allowed to "Save as" a file
>>>>>>>>> even if it is saved and save button is disabled.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Open any SQL file, change some text and click on the 'Save'
>>>>>>>>>>       button, No notifier message has been flashed that 'File saved successfully'
>>>>>>>>>>       and the button does not get disabled as well.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Format SQL not working.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Clear Query keyboard shortcut not working.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    -
>>>>>>>>>>       - Clicking on the 'Clear Query' menu should pop up a
>>>>>>>>>>       confirmation dialog 'Are you sure you wish to discard the current changes?'
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Open any SQL file, change some text, and try to open
>>>>>>>>>>       another file, it should pop up a confirmation dialog 'Are you sure you wish
>>>>>>>>>>       to discard the current changes?'
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - When clicking on the New Query Tool button it is
>>>>>>>>>>       not opening the new query tool window.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Shortcut Key for Replace is not correct on *Windows*
>>>>>>>>>>       (Tooltip showing Alt + Ctrl + F) but actual is (Shift + Ctrl + F)
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Most of the Keyboard shortcuts are not working on Windows
>>>>>>>>>>       at all.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - *New Connection Dialog:*
>>>>>>>>>>       - The close button should be right-aligned.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Unable to test further because when selecting any
>>>>>>>>>>       disconnected server it should pop up the password dialog to connect and
>>>>>>>>>>       then fetch the details like databases, users, roles.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Help buttons are disabled.
>>>>>>>>>>
>>>>>>>>>> The existing help button opens the query tool help. Query tool
>>>>>>>>> help is already added on the toolbar.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - *Query History*:
>>>>>>>>>>       - For some queries like 'ROLLBACK' and 'COMMIT,' Rows
>>>>>>>>>>       affected shows in the negative (-1).
>>>>>>>>>>
>>>>>>>>>> Based on existing. I have made it blank.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - *Remove All* should warn the user before removing
>>>>>>>>>>       everything "Are you sure you wish to remove all the history? This will
>>>>>>>>>>       remove all of your query histories from this and other sessions for this
>>>>>>>>>>       database."
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Duration is missing. It should be there with the Date and
>>>>>>>>>>       Rows affected.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - *Status Bar*:
>>>>>>>>>>       - We should display Milliseconds as well in Query Complete.
>>>>>>>>>>
>>>>>>>>>> It will now display in <hr>:<min>:<sec>.<msec> format. Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Total Rows: *N of N, *I always observe the same, can you
>>>>>>>>>>       please change it to *N *only, Or am I missing some
>>>>>>>>>>       scenario where it is changed?
>>>>>>>>>>
>>>>>>>>>> We're fetching rows on demand. "X of N" says total X rows fetched
>>>>>>>>> till now but total N are available.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - *Data output*:
>>>>>>>>>>       - Default message "No data output......" should be shown
>>>>>>>>>>       when there are no rows/data, check the old behavior.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Extra space in the JSON Editor, even if I resize it, its
>>>>>>>>>>       height is not adjusted. Check the second screenshot
>>>>>>>>>>       - [image: Screenshot 2022-03-17 at 11.29.21 AM.png]
>>>>>>>>>>            [image: Screenshot 2022-03-17 at 11.29.59 AM.png]
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    -
>>>>>>>>>>    - *Explain*:
>>>>>>>>>>       - Old content should be cleared from the panel if we run
>>>>>>>>>>       the new query by clicking the play button. It should show an informative
>>>>>>>>>>       message, check the old behavior.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - *Macros*:
>>>>>>>>>>       - The close button should be right-aligned.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Help buttons are disabled.
>>>>>>>>>>
>>>>>>>>>> The existing help button opens the query tool help. Query tool
>>>>>>>>> help is already added on the toolbar.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - *View/Edit Data*:
>>>>>>>>>>    - Clipboard issues.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Unable to edit table data even if the primary key is
>>>>>>>>>>       defined.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Select All rows is missing at the left corner of the 'Data
>>>>>>>>>>       Output' Panel.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Change some data and try to save if an error comes then
>>>>>>>>>>       Spinner is not cleared.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    -  Filtered Rows not working. Click on the 'Filtered Rows
>>>>>>>>>>       ...' context menu.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Sort/Filter Dialog is missing.
>>>>>>>>>>
>>>>>>>>>> The sort/filter dialog is present and opens when you click the
>>>>>>>>> filter button. I have removed the "Sort/Filter" menu item which does the
>>>>>>>>> same thing.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Select any cell of the table content, click on any filter
>>>>>>>>>>       menu 'Filter by selection' or 'Exclude by selection' multiple times. It
>>>>>>>>>>       updates the query every time and adds the condition which is not there
>>>>>>>>>>       previously.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Limit (100 rows, 500 rows ...) not working. View data of
>>>>>>>>>>       any table having 1000+ rows and then apply the limit.
>>>>>>>>>>
>>>>>>>>>> I am not able to reproduce this. Works fine.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - *Themes*:
>>>>>>>>>>       - Check and Fix all the issues related to the theme.
>>>>>>>>>>       - [image: Screenshot 2022-03-17 at 1.43.01 PM.png].
>>>>>>>>>>                           [image: Screenshot 2022-03-17 at
>>>>>>>>>>       1.44.10 PM.png].
>>>>>>>>>>       -
>>>>>>>>>>       - [image: Screenshot 2022-03-17 at 1.44.53 PM.png]
>>>>>>>>>>                            [image: Screenshot 2022-03-17 at
>>>>>>>>>>       1.45.54 PM.png]
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    -
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> *Code:*
>>>>>>>>>>
>>>>>>>>>>    - Fix pep8 issues.
>>>>>>>>>>
>>>>>>>>>> Fixed.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - Can we fix the *Deprecation Warnings?*
>>>>>>>>>>
>>>>>>>>>> I think those are coming from bootstrap. Need to check that
>>>>>>>>> separately. Not related to the query tool.
>>>>>>>>>
>>>>>>>>>> *Note: *Code review still remains, meanwhile you can start
>>>>>>>>>> fixing the above issues.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Forgot to mention in initial mail - I have removed dependency on
>>>>>>>>> Snap.svg and have written Explain SVG codes from scratch.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Wed, Mar 16, 2022 at 5:54 PM Aditya Toshniwal <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> Attached is an updated one with few more improvements and fixes.
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Mar 16, 2022 at 1:40 PM Aditya Toshniwal <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Please find the attached patch :)
>>>>>>>>>>>>
>>>>>>>>>>>> On Wed, Mar 16, 2022 at 12:16 PM Akshay Joshi <
>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi Aditya
>>>>>>>>>>>>>
>>>>>>>>>>>>> I think you forgot to attach the patch.
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Tue, Mar 15, 2022 at 4:00 PM Aditya Toshniwal <
>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi Hackers,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Attached is the initial patch that migrates the SQL Editor
>>>>>>>>>>>>>> tool to React based. Change highlights:
>>>>>>>>>>>>>> 1. Complete rewrite to React code.
>>>>>>>>>>>>>> 2. UI improvements based on suggestions and requests.
>>>>>>>>>>>>>> 3. Work towards stability and performance improvement.
>>>>>>>>>>>>>> 4. Keep row numbers in view when scrolling horizontally.
>>>>>>>>>>>>>> Fixes #3989
>>>>>>>>>>>>>> 5. Fixed status bar at the bottom with useful details. Fixes
>>>>>>>>>>>>>> #3253
>>>>>>>>>>>>>> 6. Relocate GIS Viewer Button to the Left Side of Results
>>>>>>>>>>>>>> Table. Fixed #6830
>>>>>>>>>>>>>> 7. Allow to remove single history records. Refs #4113
>>>>>>>>>>>>>> 8. Macros usability improvements. Ref #6969
>>>>>>>>>>>>>> 9. Connection bar visibility issue. Fixes #7188
>>>>>>>>>>>>>> 10. Query tool layout issues. Fixes #6725
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Please note, there are still few minor niggles at some places
>>>>>>>>>>>>>> but the patch qualified to be reviewed. We will need a good amount of time
>>>>>>>>>>>>>> to test this properly. So, I am sending the feature patch. JS
>>>>>>>>>>>>>> test cases and documentation patches will follow soon.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Please review.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> [image: image.png]
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>>> Aditya Toshniwal
>>>>>>>>>>>>>> pgAdmin Hacker | Software Architect | *edbpostgres.com*
>>>>>>>>>>>>>> <http://edbpostgres.com;
>>>>>>>>>>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> *Thanks & Regards*
>>>>>>>>>>>>> *Akshay Joshi*
>>>>>>>>>>>>> *pgAdmin Hacker | Principal Software Architect*
>>>>>>>>>>>>> *EDB Postgres <http://edbpostgres.com>*
>>>>>>>>>>>>>
>>>>>>>>>>>>> *Mobile: +91 976-788-8246*
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Thanks,
>>>>>>>>>>>> Aditya Toshniwal
>>>>>>>>>>>> pgAdmin Hacker | Software Architect | *edbpostgres.com*
>>>>>>>>>>>> <http://edbpostgres.com;
>>>>>>>>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Thanks,
>>>>>>>>>>> Aditya Toshniwal
>>>>>>>>>>> pgAdmin Hacker | Software Architect | *edbpostgres.com*
>>>>>>>>>>> <http://edbpostgres.com;
>>>>>>>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> *Thanks & Regards*
>>>>>>>>>> *Akshay Joshi*
>>>>>>>>>> *pgAdmin Hacker | Principal Software Architect*
>>>>>>>>>> *EDB Postgres <http://edbpostgres.com>*
>>>>>>>>>>
>>>>>>>>>> *Mobile: +91 976-788-8246*
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Thanks,
>>>>>>>>> Aditya Toshniwal
>>>>>>>>> pgAdmin Hacker | Software Architect | *edbpostgres.com*
>>>>>>>>> <http://edbpostgres.com;
>>>>>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Thanks,
>>>>>>>> Aditya Toshniwal
>>>>>>>> pgAdmin Hacker | Software Architect | *edbpostgres.com*
>>>>>>>> <http://edbpostgres.com;
>>>>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Thanks,
>>>>>>> Aditya Toshniwal
>>>>>>> pgAdmin Hacker | Software Architect | *edbpostgres.com*
>>>>>>> <http://edbpostgres.com;
>>>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Thanks,
>>>>>> Aditya Toshniwal
>>>>>> pgAdmin Hacker | Software Architect | *edbpostgres.com*
>>>>>> <http://edbpostgres.com;
>>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Thanks & Regards*
>>>>> *Akshay Joshi*
>>>>> *pgAdmin Hacker | Principal Software Architect*
>>>>> *EDB Postgres <http://edbpostgres.com>*
>>>>>
>>>>> *Mobile: +91 976-788-8246*
>>>>>
>>>>
>>>>
>>>> --
>>>> Thanks,
>>>> Aditya Toshniwal
>>>> pgAdmin Hacker | Software Architect | *edbpostgres.com*
>>>> <http://edbpostgres.com;
>>>> "Don't Complain about Heat, Plant a TREE"
>>>>
>>>
>>>
>>> --
>>> *Thanks & Regards*
>>> *Akshay Joshi*
>>> *pgAdmin Hacker | Principal Software Architect*
>>> *EDB Postgres <http://edbpostgres.com>*
>>>
>>> *Mobile: +91 976-788-8246*
>>>
>>
>>
>> --
>> Thanks,
>> Aditya Toshniwal
>> pgAdmin Hacker | Software Architect | *edbpostgres.com*
>> <http://edbpostgres.com;
>> "Don't Complain about Heat, Plant a TREE"
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Principal Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>


-- 
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Software Architect | *edbpostgres.com*
<http://edbpostgres.com;
"Don't Complain about Heat, Plant a TREE"


Attachments:

  [image/png] image.png (177.9K, 3-image.png)
  download | view image

  [image/png] Screenshot 2022-03-16 at 7.02.34 PM.png (25.0K, 4-Screenshot%202022-03-16%20at%207.02.34%20PM.png)
  download | view image

  [image/png] Screenshot 2022-03-17 at 11.29.21 AM.png (70.5K, 5-Screenshot%202022-03-17%20at%2011.29.21%20AM.png)
  download | view image

  [image/png] Screenshot 2022-03-17 at 11.29.59 AM.png (82.7K, 6-Screenshot%202022-03-17%20at%2011.29.59%20AM.png)
  download | view image

  [image/png] Screenshot 2022-03-17 at 1.43.01 PM.png (315.4K, 7-Screenshot%202022-03-17%20at%201.43.01%20PM.png)
  download | view image

  [image/png] Screenshot 2022-03-17 at 1.44.10 PM.png (105.7K, 8-Screenshot%202022-03-17%20at%201.44.10%20PM.png)
  download | view image

  [image/png] Screenshot 2022-03-17 at 1.44.53 PM.png (49.7K, 9-Screenshot%202022-03-17%20at%201.44.53%20PM.png)
  download | view image

  [image/png] Screenshot 2022-03-17 at 1.45.54 PM.png (158.6K, 10-Screenshot%202022-03-17%20at%201.45.54%20PM.png)
  download | view image

  [application/octet-stream] RM6131.part5.patch (16.4K, 11-RM6131.part5.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/SchemaView/index.jsx b/web/pgadmin/static/js/SchemaView/index.jsx
index c50d56e25..71f3285d2 100644
--- a/web/pgadmin/static/js/SchemaView/index.jsx
+++ b/web/pgadmin/static/js/SchemaView/index.jsx
@@ -734,12 +734,12 @@ function SchemaDialogView({
               onClose={onErrClose} />
           </Box>
           {showFooter && <Box className={classes.footer}>
-            {useMemo(()=><Box>
+            {useMemo(()=>((!props.disableSqlHelp || !props.disableDialogHelp) && <Box>
               <PgIconButton data-test="sql-help" onClick={()=>props.onHelp(true, isNew)} icon={<InfoIcon />}
                 disabled={props.disableSqlHelp} className={classes.buttonMargin} title="SQL help for this object type."/>
               <PgIconButton data-test="dialog-help" onClick={()=>props.onHelp(false, isNew)} icon={<HelpIcon />} title="Help for this dialog."
                 disabled={props.disableDialogHelp}/>
-            </Box>, [])}
+            </Box>), [])}
             <Box marginLeft="auto">
               <DefaultButton data-test="Close" onClick={props.onClose} startIcon={<CloseIcon />} className={classes.buttonMargin}>
                 {gettext('Close')}
diff --git a/web/pgadmin/static/js/helpers/Layout.jsx b/web/pgadmin/static/js/helpers/Layout.jsx
index 0f18c1b83..8adfa6327 100644
--- a/web/pgadmin/static/js/helpers/Layout.jsx
+++ b/web/pgadmin/static/js/helpers/Layout.jsx
@@ -40,7 +40,6 @@ const useStyles = makeStyles((theme)=>({
       border: 'none',
       '&.dragging': {
         opacity: 0.6,
-        pointerEvents: 'visible',
       },
       '& .dock':  {
         borderRadius: 'inherit',
@@ -49,6 +48,7 @@ const useStyles = makeStyles((theme)=>({
         borderRadius: theme.shape.borderRadius,
         '&.dock-panel.dragging': {
           opacity: 1,
+          pointerEvents: 'visible',
         },
         '& .dock-ink-bar': {
           height: '0px',
diff --git a/web/pgadmin/static/scss/_codemirror.overrides.scss b/web/pgadmin/static/scss/_codemirror.overrides.scss
index 14c08a5f9..f49fe7f52 100644
--- a/web/pgadmin/static/scss/_codemirror.overrides.scss
+++ b/web/pgadmin/static/scss/_codemirror.overrides.scss
@@ -211,5 +211,6 @@
   background-color: $sql-editor-disable-bg !important;
 }
 
-
-
+.sql-editor-mark {
+  border-bottom: 2px dotted red;
+}
diff --git a/web/pgadmin/tools/erd/__init__.py b/web/pgadmin/tools/erd/__init__.py
index 260b5a70e..40ad9a6d8 100644
--- a/web/pgadmin/tools/erd/__init__.py
+++ b/web/pgadmin/tools/erd/__init__.py
@@ -479,6 +479,7 @@ def initialize_erd(trans_id, sgid, sid, did):
     return make_json_response(
         data={
             'connId': str(trans_id),
+            'database': conn.db,
             'serverVersion': conn.manager.version,
         }
     )
diff --git a/web/pgadmin/tools/erd/static/js/erd_tool/ui_components/BodyWidget.jsx b/web/pgadmin/tools/erd/static/js/erd_tool/ui_components/BodyWidget.jsx
index 63e3cae54..6a1586ff8 100644
--- a/web/pgadmin/tools/erd/static/js/erd_tool/ui_components/BodyWidget.jsx
+++ b/web/pgadmin/tools/erd/static/js/erd_tool/ui_components/BodyWidget.jsx
@@ -81,6 +81,7 @@ export default class BodyWidget extends React.Component {
       table_dialog_open: true,
       oto_dialog_open: true,
       otm_dialog_open: true,
+      database: null,
     };
     this.diagram = new ERDCore();
     /* Flag for checking if user has opted for save before close */
@@ -575,6 +576,7 @@ export default class BodyWidget extends React.Component {
           sid: this.props.params.sid,
           did: this.props.params.did,
           stype: this.props.params.server_type,
+          database: this.state.database,
         };
 
         let sqlId = `erd${this.props.params.trans_id}`;
@@ -764,6 +766,7 @@ export default class BodyWidget extends React.Component {
       this.setState({
         conn_status: CONNECT_STATUS.CONNECTED,
         server_version: response.data.data.serverVersion,
+        database: response.data.data.database,
       });
       return true;
     } catch (error) {
diff --git a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx
index ba566d309..7738dc33f 100644
--- a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx
+++ b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx
@@ -111,7 +111,7 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
   const modal = useModal();
 
   /* Connection status poller */
-  let pollTime = qtState.preferences.sqleditor.connection_status_fetch_time > 0 ?
+  let pollTime = qtState.preferences.sqleditor.connection_status_fetch_time > 0 && !qtState.obtaining_conn ?
     qtState.preferences.sqleditor.connection_status_fetch_time*1000 : -1;
   /* No need to poll when the query is executing. Query poller will the txn status */
   if(qtState.connection_status === CONNECTION_STATUS.TRANSACTION_STATUS_ACTIVE && qtState.connected) {
diff --git a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/CopyData.js b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/CopyData.js
index b434c81e2..43f51e3aa 100644
--- a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/CopyData.js
+++ b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/CopyData.js
@@ -47,6 +47,8 @@ export default class CopyData {
     }
     clipboard.copyToClipboard(csvRows.join('\n'));
     localStorage.setItem('copied-with-headers', withHeaders);
+    /* Push actual row to storage, can be used to identify null columns */
+    localStorage.setItem('copied-rows', JSON.stringify(rows));
   }
 
   escape(iStr) {
diff --git a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx
index d7815170b..16e62a51d 100644
--- a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx
+++ b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx
@@ -22,8 +22,7 @@ import Notifier from '../../../../../../static/js/helpers/Notifier';
 const useStyles = makeStyles((theme)=>({
   textEditor: {
     position: 'absolute',
-
-    zIndex: 1050,
+    zIndex: 1080,
     backgroundColor: theme.palette.background.default,
     padding: '0.25rem',
     fontSize: '12px',
@@ -41,7 +40,7 @@ const useStyles = makeStyles((theme)=>({
   },
   jsonEditor: {
     position: 'absolute',
-    zIndex: 1050,
+    zIndex: 1080,
     backgroundColor: theme.palette.background.default,
     ...theme.mixins.panelBorder,
     padding: '0.25rem',
diff --git a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/index.jsx b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/index.jsx
index f5c5b1c0d..664497451 100644
--- a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/index.jsx
+++ b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/index.jsx
@@ -335,12 +335,8 @@ export default function QueryToolDataGrid({columns, rows, totalRowCount, dataCha
   };
 
   useEffect(()=>{
-    if(columns.length > 0 || rows.length > 0) {
-      let initCols = initialiseColumns(columns, rows, totalRowCount, columnWidthBy);
-      setColumns(formatColumns(initCols, dataChangeStore, selectedColumns, onSelectedColumnsChangeWrapped, props.rowKeyGetter, classes));
-    } else {
-      setColumns([], [], 0);
-    }
+    let initCols = initialiseColumns(columns, rows, totalRowCount, columnWidthBy);
+    setColumns(formatColumns(initCols, dataChangeStore, selectedColumns, onSelectedColumnsChangeWrapped, props.rowKeyGetter, classes));
   }, [columns, rowsResetKey]);
 
   useEffect(()=>{
diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx
index 13a81c17d..42dc05a3b 100644
--- a/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx
+++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx
@@ -166,9 +166,11 @@ export default function Query() {
   const layoutEvenBus = useContext(LayoutEventsContext);
   const lastSavedText = React.useRef('');
   const markedLine = React.useRef(0);
+  const marker = React.useRef();
 
   const removeHighlightError = (cmObj)=>{
     // Remove already existing marker
+    marker.current?.clear();
     cmObj.removeLineClass(markedLine.current, 'wrap', 'CodeMirror-activeline-background');
     markedLine.current = 0;
   };
@@ -218,7 +220,7 @@ export default function Query() {
         endMarker = errorLine.length;
 
       // Mark the error text
-      cmObj.markText({
+      marker.current = cmObj.markText({
         line: errorLineNo,
         ch: startMarker,
       }, {
diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx
index 9319bbb3a..2f2246a85 100644
--- a/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx
+++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx
@@ -14,7 +14,7 @@ import _ from 'lodash';
 import clsx from 'clsx';
 import { Box, Grid, List, ListItem, ListSubheader } from '@material-ui/core';
 import url_for from 'sources/url_for';
-import { QueryToolContext, QueryToolEventsContext } from '../QueryToolComponent';
+import { QueryToolConnectionContext, QueryToolContext, QueryToolEventsContext } from '../QueryToolComponent';
 import moment from 'moment';
 import PlayArrowRoundedIcon from '@material-ui/icons/PlayArrowRounded';
 import AssessmentRoundedIcon from '@material-ui/icons/AssessmentRounded';
@@ -86,6 +86,9 @@ const useStyles = makeStyles((theme)=>({
   },
   removeBtnMargin: {
     marginLeft: '0.25rem',
+  },
+  queryMargin: {
+    marginTop: '12px',
   }
 }));
 
@@ -337,12 +340,13 @@ function QueryHistoryDetails({entry}) {
           <DefaultButton size="xs" className={classes.copyBtn} onClick={onCopyToEditor}>{gettext('Copy to Query Editor')}</DefaultButton>
           <CodeMirror
             value={entry.query}
+            readonly={true}
             options={{
               foldGutter: false,
               lineNumbers: false,
               gutters: [],
-              readOnly: true,
             }}
+            className={classes.queryMargin}
           />
         </Box>
         <Box marginTop="0.5rem">
@@ -361,6 +365,7 @@ QueryHistoryDetails.propTypes = {
 export function QueryHistory() {
   const qhu = React.useRef(new QueryHistoryUtils());
   const queryToolCtx = React.useContext(QueryToolContext);
+  const queryToolConnCtx = React.useContext(QueryToolConnectionContext);
   const classes = useStyles();
   const eventBus = React.useContext(QueryToolEventsContext);
   const [selectedItemKey, setSelectedItemKey] = React.useState(1);
@@ -371,11 +376,16 @@ export function QueryHistory() {
   const layoutEvenBus = React.useContext(LayoutEventsContext);
   const listRef = React.useRef();
 
-  React.useEffect(async ()=>{
+  React.useEffect(()=>{
     layoutEvenBus.registerListener(LAYOUT_EVENTS.ACTIVE, (currentTabId)=>{
       currentTabId == PANELS.HISTORY && listRef.current?.focus();
     });
+  }, []);
 
+  React.useEffect(async ()=>{
+    if(!queryToolConnCtx.connected) {
+      return;
+    }
     setLoaderText(gettext('Fetching history...'));
     try {
       let {data: respData} = await queryToolCtx.api.get(url_for('sqleditor.get_query_history', {
@@ -402,7 +412,7 @@ export function QueryHistory() {
     listRef.current?.focus();
     eventBus.registerListener(QUERY_TOOL_EVENTS.PUSH_HISTORY, pushHistory);
     return ()=>eventBus.deregisterListener(QUERY_TOOL_EVENTS.PUSH_HISTORY, pushHistory);
-  }, []);
+  }, [queryToolConnCtx.connected]);
 
   const onRemove = async ()=>{
     setLoaderText(gettext('Removing history entry...'));
diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx
index 6bdb45624..bb8b89ee8 100644
--- a/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx
+++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx
@@ -547,10 +547,12 @@ export class ResultSetUtils {
     return columns;
   }
 
-  processClipboardVal(columnVal, col) {
+  processClipboardVal(columnVal, col, rawCopiedVal) {
     if(columnVal === '') {
       if(col.has_default_val) {
         columnVal = undefined;
+      } else if(rawCopiedVal === null) {
+        columnVal = null;
       }
     }
     if(col.cell === 'boolean') {
@@ -570,14 +572,19 @@ export class ResultSetUtils {
     if(!_.isArray(result) || !_.size(result)) {
       return retVal;
     }
-    for(const rec of result) {
+    let copiedRowsObjects = [];
+    try {
+      /* If the raw row objects are available, use to them identify null values */
+      copiedRowsObjects = JSON.parse(localStorage.getItem('copied-rows'));
+    } catch {/* Suppress the error */}
+    for(const [recIdx, rec] of result?.entries()) {
       // Convert 2darray to dict.
       let rowObj = {};
       for(const col of columns) {
         let columnVal = rec[col.pos];
         /* If the source is clipboard, then it needs some extra handling */
         if(fromClipboard) {
-          columnVal = this.processClipboardVal(columnVal, col);
+          columnVal = this.processClipboardVal(columnVal, col, copiedRowsObjects[recIdx]?.[col.key]);
         }
         rowObj[col.key] = columnVal;
       }
@@ -605,15 +612,16 @@ export class ResultSetUtils {
   }
 
   queryFinished(httpMessage, onResultsAvailable, onExplain) {
-    let msg;
     let endTime = new Date();
     this.eventBus.fireEvent(QUERY_TOOL_EVENTS.EXECUTION_END, true);
     this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_CONNECTION_STATUS, httpMessage.data.data.transaction_status);
     this.eventBus.fireEvent(QUERY_TOOL_EVENTS.TASK_END, gettext('Query complete'), endTime);
     this.setEndTime(endTime);
 
-    msg = gettext('Query returned successfully in %s.', this.queryRunTime());
+    let msg = gettext('Query returned successfully in %s.', this.queryRunTime());
     if(this.hasResultsToDisplay(httpMessage.data.data)) {
+      msg = gettext('Successfully run. Total query runtime: %s.', this.queryRunTime())
+        + '\n' + gettext('%s rows affected.', httpMessage.data.data?.rows_affected);
       if(!_.isNull(httpMessage.data.data.additional_messages)){
         msg = httpMessage.data.data.additional_messages + '\n' + msg;
       }
@@ -1194,10 +1202,10 @@ export function ResultSet() {
     <Box className={classes.root} ref={containerRef} tabIndex="0">
       <Loader message={loaderText} />
       <Loader message={isLoadingMore ? gettext('Loading more rows...') : null} style={{top: 'unset', right: 'unset', padding: '0.5rem 1rem'}}/>
-      {(columns.length == 0 && rows.length == 0) &&
+      {!queryData &&
         <EmptyPanelMessage text={gettext('No data output. Execute a query to get output.')}/>
       }
-      {(columns.length != 0 || rows.length != 0) && <>
+      {queryData && <>
         <ResultSetToolbar containerRef={containerRef} canEdit={queryData.can_edit}/>
         <Box flexGrow="1" minHeight="0">
           <QueryToolDataGrid
diff --git a/web/pgadmin/tools/sqleditor/static/js/show_query_tool.js b/web/pgadmin/tools/sqleditor/static/js/show_query_tool.js
index 8f2b22c5f..1ff9f8d6f 100644
--- a/web/pgadmin/tools/sqleditor/static/js/show_query_tool.js
+++ b/web/pgadmin/tools/sqleditor/static/js/show_query_tool.js
@@ -85,6 +85,7 @@ export function generateScript(parentData, queryToolMod) {
     +`&sid=${parentData.sid}`
     +`&server_type=${parentData.stype}`
     +`&did=${parentData.did}`
+    +`&database_name=${parentData.database}`
     +`&sql_id=${parentData.sql_id}`;
 
   launchQueryTool(queryToolMod, transId, url_endpoint, queryToolTitle, '');
@@ -102,6 +103,7 @@ export function showERDSqlTool(parentData, erdSqlId, queryToolTitle, queryToolMo
     },
     database: {
       _id: parentData.did,
+      label: parentData.database,
     },
   };
 
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor_title.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor_title.js
index 93bd0d015..dca571fba 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor_title.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor_title.js
@@ -16,7 +16,7 @@ const pgAdmin = pgWindow.pgAdmin;
 
 export function getDatabaseLabel(parentData) {
   return parentData.database ? parentData.database.label
-    : parentData.server.db;
+    : parentData.server?.db;
 }
 
 function isServerInformationAvailable(parentData) {


view thread (25+ 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: [pgAdmin][RM6131] Port query tool to React
  In-Reply-To: <CAM9w-_ngk8sm+VKZP7C-J=co+VgeTtLX5TVFArpg8LQbsGGoDA@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