public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nikhil Mohite <[email protected]>
To: pgadmin-hackers <[email protected]>
Cc: Dave Page <[email protected]>
Cc: Akshay Joshi <[email protected]>
Subject: Re: [pgAdmin][RM-2341]: Add menu option for starting PSQL
Date: Tue, 1 Jun 2021 17:28:21 +0530
Message-ID: <CAOBg0AO-gsDJSrLoGPJGKsq772Okgg3BWDuERaaGSDvoGbhQAA@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDdGeNOBZJu-v9YaefKeTSGcCcU2DQic1MQU9jYYLJ6K_Q@mail.gmail.com>
References: <CAOBg0AO6Tjksb+EOA_-O13yRzdL_2d3y6G74m=GGQS+Ymjv=0g@mail.gmail.com>
	<CA+OCxow9+UDMrsBBvJKW2AeAYaN4cO3w7kBGNKtsWhSM6_D7gQ@mail.gmail.com>
	<CAOBg0AMVyLBma8wsbZ-VQWF4q3OAhqWeRLpmrxVcM_YOKH+MDQ@mail.gmail.com>
	<CANxoLDd2xMu7ym9PFdhYUSy4ucNuPoZ2fvaRkuwyB+EqowLXwA@mail.gmail.com>
	<CA+OCxowoz1oFE=eMKEnfFtf=oDrkPKHGfZpUGRW-sG_tpfMBTw@mail.gmail.com>
	<CAOBg0ANFNvtD-LoFxXcLY5JJ4BVH5zNyrmdBED6B++-nKf012g@mail.gmail.com>
	<CA+OCxowW7BEZzULbEpn73ygqWtWkUwdCAB3PMcHocUeQXcM3ow@mail.gmail.com>
	<CAOBg0APGPTA4qNNryAXMwKP63uFLxQdQwnFdDXMjSr4OeH-HAg@mail.gmail.com>
	<CA+OCxozYus58i3BhP37E-2Xc6Nq5zrJegcq+eANWpvN++_LtXw@mail.gmail.com>
	<CAOBg0AO7NfJjLLFD8g5NkkbbnKiCSR5g9yshxc-65sWk2sFyBA@mail.gmail.com>
	<CA+OCxoxdaBmh6e4Fo1F_+vZExq8SPUyGAByRzOPy2kz_vgRiSA@mail.gmail.com>
	<CAOBg0AO6A10OHiQAOOguagW1mNzfK1oVPHG9W+JSCkYjR+xQkA@mail.gmail.com>
	<CA+OCxoxpyfJabnycSGmtUK1-QEndNfZV3q2d1xP-oftDn-pGDw@mail.gmail.com>
	<CANxoLDexHsJQcrd6ZrkjCub+xj_Ke+dDp_Av5no84MOJH1uC_g@mail.gmail.com>
	<CAOBg0AN6Gb9gp1F=jKeefAz6d0U2GSjC40qAJ8i7psor2KmQLA@mail.gmail.com>
	<CANxoLDd3QdOPY7Y6kDCSy99s3DFrbdhP9LNxphsEg9B5G14Dbg@mail.gmail.com>
	<CAOBg0AN3eSLvS_cG7R3WiTpfBxiJfi2YB6sV8NBWiakioXRAsQ@mail.gmail.com>
	<CANxoLDdGeNOBZJu-v9YaefKeTSGcCcU2DQic1MQU9jYYLJ6K_Q@mail.gmail.com>

Hi Team,

Following are few points related to PSQL tool on windows:

   1.  Currently using the *pywinpty* library on windows to create pty
   process and execute the  psql.exe.
   2. To read the stderr (errors) currently using '2>>&1' arguments to
   psql.exe command. (It will redirect stderr to stdout )
   3. Windows conPTY is available on Windows 10 only (released after 2018).
   4. Windows conPTY does not support the Asynchronous I/O, so to get the
   terminal output, need to add the read function after every command
   execution. (something like select() is not available)
   5. Also found some performance issues with psql on windows.
      1. To read the output from the terminal need to add some sleep time
      as it will take time to return the output.
      2. Resize the terminal is also not consistent and causing the issue
      if we resize the window faster or multiple times very quickly.
      3. Loading large dataset sometimes cause system to non-responsive
      state.(In this state restart requires)

Please find the patch for disable the psql tool for windows
platform.(Windows builds are falling due to this sending patch for disable
psql on windows.)

Reference  links:

   1. https://github.com/microsoft/terminal/issues/262
   2.
   https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-conso....
   3. https://pypi.org/project/pywinpty/


If any suggestions or questions please let me know.

Regards,
Nikhil Mohite.

On Tue, May 25, 2021 at 8:20 PM Akshay Joshi <[email protected]>
wrote:

