1) Fixed an issue where the user is unable to create a subscription if the host/IP address for connection is 127.0.0.1. Fixes #6253

2) Ensure that proper error message should be shown on the properties and statistics tab in case of insufficient privileges for a subscription. Fixes #6259
3) Fixed an issue where the 'Create Slot' option is disabled in case of the same IP/host provided but the port is different. Fixes #6260
This commit is contained in:
Pradip Parkale 2021-03-01 12:08:33 +05:30 committed by Akshay Joshi
parent cafd2af96d
commit 4267207c7f
7 changed files with 24 additions and 14 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 132 KiB

View File

@ -23,4 +23,7 @@ Bug fixes
| `Issue #5628 <https://redmine.postgresql.org/issues/5628>`_ - Remove the "launch now" option in the Windows installer, as UAC could cause it to run as an elevated user.
| `Issue #6018 <https://redmine.postgresql.org/issues/6018>`_ - Fixed encoding issue when database encoding set to SQL_ASCII and name of the column is in ASCII character.
| `Issue #6159 <https://redmine.postgresql.org/issues/6159>`_ - Ensure that the user should be able to kill the session from Dashboard if the user has a 'pg_signal_backend' role.
| `Issue #6227 <https://redmine.postgresql.org/issues/6227>`_ - Ensure PGADMIN_DEFAULT_EMAIL looks sane when initialising a container deployment.
| `Issue #6227 <https://redmine.postgresql.org/issues/6227>`_ - Ensure PGADMIN_DEFAULT_EMAIL looks sane when initialising a container deployment.
| `Issue #6253 <https://redmine.postgresql.org/issues/6253>`_ - Fixed an issue where the user is unable to create a subscription if the host/IP address for connection is 127.0.0.1.
| `Issue #6259 <https://redmine.postgresql.org/issues/6259>`_ - Ensure that proper error message should be shown on the properties and statistics tab in case of insufficient privileges for a subscription.
| `Issue #6260 <https://redmine.postgresql.org/issues/6260>`_ - Fixed an issue where the 'Create Slot' option is disabled in case of the same IP/host provided but the port is different.

View File

@ -245,6 +245,7 @@ class ServerModule(sg.ServerGroupPluginModule):
in_recovery=in_recovery,
wal_pause=wal_paused,
host=server.host,
port=server.port,
is_password_saved=bool(server.save_password),
is_tunnel_password_saved=True
if server.tunnel_password is not None else False,

View File

@ -195,7 +195,7 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
'nodes': [{'get': 'node'}, {'get': 'nodes'}],
'sql': [{'get': 'sql'}],
'msql': [{'get': 'msql'}, {'get': 'msql'}],
'stats': [{'get': 'statistics'}],
'stats': [{'get': 'statistics'}, {'get': 'statistics'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'get_publications': [{}, {'get': 'get_publications'}],
@ -261,11 +261,6 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
self._PROPERTIES_SQL]), did=did)
status, res = self.conn.execute_dict(sql)
# Check for permission denied message
if 'permission denied' in res:
return internal_server_error(
errormsg="Access is revoked for normal users")
if not status:
return internal_server_error(errormsg=res)
@ -386,7 +381,7 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
return True, res['rows'][0]
@check_precondition
def statistics(self, gid, sid, did, subid):
def statistics(self, gid, sid, did, subid=None):
"""
This function gets the statistics and returns an ajax response
for the view node.
@ -399,7 +394,7 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
"""
sql = render_template("/".join([self.template_path,
'stats.sql']),
subid=subid, conn=self.conn)
subid=subid, did=did, conn=self.conn)
status, res = self.conn.execute_dict(sql)
return make_json_response(
data=res,

View File

@ -396,8 +396,8 @@ define('pgadmin.node.subscription', [
type: 'switch', mode: ['create'],
group: gettext('With'),
disabled: 'isSameDB',
readonly: 'isConnect', deps :['connect', 'host'],
helpMessage: gettext('Specifies whether the command should create the replication slot on the publisher.'),
readonly: 'isConnect', deps :['connect', 'host', 'port'],
helpMessage: gettext('Specifies whether the command should create the replication slot on the publisher.This field will be disabled and set to false if subscription connects to same database.Otherwise, the CREATE SUBSCRIPTION call will hang.'),
},
{
@ -456,7 +456,14 @@ define('pgadmin.node.subscription', [
return true;
},
isSameDB:function(m){
if (m.attributes['host'] == m.node_info.server.host){
let host = m.attributes['host'],
port = m.attributes['port'];
if ((m.attributes['host'] == 'localhost' || m.attributes['host'] == '127.0.0.1') &&
(m.node_info.server.host == 'localhost' || m.node_info.server.host == '127.0.0.1')){
host = m.node_info.server.host;
}
if (host == m.node_info.server.host && port == m.node_info.server.port){
setTimeout( function() {
m.set('create_slot', false);
}, 10);

View File

@ -4,5 +4,8 @@ SELECT
latest_end_lsn AS {{ conn|qtIdent(_('Latest end lsn')) }},
last_msg_receipt_time AS {{ conn|qtIdent(_('Last message receipt')) }},
last_msg_send_time AS {{ conn|qtIdent(_('Last message send time'))}}
FROM pg_stat_subscription WHERE subid = {{ subid }};
FROM pg_stat_subscription
{% if subid %}
WHERE subid = {{ subid }};
{% endif %}

View File

@ -289,7 +289,8 @@ define([
timer = setTimeout(function() {
// notify user if request is taking longer than 1 second
$msgContainer.text(gettext('Retrieving data from the server...'));
if (!$msgContainer.text()== 'Failed to retrieve data from the server.')
$msgContainer.text(gettext('Retrieving data from the server...'));
$msgContainer.removeClass('d-none');
if (self.grid) {
self.grid.remove();