mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added check if the Windows version is not supporting the ConPty or WinPty disable the PSQL for that version.
refs #2341
This commit is contained in:
parent
dcaeb20e29
commit
09693d14d1
@ -10,6 +10,10 @@ PSQL tool allows user to connect to PostgreSQL/EDB Advanced server using psql te
|
|||||||
|
|
||||||
* PSQL will connect to the current connected database from browser tree.
|
* PSQL will connect to the current connected database from browser tree.
|
||||||
|
|
||||||
|
* PSQL utility does support execution of OS meta-commands by using "\\!". Due
|
||||||
|
to security concerns, we have disabled the execution of such commands in
|
||||||
|
pgAdmin. To enable OS meta-commands set ALLOW_PSQL_SHELL_COMMANDS = True in configuration.
|
||||||
|
|
||||||
.. image:: images/psql_tool.png
|
.. image:: images/psql_tool.png
|
||||||
:alt: PSQL tool window
|
:alt: PSQL tool window
|
||||||
:align: center
|
:align: center
|
||||||
@ -17,3 +21,5 @@ PSQL tool allows user to connect to PostgreSQL/EDB Advanced server using psql te
|
|||||||
You can open multiple instance of the PSQL tool in individual tabs simultaneously.
|
You can open multiple instance of the PSQL tool in individual tabs simultaneously.
|
||||||
To close the PSQL tool, click the *X* in the upper-right hand corner of the tab bar.
|
To close the PSQL tool, click the *X* in the upper-right hand corner of the tab bar.
|
||||||
|
|
||||||
|
**Note:** For the Windows platform, this feature is available on Windows 10 (1809 version) and onwards.
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ winreg = None
|
|||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
import winreg
|
import winreg
|
||||||
|
|
||||||
socketio = SocketIO(manage_session=False, async_mode='eventlet',
|
socketio = SocketIO(manage_session=False, async_mode='threading',
|
||||||
logger=False, engineio_logger=False, debug=False,
|
logger=False, engineio_logger=False, debug=False,
|
||||||
ping_interval=25, ping_timeout=120)
|
ping_interval=25, ping_timeout=120)
|
||||||
|
|
||||||
|
@ -855,7 +855,8 @@ def utils():
|
|||||||
support_ssh_tunnel=config.SUPPORT_SSH_TUNNEL,
|
support_ssh_tunnel=config.SUPPORT_SSH_TUNNEL,
|
||||||
logout_url=_get_logout_url(),
|
logout_url=_get_logout_url(),
|
||||||
platform=sys.platform,
|
platform=sys.platform,
|
||||||
qt_default_placeholder=QT_DEFAULT_PLACEHOLDER
|
qt_default_placeholder=QT_DEFAULT_PLACEHOLDER,
|
||||||
|
enable_psql=config.ENABLE_PSQL
|
||||||
),
|
),
|
||||||
200, {'Content-Type': MIMETYPE_APP_JS})
|
200, {'Content-Type': MIMETYPE_APP_JS})
|
||||||
|
|
||||||
|
@ -505,39 +505,39 @@ def register_browser_preferences(self):
|
|||||||
' revert back to the default title with placeholders.'
|
' revert back to the default title with placeholders.'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if config.ENABLE_PSQL:
|
||||||
self.open_in_new_tab = self.preference.register(
|
self.open_in_new_tab = self.preference.register(
|
||||||
'tab_settings', 'new_browser_tab_open',
|
'tab_settings', 'new_browser_tab_open',
|
||||||
gettext("Open in new browser tab"), 'select2', None,
|
gettext("Open in new browser tab"), 'select2', None,
|
||||||
category_label=PREF_LABEL_OPTIONS,
|
category_label=PREF_LABEL_OPTIONS,
|
||||||
options=[{'label': gettext('Query Tool'), 'value': 'qt'},
|
options=[{'label': gettext('Query Tool'), 'value': 'qt'},
|
||||||
{'label': gettext('Debugger'), 'value': 'debugger'},
|
{'label': gettext('Debugger'), 'value': 'debugger'},
|
||||||
{'label': gettext('Schema Diff'), 'value': 'schema_diff'},
|
{'label': gettext('Schema Diff'), 'value': 'schema_diff'},
|
||||||
{'label': gettext('ERD Tool'), 'value': 'erd_tool'},
|
{'label': gettext('ERD Tool'), 'value': 'erd_tool'},
|
||||||
{'label': gettext('PSQL Tool'), 'value': 'psql_tool'}],
|
{'label': gettext('PSQL Tool'), 'value': 'psql_tool'}],
|
||||||
help_str=gettext(
|
help_str=gettext(
|
||||||
'Select Query Tool, Debugger, Schema Diff, ERD Tool '
|
'Select Query Tool, Debugger, Schema Diff, ERD Tool '
|
||||||
'or PSQL Tool from the drop-down to set '
|
'or PSQL Tool from the drop-down to set '
|
||||||
'open in new browser tab for that particular module.'
|
'open in new browser tab for that particular module.'
|
||||||
),
|
),
|
||||||
select2={
|
select2={
|
||||||
'multiple': True, 'allowClear': False,
|
'multiple': True, 'allowClear': False,
|
||||||
'tags': True, 'first_empty': False,
|
'tags': True, 'first_empty': False,
|
||||||
'selectOnClose': False, 'emptyOptions': True,
|
'selectOnClose': False, 'emptyOptions': True,
|
||||||
'tokenSeparators': [','],
|
'tokenSeparators': [','],
|
||||||
'placeholder': gettext('Select open new tab...')
|
'placeholder': gettext('Select open new tab...')
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.psql_tab_title = self.preference.register(
|
self.psql_tab_title = self.preference.register(
|
||||||
'tab_settings', 'psql_tab_title_placeholder',
|
'tab_settings', 'psql_tab_title_placeholder',
|
||||||
gettext("PSQL tool tab title"),
|
gettext("PSQL tool tab title"),
|
||||||
'text', '%DATABASE%/%USERNAME%@%SERVER%',
|
'text', '%DATABASE%/%USERNAME%@%SERVER%',
|
||||||
category_label=PREF_LABEL_DISPLAY,
|
category_label=PREF_LABEL_DISPLAY,
|
||||||
help_str=gettext(
|
help_str=gettext(
|
||||||
'Supported placeholders are %DATABASE%, %USERNAME%, '
|
'Supported placeholders are %DATABASE%, %USERNAME%, '
|
||||||
'and %SERVER%. Users can provide any string with or without'
|
'and %SERVER%. Users can provide any string with or without'
|
||||||
' placeholders of their choice. The blank title will be revert'
|
' placeholders of their choice. The blank title will be revert'
|
||||||
' back to the default title with placeholders.'
|
' back to the default title with placeholders.'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
@ -53,7 +53,7 @@ define('pgadmin.browser.utils',
|
|||||||
pgAdmin['override_user_inactivity_timeout'] = '{{ current_app.config.get('OVERRIDE_USER_INACTIVITY_TIMEOUT') }}' == 'True';
|
pgAdmin['override_user_inactivity_timeout'] = '{{ current_app.config.get('OVERRIDE_USER_INACTIVITY_TIMEOUT') }}' == 'True';
|
||||||
|
|
||||||
/* GET PSQL Tool related config */
|
/* GET PSQL Tool related config */
|
||||||
pgAdmin['enable_psql'] = '{{ current_app.config.get('ENABLE_PSQL') }}' == 'True';
|
pgAdmin['enable_psql'] = '{{enable_psql}}' == 'True';
|
||||||
pgAdmin['allow_psql_shell_commands'] = '{{ current_app.config.get('ALLOW_PSQL_SHELL_COMMANDS') }}' == 'True';
|
pgAdmin['allow_psql_shell_commands'] = '{{ current_app.config.get('ALLOW_PSQL_SHELL_COMMANDS') }}' == 'True';
|
||||||
pgAdmin['platform'] = '{{platform}}';
|
pgAdmin['platform'] = '{{platform}}';
|
||||||
pgAdmin['qt_default_placeholder'] = '{{qt_default_placeholder}}'
|
pgAdmin['qt_default_placeholder'] = '{{qt_default_placeholder}}'
|
||||||
|
@ -20,7 +20,12 @@ from ... import socketio as sio
|
|||||||
from pgadmin.utils import get_complete_file_path
|
from pgadmin.utils import get_complete_file_path
|
||||||
|
|
||||||
if _platform == 'win32':
|
if _platform == 'win32':
|
||||||
from winpty import PtyProcess
|
# Check Windows platform support for WinPty api, Disable psql
|
||||||
|
# if not supporting
|
||||||
|
try:
|
||||||
|
from winpty import PtyProcess
|
||||||
|
except ImportError as error:
|
||||||
|
config.ENABLE_PSQL = False
|
||||||
else:
|
else:
|
||||||
import fcntl
|
import fcntl
|
||||||
import termios
|
import termios
|
||||||
|
Loading…
Reference in New Issue
Block a user