> Thanks, patch applied.
>
> I have updated the screenshot and some documentation stuff.
>
> On Tue, May 25, 2021 at 3:08 PM Nikhil Mohite <
> [email protected]> wrote:
>
>> Hi Akshay,
>>
>>
>> Please find the updated patch. (V6)
>> On Tue, May 25, 2021 at 2:55 PM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Hi Nikhil
>>>
>>> Please rebase and send the patch again.
>>>
>>> On Tue, May 25, 2021 at 2:52 PM Nikhil Mohite <
>>> [email protected]> wrote:
>>>
>>>> Hi Akshay/ Team
>>>>
>>>> On Mon, May 24, 2021 at 9:19 PM Akshay Joshi <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi Nikhil
>>>>>
>>>>> Following are the review comments:
>>>>>
>>>>>    - Set "ENABLE_PSQL = False", PSQL button from browser tree and
>>>>>    context menu option should not be visible.
>>>>>    - Documentation screenshot should be in standard theme for
>>>>>    consistency, and check the size it's very large. Take the screenshot with
>>>>>    the new PSQL button on the browser tree.
>>>>>    - Update 'menu_bar.rst' and 'toolbar.rst' with new changes.
>>>>>    - Remove commented code (if any)
>>>>>    - Check SonarQube (I haven't run)
>>>>>
>>>>> Please find the updated patch, resolve all the review comments, and
>>>> update the code to resolve the SonarQube issues.
>>>>
>>>>>
>>>>> On Thu, May 20, 2021 at 2:52 PM Dave Page <[email protected]> wrote:
>>>>>
>>>>>> Thanks Nikhil. Can someone else review this version please?
>>>>>>
>>>>>> On Wed, May 19, 2021 at 2:42 PM Nikhil Mohite <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi Dave/ Team,
>>>>>>>
>>>>>>> On Wed, May 19, 2021 at 1:43 PM Dave Page <[email protected]> wrote:
>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> On Wed, May 19, 2021 at 8:58 AM Nikhil Mohite <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Hi Dave/ Team,
>>>>>>>>>
>>>>>>>>> On Tue, May 18, 2021 at 8:41 PM Dave Page <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi
>>>>>>>>>>
>>>>>>>>>> On Tue, May 18, 2021 at 12:12 PM Nikhil Mohite <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Dave/Team,
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Mon, May 17, 2021 at 6:47 PM Dave Page <[email protected]>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi
>>>>>>>>>>>
>>>>>>>>>>> On Mon, May 17, 2021 at 11:01 AM Nikhil Mohite <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi Akshay/ Team,
>>>>>>>>>>>>
>>>>>>>>>>>> Please find the attached updated patch for the psql tool.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Hmm, this version is also broken. There's a typo in
>>>>>>>>>>> editor_template.html on line 138 - it splits a string across two lines
>>>>>>>>>>> which throws an error. Having fixed that...
>>>>>>>>>>>
>>>>>>>>>>> I also note there's a lot of Javascript in that HTML file. That
>>>>>>>>>>> should be pushed into the webpacked bundle I think, and not included inline
>>>>>>>>>>> in HTML.
>>>>>>>>>>>
>>>>>>>>>> I have moved most of the code in the js file, few things are
>>>>>>>>>> still in HTML.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Hmm, yes - in particular, colours for the different themes. Please
>>>>>>>>> move them into the css for the themes. You have a mix of style, layout and
>>>>>>>>> code in this file which needs to be cleaned up.
>>>>>>>>> xterm V3 onwards they have provided the API to set the theme and
>>>>>>>>> other settings, earlier I tried with CSS to override the theme but couldn’t
>>>>>>>>> able to apply the theme properly as some style get applied as in-line style
>>>>>>>>> for the HTML, so used the API to set the theme.
>>>>>>>>>
>>>>>>>>
>>>>>>>> OK, but either way we can't hard-code styles from themes in HTML
>>>>>>>> templates for individual features; that way leads to madness.
>>>>>>>>
>>>>>>>> Perhaps Aditya or one of the other team members can give some
>>>>>>>> assistance?
>>>>>>>>
>>>>>>> I have moved the color settings to the respective theme files.
>>>>>>> Aditya helped in this.
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Speaking of themes, the background colour for selected text
>>>>>>>>>> doesn't seem right (it's barely visible) in the dark theme. Can you fix
>>>>>>>>>> that to match the colouring in the SQL text boxes please?
>>>>>>>>>>
>>>>>>>>> I tried the default selection color from SQL for the dark and
>>>>>>> standard themes but still, it was not readable so just updated the color
>>>>>>> code with another color as follows.
>>>>>>> 1. Dark Theme:
>>>>>>> [image: Screenshot 2021-05-19 at 6.29.43 PM.png]
>>>>>>> 2. High Contrast: (using default SQL selection color)
>>>>>>> [image: Screenshot 2021-05-19 at 6.59.52 PM.png]
>>>>>>> 3. Standard:
>>>>>>> [image: image.png]
>>>>>>> can we go with the colors or should we update it?
>>>>>>>
>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> A couple of other things I noticed:
>>>>>>>>>>>>
>>>>>>>>>>>> - The button is enabled if the treeview has a Server selected.
>>>>>>>>>>>> It could be argued that the query tool should do the same (defaulting to
>>>>>>>>>>>> the maintenance database), however, that would be a separate change, and
>>>>>>>>>>>> psql should be consistent with the query tool.
>>>>>>>>>>>>
>>>>>>>>>>> It is now consistent with the query tool.
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> - If I do a "select * from pg_class;" I still get:
>>>>>>>>>>>>
>>>>>>>>>>>> postgres=# select * from pg_class;
>>>>>>>>>>>> WARNING: terminal is not fully functional
>>>>>>>>>>>>
>>>>>>>>>>> I am not able to reproduce the warning for the terminal (I am
>>>>>>>>>>> working on Catalina 10.15.7), I checked on browsers (chrome, firefox,
>>>>>>>>>>> Safari) and also checked on local nwjs runtime but still not able to
>>>>>>>>>>> reproduce the warning. but found one limitation:
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> It looks like that can be fixed by adding:
>>>>>>>>>>
>>>>>>>>>> env={'TERM': 'xterm'}
>>>>>>>>>>
>>>>>>>>> Added this in the environment when opening the psql panel.
>>>>>>>
>>>>>>>>
>>>>>>>>>> to the subprocess.Popen() call.
>>>>>>>>>>
>>>>>>>>>> I noticed while I was playing with that, that you are passing the
>>>>>>>>>> password as part of the connection string. As I've mentioned in the past,
>>>>>>>>>> that is absolutely not acceptable; it will expose the password to all
>>>>>>>>>> manner of tools (such as ps -ef). You *must* pass the password to psql
>>>>>>>>>> using the PGPASSWORD environment variable.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> if we try to load data from the table containing millions of
>>>>>>>>>>> records, UI gets very slow.
>>>>>>>>>>>
>>>>>>>>>> Removed the password from the connection string and added
>>>>>>> 'PGPASSWORD' in the environment.
>>>>>>>
>>>>>>>>
>>>>>>>>>> Is xtermjs discarding the older buffer contents when it fills up?
>>>>>>>>>> Can you tell where the memory usage is?
>>>>>>>>>>
>>>>>>>>> I checked the psql memory consumption in terminal and pgAdmin psql
>>>>>>>>> tool memory consumption is the similar. Also tested the performance and
>>>>>>>>> query execution timing is also  similar.
>>>>>>>>>
>>>>>>>>
>>>>>>>> OK, so there's probably not much we can do here.
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> - I'm sure using \q in the previous version displayed a message
>>>>>>>>>>>> saying the session exited (the one on line 138 of editor_template.html). It
>>>>>>>>>>>> no longer seems to do so.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> In addition to the issue above, it looks like the \! blocking may
>>>>>>>>>> have lost it's ability to ignore quoted strings:
>>>>>>>>>>
>>>>>>>>>> pgweb=# select '\!';
>>>>>>>>>> ERROR: Shell commands are disabled in psql for security
>>>>>>>>>>
>>>>>>>>> Fixed the issue now it is consistent with the psql terminal.
>>>>>>>
>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Tue, May 11, 2021 at 3:40 PM Dave Page <[email protected]>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Tue, May 11, 2021 at 9:02 AM Akshay Joshi <
>>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi Nikhil
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Following are the review comments:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> *GUI specific*:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    - We need a panel icon for PSQL like query tool, we can
>>>>>>>>>>>>>>>    also add that on the browser tree toolbar.
>>>>>>>>>>>>>>>    - PSQL Tool menu should be visible for all the child
>>>>>>>>>>>>>>>    nodes of the database node. Follow the same as Query Tool.
>>>>>>>>>>>>>>>    - PSQL tab title should be only database server name as
>>>>>>>>>>>>>>>    the user can change the database/user from PSQL command, so it's been
>>>>>>>>>>>>>>>    difficult to update the tab title.
>>>>>>>>>>>>>>>    - PSQL connection is still open even if we disconnect
>>>>>>>>>>>>>>>    the database server from the browser tree.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> *Code specific:*
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    - Remove an extra space from requirements.txt and
>>>>>>>>>>>>>>>    package.json
>>>>>>>>>>>>>>>    - Documentation needs to be updated to let the user know
>>>>>>>>>>>>>>>    from where the PSQL tool will open and on which node it is applicable.
>>>>>>>>>>>>>>>    - psql/__init__.py check there are so many unused
>>>>>>>>>>>>>>>    imports please remove them.
>>>>>>>>>>>>>>>    - We are not using cheroot so it should be removed from
>>>>>>>>>>>>>>>    requirements.txt and also remove the import statement from pgAdmin4.py
>>>>>>>>>>>>>>>    - Test cases are showing successful but actually, there
>>>>>>>>>>>>>>>    are some routing errors please check.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> A few other things I noticed:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> - I was prompted to enter a password. This should be passed
>>>>>>>>>>>>>> in the environment to psql as it is for pg_dump etc.
>>>>>>>>>>>>>> - There seems to be an issue with terminal compatibility
>>>>>>>>>>>>>> (which I didn't have on my prototype):
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ml=# select * from pg_class;
>>>>>>>>>>>>>> WARNING: terminal is not fully functional
>>>>>>>>>>>>>> -[ RECORD 1
>>>>>>>>>>>>>> ]-------+----------------------------------------------
>>>>>>>>>>>>>> oid                 | 79354
>>>>>>>>>>>>>> relname             | housing
>>>>>>>>>>>>>> ...
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> - The panel should honour the styleguide. I'm running in dark
>>>>>>>>>>>>>> mode, and see a jet black background. I would expect to see the same
>>>>>>>>>>>>>> background/foreground colours as the treeview.
>>>>>>>>>>>>>> - I spotted at least one print() statement that shouldn't be
>>>>>>>>>>>>>> there (debug output should go through the logger) - psql/__init__.py:235
>>>>>>>>>>>>>> - This seems suspect - why would there be a password in a
>>>>>>>>>>>>>> connection string we've built? And why would it be xxx?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>     if 'password=xxx' in conn_attr:
>>>>>>>>>>>>>>         conn_attr = conn_attr.replace('password=xxx', '')
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> - There's a thick white line at the bottom of the panel,
>>>>>>>>>>>>>> where a horizontal scrollbar might be if there was one.
>>>>>>>>>>>>>> - The trailing semi-colon should be removed from: "ERROR:
>>>>>>>>>>>>>> Shell commands are disabled in psql for security;"
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Once we're happy with the patch in general, I'll do a string
>>>>>>>>>>>>>> review before committing. In particular, I want to be sure the text in
>>>>>>>>>>>>>> config.py is appropriately worded.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> This is shaping up nicely! Good work.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Mon, May 10, 2021 at 7:32 PM Nikhil Mohite <
>>>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Hi Dave/ Team,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> PFA updated patch, sorry for the inconvenience, while
>>>>>>>>>>>>>>>> cleanup I removed the unwanted libraries but forgot to remove the code
>>>>>>>>>>>>>>>> related to them.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On Mon, May 10, 2021 at 7:10 PM Dave Page <
>>>>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On Mon, May 10, 2021 at 1:45 PM Nikhil Mohite <
>>>>>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Hi Hackers,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Please find the attached patch for RM-2341
>>>>>>>>>>>>>>>>>> <https://redmine.postgresql.org/issues/2341;: Add Menu
>>>>>>>>>>>>>>>>>> option for starting PSQL.
>>>>>>>>>>>>>>>>>> 1. Added new Option PSQL Tool in Tools menu.
>>>>>>>>>>>>>>>>>> 2. Added the same option for Server and Database nodes
>>>>>>>>>>>>>>>>>> from the tree view.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Unfortunately there's a trailing comma in package.json
>>>>>>>>>>>>>>>>> that makes it invalid. If I fix that, then I get the error below, so I'm
>>>>>>>>>>>>>>>>> guessing the intention was to actually include another package there?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ERROR in ./pgadmin/tools/psql/static/js/psql_module.js
>>>>>>>>>>>>>>>>> 23:50-82
>>>>>>>>>>>>>>>>> Module not found: Error: Can't resolve
>>>>>>>>>>>>>>>>> 'local-echo-controller' in
>>>>>>>>>>>>>>>>> '/Users/dpage/git/pgadmin4/web/pgadmin/tools/psql/static/js'
>>>>>>>>>>>>>>>>> resolve 'local-echo-controller' in
>>>>>>>>>>>>>>>>> '/Users/dpage/git/pgadmin4/web/pgadmin/tools/psql/static/js'
>>>>>>>>>>>>>>>>>   Parsed request is a module
>>>>>>>>>>>>>>>>>   using description file:
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/package.json (relative path:
>>>>>>>>>>>>>>>>> ./pgadmin/tools/psql/static/js)
>>>>>>>>>>>>>>>>>     aliased with mapping 'local-echo-controller':
>>>>>>>>>>>>>>>>> '/Users/dpage/git/pgadmin4/web/node_modules/local-echo' to
>>>>>>>>>>>>>>>>> '/Users/dpage/git/pgadmin4/web/node_modules/local-echo'
>>>>>>>>>>>>>>>>>       using description file:
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/package.json (relative path:
>>>>>>>>>>>>>>>>> ./pgadmin/tools/psql/static/js)
>>>>>>>>>>>>>>>>>         Field 'browser' doesn't contain a valid alias
>>>>>>>>>>>>>>>>> configuration
>>>>>>>>>>>>>>>>>         root path /Users/dpage/git/pgadmin4/web
>>>>>>>>>>>>>>>>>           using description file:
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/package.json (relative path:
>>>>>>>>>>>>>>>>> ./Users/dpage/git/pgadmin4/web/node_modules/local-echo)
>>>>>>>>>>>>>>>>>             no extension
>>>>>>>>>>>>>>>>>               Field 'browser' doesn't contain a valid
>>>>>>>>>>>>>>>>> alias configuration
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/Users/dpage/git/pgadmin4/web/node_modules/local-echo
>>>>>>>>>>>>>>>>> doesn't exist
>>>>>>>>>>>>>>>>>             .js
>>>>>>>>>>>>>>>>>               Field 'browser' doesn't contain a valid
>>>>>>>>>>>>>>>>> alias configuration
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/Users/dpage/git/pgadmin4/web/node_modules/local-echo.js
>>>>>>>>>>>>>>>>> doesn't exist
>>>>>>>>>>>>>>>>>             .jsx
>>>>>>>>>>>>>>>>>               Field 'browser' doesn't contain a valid
>>>>>>>>>>>>>>>>> alias configuration
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/Users/dpage/git/pgadmin4/web/node_modules/local-echo.jsx
>>>>>>>>>>>>>>>>> doesn't exist
>>>>>>>>>>>>>>>>>             as directory
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/Users/dpage/git/pgadmin4/web/node_modules/local-echo
>>>>>>>>>>>>>>>>> doesn't exist
>>>>>>>>>>>>>>>>>         using description file:
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/package.json (relative path:
>>>>>>>>>>>>>>>>> ./node_modules/local-echo)
>>>>>>>>>>>>>>>>>           no extension
>>>>>>>>>>>>>>>>>             Field 'browser' doesn't contain a valid alias
>>>>>>>>>>>>>>>>> configuration
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/node_modules/local-echo doesn't exist
>>>>>>>>>>>>>>>>>           .js
>>>>>>>>>>>>>>>>>             Field 'browser' doesn't contain a valid alias
>>>>>>>>>>>>>>>>> configuration
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/node_modules/local-echo.js doesn't exist
>>>>>>>>>>>>>>>>>           .jsx
>>>>>>>>>>>>>>>>>             Field 'browser' doesn't contain a valid alias
>>>>>>>>>>>>>>>>> configuration
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/node_modules/local-echo.jsx doesn't exist
>>>>>>>>>>>>>>>>>           as directory
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> /Users/dpage/git/pgadmin4/web/node_modules/local-echo doesn't exist
>>>>>>>>>>>>>>>>>  @ ./pgadmin/tools/psql/static/js/index.js 17:19-43
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> 2021-05-10 14:38:37: webpack 5.21.2 compiled with 1 error
>>>>>>>>>>>>>>>>> in 60041 ms
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>> Dave Page
>>>>>>>>>>>>>>>>> Blog: https://pgsnake.blogspot.com
>>>>>>>>>>>>>>>>> Twitter: @pgsnake
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> EDB: https://www.enterprisedb.com
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>>>> Nikhil Mohite
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>> *Thanks & Regards*
>>>>>>>>>>>>>>> *Akshay Joshi*
>>>>>>>>>>>>>>> *pgAdmin Hacker | Principal Software Architect*
>>>>>>>>>>>>>>> *EDB Postgres <http://edbpostgres.com>*
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> *Mobile: +91 976-788-8246*
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> Dave Page
>>>>>>>>>>>>>> Blog: https://pgsnake.blogspot.com
>>>>>>>>>>>>>> Twitter: @pgsnake
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> EDB: https://www.enterprisedb.com
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>> Nikhil Mohite
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Dave Page
>>>>>>>>>>>> Blog: https://pgsnake.blogspot.com
>>>>>>>>>>>> Twitter: @pgsnake
>>>>>>>>>>>>
>>>>>>>>>>>> EDB: https://www.enterprisedb.com
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Regards,
>>>>>>>>>>> Nikhil Mohite
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Dave Page
>>>>>>>>>> Blog: https://pgsnake.blogspot.com
>>>>>>>>>> Twitter: @pgsnake
>>>>>>>>>>
>>>>>>>>>> EDB: https://www.enterprisedb.com
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Nikhil Mohite
>>>>>>>>>
>>>>>>>>>> <https://www.enterprisedb.com;
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>> *Thanks & Regards,*
>>>>>>>>> *Nikhil Mohite*
>>>>>>>>> *Software Engineer.*
>>>>>>>>> *EDB Postgres* <https://www.enterprisedb.com/;
>>>>>>>>> *Mob.No: +91-7798364578.*
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Dave Page
>>>>>>>> Blog: https://pgsnake.blogspot.com
>>>>>>>> Twitter: @pgsnake
>>>>>>>>
>>>>>>>> EDB: https://www.enterprisedb.com
>>>>>>>>
>>>>>>>> Regards,
>>>>>>> Nikhil Mohite
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Dave Page
>>>>>> Blog: https://pgsnake.blogspot.com
>>>>>> Twitter: @pgsnake
>>>>>>
>>>>>> EDB: https://www.enterprisedb.com
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> *Thanks & Regards*
>>>>> *Akshay Joshi*
>>>>> *pgAdmin Hacker | Principal Software Architect*
>>>>> *EDB Postgres <http://edbpostgres.com>*
>>>>>
>>>>> *Mobile: +91 976-788-8246*
>>>>>
>>>>
>>>
>>> --
>>> *Thanks & Regards*
>>> *Akshay Joshi*
>>> *pgAdmin Hacker | Principal Software Architect*
>>> *EDB Postgres <http://edbpostgres.com>*
>>>
>>> *Mobile: +91 976-788-8246*
>>>
>>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Principal Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>


Attachments:

  [image/png] Screenshot 2021-05-19 at 6.29.43 PM.png (81.5K, 3-Screenshot%202021-05-19%20at%206.29.43%20PM.png)
  download | view image

  [image/png] Screenshot 2021-05-19 at 6.59.52 PM.png (76.3K, 4-Screenshot%202021-05-19%20at%206.59.52%20PM.png)
  download | view image

  [image/png] image.png (52.6K, 5-image.png)
  download | view image

  [application/octet-stream] disable_psql_for_windows.patch (27.0K, 6-disable_psql_for_windows.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py
index 300625c5..edbd491e 100644
--- a/web/pgadmin/browser/__init__.py
+++ b/web/pgadmin/browser/__init__.py
@@ -851,7 +851,8 @@ def utils():
             app_version_int=config.APP_VERSION_INT,
             pg_libpq_version=pg_libpq_version,
             support_ssh_tunnel=config.SUPPORT_SSH_TUNNEL,
-            logout_url=_get_logout_url()
+            logout_url=_get_logout_url(),
+            platform=sys.platform
         ),
         200, {'Content-Type': MIMETYPE_APP_JS})
 
