MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / servers

Function servers

web/pgadmin/tools/schema_diff/__init__.py:274–318  ·  view source on GitHub ↗

This function will return the list of servers for the specified server id.

()

Source from the content-addressed store, hash-verified

272)
273@pga_login_required
274def servers():
275 """
276 This function will return the list of servers for the specified
277 server id.
278 """
279 res = {}
280 auto_detected_server = None
281 try:
282 """Return a JSON document listing the server groups for the user"""
283 driver = get_driver(PG_DEFAULT_DRIVER)
284
285 from pgadmin.browser.server_groups.servers import\
286 server_icon_and_background
287
288 for server in get_user_server_query().filter(
289 Server.is_adhoc == 0):
290
291 shared_server = SharedServer.query.filter_by(
292 user_id=current_user.id,
293 osid=server.id).first()
294
295 if server.discovery_id and shared_server:
296 continue
297
298 manager = driver.connection_manager(server.id)
299 conn = manager.connection()
300 connected = conn.connected()
301 server_info = {
302 "value": server.id,
303 "label": server.name,
304 "image": server_icon_and_background(connected, manager,
305 server),
306 "_id": server.id,
307 "connected": connected
308 }
309
310 if server.servergroup.name in res:
311 res[server.servergroup.name].append(server_info)
312 else:
313 res[server.servergroup.name] = [server_info]
314
315 except Exception as e:
316 app.logger.exception(e)
317
318 return make_json_response(data=res)
319
320
321@blueprint.route(

Callers

nothing calls this directly

Calls 10

get_driverFunction · 0.90
get_user_server_queryFunction · 0.90
make_json_responseFunction · 0.90
filterMethod · 0.80
connection_managerMethod · 0.80
connectionMethod · 0.80
appendMethod · 0.80
firstMethod · 0.65
connectedMethod · 0.45

Tested by

no test coverage detected