forked from pgadmin-org/pgadmin4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.py
More file actions
173 lines (144 loc) · 6.24 KB
/
constants.py
File metadata and controls
173 lines (144 loc) · 6.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2025, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
"""Application wide constants."""
from flask_babel import gettext
# Mimetypes
MIMETYPE_APP_HTML = 'text/html'
MIMETYPE_APP_JS = 'application/javascript'
MIMETYPE_APP_JSON = 'application/json'
NO_CACHE_CONTROL = 'no-cache, no-store, must-revalidate'
# Preference labels
PREF_LABEL_KEYBOARD_SHORTCUTS = gettext('Keyboard shortcuts')
PREF_LABEL_DISPLAY = gettext('Display')
PREF_LABEL_BREADCRUMBS = gettext('Object Breadcrumbs')
PREF_LABEL_OPTIONS = gettext('Options')
PREF_LABEL_EXPLAIN = gettext('Explain')
PREF_LABEL_EDITOR = gettext('Editor')
PREF_LABEL_CSV_TXT = gettext('CSV/TXT Output')
PREF_LABEL_RESULTS_GRID = gettext('Results grid')
PREF_LABEL_SQL_FORMATTING = gettext('SQL formatting')
PREF_LABEL_TABS_SETTINGS = gettext('Tab settings')
PREF_LABEL_REFRESH_RATES = gettext('Refresh rates')
PREF_LABEL_GRAPH_VISUALISER = gettext('Graph Visualiser')
PREF_LABEL_USER_INTERFACE = gettext('User Interface')
PREF_LABEL_FILE_DOWNLOADS = gettext('File Downloads')
PGADMIN_STRING_SEPARATOR = '_$PGADMIN$_'
PGADMIN_NODE = 'pgadmin.node.%s'
UNAUTH_REQ = "Unauthorized request."
SERVER_CONNECTION_CLOSED = gettext(
'Not connected to server or connection with the server has been closed.')
# Query tool placeholder
QT_DEFAULT_PLACEHOLDER = '%DATABASE%/%USERNAME%@%SERVER%'
VW_EDT_DEFAULT_PLACEHOLDER = '%SCHEMA%.%TABLE%/%DATABASE%/%USERNAME%@%SERVER%'
# Data Types
DATATYPE_TIME_WITH_TIMEZONE = 'time with time zone'
DATATYPE_TIME_WITHOUT_TIMEZONE = 'time without time zone'
DATATYPE_TIMESTAMP_WITH_TIMEZONE = 'timestamp with time zone'
DATATYPE_TIMESTAMP_WITHOUT_TIMEZONE = 'timestamp without time zone'
# Error Messages
ERROR_MSG_TRANS_ID_NOT_FOUND = gettext(
'Transaction ID not found in the session.')
ERROR_MSG_FAIL_TO_PROMOTE_QT = gettext('FAIL TO PROMOTE VIEW/EDIT DATA '
'TO QUERY TOOL')
# Role module constant
ERROR_FETCHING_ROLE_INFORMATION = gettext(
'Error fetching role information from the database server.')
ERROR_FETCHING_DATA = gettext('Unable to fetch data.')
ERROR_SERVER_ID_NOT_SPECIFIED = gettext('Server ID not specified.')
# Authentication Sources
INTERNAL = 'internal'
LDAP = 'ldap'
KERBEROS = 'kerberos'
OAUTH2 = 'oauth2'
WEBSERVER = 'webserver'
SUPPORTED_AUTH_SOURCES = [INTERNAL,
LDAP,
KERBEROS,
OAUTH2,
WEBSERVER]
BINARY_PATHS = {
"as_bin_paths": [
{"version": "130000", "next_major_version": "140000",
"serverType": gettext("EDB Advanced Server 13"), "binaryPath": None,
"isDefault": False},
{"version": "140000", "next_major_version": "150000",
"serverType": gettext("EDB Advanced Server 14"), "binaryPath": None,
"isDefault": False},
{"version": "150000", "next_major_version": "160000",
"serverType": gettext("EDB Advanced Server 15"), "binaryPath": None,
"isDefault": False},
{"version": "160000", "next_major_version": "170000",
"serverType": gettext("EDB Advanced Server 16"), "binaryPath": None,
"isDefault": False},
{"version": "170000", "next_major_version": "180000",
"serverType": gettext("EDB Advanced Server 17"), "binaryPath": None,
"isDefault": False}
],
"pg_bin_paths": [
{"version": "130000", "next_major_version": "140000",
"serverType": gettext("PostgreSQL 13"), "binaryPath": None,
"isDefault": False},
{"version": "140000", "next_major_version": "150000",
"serverType": gettext("PostgreSQL 14"), "binaryPath": None,
"isDefault": False},
{"version": "150000", "next_major_version": "160000",
"serverType": gettext("PostgreSQL 15"), "binaryPath": None,
"isDefault": False},
{"version": "160000", "next_major_version": "170000",
"serverType": gettext("PostgreSQL 16"), "binaryPath": None,
"isDefault": False},
{"version": "170000", "next_major_version": "180000",
"serverType": gettext("PostgreSQL 17"), "binaryPath": None,
"isDefault": False}
]
}
UTILITIES_ARRAY = ['pg_dumpall', 'pg_dump', 'pg_restore', 'psql']
BG_PROCESS_ERROR_MSGS = {
3221225781: gettext('Unable to find a dll needed by the utility. Ensure '
'.dll files needed by the utility are in the same '
'folder as your executable.')
}
ENTER_EMAIL_ADDRESS = "Email address: "
USER_NOT_FOUND = gettext("The specified user ID (%s) could not be found.")
DATABASE_LAST_SYSTEM_OID = 16383
# Drivers
PSYCOPG3 = 'psycopg3'
# Shared storage
MY_STORAGE = 'my_storage'
ACCESS_DENIED_MESSAGE = gettext(
"Access denied: You’re having limited access. You’re not allowed to "
"Rename, Delete or Create any files/folders")
KEY_RING_SERVICE_NAME = 'pgAdmin4'
KEY_RING_USER_NAME = 'pgadmin4-master-password'
KEY_RING_USERNAME_FORMAT = KEY_RING_SERVICE_NAME + '-{0}-{1}'
KEY_RING_TUNNEL_FORMAT = KEY_RING_SERVICE_NAME + '-tunnel-{0}-{1}'
KEY_RING_DESKTOP_USER = KEY_RING_SERVICE_NAME + '-desktop-user-{0}'
class MessageType:
SUCCESS = 'Success',
ERROR = 'Error',
INFO = 'Info',
CLOSE = 'Close',
WARNING = 'Warning'
DBMS_JOB_SCHEDULER_ID = 999999
# String Constants
IP_ADDRESS_STRING = '{}/{}'
TWO_PARAM_STRING = '{0}/{1}'
SERVER_NOT_FOUND = gettext("Could not find the specified server.")
SSL_MODES = ['prefer', 'require', 'verify-ca', 'verify-full']
DATA_TYPE_WITH_LENGTH = [1560, 'bit', 1561, 'bit[]',
1562, 'varbit', 'bit varying',
1563, 'varbit[]', 'bit varying[]',
1042, 'bpchar', 'character',
1043, 'varchar', 'character varying',
1014, 'bpchar[]', 'character[]',
1015, 'varchar[]', 'character varying[]',
'vector', 'vector[]', 'halfvec', 'halfvec[]',
'sparsevec', 'sparsevec[]']
RESTRICTION_TYPE_DATABASES = 'databases'
RESTRICTION_TYPE_SQL = 'sql'