diff --git a/web/pgadmin/browser/register_browser_preferences.py b/web/pgadmin/browser/register_browser_preferences.py
index d835ca82..0e464c06 100644
--- a/web/pgadmin/browser/register_browser_preferences.py
+++ b/web/pgadmin/browser/register_browser_preferences.py
@@ -6,6 +6,7 @@
 # This software is released under the PostgreSQL Licence
 #
 ##########################################################################
+import sys
 from flask_babelex import gettext
 from pgadmin.utils.constants import PREF_LABEL_DISPLAY,\
     PREF_LABEL_KEYBOARD_SHORTCUTS, PREF_LABEL_TABS_SETTINGS, \
@@ -505,37 +506,61 @@ def register_browser_preferences(self):
         )
     )
 
-    self.open_in_new_tab = self.preference.register(
-        'tab_settings', 'new_browser_tab_open',
-        gettext("Open in new browser tab"), 'select2', None,
-        category_label=PREF_LABEL_OPTIONS,
-        options=[{'label': gettext('Query Tool'), 'value': 'qt'},
-                 {'label': gettext('Debugger'), 'value': 'debugger'},
-                 {'label': gettext('Schema Diff'), 'value': 'schema_diff'},
-                 {'label': gettext('ERD Tool'), 'value': 'erd_tool'},
-                 {'label': gettext('PSQL Tool'), 'value': 'psql_tool'}],
-        help_str=gettext('Select Query Tool, Debugger, Schema Diff, ERD Tool '
-                         'or PSQL Tool from the drop-down to set '
-                         'open in new browser tab for that particular module.'
-                         ),
-        select2={
-            'multiple': True, 'allowClear': False,
-            'tags': True, 'first_empty': False,
-            'selectOnClose': False, 'emptyOptions': True,
-            'tokenSeparators': [','],
-            'placeholder': gettext('Select open new tab...')
-        }
-    )
-
-    self.psql_tab_title = self.preference.register(
-        'tab_settings', 'psql_tab_title_placeholder',
-        gettext("PSQL tool tab title"),
-        'text', '%DATABASE%/%USERNAME%@%SERVER%',
-        category_label=PREF_LABEL_DISPLAY,
-        help_str=gettext(
-            'Supported placeholders are %DATABASE%, %USERNAME%, and %SERVER%. '
-            'Users can provide any string with or without placeholders of'
-            ' their choice. The blank title will be revert back to the'
-            ' default title with placeholders.'
+    if sys.platform != 'win32':
+        self.open_in_new_tab = self.preference.register(
+            'tab_settings', 'new_browser_tab_open',
+            gettext("Open in new browser tab"), 'select2', None,
+            category_label=PREF_LABEL_OPTIONS,
+            options=[{'label': gettext('Query Tool'), 'value': 'qt'},
+                     {'label': gettext('Debugger'), 'value': 'debugger'},
+                     {'label': gettext('Schema Diff'), 'value': 'schema_diff'},
+                     {'label': gettext('ERD Tool'), 'value': 'erd_tool'},
+                     {'label': gettext('PSQL Tool'), 'value': 'psql_tool'}],
+            help_str=gettext(
+                'Select Query Tool, Debugger, Schema Diff, ERD Tool '
+                'or PSQL Tool from the drop-down to set '
+                'open in new browser tab for that particular module.'
+            ),
+            select2={
+                'multiple': True, 'allowClear': False,
+                'tags': True, 'first_empty': False,
+                'selectOnClose': False, 'emptyOptions': True,
+                'tokenSeparators': [','],
+                'placeholder': gettext('Select open new tab...')
+            }
+        )
+
+        self.psql_tab_title = self.preference.register(
+            'tab_settings', 'psql_tab_title_placeholder',
+            gettext("PSQL tool tab title"),
+            'text', '%DATABASE%/%USERNAME%@%SERVER%',
+            category_label=PREF_LABEL_DISPLAY,
+            help_str=gettext(
+                'Supported placeholders are %DATABASE%, %USERNAME%, '
+                'and %SERVER%. Users can provide any string with or without'
+                ' placeholders of their choice. The blank title will be revert'
+                ' back to the default title with placeholders.'
+            )
+        )
+    else:
+        self.open_in_new_tab = self.preference.register(
+            'tab_settings', 'new_browser_tab_open',
+            gettext("Open in new browser tab"), 'select2', None,
+            category_label=PREF_LABEL_OPTIONS,
+            options=[{'label': gettext('Query Tool'), 'value': 'qt'},
+                     {'label': gettext('Debugger'), 'value': 'debugger'},
+                     {'label': gettext('Schema Diff'), 'value': 'schema_diff'},
+                     {'label': gettext('ERD Tool'), 'value': 'erd_tool'}],
+            help_str=gettext(
+                'Select Query Tool, Debugger, Schema Diff, ERD Tool '
+                'or PSQL Tool from the drop-down to set '
+                'open in new browser tab for that particular module.'
+            ),
+            select2={
+                'multiple': True, 'allowClear': False,
+                'tags': True, 'first_empty': False,
+                'selectOnClose': False, 'emptyOptions': True,
+                'tokenSeparators': [','],
+                'placeholder': gettext('Select open new tab...')
+            }
         )
-    )
diff --git a/web/pgadmin/browser/static/js/collection.js b/web/pgadmin/browser/static/js/collection.js
index e763aa11..64442189 100644
--- a/web/pgadmin/browser/static/js/collection.js
+++ b/web/pgadmin/browser/static/js/collection.js
@@ -66,12 +66,14 @@ define([
             }]);
 
             // show psql tool same as query tool.
