mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-24 07:16:52 -06:00
Added support to open SQL help, Dialog help, and online help in an external web browser. Fixes #7139
This commit is contained in:
parent
28be10a1b5
commit
19beb62f81
@ -78,22 +78,25 @@ Use the *Runtime Menu* to access the *Configuration* dialog:
|
||||
:alt: Runtime Configuration
|
||||
:align: center
|
||||
|
||||
Following are the details of the *Fixed port number?*, *Port Number*, and *Connection
|
||||
Timeout* configuration parameters:
|
||||
Following are the details of the *Fixed port number?*, *Port Number*, *Connection
|
||||
Timeout*, and 'Open Documentation in Default Browser?' configuration parameters:
|
||||
|
||||
.. table::
|
||||
:class: longtable
|
||||
:widths: 2 1 4
|
||||
|
||||
+--------------------------+--------------------+---------------------------------------------------------------+
|
||||
| Key | Type | Purpose |
|
||||
+==========================+====================+===============================================================+
|
||||
| FixedPort | Boolean | Use a fixed network port number rather than a random one. |
|
||||
+--------------------------+--------------------+---------------------------------------------------------------+
|
||||
| PortNumber | Integer | The port number to use, if using a fixed port. |
|
||||
+--------------------------+--------------------+---------------------------------------------------------------+
|
||||
| ConnectionTimeout | Integer | The number of seconds to wait for application server startup. |
|
||||
+--------------------------+--------------------+---------------------------------------------------------------+
|
||||
+----------------------------------------+--------------------+---------------------------------------------------------------+
|
||||
| Key | Type | Purpose |
|
||||
+========================================+====================+===============================================================+
|
||||
| FixedPort | Boolean | Use a fixed network port number rather than a random one. |
|
||||
+----------------------------------------+--------------------+---------------------------------------------------------------+
|
||||
| PortNumber | Integer | The port number to use, if using a fixed port. |
|
||||
+----------------------------------------+--------------------+---------------------------------------------------------------+
|
||||
| ConnectionTimeout | Integer | The number of seconds to wait for application server startup. |
|
||||
+----------------------------------------+--------------------+---------------------------------------------------------------+
|
||||
| Open Documentation in Default Browser | Boolean | By checking this option, all documentation links will open in |
|
||||
| | | the default browser instead of in a new window. |
|
||||
+----------------------------------------+--------------------+---------------------------------------------------------------+
|
||||
|
||||
Log dialog
|
||||
----------
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 208 KiB |
@ -2,13 +2,14 @@
|
||||
Version 6.5
|
||||
************
|
||||
|
||||
Release date: 2021-02-10
|
||||
Release date: 2021-02-11
|
||||
|
||||
This release contains a number of bug fixes and new features since the release of pgAdmin4 6.4.
|
||||
|
||||
New features
|
||||
************
|
||||
|
||||
| `Issue #7139 <https://redmine.postgresql.org/issues/7139>`_ - Added support to open SQL help, Dialog help, and online help in an external web browser.
|
||||
|
||||
Housekeeping
|
||||
************
|
||||
|
@ -54,6 +54,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card shadow-sm mt-3">
|
||||
<div class="card-header h6">Open Documentation</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label> By checking this option, all documentation links will open in the default browser instead of in a new window.
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-inline">
|
||||
<div class="form-check mr-3">
|
||||
<label class="form-check-label mr-2" for="fixedPortCheck">Open Documentation in Default Browser?</label>
|
||||
<input type="checkbox" class="form-check-input" id="openDocsInBrowser"
|
||||
data-name="open_docs_in_browser"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2 d-flex fixed-bottom shadow bg-white">
|
||||
<div class="mr-auto" id="status-text"></div>
|
||||
<div class="ml-auto">
|
||||
|
@ -35,6 +35,7 @@ function saveConfiguration() {
|
||||
misc.ConfigureStore.set('fixedPort', document.getElementById('fixedPortCheck').checked);
|
||||
misc.ConfigureStore.set('portNo', parseInt(document.getElementById('portNo').value));
|
||||
misc.ConfigureStore.set('connectionTimeout', parseInt(document.getElementById('timeOut').value));
|
||||
misc.ConfigureStore.set('openDocsInBrowser', document.getElementById('openDocsInBrowser').checked);
|
||||
|
||||
misc.ConfigureStore.saveConfig();
|
||||
|
||||
@ -61,8 +62,9 @@ function enableDisableSaveButton() {
|
||||
let configData = misc.ConfigureStore.getConfigData();
|
||||
|
||||
if (configData['fixedPort'] !== document.getElementById('fixedPortCheck').checked ||
|
||||
configData['portNo'] !== document.getElementById('portNo').value ||
|
||||
configData['connectionTimeout'] !== document.getElementById('timeOut').value) {
|
||||
configData['portNo'] != document.getElementById('portNo').value ||
|
||||
configData['connectionTimeout'] != document.getElementById('timeOut').value ||
|
||||
configData['openDocsInBrowser'] !== document.getElementById('openDocsInBrowser').checked) {
|
||||
document.getElementById('btnSave').removeAttribute('disabled');
|
||||
} else {
|
||||
document.getElementById('btnSave').setAttribute('disabled', 'disabled');
|
||||
@ -85,9 +87,15 @@ configWindow.on('loaded', function() {
|
||||
document.getElementById('portNo').value = configData['portNo'];
|
||||
document.getElementById('timeOut').value = configData['connectionTimeout'];
|
||||
|
||||
if (configData['openDocsInBrowser']) {
|
||||
document.getElementById('openDocsInBrowser').checked = true;
|
||||
} else {
|
||||
document.getElementById('openDocsInBrowser').checked = false;
|
||||
}
|
||||
// Add event listeners
|
||||
document.getElementById('btnSave').addEventListener('click', checkConfiguration);
|
||||
document.getElementById('fixedPortCheck').addEventListener('change', onCheckChange);
|
||||
document.getElementById('portNo').addEventListener('change', enableDisableSaveButton);
|
||||
document.getElementById('timeOut').addEventListener('change', enableDisableSaveButton);
|
||||
document.getElementById('openDocsInBrowser').addEventListener('change', enableDisableSaveButton);
|
||||
});
|
||||
|
@ -147,7 +147,7 @@ const getAvailablePort = (fixedPort) => {
|
||||
const currentTime = (new Date()).getTime();
|
||||
const serverLogFile = path.join(getLocalAppDataPath(), 'pgadmin4.' + currentTime.toString() + '.log');
|
||||
const configFileName = path.join(getAppDataPath(), 'runtime_config.json');
|
||||
const DEFAULT_CONFIG_DATA = {'fixedPort': false, 'portNo': 5050, 'connectionTimeout': 90, 'zoomLevel': 0};
|
||||
const DEFAULT_CONFIG_DATA = {'fixedPort': false, 'portNo': 5050, 'connectionTimeout': 90, 'zoomLevel': 0, 'openDocsInBrowser': true};
|
||||
|
||||
// This function is used to read the file and return the content
|
||||
const readServerLog = () => {
|
||||
|
@ -19,6 +19,8 @@ let serverCheckUrl = null;
|
||||
|
||||
let serverPort = 5050;
|
||||
|
||||
let docsURLSubStrings = ['www.enterprisedb.com', 'www.postgresql.org', 'www.pgadmin.org', 'help/help'];
|
||||
|
||||
// Paths to the rest of the app
|
||||
let pythonPath = misc.getPythonPath();
|
||||
let pgadminFile = '../web/pgAdmin4.py';
|
||||
@ -101,7 +103,7 @@ function startDesktopMode() {
|
||||
nw.Window.open('src/html/configure.html', {
|
||||
'frame': true,
|
||||
'width': 600,
|
||||
'height': 420,
|
||||
'height': 585,
|
||||
'position': 'center',
|
||||
'resizable': false,
|
||||
'focus': true,
|
||||
@ -231,6 +233,20 @@ function launchPgAdminWindow() {
|
||||
// Set the width and height for the new window.
|
||||
pgadminWindow.on('new-win-policy', function(frame, url, policy) {
|
||||
if(!frame) {
|
||||
let openDocsInBrowser = misc.ConfigureStore.get('openDocsInBrowser', true);
|
||||
let isDocURL = false;
|
||||
docsURLSubStrings.forEach(function(key) {
|
||||
if(url.indexOf(key) > 0) {
|
||||
isDocURL = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (openDocsInBrowser && isDocURL) {
|
||||
// Do not open the window
|
||||
policy.ignore();
|
||||
// Open URL in the external browser.
|
||||
nw.Shell.openExternal(url);
|
||||
} else {
|
||||
policy.setNewWindowManifest({
|
||||
'icon': '../../assets/pgAdmin4.png',
|
||||
'frame': true,
|
||||
@ -240,6 +256,7 @@ function launchPgAdminWindow() {
|
||||
'width': pgadminWindow.width,
|
||||
'height': pgadminWindow.height,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user