Skip to content

Commit

Permalink
Added support for viewing Log Based Clusters. pgadmin-org#7216
Browse files Browse the repository at this point in the history
  • Loading branch information
adityatoshniwal committed Mar 18, 2024
1 parent f351b10 commit 1ce6be7
Show file tree
Hide file tree
Showing 33 changed files with 1,248 additions and 157 deletions.
16 changes: 14 additions & 2 deletions web/pgadmin/browser/server_groups/servers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from flask_babel import gettext
from flask_security import current_user, login_required
from psycopg.conninfo import make_conninfo, conninfo_to_dict

from pgadmin.browser.server_groups.servers.types import ServerType
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, bad_request, forbidden, \
Expand All @@ -30,7 +31,8 @@
from pgadmin.utils.master_password import get_crypt_key
from pgadmin.utils.exception import CryptKeyMissing
from pgadmin.tools.schema_diff.node_registry import SchemaDiffRegistry
from pgadmin.browser.server_groups.servers.utils import is_valid_ipaddress
from pgadmin.browser.server_groups.servers.utils import \
is_valid_ipaddress, get_replication_type
from pgadmin.utils.constants import UNAUTH_REQ, MIMETYPE_APP_JS, \
SERVER_CONNECTION_CLOSED
from sqlalchemy import or_
Expand Down Expand Up @@ -343,6 +345,9 @@ def register(self, app, options):
from .tablespaces import blueprint as module
self.submodules.append(module)

from .replica_nodes import blueprint as module
self.submodules.append(module)

super().register(app, options)

# We do not have any preferences for server node.
Expand Down Expand Up @@ -469,7 +474,7 @@ class ServerNode(PGChildNodeView):
}],
'check_pgpass': [{'get': 'check_pgpass'}],
'clear_saved_password': [{'put': 'clear_saved_password'}],
'clear_sshtunnel_password': [{'put': 'clear_sshtunnel_password'}]
'clear_sshtunnel_password': [{'put': 'clear_sshtunnel_password'}],
})
SSL_MODES = ['prefer', 'require', 'verify-ca', 'verify-full']

Expand Down Expand Up @@ -1427,6 +1432,7 @@ def connect_status(self, gid, sid):
in_recovery = None
wal_paused = None
errmsg = None
replication_type = None
if connected:
status, result, in_recovery, wal_paused =\
recovery_state(conn, manager.version)
Expand All @@ -1436,10 +1442,13 @@ def connect_status(self, gid, sid):
manager.release()
errmsg = "{0} : {1}".format(server.name, result)

replication_type = get_replication_type(conn, manager.version)

return make_json_response(
data={
'icon': server_icon_and_background(connected, manager, server),
'connected': connected,
'replication_type': replication_type,
'in_recovery': in_recovery,
'wal_pause': wal_paused,
'server_type': manager.server_type if connected else "pg",
Expand Down Expand Up @@ -1709,13 +1718,16 @@ def connect(self, gid, sid):
_, _, in_recovery, wal_paused =\
recovery_state(conn, manager.version)

replication_type = get_replication_type(conn, manager.version)

return make_json_response(
success=1,
info=gettext("Server connected."),
data={
'icon': server_icon_and_background(True, manager, server),
'connected': True,
'server_type': manager.server_type,
'replication_type': replication_type,
'type': manager.server_type,
'version': manager.version,
'db': manager.db,
Expand Down

0 comments on commit 1ce6be7

Please sign in to comment.