-            pgAdmin.Browser.add_menus([{
-              name: 'show_psql_tool', node: this.type, module: this,
-              applies: ['context'], callback: 'show_psql_tool',
-              priority: 998, label: gettext('PSQL Tool (Beta)'),
-              icon: 'fas fa-terminal',
-            }]);
+            if(pgAdmin['enable_psql'] && pgAdmin['platform'] != 'win32') {
+              pgAdmin.Browser.add_menus([{
+                name: 'show_psql_tool', node: this.type, module: this,
+                applies: ['context'], callback: 'show_psql_tool',
+                priority: 998, label: gettext('PSQL Tool (Beta)'),
+                icon: 'fas fa-terminal',
+              }]);
+            }
           }
         }
       },
diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js
index f7c04d0d..c2e73931 100644
--- a/web/pgadmin/browser/static/js/node.js
+++ b/web/pgadmin/browser/static/js/node.js
@@ -210,7 +210,7 @@ define('pgadmin.browser.node', [
           icon: 'fa fa-search', enable: enable,
         }]);
 
-        if(pgAdmin['enable_psql']) {
+        if(pgAdmin['enable_psql'] && pgAdmin['platform'] != 'win32') {
           // show psql tool same as query tool.
           pgAdmin.Browser.add_menus([{
             name: 'show_psql_tool', node: this.type, module: this,
diff --git a/web/pgadmin/browser/static/js/toolbar.js b/web/pgadmin/browser/static/js/toolbar.js
index bc9c13a3..4aaa41ce 100644
--- a/web/pgadmin/browser/static/js/toolbar.js
+++ b/web/pgadmin/browser/static/js/toolbar.js
@@ -59,7 +59,7 @@ let _defaultToolBarButtons = [
   }
 ];
 
-if(pgAdmin['enable_psql']) {
+if(pgAdmin['enable_psql'] && pgAdmin['platform'] != 'win32') {
   _defaultToolBarButtons.unshift({
     label: gettext('PSQL Tool'),
     ariaLabel: gettext('PSQL Tool'),
@@ -119,7 +119,7 @@ export function initializeToolbar(panel, wcDocker) {
       pgAdmin.DataGrid.show_filtered_row({mnuid: 4}, pgAdmin.Browser.tree.selected());
     else if ('name' in data && data.name === gettext('Search objects'))
       pgAdmin.SearchObjects.show_search_objects('', pgAdmin.Browser.tree.selected());
-    else if ('name' in data && data.name === gettext('PSQL Tool')){
+    else if ('name' in data && data.name === gettext('PSQL Tool') && pgAdmin['platform'] != 'win32'){
       var input = {},
         t = pgAdmin.Browser.tree,
         i = input.item || t.selected(),
diff --git a/web/pgadmin/browser/templates/browser/js/utils.js b/web/pgadmin/browser/templates/browser/js/utils.js
index 0634aa70..ec20cbe8 100644
--- a/web/pgadmin/browser/templates/browser/js/utils.js
+++ b/web/pgadmin/browser/templates/browser/js/utils.js
@@ -54,6 +54,8 @@ define('pgadmin.browser.utils',
 
   /* GET PSQL Tool related config */
   pgAdmin['enable_psql'] =  '{{ current_app.config.get('ENABLE_PSQL') }}' == 'True';
+  pgAdmin['allow_psql_shell_commands'] =  '{{ current_app.config.get('ALLOW_PSQL_SHELL_COMMANDS') }}'  == 'True';
+  pgAdmin['platform'] =  '{{platform}}';
 
   // Define list of nodes on which Query tool option doesn't appears
   var unsupported_nodes = pgAdmin.unsupported_nodes = [
diff --git a/web/pgadmin/tools/psql/__init__.py b/web/pgadmin/tools/psql/__init__.py
index e871b487..7f5adae9 100644
--- a/web/pgadmin/tools/psql/__init__.py
+++ b/web/pgadmin/tools/psql/__init__.py
@@ -1,35 +1,35 @@
 #!/usr/bin/env python3
-import fcntl
+
 import os
-import pty
 import re
 import select
 import struct
-import termios
 import config
+from sys import platform as _platform
 import eventlet.green.subprocess as subprocess
-
 from config import PG_DEFAULT_DRIVER
 from flask import Response, url_for, request
 from flask import render_template, copy_current_request_context, \
     current_app as app
 from flask_babelex import gettext
 from flask_security import login_required, current_user
-from pgadmin.browser.utils import underscore_unescape
+from pgadmin.browser.utils import underscore_unescape, underscore_escape
 from pgadmin.utils import PgAdminModule
 from pgadmin.utils.constants import MIMETYPE_APP_JS
 from pgadmin.utils.driver import get_driver
 from ... import socketio as sio
 from pgadmin.utils import get_complete_file_path
-from pgadmin.utils.ajax import internal_server_error
 
+if _platform != 'win32':
+    import fcntl
+    import termios
+    import pty
 
 session_input = dict()
 session_input_cursor = dict()
 session_last_cmd = dict()
 pdata = dict()
 cdata = dict()
-_NODES_SQL = 'nodes.sql'
 
 
 class PSQLModule(PgAdminModule):
@@ -225,27 +225,35 @@ def start_process(data):
     """
     @copy_current_request_context
     def read_and_forward_pty_output(sid, data):
-        max_read_bytes = 1024 * 20
-
-        p, parent, fd = create_pty_terminal(connection_data)
 
-        while p and p.poll() is None:
-            if request.sid in app.config['sessions']:
-                # This code is added to make this unit testable.
-                if "is_test" not in data:
-                    sio.sleep(0.01)
-                else:
-                    data['count'] += 1
-                    if data['count'] == 5:
-                        break
-
-                timeout = 0
-                # module provides access to platform-specific I/O
-                # monitoring functions
-                (data_ready, _, _) = select.select([parent, fd], [], [],
-                                                   timeout)
+        max_read_bytes = 1024 * 20
 
-                read_terminal_data(parent, data_ready, max_read_bytes, sid)
+        if _platform != 'win32':
+            p, parent, fd = create_pty_terminal(connection_data)
+
+            while p and p.poll() is None:
+                if request.sid in app.config['sessions']:
+                    # This code is added to make this unit testable.
+                    if "is_test" not in data:
+                        sio.sleep(0.01)
+                    else:
+                        data['count'] += 1
+                        if data['count'] == 5:
+                            break
+
+                    timeout = 0
+                    # module provides access to platform-specific I/O
+                    # monitoring functions
+                    (data_ready, _, _) = select.select([parent, fd], [], [],
+                                                       timeout)
+
+                    read_terminal_data(parent, data_ready, max_read_bytes, sid)
+        else:
+            sio.emit(
+                'conn_error',
+                {
+                    'error': 'PSQL tool not supported.',
+                }, namespace='/pty', room=request.sid)
 
     # Check user is authenticated and PSQL is enabled in config.
     if current_user.is_authenticated and config.ENABLE_PSQL:
@@ -255,6 +263,8 @@ def start_process(data):
             if data['db']:
                 db = underscore_unescape(data['db']).replace('\\', "\\\\")
 
+            data['db'] = db
+
             conn, manager = _get_connection(int(data['sid']), data)
             psql_utility = manager.utility('sql')
             connection_data = get_connection_str(psql_utility, db,
@@ -348,15 +358,15 @@ def get_conn_str(manager, db):
     """
     manager.export_password_env('PGPASSWORD')
     conn_attr =\
-        "host={0} port={1} dbname={2} user={3} sslmode={4} " \
-        "sslcompression={5} " \
-        "".format(
+        'host={0} port={1} dbname={2} user={3} sslmode={4} ' \
+        'sslcompression={5} ' \
+        ''.format(
             manager.local_bind_host if manager.use_ssh_tunnel else
             manager.host,
             manager.local_bind_port if manager.use_ssh_tunnel else
             manager.port,
-            db if db != '' else 'postgres',
-            manager.user if manager.user else 'postgres',
+            underscore_unescape(db) if db != '' else 'postgres',
+            underscore_unescape(manager.user) if manager.user else 'postgres',
             manager.ssl_mode,
             True if manager.sslcompression else False,
         )
@@ -423,7 +433,6 @@ def invalid_cmd():
     :rtype:
     """
     session_last_cmd[request.sid]['invalid_cmd'] = True
-
     for i in range(len(session_input[request.sid])):
         os.write(app.config['sessions'][request.sid],
                  '\b \b'.encode())
@@ -455,6 +464,7 @@ def check_valid_cmd(user_input):
 
     if stop_execution:
         session_last_cmd[request.sid]['invalid_cmd'] = True
+
         # Remove already added command from terminal.
         for i in range(len(user_input)):
             os.write(app.config['sessions'][request.sid],
@@ -482,6 +492,7 @@ def enter_key_press(data):
     # contains \! in input.
     is_new_connection = session_last_cmd[request.sid][
         'is_new_connection']
+
     if user_input.startswith('\\!') and re.match("^\\\!$", user_input) and len(
         user_input) == 2 and not config.ALLOW_PSQL_SHELL_COMMANDS \
             and not is_new_connection:
@@ -490,7 +501,8 @@ def enter_key_press(data):
         not config.ALLOW_PSQL_SHELL_COMMANDS and\
             not session_last_cmd[request.sid]['is_new_connection']:
         check_valid_cmd(user_input)
-    elif user_input == '\q' or user_input == 'q\\q':
+    elif user_input == '\q' or user_input == 'q\\q' or \
+            user_input in ['exit', 'exit;']:
         # If user enter \q to terminate the PSQL, emit the msg to
         # notify user connection is terminated.
         sio.emit('pty-output',
@@ -501,6 +513,7 @@ def enter_key_press(data):
                          ' tool.'),
                      'error': True},
                  namespace='/pty', room=request.sid)
+
         os.write(app.config['sessions'][request.sid],
                  '\n'.encode())
 
diff --git a/web/pgadmin/tools/psql/static/js/psql_module.js b/web/pgadmin/tools/psql/static/js/psql_module.js
index f0132507..5a6fffc0 100644
--- a/web/pgadmin/tools/psql/static/js/psql_module.js
+++ b/web/pgadmin/tools/psql/static/js/psql_module.js
@@ -54,7 +54,7 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, Browser)
       }];
 
       this.enable_psql_tool = pgAdmin['enable_psql'];
-      if(pgAdmin['enable_psql']) {
+      if(pgAdmin['enable_psql'] && pgAdmin['platform'] != 'win32') {
         pgBrowser.add_menus(menus);
       }
 
diff --git a/web/pgadmin/tools/psql/templates/editor_template.html b/web/pgadmin/tools/psql/templates/editor_template.html
index 74d9b888..0568ad71 100644
--- a/web/pgadmin/tools/psql/templates/editor_template.html
+++ b/web/pgadmin/tools/psql/templates/editor_template.html
@@ -23,36 +23,40 @@
 require(
     ['sources/generated/psql_tool'],
     function(pgBrowser) {
-        const term = self.pgAdmin.Browser.psql.psql_terminal();
-        <!--Addon for fitAddon, webLinkAddon, SearchAddon  -->
-        const fitAddon = self.pgAdmin.Browser.psql.psql_Addon(term);
-        <!-- Update the theme for terminal as per pgAdmin 4 theme.-->
-        self.pgAdmin.Browser.psql.set_theme(term);
-        <!-- Open the terminal -->
-        term.open(document.getElementById('psql-terminal'));
-        <!-- Socket-->
-        const socket = self.pgAdmin.Browser.psql.psql_socket();
-        self.pgAdmin.Browser.psql.psql_socket_io(socket, '{{is_enable}}', '{{sid}}', '{{db}}', '{{server_type}}', fitAddon, term);
-        self.pgAdmin.Browser.psql.psql_terminal_io(term, socket);
-        self.pgAdmin.Browser.psql.check_db_name_change('{{db}}', '{{o_db_name}}');
-
-        <!-- Resize the terminal -->
-        function fitToscreen(){
-            fitAddon.fit()
-            socket.emit("resize", {"cols": term.cols, "rows": term.rows})
-        }
+        if (self.pgAdmin['platform'] != 'win32') {
+            const term = self.pgAdmin.Browser.psql.psql_terminal();
+            <!--Addon for fitAddon, webLinkAddon, SearchAddon  -->
+            const fitAddon = self.pgAdmin.Browser.psql.psql_Addon(term);
+            <!-- Update the theme for terminal as per pgAdmin 4 theme.-->
+            self.pgAdmin.Browser.psql.set_theme(term);
+            <!-- Open the terminal -->
+            term.open(document.getElementById('psql-terminal'));
+            <!-- Socket-->
+            const socket = self.pgAdmin.Browser.psql.psql_socket();
+            self.pgAdmin.Browser.psql.psql_socket_io(socket, '{{is_enable}}', '{{sid}}', '{{db}}', '{{server_type}}', fitAddon, term);
+            self.pgAdmin.Browser.psql.psql_terminal_io(term, socket);
+            self.pgAdmin.Browser.psql.check_db_name_change('{{db}}', '{{o_db_name}}');
+
+            <!-- Resize the terminal -->
+            function fitToscreen(){
+                fitAddon.fit()
+                socket.emit("resize", {"cols": term.cols, "rows": term.rows})
+            }
 
-        function debounce(func, wait_ms) {
-            let timeout
-            return function(...args) {
-              const context = this
-              clearTimeout(timeout)
-              timeout = setTimeout(() => func.apply(context, args), wait_ms)
+            function debounce(func, wait_ms) {
+                let timeout
+                return function(...args) {
+                  const context = this
+                  clearTimeout(timeout)
+                  timeout = setTimeout(() => func.apply(context, args), wait_ms)
+                }
             }
-        }
 
-        const wait_ms = 50;;
-        window.onresize = debounce(fitToscreen, wait_ms)
+            const wait_ms = 50;;
+            window.onresize = debounce(fitToscreen, wait_ms)
+        } else {
+            document.getElementById('psql-terminal').innterHTML = 'PSQL not supported'
+        }
     });
 {% endblock %}
 
diff --git a/web/pgadmin/tools/psql/tests/test_backend_task.py b/web/pgadmin/tools/psql/tests/test_backend_task.py
index a4f14ee4..504db305 100644
--- a/web/pgadmin/tools/psql/tests/test_backend_task.py
+++ b/web/pgadmin/tools/psql/tests/test_backend_task.py
@@ -1,5 +1,6 @@
 import uuid
 import config
+import sys
 from pgadmin.utils.route import BaseTestGenerator
 from regression.python_test_utils import test_utils as utils
 from regression import parent_node_dict
@@ -24,6 +25,8 @@ class PSQLBackend(BaseTestGenerator):
         self.server_con = server_utils.connect_server(self, self.sid)
 
     def runTest(self):
+        if sys.platform == 'win32':
+            self.skipTest('PSQL disabled for windows')
         # Fetch flask client to access current user and other cookies.
         flask_client = app.test_client()
         flask_client.get('/')
diff --git a/web/pgadmin/tools/psql/tests/test_panel.py b/web/pgadmin/tools/psql/tests/test_panel.py
index c53785cc..ca94f309 100644
--- a/web/pgadmin/tools/psql/tests/test_panel.py
+++ b/web/pgadmin/tools/psql/tests/test_panel.py
@@ -1,5 +1,6 @@
 import uuid
 import random
+import sys
 from pgadmin.utils.route import BaseTestGenerator
 from regression.python_test_utils import test_utils as utils
 from regression import parent_node_dict
@@ -16,6 +17,8 @@ class PSQLPanel(BaseTestGenerator):
         self.theme = 'standard'
 
     def runTest(self):
+        if sys.platform == 'win32':
+            self.skipTest('PSQL disabled for windows')
         trans_id = random.randint(1, 9999999)
         url = '/psql/panel/{trans_id}?sgid={sgid}&sid={sid}&did={did}' \
               '&server_type=pg&db={db_name}&theme={theme}'.\
diff --git a/web/pgadmin/tools/psql/tests/test_psql_disabled.py b/web/pgadmin/tools/psql/tests/test_psql_disabled.py
index 7dc52498..fdae5d66 100644
--- a/web/pgadmin/tools/psql/tests/test_psql_disabled.py
+++ b/web/pgadmin/tools/psql/tests/test_psql_disabled.py
@@ -1,5 +1,6 @@
 import uuid
 import config
+import sys
 from pgadmin.utils.route import BaseTestGenerator
 from regression.python_test_utils import test_utils as utils
 from regression import parent_node_dict
@@ -17,6 +18,8 @@ class PSQLSocketDisabled(BaseTestGenerator):
         config.ENABLE_PSQL = False
 
     def runTest(self):
+        if sys.platform == 'win32':
+            self.skipTest('PSQL disabled for windows')
         self.test_client = socketio.test_client(app, namespace='/pty')
         self.assertTrue(self.test_client.is_connected('/pty'))
         received = self.test_client.get_received('/pty')
diff --git a/web/pgadmin/tools/psql/tests/test_psql_input.py b/web/pgadmin/tools/psql/tests/test_psql_input.py
index 6f6eabe7..b5a8d656 100644
--- a/web/pgadmin/tools/psql/tests/test_psql_input.py
+++ b/web/pgadmin/tools/psql/tests/test_psql_input.py
@@ -1,5 +1,6 @@
 import uuid
 import config
+import sys
 from pgadmin.utils.route import BaseTestGenerator
 from regression.python_test_utils import test_utils as utils
 from regression import parent_node_dict
@@ -24,6 +25,8 @@ class PSQLInput(BaseTestGenerator):
         self.server_con = server_utils.connect_server(self, self.sid)
 
     def runTest(self):
+        if sys.platform == 'win32':
+            self.skipTest('PSQL disabled for windows')
         # Fetch flask client to access current user and other cookies.
         flask_client = app.test_client()
         flask_client.get('/')
diff --git a/web/pgadmin/tools/psql/tests/test_resize_terminal.py b/web/pgadmin/tools/psql/tests/test_resize_terminal.py
index d305c2d0..ff981963 100644
--- a/web/pgadmin/tools/psql/tests/test_resize_terminal.py
+++ b/web/pgadmin/tools/psql/tests/test_resize_terminal.py
@@ -1,5 +1,6 @@
 import uuid
 import config
+import sys
 from pgadmin.utils.route import BaseTestGenerator
 from regression.python_test_utils import test_utils as utils
 from regression import parent_node_dict
@@ -24,6 +25,8 @@ class PSQLResizeTerminal(BaseTestGenerator):
         self.server_con = server_utils.connect_server(self, self.sid)
 
     def runTest(self):
+        if sys.platform == 'win32':
+            self.skipTest('PSQL disabled for windows')
         # Fetch flask client to access current user and other cookies.
         flask_client = app.test_client()
         flask_client.get('/')
diff --git a/web/pgadmin/tools/psql/tests/test_socket_connect.py b/web/pgadmin/tools/psql/tests/test_socket_connect.py
index 3791525a..8a0d8d61 100644
--- a/web/pgadmin/tools/psql/tests/test_socket_connect.py
+++ b/web/pgadmin/tools/psql/tests/test_socket_connect.py
@@ -1,5 +1,6 @@
 import uuid
 import config
+import sys
 from pgadmin.utils.route import BaseTestGenerator
 from regression.python_test_utils import test_utils as utils
 from regression import parent_node_dict
@@ -17,6 +18,8 @@ class PSQLSocketConnect(BaseTestGenerator):
         config.ENABLE_PSQL = True
 
     def runTest(self):
+        if sys.platform == 'win32':
+            self.skipTest('PSQL disabled for windows')
         self.test_client = socketio.test_client(app, namespace='/pty')
         self.assertTrue(self.test_client.is_connected('/pty'))
         received = self.test_client.get_received('/pty')
diff --git a/web/pgadmin/tools/psql/tests/test_socket_disconnect.py b/web/pgadmin/tools/psql/tests/test_socket_disconnect.py
index 0619eb30..086b85f9 100644
--- a/web/pgadmin/tools/psql/tests/test_socket_disconnect.py
+++ b/web/pgadmin/tools/psql/tests/test_socket_disconnect.py
@@ -1,5 +1,6 @@
 import uuid
 import config
+import sys
 from pgadmin.utils.route import BaseTestGenerator
 from regression.python_test_utils import test_utils as utils
 from regression import parent_node_dict
@@ -17,6 +18,8 @@ class PSQLSocketDisconnect(BaseTestGenerator):
         config.ENABLE_PSQL = True
 
     def runTest(self):
+        if sys.platform == 'win32':
+            self.skipTest('PSQL disabled for windows')
         # Fetch flask client to access current user and other cookies.
         flask_test_client = app.test_client()
         flask_test_client.get('/')
diff --git a/web/pgadmin/tools/psql/tests/test_start_process.py b/web/pgadmin/tools/psql/tests/test_start_process.py
index 1245de3f..4bc316df 100644
--- a/web/pgadmin/tools/psql/tests/test_start_process.py
+++ b/web/pgadmin/tools/psql/tests/test_start_process.py
@@ -1,5 +1,6 @@
 import uuid
 import config
+import sys
 from pgadmin.utils.route import BaseTestGenerator
 from regression.python_test_utils import test_utils as utils
 from regression import parent_node_dict
@@ -21,6 +22,8 @@ class PSQLStartProcess(BaseTestGenerator):
         self.server_con = server_utils.connect_server(self, self.sid)
 
     def runTest(self):
+        if sys.platform == 'win32':
+            self.skipTest('PSQL disabled for windows')
         # Fetch flask client to access current user and other cookies.
         flask_client = app.test_client()
         flask_client.get('/')
diff --git a/web/pgadmin/tools/psql/tests/test_start_process_fail.py b/web/pgadmin/tools/psql/tests/test_start_process_fail.py
index 0acc7be2..6abfc511 100644
--- a/web/pgadmin/tools/psql/tests/test_start_process_fail.py
+++ b/web/pgadmin/tools/psql/tests/test_start_process_fail.py
@@ -1,5 +1,6 @@
 import uuid
 import config
+import sys
 from pgadmin.utils.route import BaseTestGenerator
 from regression.python_test_utils import test_utils as utils
 from regression import parent_node_dict
@@ -17,6 +18,8 @@ class PSQLStartProcessFail(BaseTestGenerator):
         config.ENABLE_PSQL = True
 
     def runTest(self):
+        if sys.platform == 'win32':
+            self.skipTest('PSQL disabled for windows')
         self.test_client = socketio.test_client(app, namespace='/pty')
         self.assertTrue(self.test_client.is_connected('/pty'))
         received = self.test_client.get_received('/pty')


view thread (54+ 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], [email protected]
  Subject: Re: [pgAdmin][RM-2341]: Add menu option for starting PSQL
  In-Reply-To: <CAOBg0AO-gsDJSrLoGPJGKsq772Okgg3BWDuERaaGSDvoGbhQAA@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