MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / get_application_state

Function get_application_state

web/pgadmin/settings/__init__.py:349–386  ·  view source on GitHub ↗

Returns application state if any stored.

()

Source from the content-addressed store, hash-verified

347 methods=["GET"], endpoint='get_application_state')
348@pga_login_required
349def get_application_state():
350 """
351 Returns application state if any stored.
352 """
353 fernet = Fernet(current_app.config['SECRET_KEY'].encode())
354 result = db.session \
355 .query(ApplicationState) \
356 .filter(ApplicationState.uid == current_user.id) \
357 .all()
358
359 res = []
360 for row in result:
361 connection_info = row.connection_info
362 if (connection_info and 'open_file_name' in connection_info and
363 connection_info['open_file_name']):
364 file_path = get_complete_file_path(
365 connection_info['open_file_name'])
366 file_deleted = False if file_path else True
367 connection_info['file_deleted'] = file_deleted
368
369 if (not file_deleted and connection_info['is_editor_dirty'] and
370 'last_saved_file_hash' in connection_info and
371 connection_info['last_saved_file_hash']):
372 connection_info['external_file_changes'] = \
373 check_external_file_changes(
374 file_path, connection_info['last_saved_file_hash'])
375
376 res.append({'connection_info': connection_info,
377 'tool_data': fernet.decrypt(row.tool_data).decode(),
378 'id': row.id
379 })
380 return make_json_response(
381 data={
382 'status': True,
383 'msg': '',
384 'result': res
385 }
386 )
387
388
389@blueprint.route(

Callers

nothing calls this directly

Calls 6

get_complete_file_pathFunction · 0.90
make_json_responseFunction · 0.90
filterMethod · 0.80
appendMethod · 0.80
decodeMethod · 0.80

Tested by

no test coverage detected