2121 success_return , internal_server_error
2222from pgadmin .utils .menu import MenuItem
2323
24- from pgadmin .model import db , Setting , PgadminStateData
24+ from pgadmin .model import db , Setting , ApplicationState
2525from pgadmin .utils .constants import MIMETYPE_APP_JS
2626from .utils import get_dialog_type , get_file_type_setting
2727from cryptography .fernet import Fernet
@@ -54,8 +54,9 @@ def get_exposed_url_endpoints(self):
5454 'settings.reset_tree_state' ,
5555 'settings.save_file_format_setting' ,
5656 'settings.get_file_format_setting' ,
57- 'settings.save_pgadmin_state' ,
58- 'settings.delete_pgadmin_state'
57+ 'settings.save_application_state' ,
58+ 'settings.get_application_state' ,
59+ 'settings.delete_application_state'
5960 ]
6061
6162
@@ -262,11 +263,11 @@ def get_file_format_setting():
262263
263264
264265@blueprint .route (
265- '/save_pgadmin_state ' ,
266- methods = ["POST" ], endpoint = 'save_pgadmin_state '
266+ '/save_application_state ' ,
267+ methods = ["POST" ], endpoint = 'save_application_state '
267268)
268269@pga_login_required
269- def save_pgadmin_state_data ():
270+ def save_application_state ():
270271 """
271272 Args:
272273 sid: server id
@@ -279,7 +280,7 @@ def save_pgadmin_state_data():
279280 connection_info = data ['connection_info' ] \
280281 if 'connection_info' in data else None
281282 try :
282- data_entry = PgadminStateData (
283+ data_entry = ApplicationState (
283284 uid = current_user .id , id = id ,connection_info = connection_info ,
284285 tool_name = data ['tool_name' ], tool_data = tool_data )
285286
@@ -298,15 +299,15 @@ def save_pgadmin_state_data():
298299
299300
300301@blueprint .route (
301- '/get_pgadmin_state ' ,
302- methods = ["GET" ], endpoint = 'get_pgadmin_state '
302+ '/get_application_state ' ,
303+ methods = ["GET" ], endpoint = 'get_application_state '
303304)
304305@pga_login_required
305- def get_pgadmin_state ():
306+ def get_application_state ():
306307 fernet = Fernet (current_app .config ['SECRET_KEY' ].encode ())
307308 result = db .session \
308- .query (PgadminStateData ) \
309- .filter (PgadminStateData .uid == current_user .id ) \
309+ .query (ApplicationState ) \
310+ .filter (ApplicationState .uid == current_user .id ) \
310311 .all ()
311312
312313 res = []
@@ -326,10 +327,10 @@ def get_pgadmin_state():
326327
327328
328329@blueprint .route (
329- '/delete_pgadmin_state /' ,
330- methods = ["DELETE" ], endpoint = 'delete_pgadmin_state ' )
330+ '/delete_application_state /' ,
331+ methods = ["DELETE" ], endpoint = 'delete_application_state ' )
331332@pga_login_required
332- def delete_pgadmin_state_data ():
333+ def delete_application_state ():
333334 trans_id = None
334335 if request .data :
335336 data = json .loads (request .data )
@@ -341,14 +342,14 @@ def delete_tool_data(trans_id):
341342 try :
342343 if trans_id :
343344 results = db .session \
344- .query (PgadminStateData ) \
345- .filter (PgadminStateData .uid == current_user .id ,
346- PgadminStateData .id == trans_id ) \
345+ .query (ApplicationState ) \
346+ .filter (ApplicationState .uid == current_user .id ,
347+ ApplicationState .id == trans_id ) \
347348 .all ()
348349 else :
349350 results = db .session \
350- .query (PgadminStateData ) \
351- .filter (PgadminStateData .uid == current_user .id ) \
351+ .query (ApplicationState ) \
352+ .filter (ApplicationState .uid == current_user .id ) \
352353 .all ()
353354 for result in results :
354355 db .session .delete (result )
@@ -364,6 +365,6 @@ def delete_tool_data(trans_id):
364365 return make_json_response (
365366 data = {
366367 'status' : False ,
367- 'msg' : ' str(e)' ,
368+ 'msg' : str (e ),
368369 }
369370 )
0 commit comments