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

Function utils

web/pgadmin/browser/__init__.py:499–568  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

497@pgCSRFProtect.exempt
498@pga_login_required
499def utils():
500 layout = get_layout()
501
502 snippets = []
503
504 prefs = Preferences.module('paths')
505 pg_help_path_pref = prefs.preference('pg_help_path')
506 pg_help_path = pg_help_path_pref.get()
507
508 # Try to fetch current libpq version from the driver
509 try:
510 from config import PG_DEFAULT_DRIVER
511 from pgadmin.utils.driver import get_driver
512 driver = get_driver(PG_DEFAULT_DRIVER)
513 pg_libpq_version = driver.libpq_version()
514 except Exception:
515 pg_libpq_version = 0
516
517 # Check if LLM features are enabled (system-level AND provider configured)
518 from pgadmin.llm.utils import is_llm_enabled
519
520 for submodule in current_blueprint.submodules:
521 snippets.extend(submodule.jssnippets)
522
523 auth_only_internal = False
524 auth_source = []
525
526 if config.SERVER_MODE:
527 if session['auth_source_manager']['current_source'] == INTERNAL:
528 auth_only_internal = True
529 auth_source = session['auth_source_manager'][
530 'source_friendly_name']
531
532 shared_storage_list, \
533 restricted_shared_storage_list = get_shared_storage_list()
534
535 response = make_response(
536 render_template(
537 'browser/js/utils.js',
538 layout=layout,
539 jssnippets=snippets,
540 pg_help_path=pg_help_path,
541 app_name=config.APP_NAME,
542 app_version_int=config.APP_VERSION_INT,
543 pg_libpq_version=pg_libpq_version,
544 support_ssh_tunnel=config.SUPPORT_SSH_TUNNEL,
545 logout_url=get_logout_url(),
546 platform=sys.platform,
547 qt_default_placeholder=QT_DEFAULT_PLACEHOLDER,
548 vw_edt_default_placeholder=VW_EDT_DEFAULT_PLACEHOLDER,
549 enable_psql=config.ENABLE_PSQL,
550 _=gettext,
551 auth_only_internal=auth_only_internal,
552 mfa_enabled=is_mfa_enabled(),
553 is_admin=current_user.has_role("Administrator"),
554 login_url=login_url,
555 username=current_user.username.replace("'","\\'"),
556 auth_source=auth_source,

Callers

nothing calls this directly

Calls 12

get_layoutFunction · 0.90
get_driverFunction · 0.90
get_logout_urlFunction · 0.90
is_mfa_enabledFunction · 0.90
is_llm_enabledFunction · 0.90
get_shared_storage_listFunction · 0.85
make_responseFunction · 0.85
moduleMethod · 0.80
preferenceMethod · 0.80
extendMethod · 0.80
getMethod · 0.45
libpq_versionMethod · 0.45

Tested by

no test coverage detected